public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50619] New: Surprising interaction between  -finit-real=NAN and the associate construct
@ 2011-10-04 22:00 fkrogh#gcc at mathalacarte dot com
  2011-10-05  8:25 ` [Bug fortran/50619] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: fkrogh#gcc at mathalacarte dot com @ 2011-10-04 22:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50619

             Bug #: 50619
           Summary: Surprising interaction between  -finit-real=NAN and
                    the associate construct
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fkrogh#gcc@mathalacarte.com


With a real variable defined in a derived type and referenced in an associate
construct the value is redefined as a NaN when using the compilier flag
-finit-real=NAN.  The following two short routines illustrate the problem.


program testa1
  use testa2
  type(test_ty) :: e
  call test(e)
  stop
end program testa1

module testa2
type, public ::  test_ty ! Values that can be set or looked at by the user.
  real :: rmult = 1.0e0 ! Multiplies reals using default format.
end type test_ty

contains
  subroutine test(e)
    type(test_ty) :: e
    print '("No associate: e%rmult =", es15.6)', e%rmult
    associate (rmult=>e%rmult)
      print '("Associate: %rmult =", es15.6)', e%rmult
    end associate
  end subroutine test
end module testa2

compile with

gfortran  -ggdb -finit-real=NAN  -o testa1 testa2.f90 testa1.f90

and get

No associate: e%rmult =   1.000000E+00
Associate: %rmult =            NaN


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-06-14 13:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-04 22:00 [Bug fortran/50619] New: Surprising interaction between -finit-real=NAN and the associate construct fkrogh#gcc at mathalacarte dot com
2011-10-05  8:25 ` [Bug fortran/50619] " burnus at gcc dot gnu.org
2011-11-30 21:35 ` bdavis at gcc dot gnu.org
2012-06-04  9:44 ` gcc.10.dimsea at spamgourmet dot org
2012-06-04 12:32 ` burnus at gcc dot gnu.org
2012-06-04 21:01 ` burnus at gcc dot gnu.org
2012-06-05 11:57 ` gcc.10.dimsea at spamgourmet dot org
2012-06-05 13:05 ` burnus at gcc dot gnu.org
2012-06-14 13:05 ` burnus at gcc dot gnu.org
2012-06-14 13:07 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).