public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49111] New: Unnecessary warning for private interfaces having the BIND(C) attribute
@ 2011-05-22 16:03 jwmwalrus at gmail dot com
2011-05-22 16:35 ` [Bug fortran/49111] " jwmwalrus at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jwmwalrus at gmail dot com @ 2011-05-22 16:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49111
Summary: Unnecessary warning for private interfaces having the
BIND(C) attribute
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jwmwalrus@gmail.com
When the following module:
module mod1
use iso_c_binding
implicit none
save
interface
function strerror(errnum) bind(C, NAME = 'strerror')
import
type(C_PTR) :: strerror
integer(C_INT), value :: errnum
end function
end interface
private strerror
end module mod1
gfortran warns about the private symbol 'strerror' being given a binding label.
The exact warning is:
...:~$ gfortran -c test_gfortran_private_cbinding.f90
test_gfortran_private_cbinding.f90:8.8:
function strerror(errnum) bind(C, NAME = 'strerror')
1
Warning: Symbol 'strerror' at (1) is marked PRIVATE but has been given the
binding label 'strerror'
In sections 5.3.2 and 5.3.5 of the Fortran 2008 standard, there seems to be no
restriction between the BIND and PRIVATE attributes ---i.e., the BIND(C)
attribute is compatible with the PRIVATE attribute, and therefore no warning
should be issued by the gfortran.
The version information is:
...:~$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.6.0-3~ppa1'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 20110409 (prerelease) (Ubuntu 4.6.0-3~ppa1)
The system information (for Ubuntu 11.04) is:
...:~$ uname -srvmpio
Linux 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64
x86_64 x86_64 GNU/Linux
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/49111] Unnecessary warning for private interfaces having the BIND(C) attribute
2011-05-22 16:03 [Bug fortran/49111] New: Unnecessary warning for private interfaces having the BIND(C) attribute jwmwalrus at gmail dot com
@ 2011-05-22 16:35 ` jwmwalrus at gmail dot com
2011-05-22 17:31 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jwmwalrus at gmail dot com @ 2011-05-22 16:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49111
--- Comment #1 from John <jwmwalrus at gmail dot com> 2011-05-22 16:14:48 UTC ---
Created attachment 24328
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24328
Test case
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/49111] Unnecessary warning for private interfaces having the BIND(C) attribute
2011-05-22 16:03 [Bug fortran/49111] New: Unnecessary warning for private interfaces having the BIND(C) attribute jwmwalrus at gmail dot com
2011-05-22 16:35 ` [Bug fortran/49111] " jwmwalrus at gmail dot com
@ 2011-05-22 17:31 ` burnus at gcc dot gnu.org
2012-10-12 20:54 ` craig.powers at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-05-22 17:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49111
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #24328|application/octet-stream |text/plain
mime type| |
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-22 17:04:39 UTC ---
Comment on attachment 24328
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24328
Test case
(In reply to comment #0)
> gfortran warns about the private symbol 'strerror' being given a binding label.
>
> In sections 5.3.2 and 5.3.5 of the Fortran 2008 standard, there seems to be no
> restriction between the BIND and PRIVATE attributes ---[...] and therefore no
> warning should be issued by the gfortran.
The Fortran standard only states whether something is valid or not - not
whether a compiler should issue a warning or not.
The idea is that having PRIVATE (making it inaccessible from outside the module
by direct means) and having a C binding (make it available out side) are in a
way opposite concepts - and thus possible unintended.
However, for an INTERFACE - as opposed to a module procedure - a warning indeed
does not make much sense.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/49111] Unnecessary warning for private interfaces having the BIND(C) attribute
2011-05-22 16:03 [Bug fortran/49111] New: Unnecessary warning for private interfaces having the BIND(C) attribute jwmwalrus at gmail dot com
2011-05-22 16:35 ` [Bug fortran/49111] " jwmwalrus at gmail dot com
2011-05-22 17:31 ` burnus at gcc dot gnu.org
@ 2012-10-12 20:54 ` craig.powers at gmail dot com
2013-12-29 13:08 ` dominiq at lps dot ens.fr
2021-10-24 23:46 ` sandra at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: craig.powers at gmail dot com @ 2012-10-12 20:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49111
Craig Powers <craig.powers at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |craig.powers at gmail dot
| |com
--- Comment #3 from Craig Powers <craig.powers at gmail dot com> 2012-10-12 20:53:53 UTC ---
I see the accessibility denoted by PRIVATE/PUBLIC as conceptually different
from the accessibility denoted by BIND(C). In addition to the fact that
BIND(C) does not distinguish an import from an export, there is also the
consideration that one might wish to hide the C-callable routine (marked with
BIND(C)) from other Fortran code by also marking it PRIVATE.
I'm in the process of producing a Fortran interface to a C library, and I find
that there are some instances where I want to declare the import as PRIVATE and
then provide a wrapper routine to take care of the Fortran-to-C stuff that is
mechanical e.g. converting a Fortran array.
Because my Fortran is a little rusty, and this is my first time making any
extended use of the BIND(C) features, the warning made me concerned that I
hadn't accomplished what I intended to accomplish.
I see this warning as far more likely to be a spurious complaint about valid
and intended usage than to be a useful hint about something unintended.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/49111] Unnecessary warning for private interfaces having the BIND(C) attribute
2011-05-22 16:03 [Bug fortran/49111] New: Unnecessary warning for private interfaces having the BIND(C) attribute jwmwalrus at gmail dot com
` (2 preceding siblings ...)
2012-10-12 20:54 ` craig.powers at gmail dot com
@ 2013-12-29 13:08 ` dominiq at lps dot ens.fr
2021-10-24 23:46 ` sandra at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-12-29 13:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49111
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Priority|P3 |P4
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-12-29
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r206227.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/49111] Unnecessary warning for private interfaces having the BIND(C) attribute
2011-05-22 16:03 [Bug fortran/49111] New: Unnecessary warning for private interfaces having the BIND(C) attribute jwmwalrus at gmail dot com
` (3 preceding siblings ...)
2013-12-29 13:08 ` dominiq at lps dot ens.fr
@ 2021-10-24 23:46 ` sandra at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: sandra at gcc dot gnu.org @ 2021-10-24 23:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49111
sandra at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sandra at gcc dot gnu.org
--- Comment #8 from sandra at gcc dot gnu.org ---
Still present on master, so no, this bug hasn't spontaneously fixed itself.
:-(
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-10-24 23:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-22 16:03 [Bug fortran/49111] New: Unnecessary warning for private interfaces having the BIND(C) attribute jwmwalrus at gmail dot com
2011-05-22 16:35 ` [Bug fortran/49111] " jwmwalrus at gmail dot com
2011-05-22 17:31 ` burnus at gcc dot gnu.org
2012-10-12 20:54 ` craig.powers at gmail dot com
2013-12-29 13:08 ` dominiq at lps dot ens.fr
2021-10-24 23:46 ` sandra 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).