[LLVMdev] Crash in opt.cpp:739 when loading custom pass (only on system-wide debug install of llvm)
Maciej Piechotka
uzytkownik2 at gmail.com
Wed Dec 25 04:27:33 PST 2013
On Wed, 2013-12-25 at 12:56 +0100, Maciej Piechotka wrote:
> On Wed, 2013-12-25 at 05:33 +0100, Maciej Piechotka wrote:
> > Hi,
> >
> > I'm trying to write custom pass. However opt started crashed in opt.cpp.
> > After debugging it looks like PassInf->NormalCtor points to unmapped
> > memory (rest of struct contains correct data about my pass) - it pointed
> > high in user memory (0x756e672e006e6f69).
> >
> > It happens only when I tried to install debug version of llvm
> > system-wide (I've check that it wasn't caused by stale .a files). When I
> > used the local install (via cmake to $HOME) or release it works[1].
> >
> > My system is Gentoo, 64 bit. To bootstrap I've used gcc 4.8.2.
> >
> > Any idea what might be a cause of it (my build system is practically
> > copied from documentation[2])?
> >
> > Best regards
> >
> > PS. The difference seems to be in system-wide install only
> > optimized/assertions/expensive-checks flags (I'm using Gentoo ebuild).
> >
> > [1] The problem with local install is that it cause problems with clang
> > (probably because of some incompatibilities between released version
> > clang was compiled against and debug version it's loading) and release
> > version don't have debug flags support etc.
> > [2] http://llvm.org/docs/CMake.html#developing-llvm-pass-out-of-source
>
> When I tried to manually rewrite the RegisterPass:
>
> struct RegisterMyPass {
> RegisterMyPass();
> };
>
> llvm::Pass *create_my_pass() {
> return new vallvm::MyPass();
> }
>
> RegisterMyPass::RegisterMyPass() {
> static llvm::PassInfo info(...,
> ...,
> &vallvm::MyPass::ID,
> create_my_pass,
> false, false);
> if (info.getNormalCtor() == create_closure_capture) {
> llvm::errs() << "???\n";
> info.setNormalCtor(create_closure_capture);
> if (info.getNormalCtor() == create_closure_capture) {
> llvm::errs() << "???\n";
> }
> }
> llvm::PassRegistry::getPassRegistry()->registerPass(info);
> }
>
Sorry - too less coffee (I thought I wrote != instead of == - which
would be strange).
Regards
> With debug built it prints "???" twice.
>
> Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131225/22cbb9a9/attachment.sig>
More information about the llvm-dev
mailing list