From 3d3e0f7dd08d70582d30aae016a90a585b96895d Mon Sep 17 00:00:00 2001 From: tkoenig Date: Tue, 1 May 2007 13:11:36 +0000 Subject: 2007-05-01 Thomas Koenig PR fortran/31732 * dependency.c (gfc_full_array_ref_p): If the reference is to a single element, check that the array has a single element and that the correct element is referenced. 2007-05-01 Thomas Koenig PR fortran/31732 * gfortran.dg/array_memset_2: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124326 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/dependency.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gcc/fortran/dependency.c') diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index b79f2229835..bdda6d871d3 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -1126,6 +1126,24 @@ gfc_full_array_ref_p (gfc_ref *ref) for (i = 0; i < ref->u.ar.dimen; i++) { + /* If we have a single element in the reference, we need to check + that the array has a single element and that we actually reference + the correct element. */ + if (ref->u.ar.dimen_type[i] == DIMEN_ELEMENT) + { + if (!ref->u.ar.as + || !ref->u.ar.as->lower[i] + || !ref->u.ar.as->upper[i] + || gfc_dep_compare_expr (ref->u.ar.as->lower[i], + ref->u.ar.as->upper[i]) + || !ref->u.ar.start[i] + || gfc_dep_compare_expr (ref->u.ar.start[i], + ref->u.ar.as->lower[i])) + return false; + else + continue; + } + /* Check the lower bound. */ if (ref->u.ar.start[i] && (!ref->u.ar.as -- cgit v1.2.1