]> 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>
Tue, 27 May 2025 19:49:10 +0000 (12:49 -0700)
commit42983ffde6612b7f8a4e7ab3e76fa8b0d136e854
tree46c107adc10d0e1f1bc4fc02e7949df53af16c08
parent787a8dec1acedf5561c8ee43bed0b3653fca150d
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.
* 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.

Co-Authored-By: Steve Kargl <kargl@gcc.gnu.org>
gcc/fortran/check.cc
gcc/fortran/misc.cc
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