[LLVMbugs] [Bug 1827] New: crash on simple loop example

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Nov 26 23:25:45 PST 2007


           Summary: crash on simple loop example
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=1271)
 --> (http://llvm.org/bugs/attachment.cgi?id=1271)
hand-written crasher (not reduced)

I got this example from the comment in the top of GCC's
tree-scalar-evolution.c. Amazingly, it triggers an assert in LLVM:

$ llvm-commit/Debug/bin/opt -analyze -scalar-evolution gcc3.bc

Printing analysis 'Scalar Evolution Analysis' for function 'foo':
Classifying expressions for: foo
        %a = phi i32 [ 2, %entry ], [ %b, %loop_1 ]             ; <i32>
opt: APInt.cpp:1725: llvm::APInt llvm::APInt::udiv(const llvm::APInt&) const:
Assertion `RHS.VAL != 0 && "Divide by zero?"' failed.
  --> { 2,+, 1}<loop_1>         Exits: llvm-commit/Debug/bin/opt[0x85d259a]
(gdb) bt
#0  0xffffe405 in __kernel_vsyscall ()
#1  0xf7c3f7f5 in raise () from /lib/i686/cmov/libc.so.6
#2  0xf7c41181 in abort () from /lib/i686/cmov/libc.so.6
#3  0xf7c38b6e in __assert_fail () from /lib/i686/cmov/libc.so.6
#4  0x085a6500 in llvm::APInt::udiv (this=0xffe45c9c, RHS=@0xffe45bf8)
    at APInt.cpp:1725
#5  0x084cfbd1 in llvm::APInt::sdiv (this=0xffe45c9c, RHS=@0xffe45bf8)
    at /home/nicholas/llvm-commit/include/llvm/ADT/APInt.h:608
#6  0x084b9217 in SolveQuadraticEquation (AddRec=0x86c7618, SE=@0x86c4448)
    at ScalarEvolution.cpp:2342
#7  0x084c0700 in llvm::SCEVAddRecExpr::getNumIterationsInRange (
    this=0x86c75c8, Range=@0xffe45f20, SE=@0x86c4448)
    at ScalarEvolution.cpp:2563
#8  0x084c0176 in llvm::SCEVAddRecExpr::getNumIterationsInRange (
    this=0x86c7558, Range=@0xffe460c4, SE=@0x86c4448)
    at ScalarEvolution.cpp:2503
#9  0x084c1870 in ComputeIterationCount (this=0x86c5000, L=0x86c4f70)
    at ScalarEvolution.cpp:1797
#10 0x084c1edf in getIterationCount (this=0x86c5000, L=0x86c4f70)
    at ScalarEvolution.cpp:1676
#11 0x084c2e04 in getSCEVAtScope (this=0x86c5000, V=0x86c72a8, L=0x0)
    at ScalarEvolution.cpp:2271
#12 0x084c3003 in llvm::ScalarEvolution::getSCEVAtScope (this=0x86c4448, 
    V=0x86c45b8, L=0x0) at ScalarEvolution.cpp:2673
#13 0x084c326c in llvm::ScalarEvolution::print (this=0x86c4448, OS=@0x86bd0a0)
    at ScalarEvolution.cpp:2723
#14 0x082dcafe in llvm::Pass::print (this=0x86c4448, O=0x86bd0a0, M=0x86c3870)
    at /home/nicholas/llvm-commit/include/llvm/Pass.h:119
#15 0x082dcaad in runOnFunction (this=0x86c31b0, F=@0x86c5b80) at opt.cpp:166
#16 0x085645f6 in llvm::FPPassManager::runOnFunction (this=0x86c5608, 
    F=@0x86c5b80) at PassManager.cpp:1171
#17 0x08564798 in llvm::FPPassManager::runOnModule (this=0x86c5608, 
    M=@0x86c3870) at PassManager.cpp:1191
#18 0x085642cc in llvm::MPPassManager::runOnModule (this=0x86c52f8, 
    M=@0x86c3870) at PassManager.cpp:1240
#19 0x08564484 in llvm::PassManagerImpl::run (this=0x86c2fe0, M=@0x86c3870)
    at PassManager.cpp:1313
#20 0x085644d6 in llvm::PassManager::run (this=0xffe46548, M=@0x86c3870)
    at PassManager.cpp:1345
#21 0x082dc603 in main (argc=4, argv=0xffe46744) at opt.cpp:426

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list