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

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Jun 21 12:16:40 PDT 2008


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

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


This happens with svn 52513 on ubuntu feisty on ia32.

Unfortunately I have not been able to further reduce the test input.

[regehr at babel tmp21]$ llvm-gcc -O2 -fwrapv small.c -o small  
[regehr at babel tmp21]$ ./small
0
[regehr at babel tmp21]$ llvm-gcc -O3 -fwrapv small.c -o small
[regehr at babel tmp21]$ ./small
1



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

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

static inline int
rshift_s_s(int left, int right)
{
        if ((left < 0)
                || (right < 0)
                || (right >= sizeof(int)*CHAR_BIT)) {
                /* Avoid implementation-defined and undefined behavior. */
                return left;
        }
        return left >> right;
}

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

uint32_t g_2;
uint32_t g_3 = 0x00252604L;

int32_t func_10 (int8_t p_12);
int32_t func_10 (int8_t p_12)
{
  int32_t l_14 = 1;
  uint16_t l_26;
  uint32_t l_15 = 1;
  if ((l_14 || l_15) % mod_rhs (1 < p_12))
    for (0; l_26; l_26 -= 1)
      {
      }
  return 1;
}

void func_1 (void);
void func_1 (void)
{
  int8_t l_4 = 0x18L;
  int32_t l_5 = 1;
  uint16_t l_6 = 1;
  uint32_t l_7 = 1;
  uint32_t l_8 = 1;
  g_2 =
    ((((g_3 ^ l_4) <= (1 % mod_rhs (1)) && l_4)
      && (g_3 > (l_6 && 1))) != (((rshift_s_s (l_5, 1))
                                  || (l_7 && g_3) <= (l_6 && g_2)) - ((l_8
                                                                       && l_5)
                                                                      %
                                                                      mod_rhs
                                                                     
(lshift_s_s
                                                                       ((1 <
                                                                         l_6),
                                                                        func_10
                                                                       
(g_3))))));
}

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