From: ro@techfak.uni-bielefeld.DE (Rainer Orth)
Subject: g++ 2.2.2 ss-920925 produces invalid assembler output on Solaris 2.0
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 2 Oct 1992 07:20:40 GMT

I've just build gcc 2.2.2 ss-920925 on a SPARCstation ELC running Solaris 2.0.

The compiler has been configured using 

	configure --prefix=/vol/gnu sparc-sun-solaris2.0

and passed a full bootstrap, starting with Cygnus' gcc cygnus-2.0.2.

g++ -g sometimes produces invalid assembler output.

The following input file is a minimal test case to demonstrate the problem:

----- dwarfbug.ii ------------------------------------------------------------
class cmap {
public:
  void operator()(void);
};
inline void cmap::operator()(void)
{
}
------------------------------------------------------------------------------

If compiled as below,

ro@efeu 988 > gcc -v -g -S dwarfbug.ii
Reading specs from /vol/gnu/lib/gcc-lib/sparc-sun-solaris2.0/2.2.2/specs
gcc version 2.2.2
 /vol/gnu/lib/gcc-lib/sparc-sun-solaris2.0/2.2.2/cc1plus dwarfbug.ii -quiet -g -version -o dwarfbug.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.

it produces the following assembler source:

----- dwarfbug.s -------------------------------------------------------------
	.file	"dwarfbug.ii"

	.pushsection	".text"
.L_text_b:
	.popsection

	.pushsection	".data"
.L_data_b:
	.popsection

	.pushsection	".data1"
.L_data1_b:
	.popsection

	.pushsection	".rodata"
.L_rodata_b:
	.popsection

	.pushsection	".rodata1"
.L_rodata1_b:
	.popsection

	.pushsection	".bss"
.L_bss_b:
	.popsection

	.pushsection	".debug_sfnames"
.L_sfnames_b:
	.asciz	"/volumes/gnu/src/groff-1.06/"
	.popsection

	.pushsection	".line"
.L_line_b:
	.uaword	.L_line_e-.L_line_b
	.uaword	.L_text_b
	.popsection

	.pushsection	".debug_srcinfo"
.L_srcinfo_b:
	.uaword	.L_line_b
	.uaword	.L_sfnames_b
	.uaword	.L_text_b
	.uaword	.L_text_e
	.uaword	0xffffffff
	.popsection

	.pushsection	".debug_pubnames"
	.uaword	.L_debug_b
	.popsection

	.pushsection	".debug_aranges"
	.uaword	.L_debug_b
	.popsection

	.pushsection	".debug"
.L_debug_b:
.L_D1:
	.uaword	.L_D1_e-.L_D1
	.uahalf	0x11
	.uahalf	0x12
	.uaword	.L_D2
	.uahalf	0x38
	.asciz	"dwarfbug.ii"
	.uahalf	0x258
	.asciz	"GNU C++ 2.2.2"
	.uahalf	0x136
	.uaword	0x4
	.uahalf	0x111
	.uaword	.L_text_b
	.uahalf	0x121
	.uaword	.L_text_e
	.uahalf	0x106
	.uaword	.L_line_b
	.uahalf	0x1b8
	.asciz	"/volumes/gnu/src/groff-1.06"
	.uahalf	0x8006
	.uaword	.L_sfnames_b
	.uahalf	0x8016
	.uaword	.L_srcinfo_b
.L_D1_e:
	.popsection


	.pushsection	".debug"
.L_D3:
	.uaword	.L_D3_e-.L_D3
	.uahalf	0x14
	.uahalf	0x12
	.uaword	.L_D4
	.uahalf	0x38
	.asciz	"__cl"
	.uahalf	0x208
	.asciz	""
	.uahalf	0x142
	.uaword	.L_T68
	.L_E68 = .L_D3
.L_D3_e:
.L_D5:
	.uaword	.L_D5_e-.L_D5
	.uahalf	0x5
	.uahalf	0x12
	.uaword	.L_D6
	.uahalf	0x38
	.asciz	"this"
	.uahalf	0x83
	.uahalf	.L_t5_e-.L_t5
.L_t5:
	.byte	0x1
	.uaword	.L_T68
.L_t5_e:
	.L_E72 = .L_D5
.L_D5_e:
.L_D6:
	.uaword	0x4
.L_D4:
	.uaword	.L_D4_e-.L_D4
	.uahalf	0x13
	.uahalf	0x12
	.uaword	.L_D7
	.L_T68 = .L_D4
	.uahalf	0xb6
	.uaword	0x1
.L_D4_e:
.L_D8:
	.uaword	.L_D8_e-.L_D8
	.uahalf	0x14
	.uahalf	0x12
	.uaword	.L_D9
	.uahalf	0x38
	.asciz	"__cl"
	.uahalf	0x208
	.asciz	""
	.uahalf	0x142
	.uaword	.L_T68
	.L_E68 = .L_D8
.L_D8_e:
.L_D10:
	.uaword	.L_D10_e-.L_D10
	.uahalf	0x5
	.uahalf	0x12
	.uaword	.L_D11
	.uahalf	0x38
	.asciz	"this"
	.uahalf	0x83
	.uahalf	.L_t10_e-.L_t10
.L_t10:
	.byte	0x1
	.uaword	.L_T68
.L_t10_e:
	.L_E72 = .L_D10
.L_D10_e:
.L_D11:
	.uaword	0x4
.L_D9:
	.uaword	0x4
	.popsection

	.pushsection	".debug"
.L_D7:
	.uaword	.L_D7_e-.L_D7
	.align 4
.L_D7_e:
.L_D2:
	.popsection

	.pushsection	".text"
.L_text_e:
	.popsection

	.pushsection	".data"
.L_data_e:
	.popsection

	.pushsection	".data1"
.L_data1_e:
	.popsection

	.pushsection	".rodata"
.L_rodata_e:
	.popsection

	.pushsection	".rodata1"
.L_rodata1_e:
	.popsection

	.pushsection	".bss"
.L_bss_e:
	.popsection

	.pushsection	".line"
.L_line_last:
	.uaword	0x0
	.uahalf	0xffff
	.uaword	.L_text_e-.L_text_b
.L_line_e:
	.popsection

	.pushsection	".debug_srcinfo"
	.uaword	.L_line_last-.L_line_b
	.uaword	0xffffffff
	.popsection

	.pushsection	".debug_pubnames"
	.uaword	0x0
	.asciz	""
	.popsection

	.pushsection	".debug_aranges"
	.uaword	.L_text_b
	.uaword	.L_text_e-.L_text_b
	.uaword	.L_data_b
	.uaword	.L_data_e-.L_data_b
	.uaword	.L_data1_b
	.uaword	.L_data1_e-.L_data1_b
	.uaword	.L_rodata_b
	.uaword	.L_rodata_e-.L_rodata_b
	.uaword	.L_rodata1_b
	.uaword	.L_rodata1_e-.L_rodata1_b
	.uaword	.L_bss_b
	.uaword	.L_bss_e-.L_bss_b
	.uaword	0x0
	.uaword	0x0
	.popsection
	.ident	"GCC: (GNU) 2.2.2"
------------------------------------------------------------------------------

This makes as barf about redefined symbols:

ro@efeu 989 > gcc -v -c dwarfbug.s
Reading specs from /vol/gnu/lib/gcc-lib/sparc-sun-solaris2.0/2.2.2/specs
gcc version 2.2.2
 /usr/ccs/bin/as -V -Qy -s -o dwarfbug.o dwarfbug.s
/usr/ccs/bin/as: C Development Set  (CDS) SPARCompilers 2.0 18 May 1992
/usr/ccs/bin/as: "dwarfbug.s", line 135: error: redefinition of symbol ".L_E68"
/usr/ccs/bin/as: "dwarfbug.s", line 150: error: redefinition of symbol ".L_E72"
gcc: dwarfbug.o: No such file or directory

The problem vanishes if the source is compiled without -g or inline is
omitted from the operator definition.

-----------------------------------------------------------------------------
Rainer Orth, Technical Computer Science, University of Bielefeld

Internet: ro@TechFak.Uni-Bielefeld.DE


Newsgroups: gnu.g++.bug