[Bug fortran/68283] [5/6 Regression] ice: gfc_variable_attr(): Bad array reference

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 11 17:53:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68283

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to Manuel López-Ibáñez from comment #4)
>
> Does the ICE happens while printing an error? If not, something must be
> checking for buffered errors and changing behavior depending on that. The
> new code might be clearing the buffered errors flag (or not buffering them
> at all) too early.

No.  It happens after error messages have been issued.
The ICE goes away with

laptop-kargl:kargl[219] svn diff primary.c 
Index: primary.c
===================================================================
--- primary.c   (revision 229970)
+++ primary.c   (working copy)
@@ -2268,8 +2268,6 @@ gfc_variable_attr (gfc_expr *expr, gfc_t
                    && errors > 0)
                  break;
              }
-           if (n == ref->u.ar.as->rank)
-             gfc_internal_error ("gfc_variable_attr(): Bad array reference");
          }

        break;

There are a number of questionable gfc_internal_error()'s within gfortran.
I suspect some come from the idea "Correctly written Fortran code cannot
possibly reach this point, so there must be some internal error to get
here."  The original code should have simply returned because clearly
"Poorly written invalid code can reach this point, and an internal 
error is not appropriate.  So, let gfortran exit gracefully".


More information about the Gcc-bugs mailing list