diff mbox

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

Message ID 2737126.5b1v7aemIl@polaris
State New
Headers show

Commit Message

Eric Botcazou June 21, 2013, 1:14 p.m. UTC
> David: Can you have a look at libgfortran/config/fpu-aix.h - Thanks!
> Uros: Can you have a look at libgfortran/config/fpu-387.h - Thanks!

The patch silently changes libgfortran/config/fpu-sysv.h as well, breaking 
Solaris in the process:

In file included from /nile.build/botcazou/gcc-
head/src/libgfortran/runtime/fpu.c:29:0:
./fpu-target.h: In function 'get_fpu_except_flags':
./fpu-target.h:88:3: error: unknown type name 'fp_except_t'
   fp_except_t set_excepts;
   ^
make[2]: *** [fpu.lo] Error 1
make[2]: Leaving directory `/nfs/nile/nile.build/botcazou/gcc-head/sparc-sun-
solaris2.10/sparc-sun-solaris2.10/libgfortran'

Excert from the man page:

NAME
     fpgetround, fpsetround, fpgetmask,  fpsetmask,  fpgetsticky,
     fpsetsticky - IEEE floating-point environment control

SYNOPSIS
     #include <ieeefp.h>

     fp_rnd fpgetround(void);

     fp_rnd fpsetround(fp_rnd rnd_dir);

     fp_except fpgetmask(void);

     fp_except fpsetmask(fp_except mask);

     fp_except fpgetsticky(void);

     fp_except fpsetsticky(fp_except sticky);


Fixed thusly, applied as obvious.


2013-06-21  Eric Botcazou  <ebotcazou@adacore.com>

	* config/fpu-sysv.h (get_fpu_except_flags): Fix typo.

Comments

Gerald Pfeifer June 22, 2013, 7:09 p.m. UTC | #1
On Fri, 21 Jun 2013, Eric Botcazou wrote:
> The patch silently changes libgfortran/config/fpu-sysv.h as well, 
> breaking Solaris in the process:
> 
> In file included from /nile.build/botcazou/gcc-
> head/src/libgfortran/runtime/fpu.c:29:0:
> ./fpu-target.h: In function 'get_fpu_except_flags':
> ./fpu-target.h:88:3: error: unknown type name 'fp_except_t'
>    fp_except_t set_excepts;
>    ^
> make[2]: *** [fpu.lo] Error 1
> make[2]: Leaving directory `/nfs/nile/nile.build/botcazou/gcc-head/sparc-sun-
> solaris2.10/sparc-sun-solaris2.10/libgfortran'
:
> Fixed thusly, applied as obvious.
> 
> 
> 2013-06-21  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* config/fpu-sysv.h (get_fpu_except_flags): Fix typo.

Except that now FreeBSD 10.x is broken. :-(

  In file included from /scratch2/tmp/gerald/gcc-HEAD/libgfortran/runtime/fpu.c:29:0:
  ./fpu-target.h: In function 'get_fpu_except_flags':
  ./fpu-target.h:88:3: error: unknown type name 'fp_except'
     fp_except set_excepts;
     ^
  gmake[3]: *** [fpu.lo] Error 1

Excerpt from the man page on such a system:

     fp_except_t
     fpgetmask(void);

     fp_except_t
     fpsetmask(fp_except_t mask);

     fp_except_t
     fpgetsticky(void);

     fp_except_t
     fpresetsticky(fp_except_t sticky);

My autoconf foo does not seem to be strong enough for libgfortran,
but I assume checking for both types and then using #ifdef HAVE_FP_EXCEPT_T
...#elif HAVE_FP_EXCEPT...#endif ought to work?

Gerald
Eric Botcazou June 22, 2013, 8:11 p.m. UTC | #2
> Except that now FreeBSD 10.x is broken. :-(

Death to the guy whose thought that adding/removing _t was a good idea...

>   In file included from
> /scratch2/tmp/gerald/gcc-HEAD/libgfortran/runtime/fpu.c:29:0:
> ./fpu-target.h: In function 'get_fpu_except_flags':
>   ./fpu-target.h:88:3: error: unknown type name 'fp_except'
>      fp_except set_excepts;
>      ^
>   gmake[3]: *** [fpu.lo] Error 1
> 
> Excerpt from the man page on such a system:
> 
>      fp_except_t
>      fpgetmask(void);
> 
>      fp_except_t
>      fpsetmask(fp_except_t mask);
> 
>      fp_except_t
>      fpgetsticky(void);
> 
>      fp_except_t
>      fpresetsticky(fp_except_t sticky);
> 
> My autoconf foo does not seem to be strong enough for libgfortran,
> but I assume checking for both types and then using #ifdef HAVE_FP_EXCEPT_T
> ...#elif HAVE_FP_EXCEPT...#endif ought to work?

Yes, I think that we just need to patch the LIBGFOR_CHECK_FPSETMASK check in 
acinclude.m4 so as to also test the return type of the function.
diff mbox

Patch

Index: config/fpu-sysv.h
===================================================================
--- config/fpu-sysv.h	(revision 200189)
+++ config/fpu-sysv.h	(working copy)
@@ -85,7 +85,7 @@  int
 get_fpu_except_flags (void)
 {
   int result;
-  fp_except_t set_excepts;
+  fp_except set_excepts;
 
   result = 0;
   set_excepts = fpgetsticky ();