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: [BUG REPORT + PATCH] -Wpadded on powerpc


David Taylor <dtaylor@emc.com> writes:

> If you take the simple program:
> 
> int main(void)
> {
>   return (0);
> }
> 
> and compile it using a cross gcc compiler targeting powerpc-elf-eabi
> with -Wpadded, you'll get the warning:
> 
> <built-in>:0: warning: padding struct to align `overflow_arg_area'
> 
> .
> 
> This bug is present in 3.2.3 and on the trunk; I would guess (but
> didn't verify) that it's also present in 3.3.
> 
> Investigating, the problem is in config/rs6000/rs6000.c, function
> rs6000_build_va_list.  It's building a structure (__va_list_tag) that
> looks like:
> 
>     unsigned char gpr;
>     unsigned char fpr;
> 
>     ==> 2 bytes of padding <==
> 
>     void *overflow_arg_area;
>     void *reg_save_area;
> 
> Since backwards compatability is an issue and it's not very useful to
> warn about padding in this structure that the compiler is generating
> on the user's behalf (regardless of whether the user has a variable
> argument function or not), I think that the only two real solutions
> are to either (1) teach gcc to not complain about padding when it is
> dealing with an internally created structure or to (2) add a member
> that occupies the 2 bytes of padding.  Here's a patch for the latter
> solution (against the trunk)

This patch would be OK, but it doesn't include a testcase.  Could you
add one?

> 2003-05-21  David Taylor  <dtaylor@emc.com>
> 
> 	* config/rs6000/rs6000.c (rs6000_build_va_list): Give the two
> 	bytes of padding in the __va_list_tag structure a name (reserved)
> 	so that -Wpadded won't warn on *EVERY* user file.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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