[LLVMbugs] [Bug 2536] New: possible integer codegen error

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jul 8 23:01:03 PDT 2008


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

           Summary: possible integer codegen error
           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


This is on svn 53265 on Ubuntu Feisty on ia32.

Apologies for the large test input, automatic and manual techniques were not
successful in generating a smaller one.

[regehr at babel tmp1]$ llvm-gcc -O1 -fwrapv small.c -o small
[regehr at babel tmp1]$ ./small
4
[regehr at babel tmp1]$ llvm-gcc -Os -fwrapv small.c -o small
[regehr at babel tmp1]$ ./small
0

[regehr at babel tmp1]$ cat small.c

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

typedef int int32_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;

static inline unsigned int
rshift_u_s(unsigned int left, int right)
{
        if ((right < 0)
                || (right >= sizeof(unsigned int)*CHAR_BIT)) {
                /* Avoid undefined behavior. */
                return left;
        }
        return left >> right;
}

static inline unsigned long int
mod_rhs(const long int rhs)
{
    if (rhs == 0) return 1;
    return rhs;
}

static inline unsigned long int
div_rhs(const long int rhs)
{
    if (rhs == 0) return 1;
    return rhs;
}

uint16_t g_5 = 4L;
int32_t g_104;
uint16_t g_107;
uint16_t g_227;
uint32_t g_229;
int32_t g_241;
uint16_t g_307;

int32_t func_65 (void);
int32_t func_65 (void)
{
  if (rshift_u_s (g_5, 1))
    g_107 = g_5;
  for (1; g_104; --g_104);
  return g_229;
}

int32_t func_54 (uint32_t p_55, uint16_t p_56);
int32_t func_54 (uint32_t p_55, uint16_t p_56)
{
  for (p_55 = 17; p_55; --p_55)
    if ((func_65 ()) * ((1 % mod_rhs (p_56)) || g_227))
      p_56 = 1;
  return 1;
}

int32_t func_28 (uint16_t p_29);
int32_t func_28 (uint16_t p_29)
{
  g_307 || ((0 >= p_29) / div_rhs (func_54 (g_241, 1) <= g_5))
    && (func_65 ());
  return 1;
}

int main (void)
{
  func_28 (1);
  printf ("%d\n", g_107);
  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