[LLVMbugs] [Bug 4569] New: integer wrong code bug

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Jul 17 07:35:26 PDT 2009


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

           Summary: integer wrong code bug
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            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


Seen on Ubuntu Hardy.  "2" is the right answer.

regehr at john-home:~/volatile/tmp176$ llvm-gcc -O small.c -o small
regehr at john-home:~/volatile/tmp176$ ./small
checksum = 2
regehr at john-home:~/volatile/tmp176$ llvm-gcc -O2 small.c -o small
regehr at john-home:~/volatile/tmp176$ ./small
checksum = 65282
regehr at john-home:~/volatile/tmp176$ llvm-gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure
--prefix=/home/regehr/z/tmp/llvm-gcc-r76067-install
--program-prefix=llvm-r76067- --enable-languages=c,c++
--enable-llvm=/home/regehr/z/tmp/llvm-r76067 --enable-checking=release
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5646) (LLVM build)
regehr at john-home:~/volatile/tmp176$ cat small.c

#include <stdint.h>
#include <limits.h>
#include <stdio.h>

static uint16_t
safe_sub_func_uint16_t_u_u (uint16_t ui1, uint16_t ui2)
{
  return
    ui1-ui2;
}

uint16_t g_22;

void func_36 (void);
void func_36 (void)
{
  uint8_t l_95;
  for (l_95 = 0; l_95 != 1; l_95 = safe_sub_func_uint16_t_u_u (l_95, 1))
    g_22 = l_95;
}

int main (void)
{
  func_36 ();
  printf ("checksum = %d\n", g_22);
  return 0;

}


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