Article View: gnu.g++.bug
Article #1416gcc-2.3.3 prototyping bug on MIPS
From: hogendoorn r.a.
Date: Tue, 26 Jan 1993 02:01
Date: Tue, 26 Jan 1993 02:01
56 lines
2302 bytes
2302 bytes
Consider the following simple program:
-------------------------------------------------------------
// Chapter 9 - Program 6
#include <ostream.h>
template<class ANY_TYPE>
ANY_TYPE maximum(ANY_TYPE a, ANY_TYPE b)
{
return (a > b) ? a : b;
}
int
main (void) {
int x = 12;
int y = -7;
float z = 3.1415;
char ch = 'A';
cout << maximum(x, y) << endl;
cout << maximum(-34, y) << endl;
cout << maximum(z, float(y)) << endl;
cout << maximum(z, float(x)) << endl;
cout << maximum(ch, 'X') << endl;
}
// Result of execution
// 12
// -7
// 3.141
// 12.000
// X
-----------------------------------------------------------
This compiles and runs fine with gcc-2.2.2.
With gcc-2.3.3 this generates the following errors:
~rdps/bin/g++ -v -save-temps templat1.C -o tt
...... cpp stuff omitted
/home/nlr/rdps/lib/gcc-lib/mips-sysv/2.3.3/cc1plus templat1.i -quiet -dumpbase templat1.cc -version -o templat1.s
GNU C++ version 2.3.3 [AL 1.1, MM 33] RISC-OS System V Mips compiled by GNU C version 2.3.3.
as -nocpp -EB -v -o templat1.o templat1.s
/usr/lib/cmplrs/cc/as0 -v -G 8 -EB -g0 -O1 templat1.s -o /tmp/hogend/ctmaa27274 -t /tmp/hogend/ctmsta27274
as0: main maximum maximum
as0: Error: templat1.C, line 6: .ent must precede the definition of the symbol maximum
as0: Error: templat1.C, line 6: Conflicting definition of symbol maximum
maximum
as0: Error: templat1.C, line 6: .ent must precede the definition of the symbol maximum
as0: Error: templat1.C, line 6: Conflicting definition of symbol maximum
0.02u 0.12s 0:00.7 20%
Upon examination of the .s files for gcc-2.2.2 and gcc-2.3.3, it appears
that gcc-2.2.2 generates three entrypoints: maximum__Fff, maximum__Fii and
maximum__Fcc, whereas gcc-2.3.3 generates three times: maximum, which is
obviously an error.
Technical Details
Message-ID:
<9301251334.AA00607@uxmain.nlr.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!nlr.NL!hogendShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!nlr.NL!hogend From: hogend@nlr.NL (hogendoorn r.a.) Newsgroups: gnu.g++.bug Subject: gcc-2.3.3 prototyping bug on MIPS Date: 25 Jan 1993 21:01:12 -0500 Organization: GNUs Not Usenet Lines: 57 Sender: daemon@cis.ohio-state.edu Approved: bug-g++@prep.ai.mit.edu Distribution: gnu Message-ID: <9301251334.AA00607@uxmain.nlr.nl>