From 474f253087bc346a346557b8ac152c02438930b6 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Fri, 22 Jun 2018 22:31:17 +0000 Subject: [PATCH] re PR fortran/86281 (SEGV in fortran/resolve.c:resolve_function) 2018-06-22 Paul Thomas Rainer Orth PR fortran/86281 * resolve.c (resolve_contained_fntype): Check for the charlen before testing the length. 2018-06-22 Paul Thomas PR fortran/86281 * gfortran.dg/assumed_charlen_function_7.f90: Add -std=legacy. Co-Authored-By: Rainer Orth From-SVN: r261975 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/resolve.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/assumed_charlen_function_7.f90 | 1 + 4 files changed, 14 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2e665d95a0f..7e75319c642 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-06-22 Paul Thomas + Rainer Orth + + PR fortran/86281 + * resolve.c (resolve_contained_fntype): Check for the charlen + before testing the length. + 2018-06-21 Paul Thomas PR fortran/49630 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 41040544ce5..2f5eebad5b5 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -3116,6 +3116,7 @@ resolve_function (gfc_expr *expr) /* If this is a deferred TBP with an abstract interface, its result cannot be an assumed length character (F2003: C418). */ if (sym && sym->attr.abstract && sym->attr.function + && sym->result->ts.u.cl && sym->result->ts.u.cl->length == NULL) { gfc_error ("ABSTRACT INTERFACE %qs at %L must not have an assumed " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 018fdf05682..1b14b01d8a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-22 Paul Thomas + + PR fortran/86281 + * gfortran.dg/assumed_charlen_function_7.f90: Add -std=legacy. + 2018-06-22 Kelvin Nilsen * gcc.target/powerpc/builtins-3-p8.c (test_pack_float): Remove diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_function_7.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_function_7.f90 index b36bb872e7b..1fb57a0b7ae 100644 --- a/gcc/testsuite/gfortran.dg/assumed_charlen_function_7.f90 +++ b/gcc/testsuite/gfortran.dg/assumed_charlen_function_7.f90 @@ -1,4 +1,5 @@ ! { dg-do compile } +! { dg-options "-std=legacy" } ! ! Test the fix for PR49630, comment #11. ! -- 2.30.2