https://llvm.org/bugs/show_bug.cgi?id=23358
Emmanuel STAPF <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID |--- --- Comment #3 from Emmanuel STAPF <[email protected]> --- My concern is not with the standard that says it is an undefined behavior. What I'm saying is that since I've been using clang, the clang definition of undefined behavior was to throw a floating point exception (behavior you only get now with the -O0 optimization). As a user, I expect the behavior of throwing the exception to remain the same across versions and across various compiler flags (there might be exception to this rule since certain command line options changes some behaviors). I was just highlighting that fact and am hoping you will fix this. Note that the behavior of throwing an exception is quite common to various C compilers on the various platforms I've been dealing with. PS: I kept the `volatile' modifier from the original piece of code I was debugging but it has actually no bearing in the behavior, so you can update the code sample to just: #include <stdio.h> #include <stdlib.h> int main () { int w = 123; int v = (1 / (w - w)); printf ("Value of v is %d\n", v); } Here is the output I'm observing: : cc -O0 a.c ; ./a.out Floating exception : cc -O1 a.c ; ./a.out Value of v is 1455093720 -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ LLVMbugs mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
