Re: A strange DMD error
On Tuesday, 1 November 2022 at 17:05:03 UTC, ryuukk_ wrote: This reminds me of an issue i reported last year... https://issues.dlang.org/show_bug.cgi?id=22583 This seems to be very similar to the bug I am facing, mostly the same underlying issue. Should we somehow link the 2 issues and escalate? Link to my issue: [#23450](https://issues.dlang.org/show_bug.cgi?id=23450)
Re: A strange DMD error
On Tuesday, 1 November 2022 at 16:39:57 UTC, Steven Schveighoffer wrote: 100% this is a bug in DMD. It should be filed. I ran some more tests, removing almost any of the parameters or changing their types seems to avoid the problem. I also added a parameter name for the second parameter, and DMD appears to be in this case passing the parameters in the wrong order (t1 is actually tt, t2 is null) You can also remove the `import std`, just the assert is enough. Please file if you can: https://issues.dlang.org -Steve Hey, have already filled an issue: [#23450](https://issues.dlang.org/show_bug.cgi?id=23450)
Re: A strange DMD error
This reminds me of an issue i reported last year... https://issues.dlang.org/show_bug.cgi?id=22583
Re: A strange DMD error
On 11/1/22 11:40 AM, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the code ```D import std; alias DG = void delegate(); class TType { } class MyClass { this(TType t1, TType, double, double[2], double, double, DG, TType, TType, DG, DG, DG, double, double, double, double, double, ulong, bool) { assert(t1 is null); // I am passing null so should be null! // NOTE: Seems to work in LDC but fails in DMD. writeln("No Bug!"); } } void main() { auto tt = new TType; new MyClass(null, tt, 0, [0, 0], 0, 0, null, null, null, null, null, null, 0, 0, 0, 0, 0, 0, false); } ``` The code gives an assertion failure on the current versions of dmd (reproducible on [run.dlang.io](https://run.dlang.io) as well) and does not happen when using LDC. The bug seems to be sensitive to the number of arguments and their types making it reproducible only in very limited cases. I have tried my best to reduce it to minimum but still does require these many arguments. The end results seems to me like variables are shifted i.e. variable 1 gets value of variable 2 and so on, but don't have enough proof to support this. 100% this is a bug in DMD. It should be filed. I ran some more tests, removing almost any of the parameters or changing their types seems to avoid the problem. I also added a parameter name for the second parameter, and DMD appears to be in this case passing the parameters in the wrong order (t1 is actually tt, t2 is null) You can also remove the `import std`, just the assert is enough. Please file if you can: https://issues.dlang.org -Steve
Re: A strange DMD error
On Tuesday, 1 November 2022 at 15:49:54 UTC, Keivan Shah wrote: On Tuesday, 1 November 2022 at 15:42:43 UTC, Imperatorn wrote: On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the code [...] Could be there's some restriction in DMD on number of arguments. May I ask if this was just an experiment? I hope you're not having code like that in the wild 🙏 Possible, but I think I have had code with more arguments than this and it has worked 😅 Unfortunately, not an experiment. Although have replaced the types so seems silly now, this is part of my constructor for a huge co-coordinator class that takes too many configurable start time parameters and so need to pass these many arguments. Keivan Regarding the too many configurable parameters, the general advice is to group all of the params into a `struct` and pass that instead as argument to constructor Pretty wild bug though, definitely a backend thing
Re: A strange DMD error
On Tuesday, 1 November 2022 at 16:06:44 UTC, Imperatorn wrote: Hehe. One simple thing you could do is to create a struct instead for you params and pass that Yeah, can do, thanks for the suggestion. But anyways still want to see if anyone else has seen this issue, or has a clue about what could be happening here. Seems like a rare issue and took up too much of my time so better if it's solved or at least documented somewhere in the meantime. I have filed an issue for this now: https://issues.dlang.org/show_bug.cgi?id=23450
Re: A strange DMD error
On Tuesday, 1 November 2022 at 15:49:54 UTC, Keivan Shah wrote: On Tuesday, 1 November 2022 at 15:42:43 UTC, Imperatorn wrote: On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: [...] Could be there's some restriction in DMD on number of arguments. May I ask if this was just an experiment? I hope you're not having code like that in the wild 🙏 Possible, but I think I have had code with more arguments than this and it has worked 😅 Unfortunately, not an experiment. Although have replaced the types so seems silly now, this is part of my constructor for a huge co-coordinator class that takes too many configurable start time parameters and so need to pass these many arguments. Keivan Hehe. One simple thing you could do is to create a struct instead for you params and pass that
Re: A strange DMD error
On Tuesday, 1 November 2022 at 15:42:43 UTC, Imperatorn wrote: On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the code [...] Could be there's some restriction in DMD on number of arguments. May I ask if this was just an experiment? I hope you're not having code like that in the wild 🙏 Possible, but I think I have had code with more arguments than this and it has worked 😅 Unfortunately, not an experiment. Although have replaced the types so seems silly now, this is part of my constructor for a huge co-coordinator class that takes too many configurable start time parameters and so need to pass these many arguments. Keivan
Re: A strange DMD error
On Tuesday, 1 November 2022 at 15:40:04 UTC, Keivan Shah wrote: Hello, Today I came across a strange bug while using D with `dmd`. I have still not been able to figure out under what conditions does it happen but it seems to be a DMD related bug to me. Here is a reproducible snippet of the code [...] Could be there's some restriction in DMD on number of arguments. May I ask if this was just an experiment? I hope you're not having code like that in the wild 🙏