public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55422] New: gcc does not diagnose change of linkage for a function.
@ 2012-11-20 23:52 cookevillain at yahoo dot com
  2012-11-20 23:56 ` [Bug c/55422] " cookevillain at yahoo dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: cookevillain at yahoo dot com @ 2012-11-20 23:52 UTC (permalink / raw)
  To: gcc-bugs


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;

}


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-17 20:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-20 23:52 [Bug c/55422] New: gcc does not diagnose change of linkage for a function cookevillain at yahoo dot com
2012-11-20 23:56 ` [Bug c/55422] " cookevillain at yahoo dot com
2012-11-21 11:30 ` mpolacek at gcc dot gnu.org
2012-11-21 12:44 ` mpolacek at gcc dot gnu.org
2012-11-21 21:54 ` cookevillain at yahoo dot com
2012-12-09  1:29 ` pinskia at gcc dot gnu.org
2023-12-17 20:51 ` pinskia 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).