🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

RS6000 G++ 2.2.2 bug

#107
From: Bruce Lee
Date: Wed, 22 Jul 1992 04:10
58 lines
1718 bytes
The following code causes an internal compilor error under
GCC (G++) version 2.2.2 on an RS6000.
The code works fine for g++ version 1.37 on an HP400.

The internal error only occurs if the word FATAL is defined.
In this case, the 2nd parameter to function func has a 
default argument of class DontCare.
Class DontCare has an inline  conversion operator to long,
so that the default argument should have a value of 0x80000000.

UNIX command line and display:

% g++ -o fatal fatal.cxx -DFATAL
/usr/local/bin/gcc: Internal compiler error: program cc1plus got fatal signal 11


program fatal.cxx:
-------------------------- cut here ----------------------
#include <stream.h>

class DontCare {
 public:
   DontCare (void ) {}
   operator long() { return 0x80000000L; }
   operator short() { return 0x8000; }
   operator char() { return 0x80; }
};

#ifdef FATAL
#define X    DontCare()
#else
#define X    0x80000000L
#endif

#define X2   DontCare()

void
func (long val, long val2 = X);  // internal error occurs on this line.


int
main (void )
{
   func (1);
   return 0;
}

void
func (long val, long val2)
{
   cout << "Val is " << val;
   if (val2 != X2) {
      cout << "\nVal2 is " << val2;
   }
   cout << "\n";
}

---------------------------- end of code ---------------------
Technical Details
Message-ID: <9207221610.AA07497@florida.et.byu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bones.et.byu.edu!lee

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!bones.et.byu.edu!lee
From: lee@bones.et.byu.edu (Bruce Lee)
Subject: RS6000 G++ 2.2.2 bug
Message-ID: <9207221610.AA07497@florida.et.byu.edu>
Sender: gnulists@ai.mit.edu
Organization: Brigham Young University, Provo UT USA
Date: Wed, 22 Jul 1992 04:10:21 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 60