This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/59411] Problem with TYPE(C_PTR) constant initialization
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 07 Dec 2013 16:29:34 +0000
- Subject: [Bug fortran/59411] Problem with TYPE(C_PTR) constant initialization
- Auto-submitted: auto-generated
- References: <bug-59411-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59411
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janus at gcc dot gnu.org
--- Comment #1 from janus at gcc dot gnu.org ---
(In reply to mrestelli from comment #0)
>
> type(c_ptr), parameter :: p2 = pp
> 1
> Error: non-constant initialization expression at (1)
>
> However, as far as I can tell, the code is correct (ifort accepts it).
well, just because ifort accepts it doesn't mean that it's valid.
In fact the corresponing case with actual Fortran pointers (i.e. pointer
initialization) is only allowed since F08, cf. PR45290. One should check the
Fortran standard for restrictions in the case of C_PTRs (which, strictly
speaking, are no actual pointers in the Fortran sense).