public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "longb at cray dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/48858] New: Incorrect error for same binding label on two generic interface specifics Date: Tue, 03 May 2011 21:59:00 -0000 [thread overview] Message-ID: <bug-48858-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48858 Summary: Incorrect error for same binding label on two generic interface specifics Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: longb@cray.com For this example code: > cat ck1.c #include <stdio.h> void Cfun ( int n, int *array){ if ( array == NULL ) printf ( "call %d passes NULL as arg 2 \n", n); else printf ( "call %d passes array address as arg 2 \n", n); } [The C part compiles fine.] > cat ck.f90 module graph_partitions use,intrinsic :: iso_c_binding interface Cfun subroutine cfunc1 (num, array) bind(c, name="Cfun") import :: c_int integer(c_int),value :: num integer(c_int) :: array(*) end subroutine cfunc1 subroutine cfunf2 (num, array) bind(c, name="Cfun") import :: c_int, c_ptr integer(c_int),value :: num type(c_ptr),value :: array end subroutine cfunf2 end interface end module graph_partitions program test use graph_partitions integer(c_int) :: a(100) call Cfun (1, a) call Cfun (2, C_NULL_PTR) end program test I get > gcc -c ck1.c > gfortran ck.f90 ck1.o ck.f90:11.22: subroutine cfunf2 (num, array) bind(c, name="Cfun") 1 ck.f90:5.22: subroutine cfunc1 (num, array) bind(c, name="Cfun") 2 Error: Binding label 'Cfun' in interface body at (1) collides with the global entity 'Cfun' at (2) ck.f90:20.22: .... Same behavior for 4.5.2 and 4.6.0. The same code compiles and executes fine with the Cray, Intel, and PGI compilers. The expected output is: > ./a.out call 1 passes array address as arg 2 call 2 passes NULL as arg 2 > This code should compile. There is only one "entity" with the binding lablel "Cfun". In the words in the standard, only one "entity of the program" with this binding label. The names cfunc2 and cfunc1 are both local identifiers. (Sections 16.2 and 16.3). This construction is specifically allowed in the standard to allow users to call a C function with multiple interfaces, similar to what is illustrated here.
next reply other threads:[~2011-05-03 21:59 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-05-03 21:59 longb at cray dot com [this message] 2011-05-03 21:51 ` [Bug fortran/48858] " longb at cray dot com 2011-05-04 8:24 ` burnus at gcc dot gnu.org 2011-05-04 22:43 ` longb at cray dot com 2011-05-06 18:18 ` burnus at gcc dot gnu.org 2011-05-06 18:39 ` burnus at gcc dot gnu.org 2011-05-22 14:41 ` burnus at gcc dot gnu.org 2011-07-24 19:19 ` dfranke at gcc dot gnu.org 2011-07-24 19:57 ` burnus at gcc dot gnu.org 2012-01-07 22:15 ` burnus at gcc dot gnu.org 2012-01-07 22:18 ` burnus at gcc dot gnu.org 2012-01-07 22:31 ` burnus at gcc dot gnu.org 2012-06-25 15:38 ` burnus at gcc dot gnu.org 2012-11-13 18:15 ` juno.krahn at nih dot gov 2013-05-20 20:09 ` burnus at gcc dot gnu.org 2013-05-20 20:10 ` burnus at gcc dot gnu.org 2013-05-20 20:14 ` burnus at gcc dot gnu.org 2013-05-22 9:17 ` 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-48858-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).