jj@idris.id.dk (Jesper Joergensen [ris]) (02/14/90)
Here is another BUG report, it seems that I am having a bad day ...
ENVIRONMENT
===========
Compiler: G++ version 1.36.4 (configured for 'vax')
Back-end: GCC version 1.36.93 (configured for 'vax')
System: Ultrix version 2.2-1 Worksystem v1.1 System #2
Machine: DEC VAXstation 2000
SUMMARY
=======
The compiler gets a fatal signal 4 (illegal instruction) when using the
default memberwise semantics of operator=. It seems that abort() is
called directly from the compiler code (confer GDB session at end).
EXAMPLE PROGRAM
===============
***** START *****
class Base {
int member ;
public:
Base(int member1) { member = member1 ; }
Base(const Base &x) { member = x.member ; }
Base operator=(const Base &x) { member = x.member ; return *this ; }
} ;
class Derived : Base {
public:
Derived(int member1) : Base(member1) { }
} ;
int main(int argc, const char *argv) {
Derived x(2) ;
Derived y(3) ;
Derived z(x) ; // memberwise initialisation works OK
y = z ; // memberwise assignment causes abort()
return 0 ;
}
****** END ******
The offending line is the one containing 'y = z ;'. If is commented out th
compilation succeeds with correct code, hence the default memberwise
initialisation of 'z' with 'x' in 'Derived z(x) ;' seems to be OK.
GDB LISTING
===========
Below is an emacs-logged GDB session, which should help you locate the call to
abort() from within the compiler's code. It seems that one of your invariants
has blown.
***** GDB SESSION START *****
% pwd
/usr/users/jj/GNUmail/g++errs
% gdb ~/install/g++/cc1plus
GDB 3.4, Copyright (C) 1989 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/users/jj/install/g++/cc1plus...done.
Type "help" for a list of commands.
(gdb) set args memwise.E -quiet -dumpbase memwise.cc -mgnu -version -o memwise.s
(gdb) info files
Executable file "/usr/users/jj/install/g++/cc1plus".
No core dump file
Symbols from "/usr/users/jj/install/g++/cc1plus".
Text segment in executable from 0x0 to 0x92400.
Data segment in executable from 0x92400 to 0x94800.
(gdb) dir ~/install/g++
Source directories searched: /usr/users/jj/GNUmail/g++errs:/usr/users/jj/install/g++
(gdb) run
Starting program: /usr/users/jj/install/g++/cc1plus memwise.E -quiet -dumpbase memwise.cc -mgnu -version -o memwise.s
GNU C++ version 1.36.4 (based on GCC 1.36.93) (vax) compiled by GNU C version 1.36.93.
default target switches: -munix
Program received signal 4, Illegal instruction
0x8fdea in abort ()
(gdb) info stac
#0 0x8fdea in abort ()
#1 0x64eff in copy_rtx_and_substitute (...) (...)
#2 0x6562f in copy_rtx_and_substitute (...) (...)
#3 0x64a23 in expand_inline_function (...) (...)
#4 0x517d9 in expand_call (...) (...)
#5 0x4fc0c in expand_expr (...) (...)
#6 0x537ce in expand_expr_stmt (...) (...)
#7 0x36af1 in expand_cplus_expr_stmt (...) (...)
#8 0xa633 in yyparse (...) (...)
#9 0x435a5 in compile_file (name=(char *) 0x7fffe26a "memwise.E") (toplev.c line 1250)
#10 0x44b00 in main (argc=9, argv=(char **) 0x7fffe1e8, envp=(char **) 0x7fffe210) (toplev.c line 2238)
(gdb) list *0x64eff
Reading in symbols for integrate.c...done.
0x64eff is in copy_rtx_and_substitute (integrate.c, line 1479).
1474 If it does, it may not be the same mode as `inline_target'
1475 because SUBREG is not required for hard regs.
1476 If not, adjust mode of inline_target to fit the context. */
1477 if (inline_target == 0)
1478 abort ();
1479 if (mode == GET_MODE (inline_target))
1480 return inline_target;
1481 return gen_rtx (SUBREG, mode, inline_target, 0);
1482 }
1483 if (regno == FRAME_POINTER_REGNUM)
(gdb)
****** GDB SESSION END ******
The rest is up to you, good luck !!
Jesper Jorgensen jj@idris.id.dk
Research associate
Department of Computer Science
Technical University of Denmark
DK-2800 Lyngby
DENMARK