Subject: bin/4490: g++ fails on "cout << hex;"
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ingolf@mipool.uni-jena.de>
List: netbsd-bugs
Date: 11/15/1997 00:47:56
>Number:         4490
>Category:       bin
>Synopsis:       g++ does not compile "cout << hex;" correctly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 14 15:50:01 1997
>Last-Modified:
>Originator:     Ingolf Koch
>Organization:

Ingolf Koch         http://www.minet.uni-jena.de/~ingolf/
FSU Jena, Institut fuer Angewandte Mathematik, 07740 Jena
>Release:        NetBSD-current, gnu src of 971113
>Environment:
System: NetBSD maus.rz.uni-jena.de 1.3_ALPHA NetBSD 1.3_ALPHA (MAUS) #1: Tue Nov 11 00:24:09 MET 1997 ingolf@maus.rz.uni-jena.de:/usr/src/sys/arch/amiga/compile/MAUS amiga

>Description:
	g++ does not recognize the dec, hex, ... modifiers for streams
	correctly and emits an "Undefined symbol" error message (see below).
	So you cannot switch the base for integers.
	With 1.2.1 this worked well.

    Maybe this PR should better be in category "lib". I don't know.
>How-To-Repeat:
% cat testbase.cc
#include <iostream.h>

int main() {
    cout << hex << 42 << dec << 42 << endl;
    return 0;
}

% g++ -v testbase.cc -o testbase
 /usr/bin/cc -v testbase.cc -o testbase -lg++ -lstdc++ -lm
gcc version 2.7.2.2+myc1
 /usr/libexec/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2
	-D__cplusplus -D__GNUC_MINOR__=7 -Dunix -Dm68k -Dmc68000
	-Dmc68020 -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__ -D__unix__
	-D__m68k__ -D__mc68000__ -D__mc68020__ -D__NetBSD__
	-D__KPRINTF_ATTRIBUTE__ -D__unix -D__m68k -D__mc68000
	-D__mc68020 -Asystem(unix) -Asystem(NetBSD) -Acpu(m68k)
	-Amachine(m68k) -D__HAVE_68881__ -D__HAVE_FPU__
	testbase.cc /var/tmp/cc02234a.ii
GNU CPP version 2.7.2.2+myc1 (68k, MIT syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/include
End of search list.
 /usr/libexec/cc1plus /var/tmp/cc02234a.ii -quiet -dumpbase testbase.cc
	-version -o /var/tmp/cc02234a.s
GNU C++ version 2.7.2.2+myc1 (68k, MIT syntax) compiled by GNU C
	version 2.7.2.2+myc1.
 as -o /var/tmp/cc02234a1.o /var/tmp/cc02234a.s
 ld -e start -dc -dp -o testbase /usr/lib/crt0.o -L/usr/libexec
	/var/tmp/cc02234a1.o -lg++ -lstdc++ -lm -lgcc -lc -lgcc

/var/tmp/cc02234a1.o: Undefined symbol `_dec__FR3ios' referenced from
	text segment
/var/tmp/cc02234a1.o: Undefined symbol `_hex__FR3ios' referenced from
	text segment

Note that the "endl" is recognized well.
>Fix:
    No idea.
>Audit-Trail:
>Unformatted: