Subject: pkg/34614: TME Sun3 emulator operates incorrectly when testing parser stack overflow
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <sigmfsk@aol.com>
List: pkgsrc-bugs
Date: 09/25/2006 19:10:01
>Number:         34614
>Category:       pkg
>Synopsis:       TME Sun3 emulator operates incorrectly when testing parser stack overflow
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 25 19:10:00 +0000 2006
>Originator:     Arthur Townsend
>Release:        3.0
>Organization:
>Environment:
TME running under NetBSD 3.0 for i386.  Operating system inside TME and on a the real sun3 is NetBSD 3.0 for sun3 built with MKSOFTFLOAT and gcc makefile with --nfp.
>Description:
The following code compiles fine on a real sun running NetBSD 3.0, but fails when compiling inside TME:

/* PR c/2161: parser stack overflow.  */
/* { dg-do compile } */

#define ONE	else if (0) { }
#define TEN	ONE ONE ONE ONE ONE ONE ONE ONE ONE ONE
#define HUN	TEN TEN TEN TEN TEN TEN TEN TEN TEN TEN
#define THOU	HUN HUN HUN HUN HUN HUN HUN HUN HUN HUN

void foo()
{
  if (0) { }
  /* 11,000 else if's.  */
  THOU THOU THOU THOU THOU THOU THOU THOU THOU THOU THOU
}

The compiler exits with:
gcc: Internal error: Illegal instruction (program cc1)

Depending on how gcc was compiled, it might also fail with a seg fault.

The above test file is gcc.dg/20020425-1.c from the gcc-3.3.3 testsuite.  TME also fails with an illegal instruction on gcc.dg/c99-intconst-1.c and can't compile gcc.c-torture/compile/20001226-1.c, all which work fine on a real sun3.  These are the only "large memory consumption testing" files in the gcc-3.3.3-testsuite that operate differently inside TME compared to a real sun3.
>How-To-Repeat:
gcc 20020425-1.c (contents above, and also inside the gcc.dg gcc-3.3.3 testsuite directory).
>Fix: