[LLVMbugs] [Bug 2364] New: likely integer codegen bug

Neil Booth neil at daikokuya.co.uk
Sun May 25 15:21:46 PDT 2008


bugzilla-daemon at cs.uiuc.edu wrote:-

> http://llvm.org/bugs/show_bug.cgi?id=2364
> 
>            Summary: likely integer codegen bug
>            Product: new-bugs
>            Version: unspecified
>           Platform: PC
>         OS/Version: Windows XP
>             Status: NEW
>           Severity: normal
>           Priority: P2
>          Component: new bugs
>         AssignedTo: unassignedbugs at nondot.org
>         ReportedBy: regehr at cs.utah.edu
>                 CC: llvmbugs at cs.uiuc.edu
> 
> 
> Using svn 51558 on Ubuntu Feisty on x86-32 this code is miscompiled:
> 
> int func_6 (void)
> {
>   int i = 0;
>   char x;
>   for (x = 0;
>        (x != 12);
>        x -= 4) {
>     i++;
>   }
>   return i;
> }
> 
> llvm-gcc -fwrapv -O1 -S -o - small.c -Wall -fomit-frame-pointer
> 
> gives:
> 
> func_6:
>         movl    $253, %eax
>         ret
> 
> I believe the correct result is 61.

This looks like undefined behaviour (integer overflow).

Neil.



More information about the llvm-bugs mailing list