[Bug fortran/50407] compiler confused by .operator.
sgk at troutmask dot apl.washington.edu
gcc-bugzilla@gcc.gnu.org
Fri Sep 16 15:02:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50407
--- Comment #13 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-09-16 14:42:31 UTC ---
On Fri, Sep 16, 2011 at 12:44:37PM +0000, sgk at troutmask dot
apl.washington.edu wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50407
>
> --- Comment #12 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-09-16 12:44:37 UTC ---
> On Fri, Sep 16, 2011 at 07:22:09AM +0000, zeccav at gmail dot com wrote:
> >
> > To me, it looks like the parser does not handle correctly the format
> > specification as a default-char-expression defined in fortran 95 R913
> >
>
> I posted a patch yesterday.
>
Updated patch to deal with
i = 42
print 1_'(i0)', i
end
Index: io.c
===================================================================
--- io.c (revision 178782)
+++ io.c (working copy)
@@ -2548,17 +2554,31 @@ match_dt_format (gfc_dt *dt)
if ((m = gfc_match_st_label (&label)) == MATCH_YES)
{
- if (dt->format_expr != NULL || dt->format_label != NULL)
+ char c;
+
+ /* Need to check if the format label is actually either an operand
+ to a user-defined operator or is a kind type parameter. That is,
+ print 2.ip.8 ! .ip. is a user-defined operator return CHARACTER.
+ print 1_'(I0)', i ! 1_'(I0)' is a default character string. */
+
+ gfc_gobble_whitespace ();
+ c = gfc_peek_ascii_char ();
+ if (c == '.' || c == '_')
+ gfc_current_locus = where;
+ else
{
- gfc_free_st_label (label);
- goto conflict;
- }
+ if (dt->format_expr != NULL || dt->format_label != NULL)
+ {
+ gfc_free_st_label (label);
+ goto conflict;
+ }
- if (gfc_reference_st_label (label, ST_LABEL_FORMAT) == FAILURE)
- return MATCH_ERROR;
+ if (gfc_reference_st_label (label, ST_LABEL_FORMAT) == FAILURE)
+ return MATCH_ERROR;
- dt->format_label = label;
- return MATCH_YES;
+ dt->format_label = label;
+ return MATCH_YES;
+ }
}
else if (m == MATCH_ERROR)
/* The label was zero or too large. Emit the correct diagnosis. */
More information about the Gcc-bugs
mailing list