[Issue 24118] New: ICE / regression from 2.103.1 - segfault on CTFE only code in 2.104.2 and 2.105.0

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 28 10:14:43 UTC 2023


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

          Issue ID: 24118
           Summary: ICE / regression from 2.103.1 - segfault on CTFE only
                    code in 2.104.2 and 2.105.0
           Product: D
           Version: D2
          Hardware: Other
                OS: Mac OS X
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: paolo.invernizzi at gmail.com

Platform Apple Silicon

Reduced by dustmite from our internal codebase:

```
import std.algorithm : map;
import std.range : zip;
import std.typecons : tuple;


void foo() {
    if( __ctfe ){
        zip([1,2,3], ["a", "b", "c"])
            .map!( i => tuple("", i[1]) )
            .map!( a => a[0] ? a[0] : " " ~ a[1] )
            ;
    }
}

~/dlang/dmd-2.105.0/osx/bin/dmd src/api3.d
zsh: illegal hardware instruction
```

If can help, with LDC the stack trace is:

```
0  ldc2                     0x00000001039df7e0
llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  ldc2                     0x00000001039de838 llvm::sys::RunSignalHandlers() +
72
2  ldc2                     0x00000001039dfe34 SignalHandler(int) + 304
3  libsystem_platform.dylib 0x0000000185a9aa24 _sigtramp + 56
4  ldc2                     0x0000000103d7e30c ToElemVisitor::visit(CondExp*) +
1540
5  ldc2                     0x0000000103d7e30c ToElemVisitor::visit(CondExp*) +
1540
6  ldc2                     0x0000000103d62fcc
ToIRVisitor::visit(ReturnStatement*) + 996
7  ldc2                     0x0000000103d6994c
ToIRVisitor::visit(CompoundStatement*) + 304
8  ldc2                     0x0000000103d2de7c
DtoDefineFunction(FuncDeclaration*, bool) + 6244
9  ldc2                     0x0000000103d1d7b4
CodegenVisitor::visit(TemplateInstance*) + 320
10 ldc2                     0x0000000103d3ec84 codegenModule(IRState*, Module*)
+ 3108
11 ldc2                     0x0000000103db250c
ldc::CodeGenerator::emit(Module*) + 216
12 ldc2                     0x0000000103dc7e40 codegenModules(Array<Module*>&)
+ 944
13 ldc2                     0x0000000103ce156c mars_mainBody(Param&, Array<char
const*>&, Array<char const*>&) + 1316
14 ldc2                     0x0000000103f85b74
_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 116
15 ldc2                     0x0000000103f85698 _d_run_main + 148
16 ldc2                     0x0000000103dc4fcc main + 744
17 dyld                     0x0000000185713f28 start + 2236
zsh: segmentation fault  ~/dlang/ldc-1.34.0/bin/ldc2 src/api3.d
```

--


More information about the Digitalmars-d-bugs mailing list