public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "abensonca at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/94446] New: Bogus "type mismatch" with TYPE(c_ptr) and sizeof() Date: Wed, 01 Apr 2020 16:05:21 +0000 [thread overview] Message-ID: <bug-94446-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94446 Bug ID: 94446 Summary: Bogus "type mismatch" with TYPE(c_ptr) and sizeof() Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: abensonca at gcc dot gnu.org Target Milestone: --- The following causes a bogus "type mismatch" error with the current trunk (e899d4b71255b9ae096a7ecd31a61fc76f200019): $ cat file1.F90 module nrn use, intrinsic :: ISO_C_Binding type :: rgc private contains procedure :: st => rgcST end type rgc type, extends(rgc) :: rgcG private contains procedure :: st => rgcGST end type rgcG interface module subroutine rgcGST(s,gsf) class(rgcG), intent(inout) :: s type(c_ptr), intent(in ) :: gsf end subroutine rgcGST end interface contains subroutine rgcST(s,gsf) implicit none class(rgc), intent(inout) :: s type(c_ptr), intent(in ) :: gsf end subroutine rgcST end module nrn $ cat file2.F90 module gn use :: nrn type, public :: mt class (rgc), pointer :: rgc_ end type mt type, public :: tn type (mt), pointer :: ht contains end type tn contains subroutine tnc() type(tn) :: a write (0,*) sizeof(a) end subroutine tnc end module gn module eh use :: gn end module eh $ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-git/configure --prefix=/home/abenson/Galacticus/Tools --enable-languages=c,c++,fortran --disable-multilib : (reconfigured) ../gcc-git/configure --prefix=/home/abenson/Galacticus/Tools --disable-multilib --enable-languages=c,c++,fortran,lto --no-create --no-recursion Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.0.1 20200401 (experimental) (GCC) $ gfortran -c file1.F90 -o file1.o $ gfortran -c file2.F90 -o file2.o file2.F90:24:8: 24 | use :: gn | 1 Error: Argument mismatch for the overriding procedure 'st' at (1): Type mismatch in argument 'gsf' (TYPE(c_ptr)/INTEGER(8)) The error only occurs if the module in file1.F90 is compiled separately - if I combine file1.F90 and file2.F90 into a single file, that single file compiles without error. I haven't been able to reduce the testcase further, and figuring out the cause of the error has so far been beyond my ability. What I have found though is that in the nrn.mod module file created by compiling file.F90 all instances of symbol "gsf" are correctly given DERIVED type. But, in gn.mod created by compiling file2.F90 there are two instances of symbol "gsf", the first has DERIVED type, while the second has INTEGER type. So, it seems that the problem occurs at (or before) the creation of the gn.mod module file. Also, the use of the "sizeof()" intrinsic is necessary to trigger the bug.
next reply other threads:[~2020-04-01 16:05 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-01 16:05 abensonca at gcc dot gnu.org [this message] 2021-02-14 18:27 ` [Bug fortran/94446] " dominiq at lps dot ens.fr 2021-03-29 22:01 ` abensonca at gmail dot com 2021-04-09 22:14 ` burnus at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94446-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).