[Issue 23763] New: ICE on operations involving zero-initialized structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 8 00:27:32 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23763

          Issue ID: 23763
           Summary: ICE on operations involving zero-initialized structs
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com

```
struct BigInt { int[64] data; }

immutable BigInt a = BigInt.init;

void main ()
{
    immutable BigInt b;
    static assert(a == b);
}
```

This crashes the compiler:
```
Up to      2.063  : Failure with output:
-----
onlineapp.d(8): Error: variable b cannot be read at compile time
onlineapp.d(8):        while evaluating: static assert(a == b)
-----

           2.064  : Status -6 with output:
-----
onlineapp.d(8): Error: CTFE internal error: bad compare
dmd: ctfeexpr.c:1490: int ctfeRawCmp(Loc, Expression*, Expression*): Assertion
`0' failed.
-----

           2.065.0: Status -6 with output:
-----
onlineapp.d(8): Error: CTFE internal error: bad compare
dmd: ctfeexpr.c:1507: int ctfeRawCmp(Loc, Expression*, Expression*): Assertion
`0' failed.
-----

           2.066.1: Status -6 with output:
-----
onlineapp.d(8): Error: CTFE internal error: bad compare
dmd: ctfeexpr.c:1424: int ctfeRawCmp(Loc, Expression*, Expression*): Assertion
`0' failed.
-----

           2.067.1: Status -6 with output:
-----
onlineapp.d(8): Error: CTFE internal error: bad compare
dmd: ctfeexpr.c:1582: int ctfeRawCmp(Loc, Expression*, Expression*): Assertion
`0' failed.
-----

           2.068.2: Status -6 with output:
-----
onlineapp.d(8): Error: CTFE internal error: bad compare
dmd: ctfeexpr.c:1601: int ctfeRawCmp(Loc, Expression*, Expression*): Assertion
`0' failed.
-----

2.069.2 to 2.073.2: Segfault with output: onlineapp.d(8): Error: CTFE internal
error: bad compare
2.074.1 to 2.078.3: Segfault with output: onlineapp.d(8): Error: CTFE internal
error: bad compare of `BigInt([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])` and `0`
Since      2.079.1: Status -4 with output: onlineapp.d(8): Error: CTFE internal
error: bad compare of `BigInt([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])` and `0`
```

--


More information about the Digitalmars-d-bugs mailing list