Re: [PATCH] Implement -fsanitize=float-divide-by-zero

2014-05-02 Thread Joseph S. Myers
On Tue, 29 Apr 2014, Jakub Jelinek wrote: To my surprise, the wording in C99 or C++11 make even floating point division by zero undefined behavior, but I think generally at least for IEEE floating point semantics it is well defined, thus I think we shouldn't include it in

Re: [PATCH] Implement -fsanitize=float-divide-by-zero

2014-04-30 Thread Jakub Jelinek
On Tue, Apr 29, 2014 at 11:34:50AM +0200, Marek Polacek wrote: Ran ubsan testsuite (-m32/-m64) + bootstrap-ubsan on x86_64-linux, ok now? 2014-04-29 Marek Polacek pola...@redhat.com * gcc.c (sanitize_spec_function): Handle SANITIZE_FLOAT_DIVIDE. * builtins.def: Initialize

Re: [PATCH] Implement -fsanitize=float-divide-by-zero

2014-04-30 Thread Marek Polacek
On Wed, Apr 30, 2014 at 08:55:10AM +0200, Jakub Jelinek wrote: Please assign the result of the divisions to some other volatile variables, otherwise I don't see why the compiler couldn't optimize them away all. Otherwise looks good to me. Done, thanks. Marek

Re: [PATCH] Implement -fsanitize=float-divide-by-zero

2014-04-29 Thread Tobias Burnus
Marc Glisse wrote: On Mon, 28 Apr 2014, Marek Polacek wrote: This patch implements -fsanitize=float-divide-by-zero option that can be used to detect division by zero even when using floating types. Most of the code in ubsan_instrument_division was ready for this so this was mainly about

Re: [PATCH] Implement -fsanitize=float-divide-by-zero

2014-04-29 Thread Jakub Jelinek
On Tue, Apr 29, 2014 at 10:27:58AM +0200, Tobias Burnus wrote: Thus, I think Fortran users would also prefer not to have -fsanitize=undefined implying trapping dividing by zero. Thus, I wonder whether it wouldn't be more useful to provide a command-line option to make the floating-point

Re: [PATCH] Implement -fsanitize=float-divide-by-zero

2014-04-29 Thread Marek Polacek
On Tue, Apr 29, 2014 at 10:46:06AM +0200, Jakub Jelinek wrote: On Tue, Apr 29, 2014 at 10:27:58AM +0200, Tobias Burnus wrote: Thus, I think Fortran users would also prefer not to have -fsanitize=undefined implying trapping dividing by zero. Thus, I wonder whether it wouldn't be more

[PATCH] Implement -fsanitize=float-divide-by-zero

2014-04-28 Thread Marek Polacek
This patch implements -fsanitize=float-divide-by-zero option that can be used to detect division by zero even when using floating types. Most of the code in ubsan_instrument_division was ready for this so this was mainly about handling REAL_TYPE there. Since division by a floating point zero can

Re: [PATCH] Implement -fsanitize=float-divide-by-zero

2014-04-28 Thread Marc Glisse
On Mon, 28 Apr 2014, Marek Polacek wrote: This patch implements -fsanitize=float-divide-by-zero option that can be used to detect division by zero even when using floating types. Most of the code in ubsan_instrument_division was ready for this so this was mainly about handling REAL_TYPE there.