[Bug fortran/32732] [Bind C] Character scalars are passed as arrays

Christopher D. Rickett crickett@lanl.gov
Mon Aug 6 20:51:00 GMT 2007



On Mon, 6 Aug 2007, Steve Kargl wrote:

> On Mon, Aug 06, 2007 at 10:22:44AM -0600, Christopher D. Rickett wrote:
>> On Sat, 4 Aug 2007, Steve Kargl wrote:
>>>
>>> I'm testing and reviewing your patch now.  I have a few
>>> questions:
>>>
>>>> +void
>>>> +gfc_conv_scalar_char_value (gfc_symbol *sym, gfc_se *se, gfc_expr **expr)
>>>> +{
>>>> +  gfc_expr *tmp_expr;
>>>> +
>>>> +      else if (se != NULL && (*expr)->expr_type == EXPR_VARIABLE)
>>>> +        {
>>>> +	  if ((*expr)->ref == NULL)
>>>> +	    {
>>>> +	      tmp_expr = *expr;
>>>
>>> This tmp_expr appears to be extraneous.  I've removed it in my
>>> local copy.  Is this correct?
>>
>> yes, you should be able to remove it, and simply change the place where it
>> is used for EXPR_CONSTANT to (*expr).
>>
>
> I made that change and regression tested it without any failures.
> I also a type conversion to the EXPR_CONSTANT that forces the
> conversion to a gfc_c_int_kind; otherwise, there may be problems
> with -fdefault-integer-8.  Yes, I know that -fdefault-integer-8
> may have other problems because the mapping between types may
> get screwed up.
>
> If you concur with the attached diff, I'll commit it shortly.
>

the patch looks good.  it may be useful to put a comment on the call 
to gfc_convert_type () to say what the '2' means.

thanks.
Chris



More information about the Fortran mailing list