[LLVMbugs] [Bug 3439] New: math wrong-code bug

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 29 10:16:18 PST 2009


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

           Summary: math 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


On Ubuntu Hardy on x86, llvm-gcc -O3 from 1/29/09 miscompiles the code below
such that it prints 1 instead of 0.

#include <stdint.h>

volatile uint32_t g_22;
uint32_t g_46 = 1;

#define safe_mod_macro_int16_t_s_s(si1,si2) \
  (((((int16_t)(si2)) == ((int16_t)0)) || ((((int16_t)(si1)) == (INT16_MIN)) &&
(((int16_t)(si2)) == ((int16_t)-1)))) \
  ? ((int16_t)(si1)) \
  : (((int16_t)(si1)) % ((int16_t)(si2))))

static int16_t
safe_mod_func_int16_t_s_s (int16_t _si1, int16_t _si2)
{
  return safe_mod_macro_int16_t_s_s(_si1,_si2);
}

void func_35 (uint64_t p_36);
void func_35 (uint64_t p_36)
{
  uint32_t l_38;
  for (l_38 = 0; l_38 <= 0; l_38++)
    g_22 = 1 & safe_mod_func_int16_t_s_s (g_46, p_36);
}

int
main (void)
{
  func_35 (1);
  printf ("%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