This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran] Fix PR 62142


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]