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

commit r16-967-gc69afa2f1bd7455457ab4e028a6bc51211b2dd20
Author: Jerry DeLisle <jvdeli...@gcc.gnu.org>
Date:   Thu May 29 10:02:00 2025 -0700

    Fortran: Make minor adjustment to error message.
    
            PR fortran/120049
    
    gcc/fortran/ChangeLog:
    
            * check.cc(check_c_ptr_2): Rephrase error message
            for clarity.
    
    gcc/testsuite/ChangeLog:
    
            * gfortran.dg/c_f_pointer_tests_6.f90: Adjust dg-error
            directive.

Diff:
---
 gcc/fortran/check.cc                              | 4 ++--
 gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index c693e4214070..c8904df3b21c 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -6037,8 +6037,8 @@ bool check_c_ptr_2 (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2)
 check_2_error:
 
   gfc_error ("Argument C_PTR_2 at %L to C_ASSOCIATED shall have the "
-            "same type as C_PTR_1: %s instead of %s", &c_ptr_2->where,
-            gfc_typename (&c_ptr_1->ts), gfc_typename (&c_ptr_2->ts));
+            "same type as C_PTR_1, found %s instead of %s", &c_ptr_2->where,
+            gfc_typename (&c_ptr_2->ts), gfc_typename (&c_ptr_1->ts));
 
   return false;
  }
diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 
b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
index 23ca88b0de05..bc2206d4e742 100644
--- a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
+++ b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
@@ -38,6 +38,6 @@ contains
     type(my_c_ptr_0) :: my_ptr2
     type(c_funptr) :: myfun
     print *,c_associated(my_ptr,my_ptr2)
-    print *,c_associated(my_ptr,myfun) ! { dg-error "Argument C_PTR_2 at .1. 
to C_ASSOCIATED shall have the same type as C_PTR_1: TYPE.c_ptr. instead of 
TYPE.c_funptr." }
+    print *,c_associated(my_ptr,myfun) ! { dg-error "Argument C_PTR_2 at .1. 
to C_ASSOCIATED shall have the same type as C_PTR_1, found TYPE.c_funptr. 
instead of TYPE.c_ptr." }
   end subroutine
 end

Reply via email to