http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47023

           Summary: C_Sizeof: Rejects valid code
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


The following program is rejected with:

print *, c_sizeof(a)
                  1
Error: 'x' argument of 'c_sizeof' intrinsic at (1) must be be an interoperable
data entity

However, "a" is an kind-4 INTEGER which is interoperable. It works if one uses
"integer(c_int)" - however, the message is completely bogus. While for a
BIND(C) procedure the size matters, for c_sizeof a c_int vs. c_long vs.
c_signed_char are all completely valid, thus all kind numbers should be fine.

use iso_c_binding
implicit none
integer :: a(5)
print *, sizeof(a)
print *, c_sizeof(a)
end

Reply via email to