www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16284] New: [REG2.067] CTFE internal error: bad compare

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

          Issue ID: 16284
           Summary: [REG2.067] CTFE internal error: bad compare
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: CTFE, ice
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

test.d:
----
struct S {}

struct T
{
    union {int i; S s;}
    this(uint dummy) { s = S.init; }
}

bool test()
{
    auto t1 = T(0);
    auto t2 = T(0);
    return t1 == t2;
}

static assert(test());
----

`dmd -c test.d`:
----
DMD v2.072.0-devel-9f1c806 DEBUG
test.d(13): Error: CTFE internal error: bad compare
core.exception.AssertError ctfeexpr.d(1338): Assertion failure
----------------
??:? _d_assert [0x7116b3]
??:? void ddmd.ctfeexpr.__assert(int) [0x50763f]
ctfeexpr.d:1338 _Z10ctfeRawCmp3LocP10ExpressionS1_ [0x504c77]
ctfeexpr.d:1296 _Z10ctfeRawCmp3LocP10ExpressionS1_ [0x504a45]
ctfeexpr.d:1381 _Z12ctfeIdentity3Loc3TOKP10ExpressionS2_ [0x504f28]
dinterpret.d:3313
_ZN11Interpreter22interpretCompareCommonEP6BinExpPFi3Loc3TOKP10ExpressionS5_E
[0x52b9f4]
dinterpret.d:3376 _ZN11Interpreter5visitEP6BinExp [0x52bc18]
visitor.d:1264 _ZN7Visitor5visitEP11IdentityExp [0x60f761]
expression.d:15621 _ZN11IdentityExp6acceptEP7Visitor [0x590591]
dinterpret.d:6314 _Z9interpretP10ExpressionP10InterState8CtfeGoal [0x5344ab]
dinterpret.d:1351 _ZN11Interpreter5visitEP15ReturnStatement [0x525ea0]
statement.d:2161 _ZN15ReturnStatement6acceptEP7Visitor [0x6057c9]
dinterpret.d:6332 _Z9interpretP9StatementP10InterState [0x53452a]
dinterpret.d:1135 _ZN11Interpreter5visitEP17CompoundStatement [0x5257ae]
statement.d:1372 _ZN17CompoundStatement6acceptEP7Visitor [0x603cee]
dinterpret.d:6332 _Z9interpretP9StatementP10InterState [0x53452a]
dinterpret.d:1135 _ZN11Interpreter5visitEP17CompoundStatement [0x5257ae]
statement.d:1372 _ZN17CompoundStatement6acceptEP7Visitor [0x603cee]
dinterpret.d:6332 _Z9interpretP9StatementP10InterState [0x53452a]
dinterpret.d:993
_Z9interpretP15FuncDeclarationP10InterStateP5ArrayIP10ExpressionES5_ [0x52537c]
dinterpret.d:5034 _ZN11Interpreter5visitEP7CallExp [0x530411]
expression.d:10472 _ZN7CallExp6acceptEP7Visitor [0x5813f9]
dinterpret.d:6314 _Z9interpretP10ExpressionP10InterState8CtfeGoal [0x5344ab]
dinterpret.d:723 _Z13ctfeInterpretP10Expression [0x5249cb]
expression.d:3461 _ZN10Expression13ctfeInterpretEv [0x56bf44]
staticassert.d:75 _ZN12StaticAssert9semantic2EP5Scope [0x60731b]
dmodule.d:1021 _ZN6Module9semantic2Ev [0x53c668]
mars.d:1385 int ddmd.mars.tryMain(ulong, const(char)**) [0x5c70e6]
mars.d:1587 _Dmain [0x5c7cc6]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x713412]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x71335c]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll() [0x7133ce]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x71335c]
??:? _d_run_main [0x7132cd]
??:? main [0x5c8217]
??:? __libc_start_main [0x25ca682f]
----

Compiles with 2.066.1.

--
Jul 15 2016