www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - double free or corruption (!prev)

reply Thomas Mader <thomas.mader gmail.com> writes:
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)

llvm::sys::PrintStackTrace(llvm::raw_ostream&) 
(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x872dba)

(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x870c76)

(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x870dbc)

(/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libpthread.so.0+0x12860)

(/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x35be0)

(/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x36dc1)

(/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x772ac)

(/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x7d49a)

(/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x7e3ec)

(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x92c884)

llvm::SROA::deleteDeadInstructions(llvm::SmallPtrSetImpl<llvm::AllocaInst*>&)
(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x1406a4e)

llvm::DominatorTree&, llvm::AssumptionCache&) 
(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x1412477)

llvm::sroa::SROALegacyPass::runOnFunction(llvm::Function&) 
(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x1413a0c)

llvm::FPPassManager::runOnFunction(llvm::Function&) 
(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x956b01)

llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) 
(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x956bfc)

llvm::legacy::FunctionPassManager::run(llvm::Function&) 
(/nix/store/166lj5aam0w5qiim9f5a9qccbc6fy2kq-llvm-5.0.2-lib/lib/libLLVM-5.0.so+0x95701c)

(/build/ldc-1.15.0-src/build/bin/ldc2+0x890793)

(/build/ldc-1.15.0-src/build/bin/ldc2+0x945808)

ldc::CodeGenerator::writeAndFreeLLModule(char const*) 
(/build/ldc-1.15.0-src/build/bin/ldc2+0x9420ae)

(/build/ldc-1.15.0-src/build/bin/ldc2+0x9423ae)

(/build/ldc-1.15.0-src/build/bin/ldc2+0x91412e)

Array<char const*>&) 
(/build/ldc-1.15.0-src/build/bin/ldc2+0x7c8cc3)

(/build/ldc-1.15.0-src/build/bin/ldc2+0x91272d)

_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv 
(/build/ldc-1.15.0-src/build/bin/ldc2+0x9fee2f)

_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv 
(/build/ldc-1.15.0-src/build/bin/ldc2+0x9fed74)

(/build/ldc-1.15.0-src/build/bin/ldc2+0x9fec93)

(/nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/libc.so.6+0x22b8e)

/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
Apr 10 2019
parent reply kinke <noone nowhere.com> writes:
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.
Apr 10 2019
parent Thomas Mader <thomas.mader gmail.com> writes:
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.
Apr 10 2019