sps@magoo.mcnc.org (Stephen Schaefer) (12/24/88)
Background:
On a 4.3BSD Vax 8650, I have g++ 1.31 compiled with gcc 1.31, with
fixes by Michael Tiemann to g++/cplus-init.c, g++/expr.c, g++/stmt.c,
and reverse_condition made extern in gcc/jump.c. I get a segmentation
violation with the following program. std.h and String.h are as
distributed with libg++ 1.25. gcc-c++ wasn't producing any core file,
although it did produce the ``Segmentation violation'' message, and
g++ was reporting that gcc-c++ was killed with a fatal signal. The
following change to the g++ code produced a core file for me:
*** /tmp/,RCSt1010881 Thu Dec 22 17:53:20 1988
--- toplev.c Thu Dec 22 16:16:24 1988
***************
*** 1881,1884 ****
--- 1881,1885 ----
{
error ("Segmentation violation");
signal (SIGSEGV, SIG_DFL);
+ (void) kill(getpid(), SIGSEGV);
}
Here is a script of the problem:
Script started on Fri Dec 23 12:11:22 1988
simon:sps:161 cat test.cc
# include "std.h"
# include "String.h"
void
doo()
{
String version; // if this is gone ...
char ch;
switch(ch)
{
case 'v':
String wh; // ... or this is gone, it works.
break;
}
}
simon:sps:162 g++ -v -c test.cc
g++ version 1.31.0
/usr/local/std/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dvax -Dunix test.cc /tmp/cc012457.cpp
GNU CPP version 1.31.0
/usr/local/std/lib/gcc-c++ /tmp/cc012457.cpp -quiet -dumpbase test.cc -noreg -version -o /tmp/cc012457.s
GNU C++ version 1.31.0 (vax) compiled by GNU C version 1.31.
In function doo ():
test.cc:15: Segmentation violation
g++: Program c++ got fatal signal 11.
simon:sps:163 gdb /usr/local/std/lib/gcc-c++ core
GDB 2.5, 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/local/std/lib/gcc-c++...done.
Type "help" for a list of commands.
(gdb) where
#0 0x34925 in fixup_gotos (stack_level=(rtx) 0x0, cleanup_list=(tree) 0x9ded4, first_insn=(rtx) 0x1e0360, dont_jump_in=1) (stmt.c line 680)
#1 0x35c2b in expand_end_bindings (vars=(tree) 0x1e2228, mark_ends=1, dont_jump_in=1) (stmt.c line 1646)
#2 0xcde2 in yyparse () (cplus-parse.y line 1728)
#3 0x136e in compile_file (name=(char *) 0x7fffe91c "/tmp/cc015029.cpp") (toplev.c line 1010)
#4 0x2c67 in main (argc=9, argv=(char **) 0x7fffe8a4, envp=(char **) 0x7fffe8cc) (toplev.c line 1824)
(gdb) quit
simon:sps:164
script done on Fri Dec 23 12:16:45 1988
--
Stephen P. Schaefer, Postmaster MCNC
sps@mcnc.org P.O. Box 12889
...!mcnc!sps RTP, NC 27709