]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/60450 (ICE with SHAPE intrinsic)
authorJanus Weil <janus@gcc.gnu.org>
Sat, 8 Mar 2014 13:59:00 +0000 (14:59 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Sat, 8 Mar 2014 13:59:00 +0000 (14:59 +0100)
2014-03-08  Janus Weil  <janus@gcc.gnu.org>

PR fortran/60450
* simplify.c (gfc_simplify_shape): Only clear shape if it was really
created successfully.

2014-03-08  Janus Weil  <janus@gcc.gnu.org>

PR fortran/60450
* gfortran.dg/shape_8.f90: New.

From-SVN: r208430

gcc/fortran/ChangeLog
gcc/fortran/simplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/shape_8.f90 [new file with mode: 0644]

index 5509835e4ee4ecfd685c32a0b08f186d15a0705b..db89c5ff9b4f2684f79338d3d7836e4dd5dd4e4d 100644 (file)
@@ -1,3 +1,9 @@
+2014-03-08  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/60450
+       * simplify.c (gfc_simplify_shape): Only clear shape if it was really
+       created successfully.
+
 2014-03-06  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
index b03096b651b1db6d0cefb605c0dd4c066e5840f3..7c21f226d99de8e68d5695b9d214a27b5048c337 100644 (file)
@@ -5528,7 +5528,7 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *kind)
       if (e == &gfc_bad_expr || range_check (e, "SHAPE") == &gfc_bad_expr)
        {
          gfc_free_expr (result);
-         if (t)
+         if (t == SUCCESS)
            gfc_clear_shape (shape, source->rank);
          return &gfc_bad_expr;
        }
@@ -5536,7 +5536,7 @@ gfc_simplify_shape (gfc_expr *source, gfc_expr *kind)
       gfc_constructor_append_expr (&result->value.constructor, e, NULL);
     }
 
-  if (t)
+  if (t == SUCCESS)
     gfc_clear_shape (shape, source->rank);
 
   return result;
index bf107a89615602e1c541b0410dc55d99c9505420..f5f0edfca6377792a3669a848bde7b44b6755cd2 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-08  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/60450
+       * gfortran.dg/shape_8.f90: New.
+
 2014-03-06  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/shape_8.f90 b/gcc/testsuite/gfortran.dg/shape_8.f90
new file mode 100644 (file)
index 0000000..edeb5fd
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! PR 60450: [4.7/4.8 Regression] ICE with SHAPE intrinsic
+!
+! Contributed by Dave Allured <dave.allured@noaa.gov>
+
+  real, allocatable :: x(:,:)
+  allocate (x(3,2), source=99.)
+  print *, shape (x / 10.0)
+end