www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16402] New: ICE when reinterpreting a function as a long[2]

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

          Issue ID: 16402
           Summary: ICE when reinterpreting a function as a long[2]
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: cauterite gmail.com

( https://dpaste.dzfl.pl/01922868e611 )

    void f() {};
    void main() {
        auto X = *cast(long[2]*) &f;
    };

// Internal error: backend\cod2.c 3971

The `2` in `long[2]` can be any number > 1.
On x86-32 the same bug is also triggered by `int[2]` and `uint[2]`.

This works fine:

    auto Ptr = cast(long[2]*) &f;
    auto X = *Ptr;

It can also be triggered with the enclosing function:

    void main() {
        auto X = *cast(long[2]*) &main; // Internal error …
    };

--
Aug 18 2016