[Bug fortran/50269] Wrongly rejects element of assumed-shape array in C_LOC

townsend at astro dot wisc.edu gcc-bugzilla@gcc.gnu.org
Mon Apr 1 22:24:00 GMT 2013


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

--- Comment #6 from Rich Townsend <townsend at astro dot wisc.edu> 2013-04-01 22:24:35 UTC ---
(In reply to comment #4)
> FIXED on the 4.9 trunk.

Are we sure? When running the code example given in comment #1, I get a
segfault.

Moreover, the following subroutine won't compile when using the '-std=f2008'
flag:

subroutine test_contig (a)
  use ISO_C_BINDING
  real, intent(in), contiguous, target :: a(:)
  type(C_PTR) :: b
  b = C_LOC(a)
end subroutine test_contig

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 -- hence, I'm not sure this error
message is correct. If I change the std flag to f2008ts, then the routine
compiles OK; but the TS extension shouldn't be required here.

gfortran -v:

Using built-in specs.
COLLECT_GCC=/Applications/madsdk/bin/gfortran.exec
COLLECT_LTO_WRAPPER=/Applications/madsdk/libexec/gcc/x86_64-apple-darwin11.4.2/4.9.0/lto-wrapper
Target: x86_64-apple-darwin11.4.2
Configured with: ./configure CC='gcc -D_FORTIFY_SOURCE=0'
--build=x86_64-apple-darwin11.4.2 --prefix=/Applications/madsdk
--with-gmp=/Applications/madsdk --with-mpfr=/Applications/madsdk
--with-mpc=/Applications/madsdk --enable-languages=c,c++,fortran
--disable-multilib
Thread model: posix
gcc version 4.9.0 20130401 (experimental) (GCC)



More information about the Gcc-bugs mailing list