This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: RFA: xscale-elf -mstrict-prototypes


Further investigation shows that the reason this appears to work sometimes 
and not others is that it is using the rules in PROMOTE_MODE.  Hence:

void a (unsigned char);
void b (signed char);
void c (unsigned short);
void d (signed short);

void p (int x)
{
    a (x);
}

void q (int x)
{
    b (x);
}

void r (int x)
{
    c (x);
}

void s (int x)
{
    d (x);
}

gives us (stripping out the assembler gloop):

p:
	and	r0, r0, #255
	b	a

q:
	and	r0, r0, #255
	b	b

r:
	mov	r0, r0, asl #16
	mov	r0, r0, asr #16
	b	c

s:
	mov	r0, r0, asl #16
	mov	r0, r0, asr #16
	b	d

using -malignment-traps causes the sign-extension in r and s to become 
zero-extention confirming that PROMOTE_MODE is being exposed here.

So the compiler isn't really promoting arguments according the the AAPCS 
(or ATPCS) rules, but is instead just doing a promotion that is supposed 
to be part of an optimization and then exposing that in the calling 
convention.  That's clearly wrong.

Mark, this means that we aren't yet generating AAPCS-conforming call 
sequences.

R.



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