D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16284 - [REG2.067] CTFE internal error: bad compare
Summary: [REG2.067] CTFE internal error: bad compare
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords: CTFE, ice
Depends on:
Blocks:
 
Reported: 2016-07-15 17:39 UTC by ag0aep6g
Modified: 2018-12-14 04:02 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ag0aep6g 2016-07-15 17:39:34 UTC
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.
Comment 1 Vladimir Panteleev 2017-07-05 19:43:55 UTC
Introduced in https://github.com/dlang/dmd/pull/4227.
Comment 2 Mike Franklin 2017-11-11 10:43:40 UTC
Potential Fix: https://github.com/dlang/dmd/pull/7302
Comment 3 Walter Bright 2018-12-13 11:35:59 UTC
This is still active:

test.d(13): Error: CTFE internal error: bad compare of void and void
Comment 4 Walter Bright 2018-12-14 03:09:26 UTC
(In reply to Mike Franklin from comment #2)
> Potential Fix: https://github.com/dlang/dmd/pull/7302

Rebooted as https://github.com/dlang/dmd/pull/9077
Comment 5 github-bugzilla 2018-12-14 04:02:56 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/d476b023a46b62c727ee701cf9efa518d8e29361
fix Issue 16284 - [REG2.067] CTFE internal error: bad compare

https://github.com/dlang/dmd/commit/717bfd9dfacfa298ccbddbacfd35fd2920189eb7
Merge pull request #9077 from WalterBright/fix16284

fix Issue 16284 - [REG2.067] CTFE internal error: bad compare