Article View: gnu.g++.bug
Article #929gcc 2.2.2 calls wrong overloaded function
From: Bernd Anhaeupl
Date: Wed, 09 Sep 1992 19:41
Date: Wed, 09 Sep 1992 19:41
55 lines
3019 bytes
3019 bytes
Systems: 1.)hp9000/720 (hpux 8.07)
2.)Sequent386 (UNIX System V Release 3.2.0 i386 - DYNIX/ptx V1.3.1)
Config: 1.)hp720-hpux --gas (with some patches)
2.)???? (80386, BSD syntax)
compiler input:
test.cc:
----------------------- cut here --------------------------
extern double pow(double,int*);
extern "C" {
extern int printf(char*,...);
extern double pow(double, double);
}
int main()
{
printf("pow:%g\n",pow(2.0,3.0));
return 0;
}
----------------------- cut here --------------------------
compiler output:
1.)
-------------------------------
$ gcc -v test.cc
Reading specs from /local/cross/share/gcc-sequent386_ptx-lib/specs
gcc version 2.2.2
/local/cross/sequent386_ptx/lib/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dunix -Di386 -Di387 -D_SEQUENT_ -D__unix__ -D__i386__ -D__i387__ -D___SEQUENT___ -D__unix -D__i386 -D__i387 -D___SEQUENT_ test.cc /usr/tmp/cca08578.i
GNU CPP version 2.2.2 (80386, BSD syntax)
/local/cross/sequent386_ptx/lib/cc1plus /usr/tmp/cca08578.i -quiet -dumpbase test.cc -version -o /usr/tmp/cca08578.s
GNU C++ version 2.2.2 (80386, BSD syntax) compiled by GNU C version 2.2.2.
test.cc: In function `int main ()':
test.cc:10: incompatible types in argument passing
--------------------------------------
2.)
-------------------------------------
Reading specs from /users/late/gnu/lib/gcc-lib/hp720-hpux/2.2.2/specs
gcc version 2.2.2
/users/late/gnu/lib/gcc-lib/hp720-hpux/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOURCE -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__ -D__unix__ -D___HPUX_SOURCE__ -D__hppa -D__hp9000s800 -D__hp9000s800 -D__hp9k8 -D__PWB -D__hpux -D__unix -D___HPUX_SOURCE test.cc /usr/tmp/cca26858.i
GNU CPP version 2.2.2 (hp9000s800)
/users/late/gnu/lib/gcc-lib/hp720-hpux/2.2.2/cc1plus /usr/tmp/cca26858.i -quiet -dumpbase test.cc -version -o /usr/tmp/cca26858.s
GNU C++ version 2.2.2 (hp9000s800) compiled by GNU C version 2.2.2.
test.cc: In function `int main ()':
test.cc:10: incompatible types in argument passing
--------------------------------------
It seems that the compiler wants to call pow(double,int*) instead of pow(double,double).
The bug disappears, if you move the "extern "C"{...}" block in front of the other prototype.
If somebody knows a patch for this problem please send it to me (via email!)
Bernd Anhdupl
(anhaeupl@late.e-technik.uni-erlangen.de)
Technical Details
Message-ID:
<9209091541.AA26923@late.e-technik.uni-erlangen.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!late.e-technik.uni-erlangen.DE!anhaeuplShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!late.e-technik.uni-erlangen.DE!anhaeupl From: anhaeupl@late.e-technik.uni-erlangen.DE (Bernd Anhaeupl) Subject: gcc 2.2.2 calls wrong overloaded function Message-ID: <9209091541.AA26923@late.e-technik.uni-erlangen.de> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 9 Sep 1992 19:41:02 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 56