[Issue 17726] Older DMD versions segfault when building Druntime with GCC 7.1

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 7 08:24:53 PDT 2017


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

--- Comment #6 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
Finally reduced:

////////////// test.cpp //////////////
#include <stdio.h>

union U
{
    double      Vdouble;
    long double Vldouble;
};

void fun(U *e)
{
    U esave = {};

    printf("Before crash\n");
    esave = *e; // <--- SEGFAULTS HERE
    printf("After crash\n");

    *e = esave;
}

int main()
{
    // Must be unaligned
    char buf[128] = {0};
    U* e = (U*)&buf[1];

    fun(e);
    return 0;
}
//////////////////////////////////////

g++ -O0 -otest test.cpp && ./test && g++ -O2 -otest test.cpp && ! ./test

--


More information about the Digitalmars-d-bugs mailing list