Thread View: gnu.g++.bug
1 messages
1 total messages
Started by hogendoorn r.a.
Tue, 26 Jan 1993 02:01
gcc-2.3.3 prototyping bug on MIPS
Author: 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads