Blame SOURCES/gcc48-rh1369183.patch

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