https://gcc.gnu.org/g:d4893480373deea3e9da267f85d764469d65b497

commit r16-7607-gd4893480373deea3e9da267f85d764469d65b497
Author: Harald Anlauf <[email protected]>
Date:   Sat Feb 21 08:24:20 2026 +0100

    Revert "Fortran: Fix diagnostic for ambiguous pointer function assignment 
[PR80012]"
    
    This reverts commit 84ef4948609260266f365c63ce429476fd31262f.

Diff:
---
 gcc/fortran/symbol.cc                 | 23 +++++++++++------------
 gcc/testsuite/gfortran.dg/pr80012.f90 | 14 --------------
 2 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index 34c8a969fdae..5ff14e27b942 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -24,7 +24,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "options.h"
 #include "gfortran.h"
-#include "diagnostic-core.h"
 #include "parse.h"
 #include "match.h"
 #include "constructor.h"
@@ -1888,19 +1887,19 @@ gfc_add_procedure (symbol_attribute *attr, 
procedure_type t,
   if (attr->proc != PROC_UNKNOWN && !attr->module_procedure
       && attr->access == ACCESS_UNKNOWN)
     {
-      auto_diagnostic_group d;
-      gfc_error ("%s procedure at %L is already declared as %s procedure",
-                gfc_code2string (procedures, t), where,
-                gfc_code2string (procedures, attr->proc));
       if (attr->proc == PROC_ST_FUNCTION && t == PROC_INTERNAL
          && !gfc_notification_std (GFC_STD_F2008))
-       {
-         inform (gfc_get_location (where),
-                 "F2008: A pointer function assignment is ambiguous if it is "
-                 "the first executable statement after the specification "
-                 "block.  Please add any other kind of executable "
-                 "statement before it");
-       }
+       gfc_error ("%s procedure at %L is already declared as %s "
+                  "procedure. \nF2008: A pointer function assignment "
+                  "is ambiguous if it is the first executable statement "
+                  "after the specification block. Please add any other "
+                  "kind of executable statement before it. FIXME",
+                gfc_code2string (procedures, t), where,
+                gfc_code2string (procedures, attr->proc));
+      else
+       gfc_error ("%s procedure at %L is already declared as %s "
+                  "procedure", gfc_code2string (procedures, t), where,
+                  gfc_code2string (procedures, attr->proc));
 
       return false;
     }
diff --git a/gcc/testsuite/gfortran.dg/pr80012.f90 
b/gcc/testsuite/gfortran.dg/pr80012.f90
deleted file mode 100644
index da626d565d89..000000000000
--- a/gcc/testsuite/gfortran.dg/pr80012.f90
+++ /dev/null
@@ -1,14 +0,0 @@
-! { dg-do compile }
-! { dg-options "-std=gnu" }
-! PR fortran/80012
-! Test that the error message for ambiguous pointer function assignment
-! is split into an error and an informational note, without FIXME.
-
-two() = 7
-contains
-  function two () ! { dg-error "INTERNAL-PROC procedure at .1. is already 
declared as STATEMENT-PROC procedure" }
-! { dg-message "F2008: A pointer function assignment is ambiguous" "" { target 
*-*-* } 9 }
-    integer, pointer  :: two
-    allocate(two)
-  end function two
-end

Reply via email to