Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Buggy phi instruction crashes opt, lli, llc, but not llvm-as. #14395

Open Quuxplusone opened 12 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR14379
Status NEW
Importance P normal
Reported by Kunshan Wang (kunshan.wang@anu.edu.au)
Reported on 2012-11-19 03:01:13 -0800
Last modified on 2012-11-20 15:31:04 -0800
Version trunk
Hardware PC Linux
CC baldrick@free.fr, llvm-bugs@lists.llvm.org, pawel@32bitmicro.com, rafael@espindo.la
Fixed by commit(s)
Attachments crasher.ll (444 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 9567
Crasher code.

LLVM version: SVN trunk version. Cloned from the git mirror.

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168294 91177308-0d34-0410-b5e6-96231b3b80d8

The attached crasher.ll has a bug, but will crash some llvm command-line tools.

How to reproduce:

1. Download the attached crasher.ll

2. Compile the SVN version of llvm.

3. Go to the generated bin directory.

./opt -S /path/to/crasher.ll

Then opt prints:

============================================= FROM opt ======
PHI node entries do not match predecessors!
  %x = phi i32 [ 1, %entry ], [ 2, %lab2 ]
label %lab2
label %lab3
Broken module found, compilation aborted!
0  opt             0x0000000001655c71
1  opt             0x000000000165594a
2  libpthread.so.0 0x00007fc53f303cb0
3  libc.so.6       0x00007fc53e756425 gsignal + 53
4  libc.so.6       0x00007fc53e759b8b abort + 379
5  opt             0x0000000001581def
6  opt             0x0000000001581b33
7  opt             0x000000000155fb62
llvm::FPPassManager::runOnFunction(llvm::Function&) + 380
8  opt             0x000000000155fd62
llvm::FPPassManager::runOnModule(llvm::Module&) + 102
9  opt             0x0000000001560045
llvm::MPPassManager::runOnModule(llvm::Module&) + 397
10 opt             0x00000000015606e8 llvm::PassManagerImpl::run(llvm::Module&)
+ 120
11 opt             0x000000000156088f llvm::PassManager::run(llvm::Module&) + 39
12 opt             0x000000000088a578 main + 5614
13 libc.so.6       0x00007fc53e74176d __libc_start_main + 237
14 opt             0x000000000087a0e9
Stack dump:
0.      Program arguments: ./opt -S /home/wks/code/llvm-junks/crasher.ll
1.      Running pass 'Function Pass Manager' on module '/home/wks/code/llvm-
junks/crasher.ll'.
2.      Running pass 'Module Verifier' on function '@crasher'
Aborted (core dumped)
============================================= END FROM opt ==

Using llc and lli also results in core-dump. But llvm-as can indicate the error
in crasher.ll without crashing itself.

./llvm-as /path/to/crasher.ll -o crasher.bc

============================================= FROM llvm-as ======
./llvm-as: assembly parsed, but does not verify as correct!
PHI node entries do not match predecessors!
  %x = phi i32 [ 1, %entry ], [ 2, %lab2 ]
label %lab2
label %lab3
Broken module found, compilation terminated.
Broken module found, compilation terminated.
Broken module found, compilation terminated.
============================================= END FROM llvm-as ==
Quuxplusone commented 12 years ago

Attached crasher.ll (444 bytes, application/octet-stream): Crasher code.

Quuxplusone commented 12 years ago

I don't really see why this is a problem...

Quuxplusone commented 12 years ago
(In reply to comment #1)
> I don't really see why this is a problem...

On erroneous input, tools should print error messages rather than crashing
themselves. Note that opt is not exited normally.