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

--- Comment #41 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
It's likely that caring about exceptions would actually be worse for 
optimization than caring about rounding modes (because exceptions mean 
that floating-point operations can write global state, not just read it).  
I.e., a proper implementation would also indicate splitting 
-ftrapping-math into the existing parts relating only to local 
transformations, and something new for the global effects of operations 
being considered to write the exception state, and so not be movable past 
any code that might read it (which includes most function calls, and asms 
depending on whether they might read the floating-point state register).

(There are plenty of local bugs in this area - both in machine-independent 
optimizations, and in machine-specific code, or libgcc code, that doesn't 
do the right thing regarding exceptions; lots of thorough tests would be 
needed to find such places.  But in general the local bugs should be 
individually straightforward to fix in a way that the global issues 
aren't.)

(See discussions on the gcc mailing list in Dec 2012 / Jan 2013 / Feb 2013 
for more details in this area.)

Reply via email to