https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106500
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code CC| |anlauf at gcc dot gnu.org --- Comment #4 from anlauf at gcc dot gnu.org --- I've looked some time into this and have the impression we have the checks wrong. E.g. testcase gfortran.dg/c_sizeof_6.f90 expects as error: gcc/testsuite/gfortran.dg/c_sizeof_6.f90:11:16: 11 | i = c_sizeof(str2(1:3)) ! { dg-error "must be an interoperable data" } | 1 Error: 'x' argument of 'c_sizeof' intrinsic at (1) must be an interoperable data entity: Only whole-arrays are interoperable First, other compilers accept the code (Intel, NAG, Nvidia, flang), and also the other testcases in the PR, plus they give the expected answers. Second, the standard 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. and ! 3.41 data entity ! data object, result of the evaluation of an expression, or the ! result of the execution of a function reference So, array sections could be interoperable, expressions, function results. What is unclear to me: when is an expression interoperable? Or rather when is it *not*? (Note that the standard text has not essentially changed since F2008, so we got this too strict from the beginning.)