summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-16 09:45:02 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-16 09:45:02 +0000
commit67c4265a32f69b6f7cc341840511ec0da3421b5c (patch)
tree056c703d889a13a9e621a76fea45b83d61210155
parent572e346b26cdf4225a8644af9369492bf08ee6b5 (diff)
downloadppe42-gcc-67c4265a32f69b6f7cc341840511ec0da3421b5c.tar.gz
ppe42-gcc-67c4265a32f69b6f7cc341840511ec0da3421b5c.zip
2014-08-16 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk PR fortran/62142 * trans-expr.c (is_runtime_conformable): Add NULL pointer checks. 2014-08-15 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from trunk PR fortran/62142 * gfortran.dg/realloc_on_assign_24.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@214061 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-expr.c4
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_24.f9010
4 files changed, 24 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c791ac157c8..fcdc9164043 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-16 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/62142
+ * trans-expr.c (is_runtime_conformable): Add NULL pointer checks.
+
2014-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index dbfde1bdce3..824ab785bb2 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -7842,7 +7842,7 @@ is_runtime_conformable (gfc_expr *expr1, gfc_expr *expr2)
for (a = expr2->value.function.actual; a != NULL; a = a->next)
{
e1 = a->expr;
- if (e1->rank > 0 && !is_runtime_conformable (expr1, e1))
+ if (e1 && e1->rank > 0 && !is_runtime_conformable (expr1, e1))
return false;
}
return true;
@@ -7853,7 +7853,7 @@ is_runtime_conformable (gfc_expr *expr1, gfc_expr *expr2)
for (a = expr2->value.function.actual; a != NULL; a = a->next)
{
e1 = a->expr;
- if (e1->rank > 0 && !is_runtime_conformable (expr1, e1))
+ if (e1 && e1->rank > 0 && !is_runtime_conformable (expr1, e1))
return false;
}
return true;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index af24a428d9f..54354973443 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backport from trunk
+ PR fortran/62142
+ * gfortran.dg/realloc_on_assign_24.f90: New test.
+
2014-08-15 Tom de Vries <tom@codesourcery.com>
Backport from mainline:
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_24.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_24.f90
new file mode 100644
index 00000000000..6f88c2bf27c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_24.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR 62142 - this used to segfault
+! Original test case by Ondřej Čertík .
+program test_segfault
+ implicit none
+ real, allocatable :: X(:)
+ allocate (x(1))
+ x = 1.
+ X = floor(X)
+end program
OpenPOWER on IntegriCloud