Blame SOURCES/gcc48-rh1369183.patch

25c7f1
2017-03-07  Jakub Jelinek  <jakub@redhat.com>
25c7f1
25c7f1
	Partial backport
25c7f1
	2016-05-07  Fritz Reese  <fritzoreese@gmail.com>
25c7f1
25c7f1
	PR fortran/56226
25c7f1
	* interface.c (gfc_compare_derived_types): Don't ICE if the
25c7f1
	derived type or both types have no components.
25c7f1
25c7f1
	* gfortran.dg/rh1369183.f90: New test.
25c7f1
25c7f1
--- gcc/fortran/interface.c.jj	2015-06-18 16:32:45.000000000 +0200
25c7f1
+++ gcc/fortran/interface.c	2017-03-07 18:35:38.982302826 +0100
25c7f1
@@ -418,6 +418,13 @@ gfc_compare_derived_types (gfc_symbol *d
25c7f1
       && !(derived1->attr.is_bind_c && derived2->attr.is_bind_c))
25c7f1
     return 0;
25c7f1
 
25c7f1
+  /* Protect against null components.  */
25c7f1
+  if (derived1->attr.zero_comp != derived2->attr.zero_comp)
25c7f1
+    return 0;
25c7f1
+
25c7f1
+  if (derived1->attr.zero_comp)
25c7f1
+    return 1;
25c7f1
+
25c7f1
   dt1 = derived1->components;
25c7f1
   dt2 = derived2->components;
25c7f1
 
25c7f1
--- gcc/testsuite/gfortran.dg/rh1369183.f90.jj	2017-03-07 18:37:39.574775432 +0100
25c7f1
+++ gcc/testsuite/gfortran.dg/rh1369183.f90	2017-03-07 18:38:38.423993194 +0100
25c7f1
@@ -0,0 +1,22 @@
25c7f1
+! { dg-do compile }
25c7f1
+
25c7f1
+module mod1369183
25c7f1
+  implicit none
25c7f1
+  contains
25c7f1
+  subroutine sub(test)
25c7f1
+    type test_t
25c7f1
+      sequence
25c7f1
+      integer(4) type
25c7f1
+    end type test_t
25c7f1
+    type(test_t),intent(inout) :: test
25c7f1
+  end subroutine sub
25c7f1
+end module mod1369183
25c7f1
+subroutine rh1369183
25c7f1
+  use mod1369183
25c7f1
+  implicit none 
25c7f1
+  type test_t
25c7f1
+  sequence
25c7f1
+  end type test_t
25c7f1
+  type(test_t) :: tst
25c7f1
+  call sub(tst)                ! { dg-error "Type mismatch in argument" }
25c7f1
+end subroutine rh1369183