www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14060] New: Internal error: backend/cg87.c 3394 only in MacOSX

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

          Issue ID: 14060
           Summary: Internal error: backend/cg87.c 3394 only in MacOSX
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

I found this issue from the auto-tester result of my PR:
https://github.com/D-Programming-Language/dmd/pull/4331

Following code is a part of test/runnable/interpret.d. With -m32 -O -inline
-release,  the code would cause following backend ICE.

Internal error: backend/cg87.c 3394

If you add writefln call in the compare function, the ICE would disappear.

version(addWriteln) import std.stdio;
else extern(C) int printf(const char*, ...);

void test113()
{
    import core.math;

    static void compare(real a, real b)
    {
        version(addWriteln) writefln("compare(%30.30f, %30.30f);", a, b);
        assert(fabs(a - b) < 128 * real.epsilon);
    }

    static if (__traits(compiles, (){ enum real ctval1 = yl2x(3.14, 1); }))
    {
        enum real ctval1 = yl2x(3.14, 1);
        enum real ctval2 = yl2x(2e1500L, 3);
        enum real ctval3 = yl2x(1, 5);

        real rtval1 = yl2x(3.14, 1);
        real rtval2 = yl2x(2e1500L, 3);
        real rtval3 = yl2x(1, 5);

        compare(ctval1, rtval1);
        compare(ctval2, rtval2);
        compare(ctval3, rtval3);
    }

    static if (__traits(compiles, (){ enum real ctval4 = yl2xp1(3.14, 1); }))
    {
        enum real ctval4 = yl2xp1(3.14, 1);
        enum real ctval5 = yl2xp1(2e1500L, 3);
        enum real ctval6 = yl2xp1(1, 5);

        real rtval4 = yl2xp1(3.14, 1);
        real rtval5 = yl2xp1(2e1500L, 3);
        real rtval6 = yl2xp1(1, 5);

        compare(ctval4, rtval4);
        compare(ctval5, rtval5);
        compare(ctval6, rtval6);
    }
}

int main()
{
    test113();

    printf("Success\n");
    return 0;
}

--
Jan 27 2015