Blame SOURCES/gcc48-rh1369183.patch

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