🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1233

Sun-4/SPARC stack frame bug

#1233
From: Alexander Klaiber
Date: Tue, 29 Sep 1992 16:17
45 lines
1713 bytes
Machine:	Sun-4/Sparc
OS:		SunOS 4.1.2
Compiler:	gcc-2.2.2 -g


In the code below, the allocation of the array {foo} completely messes up
the stack frame, the program dumps core.
NOTE: This seems specific to the Sun; the same program ran fine on a DECstation.

    void
    test(int n) {
	int i,j;
	double foo[n];		<======== this causes trouble
	for (i=0; i<n; ++i) {
	    foo[i] = 0.0;
	}
    }

    main() {
	test(10000);
    }


[entiat - 24] % gdb a.out
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.5, Copyright 1992 Free Software Foundation, Inc...
(gdb) b test
Breakpoint 1 at 0x2298: file test.c, line 3.
(gdb) run
Starting program: /tmp_mnt/homes/fish/klaiber/gcc/a.out 

Breakpoint 1, test (n=10000) at test.c:3
3	    int i,j;
(gdb) where
#0  test (n=10000) at test.c:3
#1  0x2330 in main () at test.c:12
(gdb) n

Program received signal 4, Illegal instruction		<================
0x22c8 in test (n=???) at test.c:3
3	    int i,j;
(gdb) where
#0  0x22c8 in test (n=???) at test.c:3
Technical Details
Message-ID: <1992Sep29.161719.4072@beaver.cs.washington.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.washington.edu!klaiber

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!wupost!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.washington.edu!klaiber
From: klaiber@cs.washington.edu (Alexander Klaiber)
Subject: Sun-4/SPARC stack frame bug
Message-ID: <1992Sep29.161719.4072@beaver.cs.washington.edu>
Sender: gnulists@ai.mit.edu
Organization: Computer Science & Engineering, U. of Washington, Seattle
Distribution: gnu
Date: Tue, 29 Sep 1992 16:17:19 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 46