This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Simple returns are broken in gcc 3.X


In looking into why g++ didn't work for vax-dec-ultrix4.3, I have found
that simple returns are broken.  Compiling this small test program

static char *
srealloc (char *p, char *q, int i)
{
  if (i == 0)
    return p;
  else
    return q;
}

yields

#NO_APP
	.text
	.align 1
__Z8sreallocPcS_i:
	.word 0x0
	subl2 $12,sp
	tstl 12(ap)
	jneq L2
	ret
L2:
	ret

As can been seen, the return values are not loaded into the return register
r0.

The problem is that expand_value_return () doesn't handle properly return
values in pseudos (see treatment in expand_function_end ()).  Further,
comparing what is done in expand_function_end and expand_null_return_1,
there appears to be other problems.  For example, instrumentation doesn't
work.  There could be problems with functtions that call alloca, etc.

It looks to me like there needs to be a common set of code used to expand
returns.  Thoughts?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]