This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/44814] ISO_C_BINDING types inherited from a USEd module are corrupted



------- Comment #1 from jkrahn at nc dot rr dot com  2010-07-04 19:09 -------
I updated my code to use ISO_C_BINDING directly, but still get this bug. In
order to avoid corruption by the USEd module, the ISO_C_BINDING imports must
all be done on the first USE statement.

This code still fails:
module mod1
  use iso_c_binding, only: C_ptr
end module mod1
module mod2
  use iso_c_binding, only: C_NULL_ptr
  use iso_c_binding, only: C_ptr
  use mod1
contains
  subroutine bug
    type(C_ptr) :: ptr
    ptr=C_NULL_ptr
  end subroutine bug
end module mod2


This code works, with the latter two "use iso_c_binding" statements merged:
module mod1
  use iso_c_binding, only: C_ptr
end module mod1
module mod2
  use iso_c_binding, only: C_ptr, C_NULL_ptr
  use mod1
contains
  subroutine bug
    type(C_ptr) :: ptr
    ptr=C_NULL_ptr
  end subroutine bug
end module mod2


The merged statement still fails if mod1 is used first:
module mod1
  use iso_c_binding, only: C_ptr
end module mod1
module mod2
  use mod1
  use iso_c_binding, only: C_ptr, C_NULL_ptr
contains
  subroutine bug
    type(C_ptr) :: ptr
    ptr=C_NULL_ptr
  end subroutine bug
end module mod2

This should also be tested against procedure interface IMPORT and USE
statements.


-- 

jkrahn at nc dot rr dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ISO_C_BINDING types         |ISO_C_BINDING types
                   |inherited from a USEd module|inherited from a USEd module
                   |are corrupted               |are corrupted


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]