public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55343] New: Renamed C_PTR entities are not treated as equivalent types.
@ 2012-11-15 16:49 juno.krahn at nih dot gov
  2013-03-03 17:31 ` [Bug fortran/55343] " dominiq at lps dot ens.fr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: juno.krahn at nih dot gov @ 2012-11-15 16:49 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55343
           Summary: Renamed C_PTR entities are not treated as equivalent
                    types.
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: juno.krahn@nih.gov


When the intrinsic C_PTR type is accessed via a local name, it is no longer
treated as equivalent to the C_PTR type under either the original name or any
other different local name.

Example code: (test_rename.f90)
---------------------
module my_mod
  implicit none
  type int_type
    integer :: i
  end type int_type
end module my_mod
program main
  use iso_c_binding, only: C_void_ptr=>C_ptr, C_string_ptr=>C_ptr
  use my_mod, only: i1_type=>int_type, i2_type=>int_type
  implicit none
  type(C_string_ptr) :: p_string
  type(C_void_ptr) :: p_void
  type (i1_type) :: i1
  type (i2_type) :: i2
  p_void = p_string
  i1 = i2
end program main
-------------------------------

Result:
$ gfortran -c test_rename.f90
test_rename.f90:15.11:

  p_void = p_string
           1
Error: Can't convert TYPE(c_string_ptr) to TYPE(c_void_ptr) at (1)


I included a user defined derived type to illustrate that the equivalence of
renamed entities in that case works as expected. This used to work in Gnu
fortran, but I don't know what version I was using at that time.

(For comparison: Intel compilers handle it correctly. The latest Sun/Oracle
works when assigning from C_PTR to a renamed entity, but not the other way
around.)


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

end of thread, other threads:[~2013-03-25 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 16:49 [Bug fortran/55343] New: Renamed C_PTR entities are not treated as equivalent types juno.krahn at nih dot gov
2013-03-03 17:31 ` [Bug fortran/55343] " dominiq at lps dot ens.fr
2013-03-25 15:54 ` burnus at gcc dot gnu.org
2013-03-25 17:53 ` burnus 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).