Pass segmentation fault after llvm_shutdown.

Hi all,

I was porting my pass from LLVM 4.0 to 6.0 and I am getting a segmentation fault.
I was able to obtain only the info below from GDB.

I tried to debug with some printf and the runOnFunction runs correctly.

Any idea/suggestion about what is going on?

The source code of the pass is here:

Any help is much appreciated,

#0 0x00007f1d93735170 in ?? ()
#1 0x00000000017d2b96 in llvm::object_deleter<llvm::SmallVector<std::pair<llvm::PassManagerBuilder::ExtensionPointTy, std::function<void (llvm::PassManagerBuilder const&, llvm::legacy::PassManagerBase&)> >, 8u> >::call(void*) ()
#2 0x0000000001b0e5e9 in llvm::llvm_shutdown() ()
#3 0x00000000008d8077 in main ()

This is the correct path to the pass:

I ran into a similar problem a while ago; see and . You get the unusual stack trace because it's trying to call a destructor in shared library which was already unloaded.

I thought we had fixed that, but maybe not? Looking again, it looks like the patch got reverted and I didn't notice.


It’s working with trunk though. Do you think the patch will end up in 6.0.1?


I have no idea what changed between 6.0 and trunk, so probably not?