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

Paul Thomas paulthomas2@wanadoo.fr
Wed May 25 21:04:00 GMT 2005


>> 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?

> The cleanest way would be to make new versions of the library
> functions in question, and have the front end use them. If we can
> agree on how to do implement this, I think I can cook up some m4
> for this.

That would be brilliant!  Paul Brook has proposed two solutions, with some 
preference for the second:

1) The existing intrinsic array functions be modified to deal with character 
arrays; eg.
void transpose (char[0] & data_out, int string_length_out, char[0] & 
data_in, int string_length_in) or
2) That wrappers are called that calculate the real element size and call a 
common work function.

With my patch for the correct dereferencing of characters and the provision 
of temporaries, where necessary, the convention in 1) is always respected. 
By kludging gfc_conv_function_call to suppress the second argument on the 
detection of sym->result->attr.proc == PROC_INTRINSIC, transpose, spread, 
eoshift and cshift all work correctly.  Thus, solutions 1) and 2) will work 
for sure and certain, thereby cleanly fixing PRs 18959, 19269 and 19271.

Paul T 




More information about the Fortran mailing list