Blame SOURCES/gcc48-rh1369183.patch

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