Re: Undefined compiler behaviour or a compiler bug?

2021-04-30 Thread Hans Petter Selasky
On 4/30/21 12:13 AM, Dimitry Andric wrote: % clang -fsanitize=undefined test.c -o test Thank you! Didn't know about that flag. --HPS ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To

Re: Undefined compiler behaviour or a compiler bug?

2021-04-29 Thread Mehmet Erol Sanliturk
On Fri, Apr 30, 2021 at 12:08 AM 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

Re: Undefined compiler behaviour or a compiler bug?

2021-04-29 Thread Dimitry Andric
On 29 Apr 2021, at 23:11, Hans Petter Selasky wrote: > > 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

Re: Undefined compiler behaviour or a compiler bug?

2021-04-29 Thread Hans Petter Selasky
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()

Undefined compiler behaviour or a compiler bug?

2021-04-29 Thread Hans Petter Selasky
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