[Bug fortran/103496] [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496 anlauf at gcc dot gnu.org changed: What|Removed |Added Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #7 from anlauf at gcc dot gnu.org --- Pushed testcase. Closing.
[Bug fortran/103496] [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496 --- Comment #6 from GCC Commits --- The master branch has been updated by Harald Anlauf : https://gcc.gnu.org/g:0bf94da59feab2c72a02c91df310a36d33dfd1f7 commit r14-10097-g0bf94da59feab2c72a02c91df310a36d33dfd1f7 Author: Harald Anlauf Date: Tue Apr 23 20:21:43 2024 +0200 Fortran: check C_SIZEOF on additions from TS29113/F2018 [PR103496] gcc/testsuite/ChangeLog: PR fortran/103496 * gfortran.dg/c_sizeof_8.f90: New test.
[Bug fortran/103496] [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496 --- Comment #5 from anlauf at gcc dot gnu.org --- Created attachment 57937 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57937=edit c_sizeof_8.f90 Here's a testcase derived from comment#0. Feel free to adapt it to your meet your needs, and push it.
[Bug fortran/103496] [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496 --- Comment #4 from Tobias Burnus --- (In reply to anlauf from comment #3) > The code in comment#0 compiles at r14-9893-gded646c91d2c0f > and gives the indicated results. which is the commit: Fortran: fix argument checking of intrinsics C_SIZEOF, C_F_POINTER [PR106500] It looks as if the issue is fixed, but gfortran misses a tescast to check that the obtained value is correct. c_sizeof_7.f90 contains tests, but I think there should be a run time trst that the obtained values are correct; I think some are constants such that a tree-dump scan test would work as well, but for the dynamic ones, a run time test seems zo be easier than trying to capture the generated code...
[Bug fortran/103496] [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496 --- Comment #3 from anlauf at gcc dot gnu.org --- The code in comment#0 compiles at r14-9893-gded646c91d2c0f and gives the indicated results.
[Bug fortran/103496] [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496 --- Comment #2 from Tobias Burnus --- (In reply to anlauf from comment #1) > https://j3-fortran.org/doc/year/21/21-134r2.txt > but it still requires using interoperable types etc. > Just asking: did you simply forget to "decorate" your declarations? If you talk about something like 'kind=c_int': On most systems, c_int == c_int32_t == 4 - and gfortran has (by default) a default integer == 4. But also 'kind=8' is very likely to be interoperable; whether it is with c_long or only c_int64_t or ... does not really matter in case of c_sizeof – we just need to know that some C type exists, which is interoperable. [Likewise, integer(kind=c_int128_t) may or may not be interoperable, depending whether that kind is available - and if not, c_int128_t should be a negative number. (Ignoring for now that c_int128_t is a vendor extension.)] But granted, usually you want to be sure that kind matches a specific C integer type and then c_... becomes useful and more portable. * * * 'interoperable type': I have to admit that I tend to get confused whether * "18.3.5 Interoperability of array variables" applies or whether also * "18.3.6 Interoperability of procedures and procedure interfaces" applies. In the latter case, array descriptors are permitted - and that permits allocatables, pointer, sub-sections etc. The former is more restrictive by only permitting explicit shape or assumed size – while the latter permits more. Given that the current wording for c_sizeof is about "that is not an assumed-size array or an assumed-rank array that is associated with an assumed-size array." I think one reasonable reading is that 18.3.6 applies as 18.3.5 does not permit assumed rank. As 21-134r2 shows, the current wording is not ideal – but at the end, the modification just implies that 18.3.5 applies (IMHO).
[Bug fortran/103496] [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496 anlauf at gcc dot gnu.org changed: What|Removed |Added CC||anlauf at gcc dot gnu.org --- Comment #1 from anlauf at gcc dot gnu.org --- I learned from Steve that there is a recent interp regarding C_SIZEOF arguments, https://j3-fortran.org/doc/year/21/21-134r2.txt but it still requires using interoperable types etc. Just asking: did you simply forget to "decorate" your declarations?