public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51266] New: Pointer initialization in PARAMETER
@ 2011-11-22 10:19 burnus at gcc dot gnu.org
  2011-11-22 15:48 ` [Bug fortran/51266] [F08] " burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-22 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51266
           Summary: Pointer initialization in PARAMETER
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
            Blocks: 45290


The following program from
   http://groups.google.com/group/comp.lang.fortran/msg/38bbc52c641f4b13
is rejected with:

        TYPE(T), PARAMETER :: C = T(X)  !!!
                                    1
  Error: Parameter 'x' at (1) has not been declared or is a variable, which
  does not reduce to a constant expression

The check is wrong as one has a pointer initialization - and X is a valid REAL,
TARGET, SAVE variable. Without PARAMETER, the initialization works. I think
just the checking needs to be fixed. (Note this is a F2008 feature.)

Variant: Use "T()" an in the derived type  "P => X".


      PROGRAM MAIN
        TARGET X
        DATA X/0.0/
        TYPE T
          REAL, POINTER :: P
        END TYPE
        TYPE(T), PARAMETER :: C = T(X)  !!!
        READ *, X
        CALL SUBR()
      CONTAINS
        SUBROUTINE SUBR
          REAL, PARAMETER :: Y = C%P  !!!
         PRINT *, Y
        END SUBROUTINE
      END


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

end of thread, other threads:[~2015-10-09  8:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 10:19 [Bug fortran/51266] New: Pointer initialization in PARAMETER burnus at gcc dot gnu.org
2011-11-22 15:48 ` [Bug fortran/51266] [F08] " burnus at gcc dot gnu.org
2012-04-15 19:55 ` janus at gcc dot gnu.org
2012-04-15 20:04 ` janus at gcc dot gnu.org
2015-08-30 10:14 ` dominiq at lps dot ens.fr
2015-08-30 10:16 ` dominiq at lps dot ens.fr
2015-10-09  8:50 ` dominiq at lps dot ens.fr

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).