[gnu.g++.bug] Bug in g++

patrick@cos.com (Patrick Steranka) (12/03/89)

>From uunet!lurch.Stanford.EDU!tiemann Thu Nov 30 14:52:28 1989
>Date: Thu, 30 Nov 89 10:48:10 PST
>From: uunet!lurch.stanford.edu!tiemann (Michael Tiemann)
>To: patrick@cos.com
>Subject: Can you define global variables that are of a type "class"
>
>Send me the code that causes the error, and tell me what machine you
>are using.  And yes, you should send GNU C++ bug reports to
>bug-g++@prep.ai.mit.edu.  

Michael, et al.,

	I have found a bug and want to report it.  The bug is:
"You can't define global variables in C++, but you should be able to."
The bug can be reproduced as follows:

==============================   File: ex5.cc  ==============================
#include <stream.h>
#include <String.h>

String astring;
 
main(int argc, char* argv[])
{
 
    astring = "This is a test";
    cout << "astring = " << astring << "\n";
}
==============================   File: ex5.cc  ==============================

This was compiled on a SUN 3/280 running SUN OS 3.5.
Here is the output from the compilation:

cd /usr.MC68020/zulu/patrick/test/c++/
make -k ex5
g++ -o ex5 -g -v ex5.cc
gcc version 1.36.1- (based on GCC 1.36)
 /usr/local/lib/gnu/gcc/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 ex5.cc /usr/tmp/cca21637.cpp
GNU CPP version 1.36
 /usr/local/lib/gnu/gcc/gcc-cc1plus /usr/tmp/cca21637.cpp -quiet -dumpbase ex5.cc -g -version -o /usr/tmp/cca21637.s
GNU C++ version 1.36.1 (based on GCC 1.36) (68k, MIT syntax) compiled by GNU C version 1.36.
default target switches: -m68020 -mc68020 -m68881 -mbitfield
 as -mc68020 -o ex5.o /usr/tmp/cca21637.s
as: error (/usr/tmp/cca21637.s:568): Invalid operand
as: error (/usr/tmp/cca21637.s:595): Invalid operand
g++: ex5.o: No such file or directory
*** Error code 1
make: Fatal error: Target `ex5' not remade because of errors

Compilation exited abnormally with code 1 at Sat Dec  2 15:02:45

tiemann@LURCH.STANFORD.EDU (Michael Tiemann) (12/03/89)

You must use the GNU assembler (which is stated in the README of
the distribution).  If you do not, then you must define
FASCIST_ASSEMBLER, and use techniques of your own devising for
initialization of global variables by constructors.  Programs
like "collect" and "collect2", also part fo the distribution
can help with this, but I cannot see any reason why you would want
to use these with the GNU assembler available.  It is twice as fast
as the standard UNIX assembler, and takes less memory.  Install GAS
and try again.

Michael