www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13841] New: infinite loop in compiler on simd arithmetic

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

          Issue ID: 13841
           Summary: infinite loop in compiler on simd arithmetic
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

import core.simd;

void foo()
{
    long4 a;
    ulong4 b;
    auto c = b - a;
}

The compiler gets stuck in semantic3. Tested on a variety of compiler versions
including git HEAD, all have the same problem.

Backtrace:

* thread #1: tid = 0x1768c7, 0x000000010000d4a5
dmd`castTo(this=0x00007fff5fbfc7a8, sc=0x00000001006c3b30,
t=0x00000001006b8f40)::CastTo::CastTo(Scope*, Type*) + 53 at cast.c:1349, queue
= 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x000000010000d4a5 dmd`castTo(this=0x00007fff5fbfc7a8,
sc=0x00000001006c3b30, t=0x00000001006b8f40)::CastTo::CastTo(Scope*, Type*) +
53 at cast.c:1349
   1346    
   1347            CastTo(Scope *sc, Type *t)
   1348                : sc(sc), t(t)
-> 1349            {
   1350                result = NULL;
   1351            }
   1352    
(lldb) bt all
* thread #1: tid = 0x1768c7, 0x000000010000d4a5
dmd`castTo(this=0x00007fff5fbfc7a8, sc=0x00000001006c3b30,
t=0x00000001006b8f40)::CastTo::CastTo(Scope*, Type*) + 53 at cast.c:1349, queue
= 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x000000010000d4a5 dmd`castTo(this=0x00007fff5fbfc7a8,
sc=0x00000001006c3b30, t=0x00000001006b8f40)::CastTo::CastTo(Scope*, Type*) +
53 at cast.c:1349
    frame #1: 0x0000000100007e05 dmd`castTo(this=0x00007fff5fbfc7a8,
sc=0x00000001006c3b30, t=0x00000001006b8f40)::CastTo::CastTo(Scope*, Type*) +
37 at cast.c:1351
    frame #2: 0x0000000100007da8 dmd`castTo(e=0x00000001006c4c00,
sc=0x00000001006c3b30, t=0x00000001006b8f40) + 40 at cast.c:2180
    frame #3: 0x000000010007d255
dmd`Expression::castTo(this=0x00000001006c4c00, sc=0x00000001006c3b30,
t=0x00000001006b8f40) + 37 at expression.h:170
    frame #4: 0x000000010000a607 dmd`typeMerge(sc=0x00000001006c3b30,
e=0x00000001006058a0, pt=0x00000001006058c0, pe1=0x00000001006058d0,
pe2=0x00000001006058d8) + 8423 at cast.c:2920
    frame #5: 0x000000010000acec dmd`typeCombine(be=0x00000001006058a0,
sc=0x00000001006c3b30) + 332 at cast.c:3020
    frame #6: 0x00000001000758f4 dmd`MinExp::semantic(this=0x00000001006058a0,
sc=0x00000001006c3b30) + 1236 at expression.c:12228
    frame #7: 0x000000010005899c
dmd`UnaExp::unaSemantic(this=0x00000001006058f0, sc=0x00000001006c3b30) + 44 at
expression.c:6432
    frame #8: 0x00000001000672af dmd`CastExp::semantic(this=0x00000001006058f0,
sc=0x00000001006c3b30) + 79 at expression.c:9579
    frame #9: 0x000000010006ee94
dmd`AssignExp::semantic(this=0x00000001006c4aa0, sc=0x00000001006c3b30) + 3716
at expression.c:11090
    frame #10: 0x000000010002d6ad
dmd`VarDeclaration::semantic(this=0x0000000100605970, sc=0x00000001006c3b30) +
11789 at declaration.c:1342
    frame #11: 0x0000000100056292
dmd`DeclarationExp::semantic(this=0x0000000100605ab0, sc=0x00000001006c3a10) +
258 at expression.c:5876
    frame #12: 0x000000010010dede
dmd`ExpStatement::semantic(this=0x0000000100605a90, sc=0x00000001006c3a10) + 62
at statement.c:830
    frame #13: 0x000000010010eca2
dmd`CompoundStatement::semantic(this=0x0000000100606630, sc=0x00000001006c3a10)
+ 210 at statement.c:1035
    frame #14: 0x0000000100085428
dmd`FuncDeclaration::semantic3(this=0x00000001006050c0, sc=0x00000001006c3730)
+ 6504 at func.c:1513
    frame #15: 0x00000001000baeec
dmd`Module::semantic3(this=0x00000001006045b0) + 156 at module.c:801
    frame #16: 0x00000001000b6296 dmd`tryMain(argc=4, argv=0x0000000100504b00)
+ 13878 at mars.c:1538
    frame #17: 0x00000001000b74ba dmd`main(argc=4, argv=0x00007fff5fbffb68) +
42 at mars.c:1761
    frame #18: 0x0000000100001908 dmd`_start + 230
    frame #19: 0x0000000100001821 dmd`start + 33

--
Dec 09 2014