------- Additional Comments From Thomas dot Koenig at online dot de 2004-12-12 10:42 ------- (In reply to comment #2) > Speculations I'd put money on if the bookies would accept it: > 1) You can show this same problem with C/C++ if you have enough cases.
Yes. $ time ./multi-case-c 150000 > multi-case.c $ gcc multi-case.c cc1: out of memory allocating 2815331376 bytes after a total of 10571776 bytes $ gcc -v Reading specs from /home/ig25/lib/gcc/i686-pc-linux-gnu/4.0.0/specs Configured with: ../gcc/configure --prefix=/home/ig25 --enable-languages=c,c++,f95 Thread model: posix gcc version 4.0.0 20041208 (experimental) $ cat multi-case-c #! /usr/bin/perl $last = shift; for ($i=1; $i<=$last; $i++) { push(@lines, sprintf(" case %d:\n j = %d;\n break;\n", $i, $last-$i)); } for ($i=0; $i<=$last; $i++) { $j = int(rand($last)); $temp = $lines[$i]; $lines[$i] = $lines[$j]; $lines[$j] = $temp; } print <<EOF; #include <stdio.h> int main() { int i,j; scanf("%d",&i); switch(i) { EOF print @lines; print <<EOF; } printf("%d\\n",i); return 0; } EOF $ ./multi-case-c 4 #include <stdio.h> int main() { int i,j; scanf("%d",&i); switch(i) { case 2: j = 2; break; case 4: j = 0; break; case 3: j = 1; break; case 1: j = 3; break; } printf("%d\n",i); return 0; This isn't a regression, gcc 3.3 had the same problem: $ /usr/bin/gcc multi-case.c cc1: out of memory allocating 2815312608 bytes after a total of 18419712 bytes $ /usr/bin/gcc -v Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gci486-linux Thread model: posix gcc version 3.3.5 (Debian 1:3.3.5-3) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18938