]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Fix c_associated argument checks.
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Tue, 20 May 2025 02:41:16 +0000 (19:41 -0700)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 31 May 2025 17:33:45 +0000 (10:33 -0700)
commit41dee7da08873721a719849d19ef07c027e76dfb
tree0080666a2d163f06339948ad83e3cf277b4ffe79
parentd8e7a2dbe736a57e4cec0293387a1c558b5a155e
Fortran: Fix c_associated argument checks.

PR fortran/120049

gcc/fortran/ChangeLog:

* check.cc (gfc_check_c_associated): Use new helper functions.
Only call check_c_ptr_1 if optional c_ptr_2 tests succeed.
(check_c_ptr_1): Handle only c_ptr_1 checks.
(check_c_ptr_2): Expand checks for c_ptr_2 and handle cases
where there is no derived pointer in the gfc_expr and check
the inmod_sym_id only if it exists. Rephrase error message.
* misc.cc (gfc_typename): Handle the case for BT_VOID rather
than throw an internal error.

gcc/testsuite/ChangeLog:

* gfortran.dg/pr120049_a.f90: Update test directives.
* gfortran.dg/pr120049_b.f90: Update test directives
* gfortran.dg/pr120049_2.f90: New test.
* gfortran.dg/c_f_pointer_tests_6.f90: Adjust dg-error
directive.

Co-Authored-By: Steve Kargl <kargl@gcc.gnu.org>
(cherry picked from commit 42983ffde6612b7f8a4e7ab3e76fa8b0d136e854)
gcc/fortran/check.cc
gcc/fortran/misc.cc
gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
gcc/testsuite/gfortran.dg/pr120049_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr120049_a.f90
gcc/testsuite/gfortran.dg/pr120049_b.f90