OSDN Git Service

2014-03-09 Janus Weil <janus@gcc.gnu.org>
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 9 Mar 2014 18:44:42 +0000 (18:44 +0000)
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 9 Mar 2014 18:44:42 +0000 (18:44 +0000)
Backport from 4.8
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-09  Janus Weil  <janus@gcc.gnu.org>

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

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@208443 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 2763fb2..928e039 100644 (file)
@@ -1,3 +1,12 @@
+2014-03-09  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from 4.8
+       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-02  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/60341
index 515528d..c9fd122 100644 (file)
@@ -5518,7 +5518,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;
        }
@@ -5526,7 +5526,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 b2e4e61..0058553 100644 (file)
@@ -1,3 +1,11 @@
+2014-03-09  Janus Weil  <janus@gcc.gnu.org>
+
+       Backport from 4.8
+       2014-03-08  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/60450
+       * gfortran.dg/shape_8.f90: New.
+
 2014-03-02  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/60341
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