karl@dufay.umb.edu ("Karl Berry.") (10/25/88)
The following program dies with a segmentation fault on a Sun 3
running Sun OS 3.4, compiled with gcc 1.30.
The same program compiles correctly with the Sun C compiler.
Here is the program:
typedef struct {
int max_row, max_col, min_row, min_col;
} bounding_box_type;
bounding_box_type get_bounding_box();
main()
{
bounding_box_type b;
b = get_bounding_box();
printf("%d", b.max_row);
}
bounding_box_type get_bounding_box()
{
bounding_box_type bb;
bb.max_row = 10;
bb.min_row = 0;
bb.max_col = 20;
bb.min_col = 5;
return bb;
}
and here is the compilation:
/usr/local/gnu/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__HAVE_68881__ -Dmc68020 x.c /tmp/cca04532.cpp
GNU CPP version 1.30
/usr/local/gnu/lib/gcc-cc1 /tmp/cca04532.cpp -quiet -dumpbase x.c -version -o /tmp/cca04532.s
GNU C version 1.30 (68k, MIT syntax) compiled by GNU C version 1.30.
as -mc68020 /tmp/cca04532.s -o x.o
ld /lib/crt0.o /lib/Mcrt1.o x.o /usr/local/gnu/lib/gcc-gnulib -lc
And the run just says ``Segmentation fault (core dumped)''.
Karl. karl@umb.edu
`.