www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - List of DMD dependency issue (which would be sloved by a task based

reply Stefan Koch <uplink.coder googlemail.com> writes:
Hi Folks,

I'd like to have a list of dependency issues that dmd has which 
are caused by the ad-hoc dependency system used for semantic 
dependencies in dmd.
And would be resolved by a system which schedules and pends 
resolve passes (a task or fiber based compilation as SDC uses)

A nice example is:

---
struct Foo {
     my_type index;
}

static if(true) {
     alias my_type = int;
}
---

from https://issues.dlang.org/show_bug.cgi?id=20905
Then there is:
https://issues.dlang.org/show_bug.cgi?id=21380
Or the mind boggling:
https://issues.dlang.org/show_bug.cgi?id=20443

I am sure we can find more crawling bugzilla
Nov 22 2020
next sibling parent Tim <tim.dlang t-online.de> writes:
On Sunday, 22 November 2020 at 13:57:39 UTC, Stefan Koch wrote:
 Hi Folks,

 I'd like to have a list of dependency issues that dmd has which 
 are caused by the ad-hoc dependency system used for semantic 
 dependencies in dmd.
 And would be resolved by a system which schedules and pends 
 resolve passes (a task or fiber based compilation as SDC uses)
Here are some issues: https://issues.dlang.org/show_bug.cgi?id=3743 https://issues.dlang.org/show_bug.cgi?id=16665 https://issues.dlang.org/show_bug.cgi?id=17883 https://issues.dlang.org/show_bug.cgi?id=19047
Nov 22 2020
prev sibling next sibling parent reply Dennis <dkorpel gmail.com> writes:
On Sunday, 22 November 2020 at 13:57:39 UTC, Stefan Koch wrote:
 I'd like to have a list of dependency issues that dmd has which 
 are caused by the ad-hoc dependency system used for semantic 
 dependencies in dmd.
Here's one: ``` immutable int a = b; mixin("immutable int b = 3;"); ``` https://issues.dlang.org/show_bug.cgi?id=9125
Nov 22 2020
parent Stefan Koch <uplink.coder googlemail.com> writes:
On Sunday, 22 November 2020 at 15:08:30 UTC, Dennis wrote:
 On Sunday, 22 November 2020 at 13:57:39 UTC, Stefan Koch wrote:
 I'd like to have a list of dependency issues that dmd has 
 which are caused by the ad-hoc dependency system used for 
 semantic dependencies in dmd.
Here's one: ``` immutable int a = b; mixin("immutable int b = 3;"); ``` https://issues.dlang.org/show_bug.cgi?id=9125
Thanks for this example. I crafted a slightly more complicated version --- import core.stdc.stdio; struct Foo { t x; } mixin("static if (true) { alias t = type; }"); mixin("alias type = short;"); void main() { printf("%d == 2\n".ptr, Foo.init.x.sizeof); } --- DMD will fail on this. Whereas SDC (https://github.com/sdc-developers/SDC) does compile it and outputs the string `2 == 2` it should be noted that SDC currently fails at the even more complicated: --- import core.stdc.stdio; struct Foo { t x; } static immutable TRUE = mixin("true"); static if (TRUE) mixin("alias type = short;"); mixin("static if (true) { alias t = type; }"); void main() { printf("%d == 2\n".ptr, Foo.init.x.sizeof); } ---
Nov 30 2020
prev sibling parent reply Mr T. <tee invalid.io> writes:
Here's one *not* depending on declaration order, an ambiguity bug:

----------------------------------
// main.d
import ma;
import mb;
immutable X = Y;    // no error!
int main() {
     return 0;
//    return Y;  // error: ma.Y conflicts with mb.Y
}
----------------------------------
module ma;
enum Y = 48;
----------------------------------
module mb;
import main;
//static if (true)    // main.d: error on X: ma.Y conflicts with 
mb.Y
static if (X == 48) // no error!
     enum Y = 64;
----------------------------------
Dec 03 2020
next sibling parent Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 4 December 2020 at 07:20:38 UTC, Mr T. wrote:
 Here's one *not* depending on declaration order, an ambiguity 
 bug:

 ----------------------------------
 // main.d
 import ma;
 import mb;
 immutable X = Y;    // no error!
 int main() {
     return 0;
 //    return Y;  // error: ma.Y conflicts with mb.Y
 }
 ----------------------------------
 module ma;
 enum Y = 48;
 ----------------------------------
 module mb;
 import main;
 //static if (true)    // main.d: error on X: ma.Y conflicts 
 with mb.Y
 static if (X == 48) // no error!
     enum Y = 64;
 ----------------------------------
This is a very interesting one. I think that task-based on demand resolution could help in fixing this bug as well. Thanks for sharing.
Dec 04 2020
prev sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 4 December 2020 at 07:20:38 UTC, Mr T. wrote:
 Here's one *not* depending on declaration order, an ambiguity 
 bug:

 ----------------------------------
 // main.d
 import ma;
 import mb;
 immutable X = Y;    // no error!
 int main() {
     return 0;
 //    return Y;  // error: ma.Y conflicts with mb.Y
 }
 ----------------------------------
 module ma;
 enum Y = 48;
 ----------------------------------
 module mb;
 import main;
 //static if (true)    // main.d: error on X: ma.Y conflicts 
 with mb.Y
 static if (X == 48) // no error!
     enum Y = 64;
 ----------------------------------
SDC does detect the ambiguity. uplink uplink-black:~/ambig$ ../d/SDC/bin/sdc main.d main.d:4:0: error: Already defined int main() { return 0; // return Even though the error message isn't great. I should probably fix it ;)
Dec 04 2020
parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 04.12.20 09:38, Stefan Koch wrote:
 On Friday, 4 December 2020 at 07:20:38 UTC, Mr T. wrote:
 Here's one *not* depending on declaration order, an ambiguity bug:

 ----------------------------------
 // main.d
 import ma;
 import mb;
 immutable X = Y;    // no error!
 int main() {
     return 0;
 //    return Y;  // error: ma.Y conflicts with mb.Y
 }
 ----------------------------------
 module ma;
 enum Y = 48;
 ----------------------------------
 module mb;
 import main;
 //static if (true)    // main.d: error on X: ma.Y conflicts with mb.Y
 static if (X == 48) // no error!
     enum Y = 64;
 ----------------------------------
SDC does detect the ambiguity. uplink uplink-black:~/ambig$ ../d/SDC/bin/sdc main.d main.d:4:0: error: Already defined int main() {     return 0; //    return ...
So does my frontend (https://github.com/tgehr/d-compiler): --- mb.d:5:10: error: declaration of 'Y' is invalid enum Y = 64; ^ main.d:4:15: note: this lookup should have resolved to it otherwise immutable X = Y; // no error! ^ --- Of course, it does not compile with versions of DMD newer than 2.060 due to, ironically, dependency issues. (Rainer once found a fix for the problem, but it caused some regressions.) There are various test cases here (many are for things other than dependency issues, but IIRC DMD chokes on quite a few of those too): https://github.com/tgehr/d-compiler/tree/master/test
Dec 04 2020
next sibling parent reply user1234 <user1234 12.de> writes:
On Friday, 4 December 2020 at 10:05:57 UTC, Timon Gehr wrote:
 Of course, it does not compile with versions of DMD newer than 
 2.060 due to,
why the hell have you not setup a CI with a daily automatic run. Your FE would be still alive today.
Dec 04 2020
parent user1234 <user1234 12.de> writes:
On Friday, 4 December 2020 at 10:34:18 UTC, user1234 wrote:
 On Friday, 4 December 2020 at 10:05:57 UTC, Timon Gehr wrote:
 Of course, it does not compile with versions of DMD newer than 
 2.060 due to,
why the hell have you not setup a CI with a daily automatic run. Your FE would be still alive today.
aka CRON
Dec 04 2020
prev sibling parent Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 4 December 2020 at 10:05:57 UTC, Timon Gehr wrote:
 On 04.12.20 09:38, Stefan Koch wrote:
 On Friday, 4 December 2020 at 07:20:38 UTC, Mr T. wrote:
 [...]
SDC does detect the ambiguity. uplink uplink-black:~/ambig$ ../d/SDC/bin/sdc main.d main.d:4:0: error: Already defined int main() {     return 0; //    return ...
So does my frontend (https://github.com/tgehr/d-compiler): --- mb.d:5:10: error: declaration of 'Y' is invalid enum Y = 64; ^ main.d:4:15: note: this lookup should have resolved to it otherwise immutable X = Y; // no error! ^ --- Of course, it does not compile with versions of DMD newer than 2.060 due to, ironically, dependency issues. (Rainer once found a fix for the problem, but it caused some regressions.) There are various test cases here (many are for things other than dependency issues, but IIRC DMD chokes on quite a few of those too): https://github.com/tgehr/d-compiler/tree/master/test
Unfortunately I was reading the output wrongly ... SDC rejected the main function itself because the name was clashing with the module name `main` :-/ Your front-end is more strict on this than SDC or DMD are. Thanks for sharing your testcases. I'll have a look as soon as I can dedicate some appropriate time.
Dec 04 2020