From: Mark Eggleston Date: Mon, 22 Jun 2020 12:35:01 +0000 (+0100) Subject: Fortran : ICE in resolve_fl_procedure PR95708 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=647340c92a042e8e6f7d004637f07060dbde49c0;p=gcc.git Fortran : ICE in resolve_fl_procedure PR95708 Now issues an error "Intrinsic procedure 'num_images' not allowed in PROCEDURE" instead of an ICE. 2020-06-22 Steven G. Kargl gcc/fortran/ PR fortran/95708 * intrinsic.c (add_functions): Replace CLASS_INQUIRY with CLASS_TRANSFORMATIONAL for intrinsic num_images. (make_generic): Replace ACTUAL_NO with ACTUAL_YES for intrinsic team_number. * resolve.c (resolve_fl_procedure): Check pointer ts.u.derived exists before using it. 2020-06-22 Mark Eggleston gcc/testsuite/ PR fortran/95708 * gfortran.dg/pr95708.f90: New test. --- diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 60d91f658bd..30f9f14572b 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -2733,8 +2733,8 @@ add_functions (void) make_generic ("null", GFC_ISYM_NULL, GFC_STD_F95); - add_sym_2 ("num_images", GFC_ISYM_NUM_IMAGES, CLASS_INQUIRY, ACTUAL_NO, - BT_INTEGER, di, GFC_STD_F2008, + add_sym_2 ("num_images", GFC_ISYM_NUM_IMAGES, CLASS_TRANSFORMATIONAL, + ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, gfc_check_num_images, gfc_simplify_num_images, NULL, dist, BT_INTEGER, di, OPTIONAL, failed, BT_LOGICAL, dl, OPTIONAL); @@ -3174,7 +3174,7 @@ add_functions (void) make_generic ("tanh", GFC_ISYM_TANH, GFC_STD_F77); add_sym_1 ("team_number", GFC_ISYM_TEAM_NUMBER, CLASS_TRANSFORMATIONAL, - ACTUAL_YES, BT_INTEGER, di, GFC_STD_F2018, + ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2018, gfc_check_team_number, NULL, gfc_resolve_team_number, team, BT_DERIVED, di, OPTIONAL); diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index aaee5eb6b9b..c53b312f7ed 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12999,6 +12999,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag) { if (arg->sym && arg->sym->ts.type == BT_DERIVED + && arg->sym->ts.u.derived && !arg->sym->ts.u.derived->attr.use_assoc && !gfc_check_symbol_access (arg->sym->ts.u.derived) && !gfc_notify_std (GFC_STD_F2003, "%qs is of a PRIVATE type " diff --git a/gcc/testsuite/gfortran.dg/pr95708.f90 b/gcc/testsuite/gfortran.dg/pr95708.f90 new file mode 100644 index 00000000000..32bd324ce15 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr95708.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! + +program test + procedure(team_num) :: g ! { dg-error "must be explicit" } +end program