This file causes dmd to core dump (and ldc2 as well).
```d
import std.algorithm;
import std.array;
void main()
{
auto r = "".map!(d => throw new Exception("blah")).array;
}
```
The stack trace in ldc2 is:
```
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 ldc2 0x0000000107142758 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 ldc2 0x0000000107141700 llvm::sys::RunSignalHandlers() + 72
2 ldc2 0x0000000107142dac SignalHandler(int) + 304
3 libsystem_platform.dylib 0x000000019ec4f4a4 _sigtramp + 56
4 ldc2 0x00000001074bf1d8 DtoStructEquals(EXP, DValue*, DValue*) + 64
5 ldc2 0x00000001074d2128 ToElemVisitor::visit(EqualExp*) + 1764
6 ldc2 0x00000001074b6aec ToIRVisitor::visit(IfStatement*) + 744
7 ldc2 0x00000001074bc638 ToIRVisitor::visit(CompoundStatement*) + 304
8 ldc2 0x00000001074b4b90 ToIRVisitor::visit(ForStatement*) + 1568
9 ldc2 0x00000001074bc638 ToIRVisitor::visit(CompoundStatement*) + 304
10 ldc2 0x00000001074b2c00 ToIRVisitor::visit(ScopeStatement*) + 284
11 ldc2 0x00000001074bc638 ToIRVisitor::visit(CompoundStatement*) + 304
12 ldc2 0x00000001074bc638 ToIRVisitor::visit(CompoundStatement*) + 304
13 ldc2 0x0000000107489050 DtoDefineFunction(FuncDeclaration*, bool) + 14852
14 ldc2 0x0000000107477b64 CodegenVisitor::visit(TemplateInstance*) + 320
15 ldc2 0x0000000107497cc0 codegenModule(IRState*, Module*) + 3140
16 ldc2 0x0000000107513fe8 codegenModules(Array<Module*>&) + 3392
17 ldc2 0x0000000107448a34 mars_mainBody(Param&, Array<char const*>&, Array<char const*>&) + 4088
18 ldc2 0x00000001075f9090 _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 116
19 ldc2 0x00000001075f8d28 _d_run_main + 148
20 ldc2 0x000000010750e5b0 main + 768
21 dyld 0x000000010aca508c start + 520
zsh: segmentation fault ldc2 badcode.d
```
If that helps at all.
If I change the array type to an int array, it compiles successfully on ldc, but still crashes with dmd.
This should work and typeof(r) should be `noreturn[]` (verified with the working integer version on ldc2)
Comment #1 by razvan.nitu1305 — 2022-11-16T09:21:47Z
Using git master I cannot reproduce the dmd core dump, however, I get a floating point exception at runtime.
Comment #2 by dlang-bot — 2023-01-19T08:23:51Z
@FeepingCreature created dlang/phobos pull request #8668 "Fix issue 23460: Use `Nullable[]` to allow iterating `Nullable` of immutable type." fixing this issue:
- Fix issue 23460: Use `Nullable[]` to allow iterating `Nullable` of immutable type.
https://github.com/dlang/phobos/pull/8668
Comment #3 by robert.schadek — 2024-12-13T19:25:27Z