[gnu.g++.bug] G++ 1.27.0 aborts

cooper@gecrux.steinmetz.ge.com (Clark Cooper) (10/29/88)

System:		G++ 1.27.0
Hardware:	Sun 3/50
OS:		SunOS 3.5
Configuration:	tm-sun3.h

Symptoms:
	G++ aborts when compiling a call to a member function that has the
same name as a local variable.

Script:
=====================
Script started on Fri Oct 28 10:55:17 1988
gecrux% cat ok.cc
struct aa {
  int xx();
};

class bb : public aa {
  int xx();
};

int bb::xx () {
  int blah;
  blah = aa::xx();
  return blah;
}
gecrux% g++ -v -g -O -S ok.cc
g++ version 1.27.0
 /usr/local/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ ok.cc /tmp/cca07921.cpp
GNU CPP version 1.27.0
 /usr/local/lib/gcc-c++ /tmp/cca07921.cpp -quiet -dumpbase ok.cc -opt -version -G -o ok.s
GNU C++ version 1.27.0 (68k, MIT syntax) compiled by GNU C version 1.28.
gecrux% cat aborts.cc
struct aa {
  int xx();
};

class bb : public aa {
  int xx();
};

int bb::xx () {
  int xx;
  xx = aa::xx();
  return xx;
}
gecrux% g++ -v -g -O -S aborts.cc
g++ version 1.27.0
 /usr/local/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ aborts.cc /tmp/cca07925.cpp
GNU CPP version 1.27.0
 /usr/local/lib/gcc-c++ /tmp/cca07925.cpp -quiet -dumpbase aborts.cc -opt -version -G -o aborts.s
GNU C++ version 1.27.0 (68k, MIT syntax) compiled by GNU C version 1.28.
/usr/sculptorq/gnu/src/g++/g++: Program c++ got fatal signal 6.
gecrux% gdb+ /usr/sculptorq/gnu/gcc-c++ core
GDB 2.8.0 (GNU C++ 1.27.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/sculptorq/gnu/gcc-c++...done.
Core file is from "gcc-c++".
Program terminated with signal 6, IOT trap.
Type "help" for a list of commands.
(gdb+) bt
#0  0x7bf90 in kill ()
#1  0x655b8 in do_actual_overload (fnname=(tree) 0xa0954, parms=(tree) 0x9a7f0, complain=1, final_cp=(struct candidate *) 0x0) (overload.c line 148)
#2  0x6c9d4 in build_member_call (cname=(tree) 0xa07b0, name=(tree) 0xa0954, parmlist=(tree) 0x0, dtor=0) (init.c line 1103)
#3  0x638a in yyparse () (parse.y line 869)
#4  0x2f94 in compile_file (name=(char *) 0xefffca0 "/tmp/cca07925.cpp") (toplev.c line 905)
#5  0x4462 in main (argc=10, argv=(char **) 0xefffc24, envp=(char **) 0xefffc50) (toplev.c line 1716)
(gdb+) directory /usr/sculptorq/gnu/src/g++
Source directories searched: /usr/sol/cooper:/usr/sculptorq/gnu/src/g++
(gdb+) list overload.c:148
143	  /* implicitly_declare() is going to pretend that the "undeclared"
144	     (really overloaded) function is declared in the local scope.
145	     We know better. Kill this wrong definition, and let the real
146	     one come through (if one exists).  */
147	  if (IDENTIFIER_LOCAL_VALUE (fnname))
148	    abort ();
149	
150	  decl = (tree) get_identifier (name);
151	
152	  /* Now check to see whether or not we can win.
(gdb+) quit
gecrux% ^D
script done on Fri Oct 28 11:00:56 1988
====================

Suggested patch:

*** overload.c.original Wed Sep  7 18:31:00 1988
--- overload.c  Fri Oct 28 10:44:41 1988
***************
*** 138,154 ****
    else
      {
        sprintf (name + tmp, "VOID");
      }
  
    /* implicitly_declare() is going to pretend that the "undeclared"
       (really overloaded) function is declared in the local scope.
       We know better. Kill this wrong definition, and let the real
       one come through (if one exists).  */
!   if (IDENTIFIER_LOCAL_VALUE (fnname))
      abort ();
-   
-   decl = (tree) get_identifier (name);
  
    /* Now check to see whether or not we can win.
       Note that if we are called from `build_classfn_ref',
       then we cannot have a mis-match, because we would have
--- 138,154 ----
    else
      {
        sprintf (name + tmp, "VOID");
      }
+   
+   decl = (tree) get_identifier (name);
  
    /* implicitly_declare() is going to pretend that the "undeclared"
       (really overloaded) function is declared in the local scope.
       We know better. Kill this wrong definition, and let the real
       one come through (if one exists).  */
!   if (IDENTIFIER_LOCAL_VALUE (decl))
      abort ();
  
    /* Now check to see whether or not we can win.
       Note that if we are called from `build_classfn_ref',
       then we cannot have a mis-match, because we would have
--
Clark Cooper       cooper@gecrux.steinmetz.ge.com, coopercc@crd.ge.com,
                   coopercc@ge-crd.arpa, ...!uunet!steinmetz!cooper