[cfe-dev] Found a bug - maybe?
Clark Gaebel
cg.wowus.cg at gmail.com
Sun Jun 6 21:03:22 PDT 2010
A picture is worth a thousand words (and by picture, I mean shell
output). This is with
clark at clark-server ~/test $ clang++ --version
clang version 1.1 (branches/release_27)
Target: x86_64-pc-linux-gnu
Thread model: posix
clark at clark-server ~/test $ cat foo.cpp
#include <cstdlib>
#include <cstdio>
struct ParseFailed {};
int main()
{
bool succeeded = false;
const char buffer[] = {
0x00, 0x11
};
try {
if(buffer > (buffer - 4))
throw ParseFailed();
succeeded = false;
} catch(ParseFailed) {
succeeded = true;
}
if(succeeded)
printf("SUCCESS!\n");
else
printf("FAILURE!\n");
}
clark at clark-server ~/test $ clang++ -O0 foo.cpp && ./a.out
SUCCESS!
clark at clark-server ~/test $ clang++ -O2 foo.cpp && ./a.out
FAILURE!
What should I do? This little oddity popped up in one of my unit tests
while running my codebase through clang.
--
Regards,
-Clark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100607/8275623e/attachment.html>
More information about the cfe-dev
mailing list