re PR fortran/92863 (ICE in gfc_typename)

2019-12-10  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/92863
    * misc.c (gfc_typename): If derived component is NULL for
    derived or class, return "invalid type" or "invalid class",
    respectively.

2019-12-10  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/92863
    * gfortran.dg/interface_45.f90: New test.

From-SVN: r279180
This commit is contained in:
Thomas Koenig 2019-12-10 18:31:33 +00:00
parent 940317b75c
commit f812dfe8e0
4 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2019-12-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92863
* misc.c (gfc_typename): If derived component is NULL for
derived or class, return "invalid type" or "invalid class",
respectively.
2019-12-10 Tobias Burnus <tobias@codesourcery.com>
PR fortran/92872

View File

@ -164,9 +164,19 @@ gfc_typename (gfc_typespec *ts)
sprintf (buffer, "UNION(%s)", ts->u.derived->name);
break;
case BT_DERIVED:
if (ts->u.derived == NULL)
{
sprintf (buffer, "invalid type");
break;
}
sprintf (buffer, "TYPE(%s)", ts->u.derived->name);
break;
case BT_CLASS:
if (ts->u.derived == NULL)
{
sprintf (buffer, "invalid class");
break;
}
ts1 = ts->u.derived->components ? &ts->u.derived->components->ts : NULL;
if (ts1 && ts1->u.derived && ts1->u.derived->attr.unlimited_polymorphic)
sprintf (buffer, "CLASS(*)");

View File

@ -1,3 +1,8 @@
2019-12-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92863
* gfortran.dg/interface_45.f90: New test.
2019-12-10 Richard Sandiford <richard.sandiford@arm.com>
* gcc.target/aarch64/sve/mixed_size_7.c: New test.

View File

@ -0,0 +1,11 @@
! { dg-do compile }
! PR 92863 - this used to ICE
! Test case by Arseny Solokha.
type(l1) function mp() ! { dg-error "type for function" }
call sub(mp) ! { dg-error "Type mismatch" }
end function mp
function bi(ry)
call sub(ry) ! { dg-error "Type mismatch" }
end function bi