Thread overview
double free or corruption (!prev)
Apr 10
kinke
April 10
On some machines there are errors when running the unittests for the ldc 1.15.0 package on NixOS which I don't have an explanation for yet.
Maybe someone knows what the problem might be.
I can not reproduce the problem on my machines.

[ 83%] Generating objects-unittest/std/string.o
double free or corruption (!prev)
#0 0x00007ffff4fb4dba llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x872dba)
#1 0x00007ffff4fb2c76 llvm::sys::RunSignalHandlers() (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x870c76)
#2 0x00007ffff4fb2dbc SignalHandler(int) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x870dbc)
#3 0x00007ffff4724860 __restore_rt (/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libpthread.so.0+0x12860)
#4 0x00007ffff4059be0 __GI_raise (/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x35be0)
#5 0x00007ffff405adc1 __GI_abort (/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x36dc1)
#6 0x00007ffff409b2ac (/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x772ac)
#7 0x00007ffff40a149a (/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x7d49a)
#8 0x00007ffff40a23ec _int_free (/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x7e3ec)
#9 0x00007ffff506e884 llvm::Instruction::eraseFromParent() (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x92c884)
#10 0x00007ffff5b48a4e llvm::SROA::deleteDeadInstructions(llvm::SmallPtrSetImpl<llvm::AllocaInst*>&) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x1406a4e)
#11 0x00007ffff5b54477 llvm::SROA::runImpl(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x1412477)
#12 0x00007ffff5b55a0c llvm::sroa::SROALegacyPass::runOnFunction(llvm::Function&) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x1413a0c)
#13 0x00007ffff5098b01 llvm::FPPassManager::runOnFunction(llvm::Function&) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x956b01)
#14 0x00007ffff5098bfc llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x956bfc)
#15 0x00007ffff509901c llvm::legacy::FunctionPassManager::run(llvm::Function&) (/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x95701c)
#16 0x0000000000890793 ldc_optimize_module(llvm::Module*) (/build/ldc-1.15.0-src/build/bin/ldc2+0x890793)
#17 0x0000000000945808 writeModule(llvm::Module*, char const*) (/build/ldc-1.15.0-src/build/bin/ldc2+0x945808)
#18 0x00000000009420ae ldc::CodeGenerator::writeAndFreeLLModule(char const*) (/build/ldc-1.15.0-src/build/bin/ldc2+0x9420ae)
#19 0x00000000009423ae ldc::CodeGenerator::emit(Module*) (/build/ldc-1.15.0-src/build/bin/ldc2+0x9423ae)
#20 0x000000000091412e codegenModules(Array<Module*>&) (/build/ldc-1.15.0-src/build/bin/ldc2+0x91412e)
#21 0x00000000007c8cc3 mars_mainBody(Param&, Array<char const*>&, Array<char const*>&) (/build/ldc-1.15.0-src/build/bin/ldc2+0x7c8cc3)
#22 0x000000000091272d cppmain(int, char**) (/build/ldc-1.15.0-src/build/bin/ldc2+0x91272d)
#23 0x00000000009fee2f _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv (/build/ldc-1.15.0-src/build/bin/ldc2+0x9fee2f)
#24 0x00000000009fed74 _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv (/build/ldc-1.15.0-src/build/bin/ldc2+0x9fed74)
#25 0x00000000009fec93 _d_run_main (/build/ldc-1.15.0-src/build/bin/ldc2+0x9fec93)
#26 0x00007ffff4046b8e __libc_start_main (/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x22b8e)
#27 0x0000000000656f0a _start /build/glibc-2.27/csu/../sysdeps/x86_64/start.S:122:0
make[3]: *** [runtime/CMakeFiles/phobos2-ldc-unittest-common.dir/build.make:1688: runtime/objects-unittest/std/string.o] Aborted
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/Makefile2:679: runtime/CMakeFiles/phobos2-ldc-unittest-common.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1780: runtime/CMakeFiles/all-test-runners.dir/rule] Error 2
make: *** [Makefile:782: all-test-runners] Error 2

https://github.com/NixOS/nixpkgs/pull/59197#issuecomment-481701148
April 10
On Wednesday, 10 April 2019 at 19:01:49 UTC, Thomas Mader wrote:
> On some machines there are errors when running the unittests for the ldc 1.15.0 package on NixOS which I don't have an explanation for yet.
> Maybe someone knows what the problem might be.
> I can not reproduce the problem on my machines.

I guess this has nothing to do with LDC itself and might be a bug in (that pretty old version of) LLVM, as it occurs deeply in some optimization pass while removing dead instructions.

While looking over the script, I noticed that you're using make, not ninja. make has issues wrt. CMake custom commands and shared dependencies, so the issues you've been seeing wrt. build order are most likely due to that.
April 11
On Wednesday, 10 April 2019 at 19:29:42 UTC, kinke wrote:
> I guess this has nothing to do with LDC itself and might be a bug in (that pretty old version of) LLVM, as it occurs deeply in some optimization pass while removing dead instructions.
>
> While looking over the script, I noticed that you're using make, not ninja. make has issues wrt. CMake custom commands and shared dependencies, so the issues you've been seeing wrt. build order are most likely due to that.

Thanks a lot.
I switched to llvm 8 and ninja.