http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50591

             Bug #: 50591
           Summary: C linker not considering number of parameters with
                    extern linkage
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: srikaw...@gmail.com


Please find the inline program to explain the bug detail.

SampleADT.c
-----------
#include<stdio.h>

int fun(int a,int b,int c)
{
printf("fun %d %d %d",a,b,c);
return 0;
}

int extrafun(int a,int b,int c)
{
printf("efun %d %d %d %d",a,b,c,*(&c+1));
return 0;
}

SampleMain.c
------------

#include<stdio.h>

/* inline functions are defined with 3 arguments in SampleADT.c
   However wrongly declared here!! */

extern int fun(int a,int b); 
extern int extrafun(int a,int b,int c,int d);

int main(int argc,char *argv[])
{
fun(10,20);
extrafun(10,20,30,40);
return 0;
}

gcc -c SampleADT.c SampleMain.c
./a.out

The above program compiles and linked successfully without any linker errors.
C-linker links function call to function definition only by name and number of
parameters were not considered.

Reply via email to