[LLVMbugs] [Bug 7928] New: if() branches incorrectly with conditional involving temporaries
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 17 07:55:11 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=7928
Summary: if() branches incorrectly with conditional involving
temporaries
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: brad.king at kitware.com
CC: llvmbugs at cs.uiuc.edu
Tested as of svn revision 110904 of clang and llvm.
$ cat test.cxx
#include <string>
#include <cstring>
int main() {
if(std::string("x").size() == (std::strlen("")+1)) {
return 0;
} else {
return 1;
}
}
$ g++ test.cxx ; ./a.out ; echo $?
0
$ clang++ -O0 test.cxx ; ./a.out ; echo $?
1
The result from clang++ should have been 0 also.
The problem goes away when optimizations are enabled:
$ clang++ -O1 test.cxx ; ./a.out ; echo $?
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