[Issue 14699] ICE: segfaults on array with zero size

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jun 14 09:04:16 PDT 2015


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

Ketmar Dark <ketmar at ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86_64                      |All
            Summary|dmd 2.67 segfaults on       |ICE: segfaults on array
                   |innocent code               |with zero size
                 OS|Windows                     |All

--- Comment #1 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
it asserts on GNU/Linux: "Internal error: backend/dt.c 120".

and it asserts even with only "this works" line (i.e. having "this crashes"
commented).

the following code triggers the bug on GNU/Linux, x86:

  struct Table(K, V, ushort capacity_) {
    V[capacity_] values;
  }
  Table!(uint, ubyte[0], 10) thisWorks;

dmd -c z00.d —> ICE.

it does so on git HEAD too.

this is triggered by `ubyte[0]`, changing it to `ubyte[1]` avoids the bug.

so i'm changing hardware info and subject.


p.s. it seems that there is unguarded `-1` somewhere in the compiler code, so
`0‒1` results in `-1`, which triggers assertion in dt.c:120.

--


More information about the Digitalmars-d-bugs mailing list