This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/55422] New: gcc does not diagnose change of linkage for a function.


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;

}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]