diff options
author | Harald Anlauf <anlauf@gmx.de> | 2024-04-09 23:07:59 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2024-04-10 18:44:05 +0200 |
commit | ded646c91d2c0fb908faf6fa8fe1df0d7df49d16 (patch) | |
tree | 98123a17738d5bb96e99365e1427d14f56374c54 /gcc/po | |
parent | 912753cc5f18d786e334dd425469fa7f93155661 (diff) | |
download | gcc-ded646c91d2c0fb908faf6fa8fe1df0d7df49d16.zip gcc-ded646c91d2c0fb908faf6fa8fe1df0d7df49d16.tar.gz gcc-ded646c91d2c0fb908faf6fa8fe1df0d7df49d16.tar.bz2 |
Fortran: fix argument checking of intrinsics C_SIZEOF, C_F_POINTER [PR106500]
The interpretation of the F2018 standard regarding valid arguments to the
intrinsic C_SIZEOF(X) was clarified in an edit to 18-007r1:
https://j3-fortran.org/doc/year/22/22-101r1.txt
loosening restrictions and giving examples. The F2023 text has:
! F2023:18.2.3.8 C_SIZEOF (X)
!
! X shall be a data entity with interoperable type and type parameters,
! and shall not be an assumed-size array, an assumed-rank array that
! is associated with an assumed-size array, an unallocated allocatable
! variable, or a pointer that is not associated.
where
! 3.41 data entity
! data object, result of the evaluation of an expression, or the
! result of the execution of a function reference
Update the checking code for interoperable arguments accordingly, and extend
to reject functions returning pointer as FPTR argument to C_F_POINTER.
gcc/fortran/ChangeLog:
PR fortran/106500
* check.cc (is_c_interoperable): Fix checks for C_SIZEOF.
(gfc_check_c_f_pointer): Reject function returning a pointer as FPTR,
and improve an error message.
gcc/testsuite/ChangeLog:
PR fortran/106500
* gfortran.dg/c_sizeof_6.f90: Remove wrong dg-error.
* gfortran.dg/sizeof_2.f90: Adjust pattern.
* gfortran.dg/c_f_pointer_tests_9.f90: New test.
* gfortran.dg/c_sizeof_7.f90: New test.
Diffstat (limited to 'gcc/po')
0 files changed, 0 insertions, 0 deletions