diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-07-07 19:43:33 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-07-07 19:43:33 +0000 |
commit | 9ad13e91692eec408fb030c65f947a4065afc7df (patch) | |
tree | 5e85887ee69ad7ab0f40465ea4c2fc12aeb7c474 /gcc | |
parent | 8432ea85051b1ea9502b73c009856890189609a6 (diff) | |
download | gcc-9ad13e91692eec408fb030c65f947a4065afc7df.zip gcc-9ad13e91692eec408fb030c65f947a4065afc7df.tar.gz gcc-9ad13e91692eec408fb030c65f947a4065afc7df.tar.bz2 |
re PR fortran/36341 (MATMUL: Bounds check missing)
2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36341
PR fortran/34670
* m4/matmul.m4: Add bounds checking.
* m4/matmull.m4: Likewise.
* generated/matmul_c10.c: Regenerated.
* generated/matmul_c16.c: Regenerated.
* generated/matmul_c4.c: Regenerated.
* generated/matmul_c8.c: Regenerated.
* generated/matmul_i1.c: Regenerated.
* generated/matmul_i16.c: Regenerated.
* generated/matmul_i2.c: Regenerated.
* generated/matmul_i4.c: Regenerated.
* generated/matmul_i8.c: Regenerated.
* generated/matmul_l16.c: Regenerated.
* generated/matmul_l4.c: Regenerated.
* generated/matmul_l8.c: Regenerated.
* generated/matmul_r10.c: Regenerated.
* generated/matmul_r16.c: Regenerated.
* generated/matmul_r4.c: Regenerated.
* generated/matmul_r8.c: Regenerated.
2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36341
PR fortran/34670
* gfortran.dg/matmul_bounds_2.f90: New test.
* gfortran.dg/matmul_bounds_3.f90: New test.
* gfortran.dg/matmul_bounds_4.f90: New test.
* gfortran.dg/matmul_bounds_5.f90: New test.
From-SVN: r137594
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 | 16 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 | 16 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 | 16 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 | 16 |
5 files changed, 73 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b212e44..143f75d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/36341 + PR fortran/34670 + * gfortran.dg/matmul_bounds_2.f90: New test. + * gfortran.dg/matmul_bounds_3.f90: New test. + * gfortran.dg/matmul_bounds_4.f90: New test. + * gfortran.dg/matmul_bounds_5.f90: New test. + 2008-07-07 Richard Guenther <rguenther@suse.de> * gcc.dg/torture/pta-ptrarith-1.c: New testcase. diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 new file mode 100644 index 0000000..429b28c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 2: is 2, should be 3" } +program main + real, dimension(3,2) :: a + real, dimension(2,3) :: b + real, dimension(:,:), allocatable :: ret + allocate (ret(2,2)) + a = 1.0 + b = 2.3 + ret = matmul(b,a) ! This is OK + deallocate(ret) + allocate(ret(3,2)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 2: is 2, should be 3" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 new file mode 100644 index 0000000..c5830de --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 1: is 2, should be 3" } +program main + real, dimension(3,2) :: a + real, dimension(2,3) :: b + real, dimension(:,:), allocatable :: ret + allocate (ret(3,3)) + a = 1.0 + b = 2.3 + ret = matmul(a,b) ! This is OK + deallocate(ret) + allocate(ret(2,3)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 1: is 2, should be 3" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 new file mode 100644 index 0000000..a61bacc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } +program main + real, dimension(3) :: a + real, dimension(3,2) :: b + real, dimension(:), allocatable :: ret + allocate (ret(2)) + a = 1.0 + b = 2.3 + ret = matmul(a,b) ! This is OK + deallocate(ret) + allocate(ret(3)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 new file mode 100644 index 0000000..4b20098 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } +program main + real, dimension(2,3) :: a + real, dimension(3) :: b + real, dimension(:), allocatable :: ret + allocate (ret(2)) + a = 1.0 + b = 2.3 + ret = matmul(a,b) ! This is OK + deallocate(ret) + allocate(ret(3)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } |