public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51266] New: Pointer initialization in PARAMETER Date: Tue, 22 Nov 2011 10:19:00 -0000 [thread overview] Message-ID: <bug-51266-4@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2011-11-22 8:51 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-11-22 10:19 burnus at gcc dot gnu.org [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-51266-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).