[Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP

Tobias Burnus burnus@net-b.de
Wed Jun 12 15:50:00 GMT 2013


Updated version:
* Uros suggestions are incorporated
* Changed from -f(no-)underflow-warning to 
-ffpe-summary=[none,all,underflow,...]

Tobias Burnus wrote:
> David: Can you have a look at libgfortran/config/fpu-aix.h - Thanks!
>
> The attached patch causes gfortran-compiled programs to print warnings 
> like
Note: The following floating-point exception are signalling: 
IEEE_DIVIDE_BY_ZERO
> when STOP / ERROR STOP is invoked. That's required by Fortran 2008 
> (8.4 STOP and ERROR STOP statements):
>
> "If any exception (14) is signaling on that image, the processor shall 
> issue a warning indicating which exceptions are signaling; this 
> warning shall be on the unit identified by the named constant ERROR 
> UNIT (13.8.2.8)."

> One surely could extend it to allow to completely disable the warning 
> - or to make it more fine grained like "none", "all" plus all single 
> flags (including underflow, denormal and inexact, where by default one 
> leaves out inexact).

Thinking about it, I think that's the better solution: It makes 
(optionally) inexact available and also allows to fully disable the 
feature. I am sure that there are users who would like to have that 
choice. Hence, I update the argument handling and libgfortran's stop.c.

Additions from the J3 list:
* IBM's "XLF compiler has an option to report fp exceptions including 
underflow and inexact.  It is default OFF."
(which matches ifort)

> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?

Tobias

PS: I filled PR 57598 to track the warning handling for coarrays.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: execept-stat-v2.diff
Type: text/x-patch
Size: 20942 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130612/f5f92bed/attachment.bin>


More information about the Fortran mailing list