diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-07 13:33:18 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-09-07 13:33:18 +0000 |
commit | d5fc2c848bc6255e898e1275c2eedbe5d9272af2 (patch) | |
tree | 7b6b6c1148c1ce29f42903a013d5d58a03c9d417 /gcc | |
parent | 1f3d58156deb5d1882d2bb14af15397311051e01 (diff) | |
download | gcc-d5fc2c848bc6255e898e1275c2eedbe5d9272af2.tar.gz |
2008-09-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/37203
* intrinsics/reshape_generic.c: Add checking on
out-of-bounds and duplicate values of order argument.
* m4/reshape.m4: Likewise.
* generated/reshape_c10.c: Regenerated.
* generated/reshape_c16.c: Regenerated.
* generated/reshape_c4.c: Regenerated.
* generated/reshape_c8.c: Regenerated.
* generated/reshape_i16.c: Regenerated.
* generated/reshape_i4.c: Regenerated.
* generated/reshape_i8.c: Regenerated.
* generated/reshape_r10.c: Regenerated.
* generated/reshape_r16.c: Regenerated.
* generated/reshape_r4.c: Regenerated.
* generated/reshape_r8.c: Regenerated.
2008-09-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/37203
* gfortran.d/reshape_order_1.f90: New test case.
* gfortran.d/reshape_order_2.f90: New test case.
* gfortran.d/reshape_order_3.f90: New test case.
* gfortran.d/reshape_order_4.f90: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/reshape_order_1.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/reshape_order_2.f90 | 16 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/reshape_order_3.f90 | 16 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/reshape_order_4.f90 | 16 |
5 files changed, 74 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b05e0c77c2f..18555753d09 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2008-09-07 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/37203 + * gfortran.d/reshape_order_1.f90: New test case. + * gfortran.d/reshape_order_2.f90: New test case. + * gfortran.d/reshape_order_3.f90: New test case. + * gfortran.d/reshape_order_4.f90: New test case. + 2008-09-07 Richard Guenther <rguenther@suse.de> Ira Rosen <irar@il.ibm.com> diff --git a/gcc/testsuite/gfortran.dg/reshape_order_1.f90 b/gcc/testsuite/gfortran.dg/reshape_order_1.f90 new file mode 100644 index 00000000000..3909bfde22b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reshape_order_1.f90 @@ -0,0 +1,18 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Duplicate value 2 in ORDER argument to RESHAPE intrinsic" } +program main + implicit none + integer(kind=1), dimension(6) :: source1 = (/ 1, 2, 3, 4, 5, 6 /) + integer, dimension(2) :: shape1 = (/ 2, 5/) + integer(kind=1), dimension(2) :: pad1 = (/ 0, 0/) + character(len=200) :: l1, l2 + integer :: i1, i2 + + l1 = "2 2" + read(unit=l1,fmt=*) i1, i2 + write (unit=l2,fmt=*) reshape(source1, shape1, pad1, (/i1, i2/)) ! Invalid +end program main +! { dg-output "Fortran runtime error: Duplicate value 2 in ORDER argument to RESHAPE intrinsic" } + + diff --git a/gcc/testsuite/gfortran.dg/reshape_order_2.f90 b/gcc/testsuite/gfortran.dg/reshape_order_2.f90 new file mode 100644 index 00000000000..3c8ef411370 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reshape_order_2.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Value 3 out of range in ORDER argument to RESHAPE intrinsic" } +program main + implicit none + integer(kind=1), dimension(6) :: source1 = (/ 1, 2, 3, 4, 5, 6 /) + integer, dimension(2) :: shape1 = (/ 2, 5/) + integer(kind=1), dimension(2) :: pad1 = (/ 0, 0/) + character(len=200) :: l1, l2 + integer :: i1, i2 + + l1 = "3 2" + read(unit=l1,fmt=*) i1, i2 + write (unit=l2,fmt=*) reshape(source1, shape1, pad1, (/i1, i2/)) ! Invalid +end program main +! { dg-output "Fortran runtime error: Value 3 out of range in ORDER argument to RESHAPE intrinsic" } diff --git a/gcc/testsuite/gfortran.dg/reshape_order_3.f90 b/gcc/testsuite/gfortran.dg/reshape_order_3.f90 new file mode 100644 index 00000000000..263488025d8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reshape_order_3.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Duplicate value 2 in ORDER argument to RESHAPE intrinsic" } +program main + implicit none + integer(kind=4), dimension(6) :: source1 = (/ 1, 2, 3, 4, 5, 6 /) + integer, dimension(2) :: shape1 = (/ 2, 5/) + integer(kind=4), dimension(2) :: pad1 = (/ 0, 0/) + character(len=200) :: l1, l2 + integer :: i1, i2 + + l1 = "2 2" + read(unit=l1,fmt=*) i1, i2 + write (unit=l2,fmt=*) reshape(source1, shape1, pad1, (/i1, i2/)) ! Invalid +end program main +! { dg-output "Fortran runtime error: Duplicate value 2 in ORDER argument to RESHAPE intrinsic" } diff --git a/gcc/testsuite/gfortran.dg/reshape_order_4.f90 b/gcc/testsuite/gfortran.dg/reshape_order_4.f90 new file mode 100644 index 00000000000..bd0536d844a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reshape_order_4.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Value 0 out of range in ORDER argument to RESHAPE intrinsic" } +program main + implicit none + integer(kind=4), dimension(6) :: source1 = (/ 1, 2, 3, 4, 5, 6 /) + integer, dimension(2) :: shape1 = (/ 2, 5/) + integer(kind=4), dimension(2) :: pad1 = (/ 0, 0/) + character(len=200) :: l1, l2 + integer :: i1, i2 + + l1 = "0 2" + read(unit=l1,fmt=*) i1, i2 + write (unit=l2,fmt=*) reshape(source1, shape1, pad1, (/i1, i2/)) ! Invalid +end program main +! { dg-output "Fortran runtime error: Value 0 out of range in ORDER argument to RESHAPE intrinsic" } |