http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50269
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Last reconfirmed| |2013-04-02 Resolution|FIXED | Ever Confirmed|0 |1 --- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-02 07:52:26 UTC --- REOPEN (In reply to comment #5) > Is this going to be ported back to earlier releases? It's kind of a biggie for > me... Probably not - it is a rather large change - and, hence, it might cause regressions. (In reply to comment #6) > Are we sure? When running the code example given in comment #1, I get a > segfault. Yes, something seems to be still broken. > Moreover, the following subroutine won't compile when using the '-std=f2008' > flag: > real, intent(in), contiguous, target :: a(:) > b = C_LOC(a) > > The error message is: > test_contig.f90:9.12: > b = C_LOC(a) > 1 > Error: TS 29113: Noninteroperable array at (1) as argument to C_LOC: Only > explicit-size and assumed-size arrays are interoperable > > My understanding of the F2008 standard is that assumed-shape arrays with the > contiguous attribute are interoperable Well, Fortran 2008 has: "A Fortran variable that is a named array is interoperable if and only if its type and type parameters are interoperable, it is not a coarray, it is of explicit shape or assumed size, and if it is of type character its length is not ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assumed or declared by an expression that is not a constant expression." ("15.3.6 Interoperability of array variables") Thus, it is definitely not interoperable. But the real question is whether it is permitted for C_LOC. From "15.2.3.6 C_LOC(X)": "Argument. X shall have either the POINTER or TARGET attribute. It shall not be a coindexed object. It shall either be a variable with interoperable type and kind type parameters, or be a scalar, nonpolymorphic variable with no length type parameters. If it is allocatable, it shall be allocated. If it is a pointer, it shall be associated. If it is an array, it shall be contiguous and have nonzero size. It shall not be a zero-length string." I think the crucial part is: "with interoperable type and kind type parameter" - which is different to the other intrinsics, which require "an interoperable data entity". Thus, it seems to be permitted in C_LOC. Thanks for testing.