home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / g / bug / 1854 < prev    next >
Encoding:
Text File  |  1992-11-20  |  2.9 KB  |  97 lines

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!miro.COM!anton
  3. From: anton@miro.COM (Jeff Anton)
  4. Subject: g++ 2.3.1 optimization bug
  5. Message-ID: <9211201859.AA02492@grail.miro.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: Gnus Not Usenet
  8. Distribution: gnu
  9. Date: Fri, 20 Nov 1992 18:59:06 GMT
  10. Approved: bug-g++@prep.ai.mit.edu
  11. Lines: 84
  12.  
  13. Here is a simple little program and problem.  When compiled with
  14. optimization, the hex manipulator has no effect.
  15.                 Jeff Anton
  16.                 anton@miro.com
  17. -----------
  18.  
  19. #include <iostream.h>
  20.  
  21. void
  22. foo(ostream *o) {
  23.     *o << o->flags() << endl;
  24.     *o << hex << o->flags() << endl;
  25.     *o << dec << o->flags() << endl;
  26. }
  27.  
  28. void
  29. bar(ostream &o) {
  30.     o << o.flags() << endl;
  31.     o << hex << o.flags() << endl;
  32.     o << dec << o.flags() << endl;
  33. }
  34.  
  35. int
  36. main(void)
  37. {
  38.     cout << cout.flags() << endl;
  39.     cout << hex << cout.flags() << endl;
  40.     cout << dec << cout.flags() << endl;
  41.  
  42.     foo(&cout);
  43.     bar(cout);
  44.  
  45.     cout << cout.flags() << endl;
  46.     cout << hex << cout.flags() << endl;
  47.     cout << dec << cout.flags() << endl;
  48. }
  49.  
  50.  
  51.  
  52. grail:anton[364]: g++ -v test.cc
  53. Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/specs
  54. gcc version 2.3.1
  55.  /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix test.cc /usr/tmp/cca02430.i
  56. GNU CPP version 2.3.1 (sparc)
  57.  /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/cc1plus /usr/tmp/cca02430.i -quiet -dumpbase test.cc -version -o /usr/tmp/cca02430.s
  58. GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
  59.  as -o /usr/tmp/cca024301.o /usr/tmp/cca02430.s
  60.  /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1 -L/usr/local/lib /usr/tmp/cca024301.o -lg++ -lgcc -lc -lgcc
  61. grail:anton[365]: a.out
  62. 536870918
  63. 20000006
  64. 536870918
  65. 84896
  66. 14ba0
  67. 84896
  68. 84896
  69. 14ba0
  70. 84896
  71. 536870918
  72. 20000006
  73. 536870918
  74. grail:anton[366]: g++ -O2 -v test.cc
  75. Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/specs
  76. gcc version 2.3.1
  77.  /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -D__OPTIMIZE__ test.cc /usr/tmp/cca02453.i
  78. GNU CPP version 2.3.1 (sparc)
  79.  /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/cc1plus /usr/tmp/cca02453.i -quiet -dumpbase test.cc -O2 -version -o /usr/tmp/cca02453.s
  80. GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
  81.  as -o /usr/tmp/cca024531.o /usr/tmp/cca02453.s
  82.  /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1/ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.3.1 -L/usr/local/lib /usr/tmp/cca024531.o -lg++ -lgcc -lc -lgcc
  83. grail:anton[367]: a.out
  84. 536870918
  85. 536870918
  86. 536870918
  87. 84896
  88. 84928
  89. 84880
  90. 84896
  91. 84928
  92. 84880
  93. 536870918
  94. 536870918
  95. 536870918
  96.  
  97.