home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / g / bug / 2328 < prev    next >
Encoding:
Text File  |  1993-01-25  |  2.2 KB  |  70 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!nlr.NL!hogend
  2. From: hogend@nlr.NL (hogendoorn r.a.)
  3. Newsgroups: gnu.g++.bug
  4. Subject: gcc-2.3.3 prototyping bug on MIPS
  5. Date: 25 Jan 1993 21:01:12 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 57
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-g++@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <9301251334.AA00607@uxmain.nlr.nl>
  12.  
  13. Consider the following simple program:
  14. -------------------------------------------------------------
  15.                 // Chapter 9 - Program 6
  16. #include <ostream.h>
  17.  
  18. template<class ANY_TYPE>
  19. ANY_TYPE maximum(ANY_TYPE a, ANY_TYPE b)
  20. {
  21.    return (a > b) ? a : b;
  22. }
  23.  
  24. int
  25. main (void) {
  26.    int x = 12;
  27.    int y = -7;
  28.    float z = 3.1415;
  29.    char ch = 'A';
  30.  
  31.    cout << maximum(x, y) << endl;
  32.    cout << maximum(-34, y) << endl;
  33.    cout << maximum(z, float(y)) << endl;
  34.    cout << maximum(z, float(x)) << endl;
  35.    cout << maximum(ch, 'X') << endl;
  36. }
  37.  
  38.  
  39. // Result of execution
  40.  
  41. //       12
  42. //       -7
  43. //    3.141
  44. //   12.000
  45. // X
  46. -----------------------------------------------------------
  47. This compiles and runs fine with gcc-2.2.2.
  48. With gcc-2.3.3 this generates the following errors:
  49.  
  50. ~rdps/bin/g++ -v -save-temps templat1.C -o tt
  51. ...... cpp stuff omitted
  52.  /home/nlr/rdps/lib/gcc-lib/mips-sysv/2.3.3/cc1plus templat1.i -quiet -dumpbase templat1.cc -version -o templat1.s
  53. GNU C++ version 2.3.3 [AL 1.1, MM 33] RISC-OS System V Mips compiled by GNU C version 2.3.3.
  54.  as -nocpp -EB -v -o templat1.o templat1.s
  55. /usr/lib/cmplrs/cc/as0 -v -G 8 -EB -g0 -O1 templat1.s -o /tmp/hogend/ctmaa27274 -t /tmp/hogend/ctmsta27274 
  56. as0: main maximum maximum 
  57. as0: Error: templat1.C, line 6: .ent must precede the definition of the symbol maximum
  58. as0: Error: templat1.C, line 6: Conflicting definition of symbol maximum
  59. maximum 
  60. as0: Error: templat1.C, line 6: .ent must precede the definition of the symbol maximum
  61. as0: Error: templat1.C, line 6: Conflicting definition of symbol maximum
  62.  
  63. 0.02u 0.12s 0:00.7 20%
  64.  
  65. Upon examination of the .s files for gcc-2.2.2 and gcc-2.3.3, it appears
  66. that gcc-2.2.2 generates three entrypoints: maximum__Fff, maximum__Fii and
  67. maximum__Fcc, whereas gcc-2.3.3 generates three times: maximum, which is
  68. obviously an error.
  69.  
  70.