Path: utzoo!utgpu!water!watmath!uunet!tut.cis.ohio-state.edu!dufay.umb.edu!karl From: karl@dufay.umb.edu ("Karl Berry.") Newsgroups: gnu.gcc.bug Subject: Problem with structure returns in gcc 1.30. Message-ID: <8810241755.AA04548@dufay.cs> Date: 24 Oct 88 17:55:52 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 45 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 `.