[LLVMbugs] [Bug 14973] New: infinite loop optimized away
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jan 16 17:17:09 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=14973
Bug #: 14973
Summary: infinite loop optimized away
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: dhazeghi at yahoo.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
We have found an inconsistency in the following testcase (derived from
pr33992.c in the gcc testsuite) using clang 3.2 and trunk. When compiled
without optimization, the loop does not terminate. However, with -O1 or above,
clang optimizes away the loop. This behavior appears incorrect, as overflow
behavior is well defined with unsigned int. Using -fwrapv and -ftrapv does not
change this result.
$ clang -O0 reduced.c
$ ./a.out
^C [hangs]
$ clang -O1 reduced.c
$ ./a.out
$ clang -v
clang version 3.3 (trunk 172630)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ cat reduced.c
void foo ()
{
unsigned int i = 0;
for (i = 0; ; i++) { }
}
int main()
{
foo();
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