June 02, 2018 Re: Debugging silent exit of threads in Phobos calls | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer Attachments:
| On Fri, 2018-06-01 at 16:19 -0400, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 6/1/18 1:41 PM, Russel Winder wrote: > > struct Datum { > > public const int a; > > public const int b; > > } > > > > struct Message { > > Datum datum; > > } > > I found the bug. Basically, the Variant static if is failing because > the > assignment it is checking (assigning a Message to a Message) would > overwrite const data. But it's not really overwriting existing data, > it's emplacing into new data (always). So this check is not correct. I think then my bug report 18934 is slightly wrong and it isn't the struct within struct that is the problem, it is the const fields in a struct that is? > Much simpler test case: > > struct S > { > const int x; > } > > void main() > { > import std.variant; > import std.stdio; > Variant v = S(1); > writeln(v.get!S); // same failure > } > Aha, much nicer since it is far more localised to the issue. I was still focused on the receive and the struct within struct, which seems to be the wrong issue: it is the const fields that are the problem. Feel free to ignore my example and stack trace on https://issues.dlang.org/show_bug.cgi?id=18934 and replace it with the above! > If I replace the check in std.variant: > > static if (is(typeof(*cast(T*) target = *src)) || > > with: > > static if (is(typeof(delegate T() {return *src;})) > || > > Then it works (both your code, and the simple example). > > Note that in all cases, variant is returning a COPY of the data, not > a > reference, so it shouldn't be possible to violate const. Excellently done. Thanks for attacking this problem and finding a solution. I will not now even contemplate hacking up my code. Actually I would have put const in and still got a problem it seems, as I had the wrong reason for the problem. > Please, file a bug. I will see if I can submit a PR to fix. > Bug report is 18934. If there can be a fast release of this via 2.080.1 with subsequence fast releases via d-apt and Debian and Fedora packaging, I would be a very happy bunny. In the meantime onward with ACCU 2019 organisation. ACCU needs more D content. Yes it is 50% C++, but that is exactly why it needs D content. It also needs Go content. in 2018 we had Rust content and it went down well. -- Russel. =========================================== Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk |
June 02, 2018 Re: Debugging silent exit of threads in Phobos calls (bugzilla issue submitted) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Saturday, 2 June 2018 at 09:52:59 UTC, Russel Winder wrote:
> I get ldc2 from the Debian/Fedora repositories and dmd from d-apt (no Fedora equivalent) I really want to avoid fiddling with files that are installed via packaging. Though I guess any changes can be fixed by a reinstallation of the package.
Editing in place would be the easiest and shouldn't be a problem, but at least ldc is relocatable: import folder is specified in config, so you can have it anywhere.
|
June 18, 2018 Re: Debugging silent exit of threads in Phobos calls | ||||
---|---|---|---|---|
| ||||
Attachments:
| For anyone still interested in this problem: Steve's pull request fixing the problem is included in D 2.081.0.
I can experiment as soon as DMD 2.081.0 is released but will have to wait till the fixes get into LDC to create production code.
Moral of the story: silent, except during gdb debugging, assertion fails in
Phobos are a pain in the arse.
--
Russel.
===========================================
Dr Russel Winder t: +44 20 7585 2200
41 Buckmaster Road m: +44 7770 465 077
London SW11 1EN, UK w: www.russel.org.uk
|
Copyright © 1999-2021 by the D Language Foundation