This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] Fix PR 24643
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, tobias dot schlueter at physik dot uni-muenchen dot de, toon at moene dot indiv dot nluug dot nl
- Date: Wed, 09 Nov 2005 22:43:51 +0100
- Subject: Re: [gfortran] Fix PR 24643
Tobi wrote:
PR 24643 is a case where we rejected vallid code because we wouldn't accept a
substring of a aymbol with FL_VARIABLE but BT_UNKNOWN, in other words
substrings of implicitly typed character variables wouldn't work if the
variable had been used before. This patch makes sure that we give them the
right type before looking for the substring specifier.
Bubblestrapped and tested, two new testcases attached. Ok?
- Tobi
2005-11-09 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/24643
* primary.c (match_varspec): Check for implicitly typed CHARACTER
variables before matching substrings.
Index: fortran/primary.c
===================================================================
--- fortran/primary.c (revision 106651)
+++ fortran/primary.c (working copy)
@@ -1634,6 +1634,15 @@ match_varspec (gfc_expr * primary, int e
}
check_substring:
+ if (primary->ts.type == BT_UNKNOWN)
+ {
+ if (gfc_get_default_type (sym, sym->ns)->type == BT_CHARACTER)
+ {
+ gfc_set_default_type (sym, 0, sym->ns);
+ primary->ts = sym->ts;
+ }
+ }
+
if (primary->ts.type == BT_CHARACTER)
{
switch (match_substring (primary->ts.cl, equiv_flag, &substring))
Yeah, not great (in the sense that I do not think that this is the
place where this decision should be), but It Just Works.
Now all I'm left with compiling the 1.2 million lines of HIRLAM is
non-standard code, that'll weed out tomorrow.
Thanks for looking into this !
Cheers,
--
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/