diff options
author | Harald Anlauf <anlauf@gmx.de> | 2017-07-06 19:49:33 +0000 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2017-07-06 21:49:33 +0200 |
commit | 2c6e2eb1b10bb921b739c8733721cc8a0274dccd (patch) | |
tree | 58a20d5f3705f538114c4d6a3c3ea58a6ae5bad8 | |
parent | 9ddfe5f4202736b44f464ffabff0c3fb3f4b1d8b (diff) | |
download | gcc-2c6e2eb1b10bb921b739c8733721cc8a0274dccd.zip gcc-2c6e2eb1b10bb921b739c8733721cc8a0274dccd.tar.gz gcc-2c6e2eb1b10bb921b739c8733721cc8a0274dccd.tar.bz2 |
re PR fortran/70071 (ICE on wrong usage of a subscript triplet)
2017-07-06 Harald Anlauf <anlauf@gmx.de>
PR fortran/70071
* array.c (gfc_ref_dimen_size): Handle bad subscript triplets.
2017-07-06 Harald Anlauf <anlauf@gmx.de>
PR fortran/70071
* gfortran.dg/coarray_44.f90: New testcase.
From-SVN: r250039
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/array.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/coarray_44.f90 | 12 |
4 files changed, 29 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 692b8ff..dc89407 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2017-07-06 Harald Anlauf <anlauf@gmx.de> + + PR fortran/70071 + * array.c (gfc_ref_dimen_size): Handle bad subscript triplets. + 2017-07-03 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79866 diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 30656c1..46642bb 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -2203,9 +2203,15 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result, mpz_t *end) bool t; gfc_expr *stride_expr = NULL; - if (dimen < 0 || ar == NULL || dimen > ar->dimen - 1) + if (dimen < 0 || ar == NULL) gfc_internal_error ("gfc_ref_dimen_size(): Bad dimension"); + if (dimen > ar->dimen - 1) + { + gfc_error ("Bad array dimension at %L", &ar->c_where[dimen]); + return false; + } + switch (ar->dimen_type[dimen]) { case DIMEN_ELEMENT: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac18d1a..f0f068b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-06 Harald Anlauf <anlauf@gmx.de> + + PR fortran/70071 + * gfortran.dg/coarray_44.f90: New testcase. + 2017-07-06 Maxim Ostapenko <m.ostapenko@samsung.com> * c-c++-common/asan/kasan-alloca-1.c: New test. diff --git a/gcc/testsuite/gfortran.dg/coarray_44.f90 b/gcc/testsuite/gfortran.dg/coarray_44.f90 new file mode 100644 index 0000000..15fb8c7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_44.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +! PR fortran/70071 +! Based on testcases by Gerhard Steinmetz + +program pr70071 + implicit none + integer, allocatable :: z(:)[:,:] + allocate (z(2)[1::2,*]) ! { dg-error "Bad array dimension" } + allocate (z(1::2)[2,*]) ! { dg-error "Bad array specification in ALLOCATE" } +end program pr70071 |