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: RFC: [PATCH] Add warn_if_not_aligned attribute


On 17/08/17 15:56, H.J. Lu wrote:
> On Thu, Aug 17, 2017 at 6:52 AM, Joseph Myers <joseph@codesourcery.com> wrote:
>> On Sat, 8 Jul 2017, H.J. Lu wrote:
>>
>>> +@item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
>>> +@opindex Wpacked-not-aligned
>>> +@opindex Wno-packed-not-aligned
>>> +Warn if a structure field with explicitly specified alignment in a
>>> +packed struct or union is misaligned.  For example, a warning will
>>> +be issued on @code{struct S}, like, @code{warning: alignment 1 of
>>> +'struct S' is less than 8}, in this code:
>>
>> Use @samp for warnings quoted in the manual, as previously discussed.
>>
>> OK with that change, in the absence of C++ maintainer objections within 48
>> hours.
>>
> 
> Here is the updated patch.  I moved c++ changes to merge_decls, where
> alignment is merged,  and check_bitfield_type_and_width, where bit-fields
> are checked.
> 
> Tested on x86-64 and i686.
> 

i assume packed semantics is same on arm so these
should warn on arm too ?

on arm i see:

FAIL: gcc.dg/pr53037-2.c  (test for warnings, line 8)
FAIL: gcc.dg/pr53037-2.c  (test for warnings, line 16)
FAIL: gcc.dg/pr53037-2.c  (test for warnings, line 32)
FAIL: gcc.dg/pr53037-3.c  (test for warnings, line 8)
FAIL: gcc.dg/pr53037-3.c  (test for warnings, line 16)
FAIL: gcc.dg/pr53037-3.c  (test for warnings, line 32)

FAIL: g++.dg/pr53037-2.C  -std=gnu++98  (test for warnings, line 6)
FAIL: g++.dg/pr53037-2.C  -std=gnu++98  (test for warnings, line 16)
FAIL: g++.dg/pr53037-2.C  -std=gnu++98  (test for warnings, line 29)
FAIL: g++.dg/pr53037-2.C  -std=gnu++11  (test for warnings, line 6)
FAIL: g++.dg/pr53037-2.C  -std=gnu++11  (test for warnings, line 16)
FAIL: g++.dg/pr53037-2.C  -std=gnu++11  (test for warnings, line 29)
FAIL: g++.dg/pr53037-2.C  -std=gnu++14  (test for warnings, line 6)
FAIL: g++.dg/pr53037-2.C  -std=gnu++14  (test for warnings, line 16)
FAIL: g++.dg/pr53037-2.C  -std=gnu++14  (test for warnings, line 29)
FAIL: g++.dg/pr53037-3.C  -std=gnu++98  (test for warnings, line 6)
FAIL: g++.dg/pr53037-3.C  -std=gnu++98  (test for warnings, line 16)
FAIL: g++.dg/pr53037-3.C  -std=gnu++98  (test for warnings, line 29)
FAIL: g++.dg/pr53037-3.C  -std=gnu++11  (test for warnings, line 6)
FAIL: g++.dg/pr53037-3.C  -std=gnu++11  (test for warnings, line 16)
FAIL: g++.dg/pr53037-3.C  -std=gnu++11  (test for warnings, line 29)
FAIL: g++.dg/pr53037-3.C  -std=gnu++14  (test for warnings, line 6)
FAIL: g++.dg/pr53037-3.C  -std=gnu++14  (test for warnings, line 16)
FAIL: g++.dg/pr53037-3.C  -std=gnu++14  (test for warnings, line 29)


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