This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/55422] New: gcc does not diagnose change of linkage for a function.
- From: "cookevillain at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Nov 2012 23:52:16 +0000
- Subject: [Bug c/55422] New: gcc does not diagnose change of linkage for a function.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55422
Bug #: 55422
Summary: gcc does not diagnose change of linkage for a
function.
Classification: Unclassified
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: cookevillain@yahoo.com
compiling:
----------------------------
static void ff(int a) {
return;
}
int f(void) {
ff(0);
int ff = 0;
{
extern void ff(int);
}
return ff;
}
----------------------------
with:
gcc -Wall -c ice.c
----------------------------
produces no diagnostic, however, clause 6.2.2(3) of the ISO standard requires
that the first declaration of ff results in ff having internal linkage; then,
since the file scope declaration is hidden, according to 6.2.2(4), ff's linkage
is now external.
gcc correctly diagnoses this in the code below, so it seems to be related to
the declaration of ff as a function. the standard makes no distinction between
these two cases though.
---------------------------
static int ff;
int f(void) {
int ff = 0;
{
extern int ff;
}
return ff;
}