On 4/29/21 11:06 PM, Hans Petter Selasky wrote:
Hi,

Can someone please explain what C-compiler flag I'm missing, to make this simple C-program terminate?

I have a function _abs() which at some point is equal to one, but the compiler thinks it is not required to emit the test for the while() at all, looking at the assembly code! A printf() clearly verifies that the _abs() function has returned one.


clang11 -O2 test.c && ./a.out

Looks like -fwrapv fixes the issue.

Sorry for the noise.

--HPS
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[email protected]"

Reply via email to