[LLVMbugs] [Bug 14506] New: Loop condition not checked with -O1 and assert()
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Dec 4 07:04:21 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14506
Bug #: 14506
Summary: Loop condition not checked with -O1 and assert()
Product: clang
Version: 3.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: llvm at yorhel.nl
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hello,
I ran into an odd issue. The following example illustrates the problem:
#include <assert.h>
int main(int argc, char **argv) {
int l, i;
for(i=0; i<1; i++)
;
for(l=0,i=0; i<1; i++) {
l++;
assert(l == i+1);
}
return 0;
}
When compiled with 'clang -O1', the second loop does not terminate as it
should. The program terminates correctly when compiled with -DNDEBUG or with
-O0.
$ clang --version
clang version 3.1 (branches/release_31)
Target: x86_64-unknown-linux-gnu
Thread model: posix
This is on Arch Linux with the clang-3.1-6 package.
--
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