From: steinarb@idt.unit.no (Steinar Bang)
Subject: gdb-4.4 coredumps without -O/-O2 flag on C++ comp. w/gcc 2.1
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 15 Apr 1992 22:43:58 GMT

PLATFORM:
 Sparc/SunOS 4.something
 Gcc 2.1
 Libg++ 2.0
 Gdb 4.4
 Gnu Emacs 18.58
 InterViews 3.0.1 with Mike Stump's patches version 1.5 (changed to use .c
            extensions on source files and the g++ command)
            Patches or binaries can be provided
    interviews.stanford.edu:/pub/3.0.1.tar.Z
 Program debugging:
    interviews.stanford.edu:/pub/contrib/schem.tar.Z
             patches to make schem compile can be provided

The bug does *not* occur with the same files compiled on:
  DecStation/Ultrix 4.2, Gcc 2.0, libg++ 2.0, gdb 4.4

SYMPTOMS:
 o gdb coredumps when I attempt to set a breakpoint in a file that has
   not been compiled with the flag combination -g -O or the
   combination -g -O2

This occurs whether I attempt to set the breakpoint with C-x SPC, M-x
gdb-break, or breaking in a function (ex. break main)

The symptoms are always the same:
 o Gdb don't echo the breakpoint setting
 o Gdb don't accept any commands
 o After a while it coredumps with a very large core file

The error message is:
Inferior Gdb segmentation fault (core dumped)

This occurs when:
  schem source files compiled with:
     -g (no opt),
     -g -O -fno-inline
  libUnidraw.a and libIV.a compiled with:
      without -g and without any optimization
      -g
      -g -O2

This does *not* occur when:
  schem source files compiled with:
     -g -O
     -g -O2
  libUnidraw.a and libIV.a compiled with:
      without -g and without any optimization
      -g
      -g -O2

FOR YOUR TESTING:
 Suggestion:
  I can give you the schem directories containing an offending a.out
  executable (I can put this out for anonymous ftp).

  Mail me if you want me to do this.

  This avoids the hassle of compiling InterViews

  Tell me which library you want it compiled with (library compiled
  with: -g, -g -O2, or no options).

FINAL WORDS:

I wondered if this was a bug in gdb, but according to the gdb texinfo doc:
   * If the debugger gets a fatal signal, for any input whatever, that
     is a GDB bug.  Reliable debuggers never crash.

So I guess it is...

- Steinar

-------Make output from making an offending a.out------
cd /home/fenris/d/steinarb/src/schem/SUN4/
make -k
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../main.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmcmds.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmcomps.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmcreator.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmdialogs.c
../scmdialogs.c: In method `void  VMessage::Reconfig ()':
../scmdialogs.c:346: warning: initialization of non-`const *' pointer from `const *'
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmed.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmkybd.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmmanips.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmnet.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmpal.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmrubs.c
../scmrubs.c: In method `void  RubberWire::Orthonormalize (int, int)':
../scmrubs.c:61: warning: implicit declaration of function `abs'
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmtools.c
../scmtools.c: In method `class Manipulator* InstanceTool::CreateManipulator (class Viewer*, class ivEvent&, class ivTransformer* (=  0 ))':
../scmtools.c:219: warning: implicit declaration of function `abs'
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmtransfns.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmtruth.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmvars.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmvarviews.c
g++ -g -I/local/lib/g++-include    -Dcplusplus_2_0 -Div2_6_compatible   -I/home/fenris/d/steinarb/interviews/include/InterViews/2.6 -I/home/fenris/d/steinarb/interviews/include/IV-look/2.6 -I/home/fenris/d/steinarb/interviews/include -I/local/include  -pipe  -c ../scmcatalog.c
g++ -g -I/local/lib/g++-include    -o a.out main.o  scmcmds.o  scmcomps.o  scmcreator.o  scmdialogs.o  scmed.o  scmkybd.o  scmmanips.o  scmnet.o  scmpal.o  scmrubs.o  scmtools.o  scmtransfns.o  scmtruth.o  scmvars.o  scmvarviews.o  scmcatalog.o  -L/home/fenris/d/steinarb/interviews/lib/SUN4 -lUnidraw  -lIV -L/local/lib -lXext -lX11 -lm  

Compilation finished at Wed Apr 15 20:34:41

Newsgroups: gnu.gdb.bug