[gnu.g++.bug] apparent bug involving g++-1.34.2 -fno-strict-prototype and gdb.3.1.2

whm@sunquest.UUCP (Bill Mitchell) (05/10/89)

I was experimenting with container classes in libg++-1.34.0 and I came across
a program that when compiled with "g++ -g -fno-strict-prototype" (version
1.34.2) makes gdb.3.1.2 core dump upon the command "break main".

This script reproduces the problem:

#!/bin/sh
cat >bug.cc <<X
#include <std.h>
#include "String.h"
#include "StringList.h"
StringListNode NilStringListNode;
main()
{
}
X
genclass String val List
g++ -v -g bug.cc
gdb.3.1.2 a.out <<X
break main
q
X
g++ -v -g -fno-strict-prototype bug.cc
gdb.3.1.2 a.out <<X
break main
q
X

Here's what running the script with "sh -x" produces:

+ cat 
#include <std.h>
#include "String.h"
#include "StringList.h"
StringListNode NilStringListNode;
main()
{
}
+ genclass String val List 
+ g++ -v -g bug.cc 
g++ version 1.34.2
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 bug.cc /tmp/cca14581.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca14581.cpp -quiet -dumpbase bug.cc -noreg -version -G -o /tmp/cca14581.s
GNU C++ version 1.34.2 (68k, MIT syntax) compiled by GNU C version 1.34.
 as -mc68020 /tmp/cca14581.s -o bug.o
 /usr/local/lib/gcc-ld++ -C -dc -dp -Bstatic /usr/local/lib/crt0+.o /usr/lib/Mcrt1.o bug.o -lg++ /usr/local/lib/gcc-gnulib -lg -lc
+ gdb.3.1.2 a.out 
break main
q
GDB 3.1.2, 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 /a/whm/nw/flow/bug/a.out...done.
Type "help" for a list of commands.
(gdb) Breakpoint 1 at 0x2112: file bug.cc, line 7.
(gdb) + g++ -v -g -fno-strict-prototype bug.cc 
g++ version 1.34.2
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 bug.cc /tmp/cca14593.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca14593.cpp -quiet -dumpbase bug.cc -fno-strict-prototype -noreg -version -G -o /tmp/cca14593.s
GNU C++ version 1.34.2 (68k, MIT syntax) compiled by GNU C version 1.34.
/usr/local/lib/g++-include/File.h:162: warning: inline declaration ignored for function with `...'

[ Lots more instances of the same warning deleted -- whm ]

StringList.h:163: warning: inline declaration ignored for function with `...'

[ Lots more instances of the same warning deleted -- whm ]

 as -mc68020 /tmp/cca14593.s -o bug.o
 /usr/local/lib/gcc-ld++ -C -dc -dp -Bstatic /usr/local/lib/crt0+.o /usr/lib/Mcrt1.o bug.o -lg++ /usr/local/lib/gcc-gnulib -lg -lc
+ gdb.3.1.2 a.out 
break main
q
GDB 3.1.2, 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 /a/whm/nw/flow/bug/a.out...done.
Type "help" for a list of commands.
(gdb) ../protobug.sh: 14601 Memory fault - core dumped

tiemann@YAHI.STANFORD.EDU (Michael Tiemann) (05/15/89)

This is a problem with GDB 3.1.2: if you set a breakpoint at a member
function which has `...' at the end (such as when compiled with
-fno-strict-prototype), GDB 3.1.2 will lose.  I will fix it, but I
don't have time to do so immediately.

Michael