www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20130] New: ICE illegal instruction when casting imported

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

          Issue ID: 20130
           Summary: ICE illegal instruction when casting imported string
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: remi.thebault gmail.com

The following code crashes DMD with error 'Illegal instruction'.
---
int main() {
    immutable array = cast(immutable(uint)[])import("12bytes.bin");
    return array.length == 3 ? 0 : 1;
}
---


The following compiles and runs succesfully.
---
int main() {
    immutable str = import("12bytes.bin");
    immutable array = cast(immutable(uint)[])str;
    return array.length == 3 ? 0 : 1;
}
---


$ dmd --version | head -n 1
DMD64 D Compiler v2.087.1

The code worked at least up to 2.084.0.

--
Aug 13 2019