https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102129

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Mon, 30 Aug 2021, vincent-gcc at vinc17 dot net via Gcc-bugs wrote:

> In the generated code with -O1 and above, one can see that the multiplication
> is done after g is called, even if -ftrapping-math is used (which is the
> default). This is incorrect as x * 5.0 may trap, terminating the program with 
> a
> floating-point exception, in which case g must not be executed.

It's incorrect as the function g might call fetestexcept and examine the 
floating-point exception flags raised, or feclearexcept to clear them.  
That has nothing to do with trap enablement.  Since trap enablement is 
outside the scope of ISO C, and since various processors implement aspects 
of it differently making it inherently unportable, issues that appear 
without involving enabled traps are best considered without involving such 
traps at all.

Reply via email to