------- Comment #3 from burnus at gcc dot gnu dot org  2008-12-15 10:48 -------
I think the patch in comment 2 is about the wrong gfc_error.
Additionally, the generic resolution seems to be correct in gfortran (-> PR
38506).

 * * *

In any case: I tried ifort, g95, NAG f95, gfortran, and sunf95 - of these only
"ifort" allows it (even with all checking enabled - thus presumably only by
accident and not on purpose).

Thus I wonder whether simply using the following "evil" workaround is better
than patching the compiler:

  f_ptr = C_LOC(X(1:1))

That works with gfortran, ifort, g95 and NAG f95. (It fails with sunf95, whose
C interoperability is a bit shaky in general.) As the string should be
contiguous in memory it should be the OK. Additionally, that is also what one
would do in C:

  char X[40];
  ptr = &X; // or equivalently:  ptr = &X[0];


-- 


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

Reply via email to