malformed C++ program crashes egcs 1.1.2

Frederick W. Wheeler wheeler@cipr.rpi.edu
Fri Jun 4 11:45:00 GMT 1999


// begin bug.cc
extern "C" {
foo (void) bar1 ();
typedef struct { int x; } head;
foo (head *) bar2 ();
foo (void *) bar3 ();
}
// end bug.cc

/*

Compiling this 6 line malformed C++ program using egcs 1.1.2 on a
sparc-sun-solaris2.6 or a hppa1.1-hp-hpux10.20 leads to an internal
compiler error.  The compilation output from both systems is below.  I
am not including bug.ii since all the preprocessor does to this file
is remove the comments.

I stumbled on this trying to compile a program that included alloc.h
from apache_1.3.6 instead of g++/alloc.h from egcs-1.1.2 due to an
environment variable mistake.  I cut the errant code down to the
smallest program I could.

Option to configure for egcs install for sparc-sun-solaris2.6:
  --with-gnu-as
  --with-stabs
  --prefix=/home/wheeler/usr/stow//egcs-1.1.2
  --exec-prefix=/home/wheeler/usr/stow//egcs-1.1.2/sparc-sun-solaris2.6
  --with-local-prefix=/home/wheeler/usr/local/
  --with-gxx-include-dir=/home/wheeler/usr/stow//egcs-1.1.2/include/g++

For hppa1.1-hp-hpux10.20 the paths are different and --with-gnu-ld is
used also.  binutils-2.9.1 was compiled and installed with egcs by
untaring binutils, then "mv binutils-2.9.1 egcs-1.1.2" then untaring
egcs right on top.  (This has worked very well for me over several
releases.  I highly recommend it.)

% gcc --version
egcs-2.91.66
% uname -a
SunOS seurat 5.6 Generic_105181-03 sun4u sparc
% gcc -c bug.cc
bug.cc: In function `int foo()':
bug.cc:3: parse error before `('
bug.cc: In function `int foo(struct foo()::head *)':
bug.cc:5: declaration of C function `int foo(struct foo()::head *)' conflicts with
bug.cc:3: previous declaration `int foo()' here
bug.cc: In function `int foo()':
bug.cc:5: parse error before `('
bug.cc: In function `int foo(void *)':
bug.cc:6: declaration of C function `int foo(void *)' conflicts with
gcc: Internal compiler error: program cc1plus got fatal signal 11

% gcc --version
egcs-2.91.66
% uname -a
HP-UX hpw6 B.10.20 A 9000/780 unknown
% gcc -c bug.cc
bug.cc: In function `int foo()':
bug.cc:3: parse error before `('
bug.cc: In function `int foo(struct foo()::head *)':
bug.cc:5: declaration of C function `int foo(struct foo()::head *)' conflicts with
bug.cc:3: previous declaration `int foo()' here
bug.cc: In function `int foo()':
bug.cc:5: parse error before `('
bug.cc: In function `int foo(void *)':
bug.cc:6: declaration of C function `int foo(void *)' conflicts with
Pid 17313 received a SIGSEGV for stack growth failure.
Possible causes: insufficient memory or swap space,
or stack size exceeded maxssiz.
gcc: Internal compiler error: program cc1plus got fatal signal 11

*/


--
Fred Wheeler
wheeler@cipr.rpi.edu
www.cipr.rpi.edu/wheeler


More information about the Gcc-bugs mailing list