[Fortran, Patch] PR31188 - Allow array dummy as range for constant arrays

Tobias Burnus burnus@net-b.de
Thu Mar 15 21:11:00 GMT 2007

:ADDPATCH fortran:

Using "letters(ivec)" where ivec is an array and dummy argument and
letters is a constant array.

Assume for a second that ivec is not an array.
When simplify_const_ref is called, one ends up in the branch:
            case AR_ELEMENT:
              if (find_array_element (p->value.constructor, &p->ref->u.ar,
                                      &cons) == FAILURE)
                return FAILURE;
              if (!cons)
                return SUCCESS;
where find_array_element contains:
      if (e->expr_type != EXPR_CONSTANT)
          cons = NULL;
          goto depart;

Back to our case: ivec is an array. Now one ends up in:
            case AR_SECTION:
              if (find_array_section (p, p->ref) == FAILURE)
                return FAILURE;
where find_array_section contains:
          gcc_assert (begin->expr_type != EXPR_ARRAY)
which causes the ICE.

Solution: Well, I simply did the analogous thing.

Build and check-gfortran'ed on x86_64-unknown-linux-gnu.
Ok for the trunk - and when the branch is open - for 4.2?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: array_dummy.diff
Type: text/x-patch
Size: 3318 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070315/8332643d/attachment.bin>

More information about the Gcc-patches mailing list