public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103496] New: [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity'
@ 2021-11-30 13:54 burnus at gcc dot gnu.org
  2021-11-30 20:14 ` [Bug fortran/103496] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-11-30 13:54 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-23 18:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 13:54 [Bug fortran/103496] New: [F2018][TS29113] C_SIZEOF – rejects now valid args with 'must be an interoperable data entity' burnus at gcc dot gnu.org
2021-11-30 20:14 ` [Bug fortran/103496] " anlauf at gcc dot gnu.org
2021-11-30 21:02 ` burnus at gcc dot gnu.org
2024-04-10 17:19 ` anlauf at gcc dot gnu.org
2024-04-12  8:59 ` burnus at gcc dot gnu.org
2024-04-12 19:18 ` anlauf at gcc dot gnu.org
2024-04-23 18:25 ` cvs-commit at gcc dot gnu.org
2024-04-23 18:28 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).