Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Alexander Klaiber
Tue, 29 Sep 1992 16:17
Sun-4/SPARC stack frame bug
Author: Alexander Klaiber
Date: Tue, 29 Sep 1992 16:17
Date: Tue, 29 Sep 1992 16:17
45 lines
1713 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads