[Bug fortran/82207] ieee_class identifies signaling NaNs as quiet NaNs

2017-09-13 Thread sacks at ucar dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82207

--- Comment #3 from Bill Sacks  ---
Thanks for pointing that out, kargl. I'm fine with this being closed if it's
not actually a bug: it's not causing me any problems, I just happened to notice
it in the course of investigating other aspects of gfortran's NaN handling.

[Bug middle-end/66462] GCC isinf/isnan/... builtins cause sNaN exceptions

2017-09-13 Thread sacks at ucar dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66462

Bill Sacks  changed:

   What|Removed |Added

 CC||sacks at ucar dot edu

--- Comment #9 from Bill Sacks  ---
I have found that, with gfortran, the following all lead to a SIGFPE if I
compile with -ffpe-trap=invalid:

(1) ieee_value(my_nan, ieee_quiet_nan)

(2) ieee_value(my_nan, ieee_signaling_nan)

(3) ieee_is_nan called on a signaling NaN

(4) gfortran's built-in isnan called on a signaling NaN

(5) ieee_class called on a signaling NaN

(See https://github.com/NCAR/billsacks-gfortran-snan/tree/master_n01 for test
code and more information.)

Are all of these duplicate problems to the one reported here, or are some of
these separate issues that should be opened?

[Bug fortran/82207] ieee_class identifies signaling NaNs as quiet NaNs

2017-09-13 Thread sacks at ucar dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82207

--- Comment #1 from Bill Sacks  ---
Created attachment 42166
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42166=edit
Simple test program

Added attachment to demonstrate the problem in a simpler test program.

Compile and run with

gfortran gfortran_snan.f90
./a.out

[Bug fortran/82207] New: ieee_class identifies signaling NaNs as quiet NaNs

2017-09-13 Thread sacks at ucar dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82207

Bug ID: 82207
   Summary: ieee_class identifies signaling NaNs as quiet NaNs
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sacks at ucar dot edu
  Target Milestone: ---

With gfortran 5.4.0, gfortran 6.3.0 and gfortran 7.1.0, running ieee_class on a
signaling NaN identifies it as an ieee_quiet_nan rather than an
ieee_signaling_nan.

(Sorry, I don't have a more recent gfortran version readily available.)

I have tried creating the NaN values using both:

(1)
  my_nan = ieee_value(my_nan, ieee_signaling_nan)

(2)

  integer, parameter :: i8 = selected_int_kind(13)
  integer(i8), parameter :: dsnan_pat = int(Z'7FF4',i8)
  my_nan = transfer(dsnan_pat, my_nan)

In both cases, I then used this code to print the type of NaN:

 my_class = ieee_class(my_nan)
 if (my_class == ieee_signaling_nan) then
print *, 'signaling nan'
 else if (my_class == ieee_quiet_nan) then
print *, 'quiet nan'
 else if (my_class == ieee_other_value) then
print *, 'other value'
 else
print *, 'UNKNOWN'
 end if


and it printed 'quiet nan'.

For full code and additional information, see:

https://github.com/NCAR/billsacks-gfortran-snan/tree/master_n01

(Note that that code and README file includes some additional stuff not
directly relevant to this bug, since I was using that test program to test a
number of aspects of gfortran's NaN handling.)

[Bug fortran/58043] [OOP] Incorrect behaviour of polymorphic array

2014-06-11 Thread sacks at ucar dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58043

Bill Sacks sacks at ucar dot edu changed:

   What|Removed |Added

 CC||sacks at ucar dot edu

--- Comment #4 from Bill Sacks sacks at ucar dot edu ---
Created attachment 32926
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=32926action=edit
another test case demonstrating this behavior

For what it's worth, I'm attaching another test case that demonstrates what
seems to be the same bug.

There are two subroutines, one in which the argument is declared as a 'type'
and one as a 'class'. The subroutine that uses the 'type' dummy variable
produces the correct output:

  21
  22
  23

whereas the one that uses the 'class' dummy variable produces the wrong output:

  21
   0
   0

I have confirmed this buggy behavior in gfortran 4.7.3, 4.8.2, 4.8.3 and 4.9.0.