🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1114

g++ 2.3.1 still calls wrong overloaded function

#1114
From: Bernd Anhaeupl
Date: Mon, 09 Nov 1992 19:02
58 lines
3223 bytes
The following bug ___is____ still in gcc 2.3.1, so here is only a repost of the 
original gcc 2.2.2 bug report.  

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 Anhaeupl
(anhaeupl@late.e-technik.uni-erlangen.de)
Technical Details
Message-ID: <9211091702.AA19300@late.e-technik.uni-erlangen.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!late.e-technik.uni-erlangen.DE!anhaeupl

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!late.e-technik.uni-erlangen.DE!anhaeupl
From: anhaeupl@late.e-technik.uni-erlangen.DE (Bernd Anhaeupl)
Subject: g++ 2.3.1 still calls wrong overloaded function
Message-ID: <9211091702.AA19300@late.e-technik.uni-erlangen.de>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 9 Nov 1992 19:02:29 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 60