Re: [PATCH] Fortran - character type names in errors and warning - for review

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fortran - character type names in errors and warning - for review

Mark Eggleston

On 13/09/2019 07:54, Janne Blomqvist wrote:

> On Mon, Sep 9, 2019 at 4:52 PM Mark Eggleston
> <[hidden email]> wrote:
>> To work around these problems I added a new length field to gfc_typespec
>> to used to produce the name of a character type if the character length
>> structure is not present.
>> The addition of the length field is a bit of kludge any pointers
>> regarding a better solution will be appreciated.
> Thanks for the patch, I agree that we should print character type
> names better. However, I'm not really happy with this approach.
> Requiring us to keep track of the character length in two places
> sounds like a recipe for confusing bugs. I don't really have a good
> solution thought out for this, but I think this should be solved
> somehow before committing the patch.
I agree, it was an east fix to get it to work.  The issues with existing
location for character length should investigated further and a better
solution found.
>
> Secondly, character lengths can be longer than what fits into int. In
> gfortran.h you'll find
>
> typedef HOST_WIDE_INT gfc_charlen_t;
>
> and then you should use gfc_mpz_get_hwi() instead of mpz_get_si(). And
> for the *printf() format string you should use
> HOST_WIDE_INT_PRINT_DEC.
Acknowledged.
>
> Thanks,

Will submit an updated patch when fixed.

regards,

Mark

--
https://www.codethink.co.uk/privacy.html