RFA: xscale-elf -mstrict-prototypes
Richard Earnshaw
rearnsha@arm.com
Thu Apr 1 15:50:00 GMT 2004
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.
More information about the Gcc-patches
mailing list