Hey,
I know it's not that urgent and as a matter of fact only a theoretical
problem, but still..
g++ crashes for a very long function name ;)

consider this perl program to generate such a stupid-evil source file:

a.pl:
#v+

my $name = "a"x(1024*1024*8);

open( FD, "> test.cpp" ) or die "ohmygawd";

print FD <<EOF

#include <iostream>

void $name(){
        std::cout << "cheers\\n";
}

int main( int argc, char** argv ) {
        $name();
        return 0;
}

EOF
;

print "Compiling..\n";

system "g++ -c test.cpp -o test -Wall -ansi";

#v-

outpus:
Compiling..
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions, see
<URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.


On my system it crashes for 8*1024*1024 chars. I guess this number is
very depended on the actual pc configuration.

 $ g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit
--enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --enable-checking=release
i486-linux-gnu
Thread model: posix
gcc version 4.0.2 (Debian 4.0.2-2)

I know it's stupid but java for instance does not simply allow longer
names than 65535 (iirc).

--
Cheers,
Kornel

Reply via email to