[Patch/gfortran] PR16939, 17192,17193,17202,18689,18890 &2129 7 - a wrinkle

THOMAS Paul Richard 169137 prthomas@drfccad.cea.fr
Wed May 25 12:17:00 GMT 2005


Following the submission of the above patch to the list, I recompiled all
the character related PR testcases.  To my surprise, a couple of others,
outside the list above, now compile and give code that can be looked at,
even if they crash at runtime.  In particular, PR19271:

program main
  character(len=1), dimension(2,2) :: a,b
  a = reshape((/'a', 'b', 'c', 'd'/), shape(a))
  b = transpose(a)           ! This works
  a = transpose(a)           ! This bombs
  print *, a, b
end program main 

correctly resolves the dependency in the second case by copying to a
temporary.

The crash at runtime, comes about because function calls returning a
character provide the string length as the second argument.  Enforcing this
fixed the problems with passing character arrays.

However, intrinsic array functions like transpose are not expecting any such
thing.  How should I deal with this?  Detect the intrinsic cases in
gfc_conv_function call?  Change the resolution of such calls?

Paul T



More information about the Fortran mailing list