https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103496

            Bug ID: 103496
           Summary: [F2018][TS29113] C_SIZEOF – rejects now valid args
                    with 'must be an interoperable data entity'
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

The following should now be fine – using an array descriptor as defined in
TS29113 / F2018:

    8 | print *, c_sizeof(a(:))
      |                  1
Error: ‘x’ argument of ‘c_sizeof’ intrinsic at (1) must be an interoperable
data entity: Only whole-arrays are interoperable

   12 | print *, c_sizeof(p)
      |                  1
Error: ‘x’ argument of ‘c_sizeof’ intrinsic at (1) must be an interoperable
data entity: Only explicit-size and assumed-size arrays are interoperable

----------------------
use iso_c_binding
implicit none
integer :: a(6)
integer, pointer :: p(:)

print *, c_sizeof(a)       ! 6*4 - OK
print *, c_sizeof(a(1))    !   4 - OK
print *, c_sizeof(a(:))    ! 6*4 - OK, rejected
print *, c_sizeof(a(2::2)) ! 3*4 - rejected

allocate(p(5))
print *, c_sizeof(p)       ! 5*4 - rejected
print *, c_sizeof(p(1))    !   4 - OK
print *, c_sizeof(p(:))    ! 5*4 - rejected
print *, c_sizeof(p(2::2)) ! 2*4 - rejected
end

Reply via email to