This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [4.5/4.6 Regression] ICE: segmentation fault in mio_expr


Hi Paul,

> Bootstrapped and regtested on FC9/x86_64 and RHEL5.4/i686 - OK for
> trunk and a bit later 4.5?

in principle the patch is ok also from my side. However, a small remark ...


*************** resolve_fl_derived (gfc_symbol *sym)
*** 10784,10791 ****
  	      /* Copy char length.  */
  	      if (ifc->ts.type == BT_CHARACTER && ifc->ts.u.cl)
  		{
! 		  c->ts.u.cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
! 		  gfc_expr_replace_comp (c->ts.u.cl->length, c);
  		}
  	    }
  	  else if (c->ts.interface->name[0] != '\0')
--- 10786,10798 ----
  	      /* Copy char length.  */
  	      if (ifc->ts.type == BT_CHARACTER && ifc->ts.u.cl)
  		{
! 		  gfc_charlen *cl = c->ts.u.cl;
! 		  cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
! 		  gfc_expr_replace_comp (cl->length, c);
! 		  if (cl->length && !cl->resolved
! 		        && gfc_resolve_expr (cl->length) == FAILURE)
! 		    return FAILURE;
! 		  c->ts.u.cl = cl;
  		}
  	    }
  	  else if (c->ts.interface->name[0] != '\0')
*************** resolve_symbol (gfc_symbol *sym)
*** 11298,11303 ****
--- 11305,11313 ----
  	    {
  	      sym->ts.u.cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
  	      gfc_expr_replace_symbols (sym->ts.u.cl->length, sym);
+ 	      if (sym->ts.u.cl->length && !sym->ts.u.cl->resolved
+ 		    && gfc_resolve_expr (sym->ts.u.cl->length) == FAILURE)
+ 		return;
  	    }
  	}
        else if (sym->ts.interface->name[0] != '\0')


Why is the first hunk here so different from the second one? In
principle they could be identical, or let's say "analogous".
In particular, why do you change these two lines in the first hunk:

! 		  c->ts.u.cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
! 		  gfc_expr_replace_comp (c->ts.u.cl->length, c);

into

! 		  gfc_charlen *cl = c->ts.u.cl;
! 		  cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
! 		  gfc_expr_replace_comp (cl->length, c);

You can remove the first assignment to "cl" here, because in the next
line it is assigned again! And why do you introduce this "cl" at all?

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]