[gfortran,patch] Fix Fortran/18827

Paul Brook paul@codesourcery.com
Sun Jan 30 19:59:00 GMT 2005


On Wednesday 12 January 2005 05:26, Feng Wang wrote:
> and the original message:
> http://gcc.gnu.org/ml/fortran/2004-12/msg00136.html
>
>  --- Feng Wang <wf_cs@yahoo.com> 的正文:
>
> > Ping!
> >
> > Today I tested again on i686 with no regression and regenerated a new
> > patch attached here.

Are you sure you are testing the right thing? Do you have checking enabled?
I still see several testsuite failures. Minimal testcase is as follows:

  assign 42 to i
  42 continue
  end

Fails on all of i686, x86_64 and powerpc-linux. I tried both your original 
patch and the updated one you posted. Both apply cleanly.

> > >  --- Paul Brook <paul@codesourcery.com> 的正文:
> > >
> > > > Not ok. This causes many regressions on i686-linux. For example:
> > > >
> > > > FAIL: gfortran.dg/g77/20010519-1.f  -O  (test for excess errors)
> > > > Excess errors:
> > > > /home/paul/cases/gcc/gcc/testsuite/gfortran.dg/g77/20010519-1.f:711:
> > > > internal compiler error: in gfc_conv_label_variable, at
> > > > fortran/trans-stmt.c:89
> > > >
> > > > Lines 87-79 are as follows:
> > > >
> > > > gfc_conv_label_variable (gfc_se * se, gfc_expr * expr)
> > > > {
> > > >   gcc_assert (expr->symtree->n.sym->attr.assign != 1);

A few comments of the patch itself:

> *************** build_field (segment_info *h, tree union
> *** 242,247 ****
> --- 242,270 ----
>                               size_binop (PLUS_EXPR,
>                                           DECL_FIELD_OFFSET (field),
>                                           DECL_SIZE_UNIT (field)));
> +   /* If this field is assigned to a lable, we create another two variables
> +      to hold the address of taget label or the format string of format
> +      label.  */
> +   if (h->sym->attr.assign)
> +     {
> +       tree len;
> +       tree addr;
> +
> +       gfc_allocate_lang_decl (field);
> +       GFC_DECL_ASSIGN (field) = 1;

Do we ever use this flag anywhere?

> +       len = gfc_create_var_np (gfc_charlen_type_node,h->sym->name);
> +       addr = gfc_create_var_np (pvoid_type_node, h->sym->name);
> +       TREE_STATIC (len) = 1;
> +       TREE_STATIC (addr) = 1;
> +       DECL_INITIAL (len) = build_int_cst (NULL_TREE, -2);
> +       TREE_PUBLIC (len) = 1;
> +       TREE_PUBLIC (addr) = 1;

Why do you make these public symbols?

> + /* Converts a varible assigned a label.  */
> + void
> + gfc_conv_label_variable (gfc_se * se, gfc_expr * expr)

This isn't a fairly useless comment. It took me a while to figure out what 
this routine does, so I think it could do with documenting better. Maybe 
something like:
/* Given a variable expression which has been ASSIGNed to, find the decl 
containing the axiliary variables.  For variables in common blocks this may 
be a field_decl.  */

Paul



More information about the Gcc-patches mailing list