[Bug fortran/93091] [OOP] Apparent bugs in "sizeof" and "transfer" intrinsic functions

anlauf at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 30 17:04:00 GMT 2019


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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libfortran                  |fortran
            Summary|Apparent bugs in "sizeof"   |[OOP] Apparent bugs in
                   |and "transfer" intrinsic    |"sizeof" and "transfer"
                   |functions                   |intrinsic functions

--- Comment #1 from anlauf at gcc dot gnu.org ---
If I add the following to poly/poly1, I get correct results:

    select type (obj)
    type is (character(*))
       print "('Sizeof: ',i0)", sizeof(obj)
       print "('Transfer: ',i0)",
size(transfer(obj,[0_c_int8_t]),kind=c_size_t)
    type is (integer)
       print "('Sizeof: ',i0)", sizeof(obj)
       print "('Transfer: ',i0)",
size(transfer(obj,[0_c_int8_t]),kind=c_size_t)
    end select

This will print:

Character
DIRECT-C
sizeof: 80
transfer: 80
POLY
sizeof: 1
transfer: 1
Sizeof: 80
Transfer: 80

etc.

Apparently OOP-related.  Not sure if the bug is in the source code or
in the compiler handling polymorphism.


More information about the Gcc-bugs mailing list