aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDaniel Franke <franke.daniel@gmail.com>2009-06-06 17:09:57 -0400
committerTobias Burnus <burnus@gcc.gnu.org>2009-06-06 23:09:57 +0200
commitf7cfd28c03650adee94bf775ef7b88156ac9e70e (patch)
tree6461a1a3ba9b0a3a1a595f3cf0693b8f544bb7a7 /gcc
parent7ba8c18c1eb8ab48d44a9735c9974ae09b8dd9d4 (diff)
downloadgcc-f7cfd28c03650adee94bf775ef7b88156ac9e70e.zip
gcc-f7cfd28c03650adee94bf775ef7b88156ac9e70e.tar.gz
gcc-f7cfd28c03650adee94bf775ef7b88156ac9e70e.tar.bz2
re PR fortran/37203 (Check ORDER= of RESHAPE)
2009-06-06 Daniel Franke <franke.daniel@gmail.com> PR fortran/37203 * simplify.c (gfc_simplify_reshape): Fixed reshaping of empty * arrays without padding. 2009-06-06 Daniel Franke <franke.daniel@gmail.com> PR fortran/37203 * reshape_zerosize_2.f90: New. From-SVN: r148238
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/simplify.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/reshape_zerosize_2.f9011
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b50949f..711367a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
2009-06-06 Daniel Franke <franke.daniel@gmail.com>
+ PR fortran/37203
+ * simplify.c (gfc_simplify_reshape): Fixed reshaping of empty arrays
+ without padding.
+
+2009-06-06 Daniel Franke <franke.daniel@gmail.com>
+
PR fortran/32890
* intrinsic.h (gfc_simplify_pack): New prototype.
* intrinsic.c (add_functions): Added
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 09cf297..737f299 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -3808,7 +3808,7 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp,
for (i = 0; i < rank; i++)
x[i] = 0;
- for (;;)
+ while (nsource > 0 || npad > 0)
{
/* Figure out which element to extract. */
mpz_set_ui (index, 0);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ca9f04f..6b87e85 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2009-06-06 Daniel Franke <franke.daniel@gmail.com>
+ PR fortran/37203
+ * reshape_zerosize_2.f90: New.
+
+2009-06-06 Daniel Franke <franke.daniel@gmail.com>
+
PR fortran/32890
* gfortran.dg/pack_assign_1.f90: New.
* gfortran.dg/pack_vector_1.f90: New.
diff --git a/gcc/testsuite/gfortran.dg/reshape_zerosize_2.f90 b/gcc/testsuite/gfortran.dg/reshape_zerosize_2.f90
new file mode 100644
index 0000000..cdbee42
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/reshape_zerosize_2.f90
@@ -0,0 +1,11 @@
+! { dg-do "run" }
+
+ ! Simplifier of RESHAPE was broken when reshaping an empty array.
+ INTEGER, PARAMETER :: empty(0,0) = RESHAPE(SHAPE(1), (/0, 0/))
+
+ ! same with surplus padding
+ INTEGER, PARAMETER :: empty_padding(0,0) = RESHAPE(SHAPE(1), (/0, 0/), PAD=( (/ 1, 2 /) ))
+
+ ! same with required padding
+ INTEGER, PARAMETER :: non_empty(2,2) = RESHAPE(SHAPE(1), (/2, 2/), PAD=( (/ 1, 2 /) ))
+END