| Submitter | Tobias Burnus |
|---|---|
| Date | July 15, 2011, 9:27 p.m. |
| Message ID | <4E20B0BE.8060906@net-b.de> |
| Download | mbox | patch |
| Permalink | /patch/104892/ |
| State | New |
| Headers | show |
Comments
On Friday 15 July 2011 23:27:26 Tobias Burnus wrote: > ptr(10,1:) => target was accepted as for the check "(10,1:)" was seen as > equivalent to the valid "(10:, 1:)" - although the first dimension is > not a range but an element. (Side note: (10:, 1:) would be wrong as well > as one then needs to have the same rank.) > > Build and regtested on x86-64-linux. > OK for the trunk? > OK. (obvious actually) Mikael
Patch
2011-07-16 Tobias Burnus <burnus@net-b.de> PR fortran/49624 * expr.c (gfc_check_pointer_assign): Fix checking for invalid pointer bounds. 2011-07-16 Tobias Burnus <burnus@net-b.de> PR fortran/49624 * gfortran.dg/pointer_remapping_7.f90: New. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 6db0836..b8eb555 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); --- /dev/null 2011-07-15 07:29:58.667884802 +0200 +++ gcc/gcc/testsuite/gfortran.dg/pointer_remapping_7.f90 2011-07-15 23:22:29.000000000 +0200 @@ -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