-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Bugzilla Link | 3354 |
Resolution | FIXED |
Resolved on | Jan 19, 2009 19:16 |
Version | unspecified |
OS | Linux |
Attachments | testcase |
CC | @lattner,@efriedma-quic |
Extended Description
The attached program displays this behavior on x86 Linux:
[regehr@babel tmp30]$ llvm-gcc -O small.c -o small
small.c: In function ‘main’:
small.c:19: warning: division by zero
small.c:19: warning: division by zero
[regehr@babel tmp30]$ ./small
x=1
Floating point exception
The thing is, the divide-by-zero behaviors are all protected by short-circuiting operations, and should never fire. I claim that LLVM's -O0 behavior is what must occur at all optimization levels:
[regehr@babel tmp30]$ llvm-gcc -O0 small.c -o small
small.c: In function ‘main’:
small.c:19: warning: division by zero
small.c:19: warning: division by zero
[regehr@babel tmp30]$ ./small
x=1
x=0
The macro in the attached code is simply a macroized version of the 2nd safe multiplication fragment here: