[Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP
Uros Bizjak
ubizjak@gmail.com
Wed Jun 12 14:04:00 GMT 2013
On Wed, Jun 12, 2013 at 3:05 PM, Tobias Burnus <burnus@net-b.de> wrote:
> 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!
>
+ unsigned short cw;
+
+ __asm__ ("fnstsw %0" : "=a" (cw));
__asm__ __volatile__ ("fnstsw\t%0" : "=a" (cw));
fnstsw uses processor state (x87 status word) that is hidden to gcc,
so it needs to be __volatile__.
+ if (has_sse())
+ {
+ unsigned int cw_sse;
+ __asm__ ("stmxcsr %0" : "=m" (*&cw_sse));
also __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw_sse));
%v will conditionally emit "v" prefix for TARGET_AVX.
+ cw |= cw_sse;
+ }
Looks OK otherwise.
Thanks,
Uros.
More information about the Fortran
mailing list