------- Comment #21 from burnus at gcc dot gnu dot org 2008-10-31 07:41 ------- (In reply to comment #17) > > Adw_xabcd_8(1:n) = transfer(-1,1.0) ! Adw_xabcd_8 is REAL > > > > That makes sense: One assigns NaN to a real variable (though a comment > > would be helpful). > Does this mean gfortran shouldn't give an error message on the first part > (with the real variable) of the bug report?
Assigning should be definitely OK: "NaN" is a valid REAL number (if one allows IEEE). NaN lies outside the floating-point model of Fortran, but it is not different from if(IEEE_SUPPORT_NAN(x)) & x = IEEE_VALUE(x, IEEE_QUIET_NAN) The question is whether real8_number = transfer(-1, 0.0_4) ! real(4) -> real(8) or real :: NaN = IEEE_VALUE(x, IEEE_QUIET_NAN) ! OK y = NaN * 5 ! Valid? are valid or not. The problem with the validity is that Fortran has a numerical model which does not allow for NaN, INF, and sub-/de-normal numbers, but Fortran 2003 has also IEEE support, which is not closer described, and (if supported by the hardware/compiler) the IEEE part of Fortran 2003 allows for NaN, +/-INF and denormal numbers (but it does not make clear when). One can argue that a NaN real(4)->real(8) conversion is OK or that it is invalid - I think one can find arguments for both; in any case NaN can be unambiguously converted from one real/complex to another real/complex kind. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37930