This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50591] New: C linker not considering number of parameters with extern linkage
- From: "srikawnth at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 02 Oct 2011 17:01:15 +0000
- Subject: [Bug c/50591] New: C linker not considering number of parameters with extern linkage
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: srikawnth@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.