public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50591] New: C linker not considering number of parameters with extern linkage
@ 2011-10-02 17:01 srikawnth at gmail dot com
2011-10-02 17:20 ` [Bug c/50591] " schwab@linux-m68k.org
0 siblings, 1 reply; 2+ messages in thread
From: srikawnth at gmail dot com @ 2011-10-02 17:01 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/50591] C linker not considering number of parameters with extern linkage
2011-10-02 17:01 [Bug c/50591] New: C linker not considering number of parameters with extern linkage srikawnth at gmail dot com
@ 2011-10-02 17:20 ` schwab@linux-m68k.org
0 siblings, 0 replies; 2+ messages in thread
From: schwab@linux-m68k.org @ 2011-10-02 17:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50591
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> 2011-10-02 17:20:39 UTC ---
If you want type-safe linking use C++. The usual ABIs for C don't provide this
information.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-02 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-02 17:01 [Bug c/50591] New: C linker not considering number of parameters with extern linkage srikawnth at gmail dot com
2011-10-02 17:20 ` [Bug c/50591] " schwab@linux-m68k.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).