[LLVMbugs] [Bug 5387] New: incorrect integer conversion with -O1

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Nov 3 22:26:36 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=5387

           Summary: incorrect integer conversion with -O1
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chenyang at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu, regehr at cs.utah.edu,
                    jxyang at cs.utah.edu


Using trunk 85610, the code below shows wrong behavior. The for loop should be
infinite. 

yang at yang-working:~$ clang -O1 -o small small.c
yang at yang-working:~$ ./small
Done!
yang at yang-working:~$ cat small.c
#include <stdio.h>

static unsigned short foo(unsigned short ui1, unsigned short ui2)
{
  return (ui1 - ui2);
}

static int bar(void)
{
    int l_2 = 0;
    for (l_2 = -1; (l_2 > -25); l_2 = foo(l_2, 1))
    {

    }
    return 0;
}

int main(void)
{
    bar();
    printf("Done!\n");
    return 0;
}
yang at yang-working:~$ clang -v
clang version 1.1 (trunk 85610)
Target: i386-pc-linux-gnu
Thread model: posix


-- 
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