[llvm-dev] Program crashes calling initializeScalarOpts

Félix Cloutier via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 8 13:05:50 PDT 2015


Hi all,

I'm trying to stabilize a project to LLVM 3.7, upgrading from a custom build dated some time after 3.6. Since I'm developing, I built a Debug+Asserts version from source. I think I managed with the API changes, but now my program crashes calling initializeScalarOpts.

The full stack trace to abort is:

1>  ::abort()
2>  ::__assert_rtn(const char *, const char *, int, const char *)
3>  llvm::DenseMapBase<llvm::DenseMap<void*, llvm::cl::Option*, llvm::DenseMapInfo<void*>, llvm::detail::DenseMapPair<void*, llvm::cl::Option*> >, void*, llvm::cl::Option*, llvm::DenseMapInfo<void*>, llvm::detail::DenseMapPair<void*, llvm::cl::Option*> >::InsertIntoBucketImpl(void* const&, llvm::detail::DenseMapPair<void*, llvm::cl::Option*>*)
4>  llvm::DenseMapBase<llvm::DenseMap<void*, llvm::cl::Option*, llvm::DenseMapInfo<void*>, llvm::detail::DenseMapPair<void*, llvm::cl::Option*> >, void*, llvm::cl::Option*, llvm::DenseMapInfo<void*>, llvm::detail::DenseMapPair<void*, llvm::cl::Option*> >::InsertIntoBucket(void*&&, llvm::cl::Option*&&, llvm::detail::DenseMapPair<void*, llvm::cl::Option*>*)
5>  llvm::DenseMapBase<llvm::DenseMap<void*, llvm::cl::Option*, llvm::DenseMapInfo<void*>, llvm::detail::DenseMapPair<void*, llvm::cl::Option*> >, void*, llvm::cl::Option*, llvm::DenseMapInfo<void*>, llvm::detail::DenseMapPair<void*, llvm::cl::Option*> >::insert(std::__1::pair<void*, llvm::cl::Option*>&&)
6>  llvm::OptionRegistry::addOption(void*, llvm::cl::Option*)
7>  void llvm::OptionRegistry::registerOption<bool, (anonymous namespace)::Scalarizer, &((anonymous namespace)::Scalarizer::ScalarizeLoadStore)>(char const*, char const*, bool const&)
8>  (anonymous namespace)::Scalarizer::registerOptions()
9>  initializeScalarizerPassOnce(llvm::PassRegistry&)
10> llvm::initializeScalarizerPass(llvm::PassRegistry&)
11> llvm::initializeScalarOpts(llvm::PassRegistry&)
12> (anonymous namespace)::initializePasses()
13> main

The failed assert checks that TheBucket (in InsertIntoBucketImpl) is not null.

Bugpoint and opt, which both also call initializeScalarOpts, don't crash with my build, so it's probably not a matter of a bad lib build.

With my program, the Scalarizer pass is the first pass that needs to add an option to the OptionRegistry. I also define a handful of other passes, some registered with the RegisterPass template, and some with INITIALIZE_* macros (and then the corresponding function call). I tried removing the passes registered with RegisterPass temporarily, but it didn't help. I also tried moving around the call to initializeScalarOpts, but it didn't help either.

If it's of any interest, I build with the libs indicated by `llvm-config --ldflags analysis codegen code passes`.

Any idea about what could be going on?

Thanks!

Félix



More information about the llvm-dev mailing list