[llvm-dev] crash with vector store

carr27 via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 7 18:44:15 PDT 2015


Hello,

I'm working on a pass where I would like to do something to the pointer 
operand of certain store instructions.  (The exact details are not 
relevant to my current problem).

My pass works fine without optimizations but my compiled programs crash 
with -O2.  I've noticed the difference is that with -O2 the bitcode 
contains vector stores.  The resulting -O2 optimized program crashes 
with a SIGSEV invalid address when I run it -- even when I do something 
that I don't think should change the store.

For example, I have two bitcode files: works [1] and broken [2].

The only differences are in broken:
1) the pointer operand of the vector store is bitcasted to int8*
2) then the bitcasted value is passed to a function the returns the same 
pointer
3) then the return value is bitcasted back to the original type
4) then the store's pointer operand is replaced with this final 
bitcasted value (that shouldn't have changed the pointer at all)

Can anyone give me a pointer as to what might be going on?

The core of my problem is that I want to be able to do manipulation of 
the pointer operand of the vector store.  But if I just pass it to a 
function that returns the same pointer my program is crashing.

Thanks,
Scott

[1] http://pastebin.com/raw.php?i=nbmfYZrv
[2] http://pastebin.com/raw.php?i=N83SypdZ
[3] test.c: http://pastebin.com/raw.php?i=RfL1QF7q


More information about the llvm-dev mailing list