This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fortran - character type names in errors and warning - for review
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Mark Eggleston <mark dot eggleston at codethink dot co dot uk>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, fortran <fortran at gcc dot gnu dot org>
- Date: Fri, 13 Sep 2019 09:54:36 +0300
- Subject: Re: [PATCH] Fortran - character type names in errors and warning - for review
- References: <ffb60571-24de-5270-1b35-91dad0e4429e@codethink.co.uk>
On Mon, Sep 9, 2019 at 4:52 PM Mark Eggleston
<mark.eggleston@codethink.co.uk> 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.
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.
Thanks,
--
Janne Blomqvist