Path: utzoo!telly!ddsw1!lll-winken!killer!osu-cis!tut.cis.ohio-state.edu!moose.cita.toronto.edu!trq From: trq@moose.cita.toronto.edu (Tom Quinn) Newsgroups: gnu.gcc.bug Subject: structure passing bug in sparc gcc 1.28 Message-ID: <8809272214.AA01712@moose.cita.toronto.edu> Date: 27 Sep 88 22:14:09 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 77 The following code demonstrates a bug in gcc v1.28 on sparc when passing structure values to a function. Two of the parameter passing registers get smashed while the end of the structure is being put onto the stack. This is on a Sun4/110 running SunOS 4.0 The compile: gcc -g -v -S -sun4 -c control2.c gcc version 1.28 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dsparc -Dsun -Dunix control2.c /tmp/cca20015.cpp GNU CPP version 1.28 /usr/local/lib/gcc-cc1 /tmp/cca20015.cpp -quiet -dumpbase control2.c -g -version -o control2.s GNU C version 1.28 (sparc) compiled by GNU C version 1.28. The code: ------------------------------------------------------------ typedef struct { char descrip[80], *name; float *vec; int dimen; } VECTOR; typedef union yystype { char charval[80]; int intval; }; extern union yystype yylval; static char data_file[80]; union yystype yylval; int yyparse() { register union yystype *yyvsp; union yystype yyvsa[200 ]; union yystype *yyvs = yyvsa; yyvsp = yyvs; *++yyvsp = yylval; { VECTOR temp; if(read_row(data_file,yyvsp[0].intval,&temp) == 0) { copy_vector(yyvsp[-1].charval,temp); } ; } } -------------------------------------------------------------- The offending assembler: .stabn 68,0,25,LM6 LM6: sub %sp,72,%sp add %l0,-80,%l1 set -16120,%o0 add %fp,%o0,%o0 ld [%o0],%o1 <<