[LLVMbugs] [Bug 3369] New: math error at all optimization levels
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Jan 21 08:08:31 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=3369
Summary: math error at all optimization levels
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
Using r62644 on Ubuntu Hardy on x86 I get func_1() returning 1 at all
optimization levels. I believe it should return -1. The safe mod macro is
just a macroized version of the safe signed mod function from here:
https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow
#include <stdint.h>
#include <stdio.h>
#define safe_mod_macro_int_s_s(si1,si2) \
(((((int)(si2)) == ((int)0)) || ((((int)(si1)) == (INT32_MIN)) &&
(((int)(si2)) == ((int)-1)))) \
? ((int)(si1)) \
: (((int)(si1)) % ((int)(si2))))
int func_1 (void);
int func_1 (void)
{
unsigned int l_174 = -7;
return safe_mod_macro_int_s_s (l_174, 2);
}
int
main (void)
{
printf ("checksum = %d\n", func_1 ());
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