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: unassig...@gcc.gnu.org

        ReportedBy: cookevill...@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;



}

Reply via email to