c-family: Update unaligned adress of packed member check
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 18 Jan 2019 13:05:18 +0000 (13:05 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 18 Jan 2019 13:05:18 +0000 (05:05 -0800)
commit420183d996f320dddb3d1094ae340c53719e0de3
tree3606267c6b36098a85b4a09a3a0d4db540ce8c7b
parentcab81ec045acaaf6f4a562e212c6b8b95d98a3ea
c-family: Update unaligned adress of packed member check

Check unaligned pointer conversion and strip NOPS.

gcc/c-family/

PR c/51628
PR c/88664
* c-common.h (warn_for_address_or_pointer_of_packed_member):
Remove the boolean argument.
* c-warn.c (check_address_of_packed_member): Renamed to ...
(check_address_or_pointer_of_packed_member): This.  Also
warn pointer conversion.
(check_and_warn_address_of_packed_member): Renamed to ...
(check_and_warn_address_or_pointer_of_packed_member): This.
Also warn pointer conversion.
(warn_for_address_or_pointer_of_packed_member): Remove the
boolean argument.  Don't check pointer conversion here.

gcc/c

PR c/51628
PR c/88664
* c-typeck.c (convert_for_assignment): Upate the
warn_for_address_or_pointer_of_packed_member call.

gcc/cp

PR c/51628
PR c/88664
* call.c (convert_for_arg_passing): Upate the
warn_for_address_or_pointer_of_packed_member call.
* typeck.c (convert_for_assignment): Likewise.

gcc/testsuite/

PR c/51628
PR c/88664
* c-c++-common/pr51628-33.c: New test.
* c-c++-common/pr51628-35.c: New test.
* c-c++-common/pr88664-1.c: Likewise.
* c-c++-common/pr88664-2.c: Likewise.
* gcc.dg/pr51628-34.c: Likewise.

From-SVN: r268075
14 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-common.h
gcc/c-family/c-warn.c
gcc/c/ChangeLog
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr51628-33.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr51628-35.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr88664-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr88664-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr51628-34.c [new file with mode: 0644]