re PR fortran/71895 (ICE in gfc_compare_derived_types, at fortran/interface.c:520)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 24 Oct 2016 19:21:42 +0000 (19:21 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 24 Oct 2016 19:21:42 +0000 (19:21 +0000)
2016-10-24  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/71895
* interface.c (gfc_compare_derived_types):  Convert gcc_assert()
to a gfc_internal_error() to prevent an ICE.

2016-10-24  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/71895
* gfortran.dg/pr71895.f90: New test.

From-SVN: r241493

gcc/fortran/ChangeLog
gcc/fortran/interface.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr71895.f90 [new file with mode: 0644]

index 5c47028555b8e8abe1b63ec08c56eaeccf8b0d07..37578811fc78e745e0b97ba2b1f5e0f68bf8ccce 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/71895
+       * interface.c (gfc_compare_derived_types):  Convert gcc_assert()
+       to a gfc_internal_error() to prevent an ICE.
+
 2016-10-24  Jakub Jelinek  <jakub@redhat.com>
 
        * trans-intrinsic.c (gfc_conv_intrinsic_minmax): Use VAR_P (x)
index dc81ab5991c15dc2f2370f0d7affebedf9bd794f..b851d5a425bdb4ad10ffb95843e767a8e929f0a3 100644 (file)
@@ -615,7 +615,8 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
   if (derived1 == derived2)
     return 1;
 
-  gcc_assert (derived1 && derived2);
+  if (!derived1 || !derived2)
+    gfc_internal_error ("gfc_compare_derived_types: invalid derived type");
 
   /* Compare UNION types specially.  */
   if (derived1->attr.flavor == FL_UNION || derived2->attr.flavor == FL_UNION)
index dc5f13ee3918b7b3c392b779a6372a960c1b56b6..0cc1027b3bb8c7099fda871dcc3d88cf4d2cf8b1 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-24  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/71895
+       * gfortran.dg/pr71895.f90: New test.
+
 2016-10-24  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/debug/dwarf2/ref-2.C: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr71895.f90 b/gcc/testsuite/gfortran.dg/pr71895.f90
new file mode 100644 (file)
index 0000000..e5d4002
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+program p
+   type t
+      integer :: n
+   end type
+   type(t) :: x
+   class(t) :: y        ! { dg-error "must be dummy, allocatable or pointer" }
+   print *, extends_type_of(x, y)
+   print *, extends_type_of(y, x)
+end