Jump to page: 1 2
Thread overview
List of DMD dependency issue (which would be sloved by a task based system)
Nov 22
Tim
Nov 22
Dennis
Dec 04
Mr T.
Dec 04
user1234
Dec 04
user1234
November 22
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
November 22
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

November 22
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
November 30
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);
}
---
December 04
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;
----------------------------------

December 04
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.
December 04
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 ;)
December 04
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
December 04
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.


December 04
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
« First   ‹ Prev
1 2