[llvm-dev] LLVM pass error

Rakesh Nair via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 8 02:33:57 PST 2016


Hi,
I wrote a sample program to iterate through each function and just print a
'hello' for every basic blocks. There were no errors while running a 'make'
command. But the program returns some errors in my system. When I check the
same program in my friend's system it works fine.

My program:

virtual bool runOnFunction(Function &F) {
  for (Function::iterator b = F.begin(), be = F.end(); b != be; ++b)
//Thorws error when I add this loop
   {

                                errs()<<"hello"<<"\t";
    }


            return false;
        }


Command : $ opt -load ~/LLVM/bulid/Debug+Asserts/lib/CSE.so -CSE < hell.ll
> /dev/null

Error while running the pass :

hello    hello    0  opt             0x00000000014a1b92
llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  opt             0x00000000014a0f79
2  libpthread.so.0 0x00007f2c1a4a7340
3  CSE.so          0x00007f2c192826cc
4  CSE.so          0x00007f2c192826ac
5  CSE.so          0x00007f2c1928267f
6  CSE.so          0x00007f2c19282564
7  opt             0x000000000142f4df
llvm::FPPassManager::runOnFunction(llvm::Function&) + 607
8  opt             0x000000000142f54b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
9  opt             0x000000000142f09f
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 927
10 opt             0x000000000059f768 main + 4888
11 libc.so.6       0x00007f2c194a6ec5 __libc_start_main + 245
12 opt             0x00000000005bae91
Stack dump:
0.    Program arguments: opt -load
/home/mtech2/LLVM/bulid/Debug+Asserts/lib/CSE.so -CSE
1.    Running pass 'Function Pass Manager' on module '<stdin>'.
2.    Running pass 'Print Instructions' on function '@main'
Segmentation fault (core dumped)

Any help regarding the error.

Regards,
Rakesh R Nair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160108/728069d9/attachment.html>


More information about the llvm-dev mailing list