<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
A picture is worth a thousand words (and by picture, I mean shell
output). This is with <br>
<blockquote>clark@clark-server ~/test $ clang++ --version<br>
clang version 1.1 (branches/release_27)<br>
Target: x86_64-pc-linux-gnu<br>
Thread model: posix<br>
clark@clark-server ~/test $ cat foo.cpp<br>
#include <cstdlib><br>
#include <cstdio><br>
<br>
struct ParseFailed {};<br>
<br>
int main()<br>
{<br>
bool succeeded = false;<br>
<br>
const char buffer[] = {<br>
0x00, 0x11<br>
};<br>
<br>
try {<br>
if(buffer > (buffer - 4))<br>
throw ParseFailed();<br>
<br>
succeeded = false;<br>
} catch(ParseFailed) {<br>
succeeded = true;<br>
}<br>
<br>
if(succeeded)<br>
printf("SUCCESS!\n");<br>
else<br>
printf("FAILURE!\n");<br>
}<br>
<br>
clark@clark-server ~/test $ clang++ -O0 foo.cpp && ./a.out<br>
SUCCESS!<br>
clark@clark-server ~/test $ clang++ -O2 foo.cpp && ./a.out<br>
FAILURE!<br>
<br>
</blockquote>
What should I do? This little oddity popped up in one of my unit tests
while running my codebase through clang.<br>
<pre class="moz-signature" cols="72">--
Regards,
-Clark</pre>
</body>
</html>