This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44814] ISO_C_BINDING types inherited from a USEd module are corrupted
- From: "jkrahn at nc dot rr dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jul 2010 19:09:20 -0000
- Subject: [Bug fortran/44814] ISO_C_BINDING types inherited from a USEd module are corrupted
- References: <bug-44814-14229@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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