-
-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Description
When compiling a main.d with an import std.stdio and a separate kernel.d,
ldc crashes in [gen/semantic-dcompute.cpp:95:21] at DComputeSemanticAnalyser::visit(VarDeclaration*)
Adding a import std.exception : enforce to main compiles, while changing it to just std.exception crashes.
After doing some reducing with dustmite i have the following 2 file testcase,
which can be compiled with ldc2 -I=testmod.d testkernel.d -mdcompute-targets=ocl-120
Some things to note.
- testmod.d must be included using -I and not passed directly for ldc to crash.
- Switching between opencl and cuda or changing versions makes no difference.
- OS is Gentoo linux x86_64.
- Tested git master with LLVM versions 18, 19 and 20. No change.
- Tested ldc release 1.29.0-beta1 Broken.
- Tested ldc release 1.28.1 Works.
lldb backtrace
* thread #1, name = 'ldc2', stop reason = signal SIGSEGV: address not mapped to object (fault address=0x8)
* frame #0: 0x0000000000c29436 ldc2`DComputeSemanticAnalyser::visit(this=0x00007fffffffc540, decl=0x00007fffeca5c720) at semantic-dcompute.cpp:95:21
frame #1: 0x0000000000aea188 ldc2`VarDeclaration::accept(this=0x00007fffeca5c720, v=0x00007fffffffc540) at declaration.d:1108:9
frame #2: 0x0000000000c0cac2 ldc2`bool RecursiveWalker::call_visitor<VarDeclaration>(this=0x00007fffffffc520, obj=0x00007fffeca5c720) at recursivevisitor.h:276:16
frame #3: 0x0000000000c08091 ldc2`RecursiveWalker::visit(this=0x00007fffffffc520, decl=0x00007fffeca5c720) at recursivevisitor.h:459:17
frame #4: 0x0000000000aea188 ldc2`VarDeclaration::accept(this=0x00007fffeca5c720, v=0x00007fffffffc520) at declaration.d:1108:9
frame #5: 0x0000000000c0ca7d ldc2`bool RecursiveWalker::recurse<Dsymbol>(this=0x00007fffffffc520, stmt=0x00007fffeca5c720) at recursivevisitor.h:260:19
frame #6: 0x0000000000c0b88b ldc2`bool RecursiveWalker::recurse<Dsymbol*>(this=0x00007fffffffc520, stmts=0x00007fffec351b70) at recursivevisitor.h:268:20
frame #7: 0x0000000000c071f8 ldc2`RecursiveWalker::visit(this=0x00007fffffffc520, ad=0x00007fffeca5c5f0) at recursivevisitor.h:289:32
frame #8: 0x0000000000baca38 ldc2`ParseTimeVisitor::visit(this=0x00007fffffffc520, s=0x00007fffeca5c5f0) at visitor.h:383:58
frame #9: 0x0000000000bacade ldc2`ParseTimeVisitor::visit(this=0x00007fffffffc520, s=0x00007fffeca5c5f0) at visitor.h:388:55
frame #10: 0x0000000000b23418 ldc2`StaticIfDeclaration::accept(this=0x00007fffeca5c5f0, v=0x00007fffffffc520) at attrib.d:582:9
frame #11: 0x0000000000c0ca7d ldc2`bool RecursiveWalker::recurse<Dsymbol>(this=0x00007fffffffc520, stmt=0x00007fffeca5c5f0) at recursivevisitor.h:260:19
frame #12: 0x0000000000c0b88b ldc2`bool RecursiveWalker::recurse<Dsymbol*>(this=0x00007fffffffc520, stmts=0x00007fffec351b40) at recursivevisitor.h:268:20
frame #13: 0x0000000000c0815e ldc2`RecursiveWalker::visit(this=0x00007fffffffc520, s=0x00007fffef3064f0) at recursivevisitor.h:467:31
frame #14: 0x0000000000bac470 ldc2`ParseTimeVisitor::visit(this=0x00007fffffffc520, s=0x00007fffef3064f0) at visitor.h:350:52
frame #15: 0x0000000000847988 ldc2`TemplateInstance::accept(this=0x00007fffef3064f0, v=0x00007fffffffc520) at dtemplate.d:5377:9
frame #16: 0x0000000000c28a33 ldc2`dcomputeSemanticAnalysis(m=0x00007fffef305a90) at semantic-dcompute.cpp:282:17
frame #17: 0x000000000083f032 ldc2`extraLDCSpecificSemanticAnalysis(modules=0x00007fffffffcc80) at semantic.d:26:13
frame #18: 0x0000000000990d3a ldc2`mars_tryMain(params=0x0000000000fcb2d0, files=<unavailable>) at main.d:770:5
frame #19: 0x0000000000d058ef ldc2`cppmain() at main.cpp:1241:34
frame #20: 0x0000000000829655 ldc2`D main(__param_0=string[] @ 0x00007fffffffcf70) at main.d:27:5
frame #21: 0x00007fffefd9113d libdruntime-ldc-shared.so.110`___lldb_unnamed_symbol6906 + 29
frame #22: 0x00007fffefd90f53 libdruntime-ldc-shared.so.110`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv + 35
frame #23: 0x00007fffefd9105b libdruntime-ldc-shared.so.110`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 155
frame #24: 0x00007fffefd90f53 libdruntime-ldc-shared.so.110`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv + 35
frame #25: 0x00007fffefd90e0e libdruntime-ldc-shared.so.110`_d_run_main2 + 798
frame #26: 0x00007fffefd90aeb libdruntime-ldc-shared.so.110`_d_run_main + 251
frame #27: 0x0000000000d4b266 ldc2`args::forwardToDruntime(argc=1, argv=0x00007fffffffd2a0) at args.cpp:80:21
frame #28: 0x0000000000d0532e ldc2`main(argc=4, originalArgv=0x00007fffffffd408) at main.cpp:1132:33
frame #29: 0x00007fffef42b43a libc.so.6`__libc_start_call_main(main=(ldc2`main at main.cpp:1098:1), argc=4, argv=0x00007fffffffd408) at libc_start_call_main.h:58:16
frame #30: 0x00007fffef42b4ea libc.so.6`__libc_start_main_impl(main=(ldc2`main at main.cpp:1098:1), argc=4, argv=0x00007fffffffd408, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffd3f8) at libc-start.c:360:3
frame #31: 0x0000000000829565 ldc2`_start at start.S:115
test files
testkernel.d@compute(CompileFor.deviceOnly) module testkernel;
import ldc.dcompute;
import testmod;
static assert(!__traits(compiles, { imported!"testmod".hasIndirections!(int[]); }));
testmod.d
template hasIndirections(T)
{
static if (is(T == enum))
enum hasIndirections = hasIndirections;
}
Metadata
Metadata
Assignees
Labels
No labels