https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106623

            Bug ID: 106623
           Summary: internal compiler error: Segmentation fault at
                    gimple-expr.cc:88
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

When compiling with -O1 and above.

---
private struct _Complex(T) { T re; T im; }
enum __c_complex_double : _Complex!double;

pragma(inline, true)
size_t hashOf()(scope const double val)
{
    return *cast(size_t*)&val;
}

pragma(inline, true)
size_t hashOf()(scope const _Complex!double val, size_t seed = 0)
{
    return hashOf(val.re) + hashOf(val.im);
}

pragma(inline, true)
size_t hashOf()(__c_complex_double val, size_t seed = 0)
{
    return hashOf(cast(_Complex!double) val, seed);
}

int main()
{
    __c_complex_double val;
    return cast(int)hashOf(val);
}
---

The conflating between native complex and struct representation in the code
generation bites us in the optimization pass.

Reply via email to