[LLVMbugs] [Bug 3119] New: maybe a loop miscompilation
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun Nov 23 12:28:45 PST 2008
http://llvm.org/bugs/show_bug.cgi?id=3119
Summary: maybe a loop miscompilation
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 bug is in 2.4 but not 2.3 and is still in r59914. This is seen on Ubuntu
Hardy on x86.
regehr at john-home:~/volatile/tmp63$ llvm-gcc -O0 small.c -o small
regehr at john-home:~/volatile/tmp63$ ./small
-1
regehr at john-home:~/volatile/tmp63$ llvm-gcc -O1 small.c -o small
regehr at john-home:~/volatile/tmp63$ ./small
0
regehr at john-home:~/volatile/tmp63$ cat small.c
#include <stdint.h>
#include <stdio.h>
static inline uint64_t
safe_mod_uint64_t_u_u (uint64_t ui1, uint64_t ui2)
{
if (ui2 == 0) return ui1;
return ui1 % ui2;
}
static inline int8_t
safe_sub_int8_t_s_s (int8_t si1, int8_t si2)
{
if (((si1^si2)
& (((si1 ^ ((si1^si2)
& (1 << (sizeof(int8_t)*8-1))))-si2)^si2)) < 0) {
return si1;
}
return si1 - si2;
}
uint32_t g_61;
uint32_t g_123;
uint32_t g_147 = 1;
int32_t func_19 (void);
int32_t func_37 (uint8_t p_39);
int32_t func_64 (uint32_t p_65, uint32_t p_66);
int32_t func_90 (uint8_t p_92, int16_t p_93, uint8_t p_95);
int32_t func_105 (int32_t p_107, int32_t p_108);
int32_t
func_19 (void)
{
func_37 (1);
return g_147;
}
int32_t
func_37 (uint8_t p_39)
{
int32_t l_243 = -1L;
if (func_90 (1, (safe_mod_uint64_t_u_u (l_243, -1L)), 1))
{
func_64 (1, 1);
}
return 1;
}
int32_t
func_64 (uint32_t p_65, uint32_t p_66)
{
for (g_147 = 0; 0; 1)
return 1;
return 1;
}
int32_t
func_90 (uint8_t p_92, int16_t p_93, uint8_t p_95)
{
return p_93;
}
int32_t
func_105 (int32_t p_107, int32_t p_108)
{
return 1;
}
int
main (void)
{
printf ("%d\n", safe_sub_int8_t_s_s ((func_19 ()), 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