------- Comment #3 from pault at gcc dot gnu dot org  2007-03-15 20:36 -------
(In reply to comment #2)
(In reply to comment #1)

> The program works as expected. n.sym->name is ivec. I don't understand why 
> ivec
> is FL_PARAMETER and not FL_VARIABLE.

It is not correct to have the line gcc_assert (begin->expr_type == EXPR_ARRAY).
This section was somebody else's (no names!) contribution to this function:)

This expression is not simplifiable and should return on finding that the
vector index is a variabe.  This works correctly:


Index: gcc/fortran/expr.c
===================================================================
*** gcc/fortran/expr.c  (revision 122847)
--- gcc/fortran/expr.c  (working copy)
*************** find_array_section (gfc_expr *expr, gfc_
*** 1062,1069 ****

        if (ref->u.ar.dimen_type[d] == DIMEN_VECTOR)  /* Vector subscript.  */
        {
!         gcc_assert (begin);
!         gcc_assert (begin->expr_type == EXPR_ARRAY);
          gcc_assert (begin->rank == 1);
          gcc_assert (begin->shape);

--- 1062,1075 ----

        if (ref->u.ar.dimen_type[d] == DIMEN_VECTOR)  /* Vector subscript.  */
        {
!         gcc_assert (begin);
!
!         if  (begin->expr_type == EXPR_ARRAY);
!           {
!             t = FAILURE;
!             goto cleanup;
!           }
!
          gcc_assert (begin->rank == 1);
          gcc_assert (begin->shape);

Paul


-- 


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

Reply via email to