This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran] Fix PR 62142
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 15 Aug 2014 23:20:30 +0200
- Subject: [patch, fortran] Fix PR 62142
- Authentication-results: sourceware.org; auth=none
Hello world,
I committed the attached patch as obvious to trunk after regression
testing. It fixes the regression in the test case by adding
a NULL check to a pointer. Will commit to 4.9 soon.
Regards
Thomas
2014-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/62142
* trans-expr.c (is_runtime_conformable): Add NULL pointer check.
2014-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/62142
* gfortran.dg/realloc_on_assign_24.f90: New test.
Index: trans-expr.c
===================================================================
--- trans-expr.c (Revision 213778)
+++ trans-expr.c (Arbeitskopie)
@@ -7895,7 +7895,7 @@ is_runtime_conformable (gfc_expr *expr1, gfc_expr
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;
@@ -7906,7 +7906,7 @@ is_runtime_conformable (gfc_expr *expr1, gfc_expr
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;
! { 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