]> gcc.gnu.org Git - gcc.git/commitdiff
Fortran : ICE in resolve_fl_procedure PR95708
authorMark Eggleston <markeggleston@gcc.gnu.org>
Mon, 22 Jun 2020 12:35:01 +0000 (13:35 +0100)
committerMark Eggleston <markeggleston@gcc.gnu.org>
Mon, 22 Jun 2020 15:28:55 +0000 (16:28 +0100)
Now issues an error "Intrinsic procedure 'num_images' not
allowed in PROCEDURE" instead of an ICE.

2020-06-22  Steven G. Kargl  <kargl@gcc.gnu.org>

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  <markeggleston@gcc.gnu.org>

gcc/testsuite/

PR fortran/95708
* gfortran.dg/pr95708.f90: New test.

gcc/fortran/intrinsic.c
gcc/fortran/resolve.c
gcc/testsuite/gfortran.dg/pr95708.f90 [new file with mode: 0644]

index 60d91f658bddb4150fde37dff5397ff59021022d..30f9f14572b0387b04f8bb9c47dbfe88845a83a6 100644 (file)
@@ -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);
 
index aaee5eb6b9b95b10870ca9ae0e609dc002a4ec0d..c53b312f7ed36bf4e11fc4d3e310c91c3b47253f 100644 (file)
@@ -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 (file)
index 0000000..32bd324
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-do compile }
+!
+
+program test
+  procedure(team_num) :: g ! { dg-error "must be explicit" }
+end program
This page took 0.094331 seconds and 5 git commands to generate.