Commit 35ca2d4e by Thomas Koenig

re PR fortran/90563 (Out of bounds error when compiling with -Wextra)

2013-08-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/90563
	* frontend-passes.c (insert_index): Suppress errors while
	simplifying the resulting expression.

2013-08-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/90563
	* gfortran.dg/do_subsript_5.f90: New test.

From-SVN: r274394
parent eabd9d91
2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/90563
* frontend-passes.c (insert_index): Suppress errors while
simplifying the resulting expression.
2019-08-13 Steven G. Kargl <kargl@gcc.gnu.org> 2019-08-13 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/89647 PR fortran/89647
......
...@@ -2518,7 +2518,12 @@ insert_index (gfc_expr *e, gfc_symbol *sym, mpz_t val, mpz_t ret) ...@@ -2518,7 +2518,12 @@ insert_index (gfc_expr *e, gfc_symbol *sym, mpz_t val, mpz_t ret)
data.sym = sym; data.sym = sym;
mpz_init_set (data.val, val); mpz_init_set (data.val, val);
gfc_expr_walker (&n, callback_insert_index, (void *) &data); gfc_expr_walker (&n, callback_insert_index, (void *) &data);
/* Suppress errors here - we could get errors here such as an
out of bounds access for arrays, see PR 90563. */
gfc_push_suppress_errors ();
gfc_simplify_expr (n, 0); gfc_simplify_expr (n, 0);
gfc_pop_suppress_errors ();
if (n->expr_type == EXPR_CONSTANT) if (n->expr_type == EXPR_CONSTANT)
{ {
......
2013-08-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/90563
* gfortran.dg/do_subsript_5.f90: New test.
2019-08-13 Steven G. Kargl <kargl@gcc.gnu.org> 2019-08-13 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/89647 PR fortran/89647
......
! { dg-do compile }
! PR 90563 - this used to be rejected, wrongly
! Original test case by Tobias Neumann
program test
implicit none
integer, parameter :: swap(4) = [2,1,3,4]
real :: p(20)
integer :: j
p = 0.0
do j=1,6
if (j<5) then
p(j) = p(swap(j))
endif
enddo
end program
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