http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48889

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-11 
08:49:38 UTC ---
Some more debugging: While e->symtree == NULL, the symbols seems to be properly
resolved as e->value.function contains:

(gdb) p e->value.function->name
$11 = 0x2aaaaac273f0 "sparsity_size"
(gdb) p e->value.function->esym->name
$13 = 0x2aaaaac273f0 "sparsity_size"

And that's the proper specific function.


I was actually wondering whether always either isym or esym exists; however, as
gfortran.dg/graphite/id-2.f90 shows, the case that only e->symtree->n.sym is
set also occurs. Draft patch:

--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -893,6 +893,9 @@ gfc_is_constant_expr (gfc_expr *e)
     case EXPR_FUNCTION:
     case EXPR_PPC:
     case EXPR_COMPCALL:
+      gcc_assert (e->symtree || e->value.function.esym
+                 || e->value.function.isym);
+
       /* Call to intrinsic with at least one argument.  */
       if (e->value.function.isym && e->value.function.actual)
        {
@@ -901,13 +904,14 @@ gfc_is_constant_expr (gfc_expr *e)
              return 0;
        }

-      /* Make sure we have a symbol.  */
-      gcc_assert (e->symtree);
-
-      sym = e->symtree->n.sym;
-
       /* Specification functions are constant.  */
       /* F95, 7.1.6.2; F2003, 7.1.7  */
+      sym = NULL;
+      if (e->symtree)
+       sym = e->symtree->n.sym;
+      if (e->value.function.esym)
+       sym = e->value.function.esym;
+
       if (sym
          && sym->attr.function
          && sym->attr.pure

Reply via email to