[gnu.g++.bug] G++ 1.31 - Bugs

gautron@UUNET.UU.NET (Philippe Gautron) (12/22/88)

version: G++ 1.31.0, GCC 1.31., libg++ 1.25.0
Machine: SUN 3/260, running SUN 0S 3.4

Configuration:	tm.h --> tm-sun3+.h
		md   --> m68k.md
		aux-output.c --> output.m68k.c

Bug fixes:	SUN3.README
		expr.c (article 244)
		stmt.c (article 245)

Symptoms:
	- libg++ compiles without -O, aborts with -0 (see also article 247)
	- libg++ tests: compilation aborts with test4.cc (signal 11)
	- ATT cfront 1.1: compiles (that's new!) but execution fails.

More about
1) libg++ test4.cc
------
[]/u2/gautron/GNU/usr/local/bin/g++ -B/u2/gautron/GNU/usr/local/lib/gcc- -I. -I/u2/gautron/GNU/usr/local/lib/g++-include -v -c test4.cc
g++ version 1.31.0
 /u2/gautron/GNU/usr/local/lib/gcc-cpp+ -v -I. -I/u2/gautron/GNU/usr/local/lib/g++-include -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix test4.cc /tmp/cca00819.cpp
GNU CPP version 1.31.0
 /u2/gautron/GNU/usr/local/lib/gcc-c++ /tmp/cca00819.cpp -quiet -dumpbase test4.cc -noreg -version -o /tmp/cca00819.s
GNU C++ version 1.31.0 (68k, MIT syntax) compiled by GNU C version 1.31.
In function struct Integer fibonacci (struct Integer):
test4.cc:35: Segmentation violation
/u2/gautron/GNU/usr/local/bin/g++: Program c++ got fatal signal 11.

[]gdb+ /u2/gautron/GNU/usr/local/lib/gcc-c++ core
gdb+ /u2/gautron/GNU/usr/local/lib/gcc-c++ core
GDB 2.5.4 (GNU C++ 1.22.0 compatible), Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /u2/gautron/GNU/usr/local/lib/gcc-c++...done.
Core file is from "gcc-c++".
Program terminated with signal 11, Segmentation fault.
Type "help" for a list of commands.
[gdb] bt
bt
#0  0x11e00 in chainon (op1=(tree) 0x1c98d4, op2=(tree) 0x1ce824) (tree.c line 777)
#1  0x169ae in poplevel (keep=1, reverse=1, functionbody=0) (cplus-decl.c line 735)
#2  0x5171a in expand_inline_function (fndecl=(tree) 0x14f948, parms=(tree) 0x1caa98, target=(rtx) 0x0, ignore=1, type=(tree) 0xd20ce, structure_value_addr=(rtx) 0x0) (integrate.c line 939)
#3  0x36c0c in expand_call (exp=(tree) 0x1cdee4, target=(rtx) 0x0, ignore=1, modifier=EXPAND_NORMAL) (expr.c line 4123)
#4  0x349ca in expand_expr (exp=(tree) 0x1cdee4, target=(rtx) 0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL) (expr.c line 2720)
#5  0x39c52 in expand_expr_stmt (exp=(tree) 0x1cdee4) (stmt.c line 929)
#6  0xa30b0 in expand_delete (type=(tree) 0x14dfac, addr=(tree) 0x1c6ea4, auto_delete=860270) (cplus-init.c line 2307)
#7  0x35a7e in expand_expr (exp=(tree) 0x1c6f14, target=(rtx) 0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL) (expr.c line 3294)
#8  0x3b08a in expand_cleanups (list=(tree) 0xce4e4, dont_do=(tree) 0x0) (stmt.c line 1902)
#9  0x3b0b6 in fixup_cleanups (list=(tree) 0xce4e4, before_jump=(rtx *) 0x1ca88c) (stmt.c line 1918)
#10 0x3965c in fixup_gotos (stack_level=(rtx) 0x0, cleanup_list=(tree) 0x0, first_insn=(rtx) 0x1c451c, dont_jump_in=0) (stmt.c line 696)
#11 0x3dc5e in fixup_parm_cleanups (after=(rtx) 0x1cd40c, before=(rtx) 0x1c5584, end=(rtx) 0x1cde20) (stmt.c line 3733)
#12 0x2138a in finish_function (call_poplevel=0) (cplus-decl.c line 6451)
#13 0xc790 in yyparse () (cplus-parse.y line 251)
#14 0x34b0 in compile_file (name=(char *) 0xefffde8 "/tmp/cca00819.cpp") (toplev.c line 1010)
#15 0x4d4e in main (argc=9, argv=(char **) 0xefffd78, envp=(char **) 0xefffda0) (toplev.c line 1824)


2) cfront:
gdb+ cfront core 
GDB 2.5.4 (GNU C++ 1.22.0 compatible), Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /usr.MC68020/corto2/gautron/TMP/cfront...Invalid symbol data: unknown symbol-type code `/' at symtab pos 182.
Core file is from "cfront".
Program terminated with signal 10, Bus error.
Type "help" for a list of commands.
[gdb] quit
[]
[]dbx cfront core
dbx cfront core
Reading symbolic information...
dbx: internal error: unexpected value 47 at line 1903 in file object.c
[]
[]cat table.s
....
.globl _new_key
_new_key:
	link a6,#-8
	moveb a6@(15),a6@(15)
	moveb a6@(19),a6@(19)
	movel a6@(8),sp@-
	clrl sp@-
	jbsr _name_PSname_PQI
	movel d0,a6@(-4)
	clrl sp@-
	movel a6@(-4),sp@-
	movel _ktbl,sp@-
	jbsr _insert_PStable_PSname_uQI
	movel d0,a6@(-8)
	movel a6@(-8),a0
	moveb a6@(15),a0@
	addw #20,sp
	movel a6@(-8),a0
	tstb a6@(19)
	jeq L165
	moveb a6@(19),d0
	jra L166
L165:
	moveb a6@(15),d0
L166:
	clrl d1
	moveb d0,d1
	movel d1,a0@(4)
	cmpb #143,a6@(15)
	jne L167
	moveb a6@(19),d0
	jra L168
L167:
	moveb a6@(15),d0
L168:
	clrl d1
	moveb d0,d1
	movel d1,d0
	asll #2,d0
	lea _keys,a0
	movel a6@(8),a0@(d0:l)
	pea 1:w
	movel a6@(-4),sp@-
	jbsr __$_name
	addqw #8,sp
L164:
	unlk a6
	rts
LC9:
	.ascii "Qr%n'sT missing\0"
...
[] cat norm2.s
...
.globl __$_expr
__$_expr:
	link a6,#0
	tstl a6@(8)
	jeq L77
	addql #1,_NFe
	movel a6@(8),a0
	movel _expr_free,a0@(8)
	movel a6@(8),_expr_free
	clrl a6@(8)
	tstl a6@(12)
	jeq L75
	movel a6@(8),sp@-
	jbsr ___builtin_delete
	addqw #4,sp
	jra L76
L75:
L76:
L77:
L74:
	unlk a6
	rts
	.even
...
.globl __$_name
__$_name:
	link a6,#0
	addqw #8,sp
	tstl a6@(8)
	jeq L138
	addql #1,_NFn
	movel a6@(8),a0
	movel _name_free,a0@(52)
	movel a6@(8),_name_free
	clrl a6@(8)
	movel a6@(12),sp@-
	movel a6@(8),sp@-
	jbsr __$_expr
L138:
L137:
	unlk a6
	rts
	.even


[]adb cfront core
core file = core -- program ``cfront''
SIGBUS 10: bus error
$C
__$_name() + 38

0x25E8E?
__$_name:
__$_name:       4e560000        =       addqw   #8,sp
:r
:r
# 1 ""

/* <<ATT cfront by G++>> */
breakpoint      _new_key+0x82:          pea     1:w
:s
:s
stopped at      _new_key+0x86:          movl    a6@(-4),sp@-
:s
:s
stopped at      _new_key+0x8a:          bsrl    __$_name
:s
:s
stopped at      __$_name:               linkw   a6,#0
:s
:s
stopped at      __$_name+4:             addqw   #8,sp
:s
:s
stopped at      __$_name+6:             tstl    a6@(8)
:s
:s
stopped at      __$_name+0xa:           beqs    __$_name+0x36
:s
:s
stopped at      __$_name+0xc:           addql   #1,_NFn:l
:s
:s
stopped at      __$_name+0x12:          movl    a6@(8),a0
:s
:s
stopped at      __$_name+0x16:          movl    _name_free:l,a0@(0x34)
:s
:s
stopped at      __$_name+0x1e:          movl    a6@(8),_name_free:l
:s
:s
stopped at      __$_name+0x26:          clrl    a6@(8)
:s
:s
stopped at      __$_name+0x2a:          movl    a6@(0xc),sp@-
:s
:s
stopped at      __$_name+0x2e:          movl    a6@(8),sp@-
:s
:s
stopped at      __$_name+0x32:          bsr     __$_expr
:s
:s
stopped at      __$_expr:               linkw   a6,#0
:s
:s
stopped at      __$_expr+4:             tstl    a6@(8)
:s
:s
stopped at      __$_expr+8:             beqs    __$_expr+0x3c
:s
:s
stopped at      __$_expr+0x3c:          unlk    a6
:s
:s
stopped at      __$_expr+0x3e:          rts
:s
:s
stopped at      __$_name+0x36:          unlk    a6
:s
:s
stopped at      __$_name+0x38:          rts
:s
:s
SIGBUS 10: bus error
stopped at      __$_name+0x38:          rts


Have a fun Michael.... 
    -- Philippe Gautron --

gautron@UUNET.UU.NET (Philippe Gautron) (12/23/88)

version: G++ 1.31.0, GCC 1.31., libg++ 1.25.0
Machine: SUN 3/260, running SUN 0S 3.4

Configuration:	tm.h --> tm-sun3+.h
		md   --> m68k.md
		aux-output.c --> output.m68k.c

Bug fixes:	SUN3.README
		expr.c (article 244)
		stmt.c (article 245)

Symptoms:
	- ATT cfront 1.1: compiles (that's new!) but execution fails.

My previous message was about execution of ATT cfront
Execution aborts with bus error. We continue to work at home, so
more information follows.

1) Consider this C++ session:

struct expr{
   ~expr();
};

struct name: expr{
  ~name();
};

name::~name()
{
	this = 0;
}

2) C code that C++ generates is:

int _name__dtor (_auto_this , _auto__free )
    struct name *_auto_this ;
    int _auto__free ;

{
    if (_auto_this ){ 
        _auto_this = 0 ;
        if (_auto_this )    // <-- Remember this test
             _expr__dtor ( (struct expr *)_auto_this , _auto__free ) ;
    }
}

3) C++ + gcc generation:

.globl __name__dtor
__name__dtor:
	link a6,#0
	tstl a6@(8)
	jeq L2
	clrl a6@(8)
	tstl a6@(8)            # <-- test
	jeq L3
	movel a6@(12),sp@-
	movel a6@(8),sp@-
	jbsr __expr__dtor
	addqw #8,sp
L3:
L2:
L1:
	unlk a6
	rts
4) G++ generation

.globl __$_name
__$_name:
	link a6,#0
	addqw #8,sp
	tstl a6@(8)
	jeq L2
	clrl a6@(8)		# where is the test ?
	movel a6@(12),sp@-
	movel a6@(8),sp@-
	jbsr __$_expr
L2:
L1:
	unlk a6
	rts

To michael:
People at home are hurry and says me: Vacation, what vacation...

-- Philippe Gautron and Yvon Gourhant --