From 73cd74f8e7a9f2c7b6fe38c0b76179f89c363f37 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sun, 17 Jul 2011 16:52:46 +0200 Subject: [PATCH] re PR fortran/49624 (ICE with pointer-bound remapping) 2011-07-17 Tobias Burnus PR fortran/49624 * expr.c (gfc_check_pointer_assign): Fix checking for invalid pointer bounds. 2011-07-17 Tobias Burnus PR fortran/49624 * gfortran.dg/pointer_remapping_7.f90: New. From-SVN: r176370 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/expr.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pointer_remapping_7.f90 | 8 ++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pointer_remapping_7.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4321c2fb061..19339a6a13f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-07-17 Tobias Burnus + + PR fortran/49624 + * expr.c (gfc_check_pointer_assign): Fix checking for invalid + pointer bounds. + 2011-07-16 Tobias Burnus * expr.c (gfc_ref_this_image): New function. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 3bf1e94bda8..b8eb5552a40 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3286,7 +3286,8 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue) upper bounds are present, we may do rank remapping. */ for (dim = 0; dim < ref->u.ar.dimen; ++dim) { - if (!ref->u.ar.start[dim]) + if (!ref->u.ar.start[dim] + || ref->u.ar.dimen_type[dim] != DIMEN_RANGE) { gfc_error ("Lower bound has to be present at %L", &lvalue->where); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ffecc486dc7..6abed53c2aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-07-17 Tobias Burnus + + PR fortran/49624 + * gfortran.dg/pointer_remapping_7.f90: New. + 2011-07-16 Jason Merrill * lib/prune.exp (prune_gcc_output): Prune "In substitution" too. diff --git a/gcc/testsuite/gfortran.dg/pointer_remapping_7.f90 b/gcc/testsuite/gfortran.dg/pointer_remapping_7.f90 new file mode 100644 index 00000000000..39126bac405 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_remapping_7.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! +! PR fortran/49624 +! + integer, target :: A(100) + integer,pointer :: P(:,:) + p(10,1:) => A ! { dg-error "Lower bound has to be present" } + end -- 2.30.2