Commit 4f81c2a3 by Steven G. Kargl

re PR fortran/91471 (f951: internal compiler error: gfc_variable_attr(): Bad array reference)

2019-08-17  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/91471
	* primary.c (gfc_variable_attr): Remove a gfc_internal_error(),
	which cannot be reached by conforming Fortran code, but seems to
	be reachable from nonconforming Fortran code.  Treat the AR_UNKNOWN
	case as a no-op.

2019-08-17  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/91471
	* gfortran.dg/pr91471.f90: New test.

From-SVN: r274603
parent 1e67491a
2019-08-17 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91471
* primary.c (gfc_variable_attr): Remove a gfc_internal_error(),
which cannot be reached by conforming Fortran code, but seems to
be reachable from nonconforming Fortran code. Treat the AR_UNKNOWN
case as a no-op.
2019-08-17 Janne Blomqvist <jb@gcc.gnu.org> 2019-08-17 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/68401 PR fortran/68401
......
...@@ -2597,12 +2597,10 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts) ...@@ -2597,12 +2597,10 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
break; break;
case AR_UNKNOWN: case AR_UNKNOWN:
/* If any of start, end or stride is not integer, there will /* For standard conforming code, AR_UNKNOWN should not happen.
already have been an error issued. */ For nonconforming code, gfortran can end up here. Treat it
int errors; as a no-op. */
gfc_get_errors (NULL, &errors); break;
if (errors == 0)
gfc_internal_error ("gfc_variable_attr(): Bad array reference");
} }
break; break;
......
2019-08-17 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91471
* gfortran.dg/pr91471.f90: New test.
2019-08-16 Marek Polacek <polacek@redhat.com> 2019-08-16 Marek Polacek <polacek@redhat.com>
PR c++/85827 PR c++/85827
......
! { dg-do compile }
! PR fortran/91471
! Code contributed by Sameeran Joshi <SameeranJayant dot Joshi at amd dot com>
!
! This invalid code (x(1) is referenced, but never set) caused an ICE due
! to hitting a gfc_internal_error() in primary.c (gfc_variable_attr). The
! fix is to remove that gfc_internal_error().
!
program dynamic
implicit none
integer, dimension(:), allocatable :: x
allocate(x(1))
stop x(1)
end program dynamic
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment