Regression with parameter_array_init_3.f90

Steve Kargl sgk@troutmask.apl.washington.edu
Sat Jan 12 17:55:00 GMT 2008


On Thu, Jan 10, 2008 at 08:06:01AM +0100, Paul Thomas wrote:
> Steve,
> >Sigh.  I spent too much time on this today :(, except those associated 
> >with endian-ness.  Nothing, nada, ne rien...
> >  
> I bootstrapped and regtested on x86_ia64/FC8, which normally catches all 
> the ailments that are going
> >The segfault is occurring in find_array_element() of expr.c.
> >This function is called 3 times.  The first 2 return because
> >e->expr_type in line 1023 is not constant.  The third trip into
> >this function I get the segfault.  AFAICT, something is
> >messed up with the ar structure.  Unfortunately, I can't
> >use gdb to trace into this function (it appears to be inlined).
> >If I try to set a break point on find_array_element, gdb tells
> >me that symbol does not exist!
> >
> >  
> I noticed that the backtrace that you posted is a bit odd - line numbers 
> and function calls are de-synched.  I am at a complete loss to explain 
> it.  Have you tried clearing your tree to bedrock and rebuilding?  Does 
> anybody else see it?
> 

The below allows parameter_array_init_3.f90 to compile on 
amd64-*-freebsd.  I have no idea why no one else sees this
regression, but my gdb sessions and the patch suggest that
ar->as->upper[i] isn't an EXPR_CONSTANT even though the
claims it is.  Note, there are no other patches in my tree.


Index: expr.c
===================================================================
--- expr.c      (revision 131471)
+++ expr.c      (working copy)
@@ -1046,8 +1046,12 @@ find_array_element (gfc_constructor *con
       mpz_add (offset, offset, delta);
 
       mpz_set_ui (tmp, 1);
-      mpz_add (tmp, tmp, ar->as->upper[i]->value.integer);
       mpz_sub (tmp, tmp, ar->as->lower[i]->value.integer);
+
+      if (!gfc_is_constant_expr (ar->as->upper[i]))
+       goto depart;
+
+      mpz_add (tmp, tmp, ar->as->upper[i]->value.integer);
       mpz_mul (span, span, tmp);
     }

-- 
Steve



More information about the Fortran mailing list