This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: xscale-elf -mstrict-prototypes
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: James Lemke <jim at wasabisystems dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc-patches at gcc dot gnu dot org, Richard Earnshaw <rearnsha at arm dot com>
- Date: Thu, 01 Apr 2004 16:50:49 +0100
- Subject: Re: RFA: xscale-elf -mstrict-prototypes
- Organization: ARM Ltd.
- Reply-to: Richard Earnshaw <rearnsha at arm dot com>
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.