[Bug c/52981] New: Separate -Wpacked into two options

akurland at digi dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 13 18:31:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52981

             Bug #: 52981
           Summary: Separate -Wpacked into two options
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: akurland@digi.com


The option -Wpacked reports two different warnings:

1. warning: padding struct to align ‘<member name>’
2. warning: padding struct size to alignment boundary

The first warning indicates that the structure can be reordered in such a way
as to reduce padding. The second warning simply indicates that the structure is
not a multiple of the largest primitive data type and required padding at the
end.

I find the first warning much more interesting than the second one.
Specifically I would like to control them individually using -Werror.

If we can add something like -Wpacked-align and -Wpacked-size as additional
options (while still preserving the behavior of -Wpacked) I think this would be
a valuable addition to GCC.



More information about the Gcc-bugs mailing list