aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2019-01-18 13:05:18 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2019-01-18 05:05:18 -0800
commit420183d996f320dddb3d1094ae340c53719e0de3 (patch)
tree3606267c6b36098a85b4a09a3a0d4db540ce8c7b /gcc/c
parentcab81ec045acaaf6f4a562e212c6b8b95d98a3ea (diff)
downloadgcc-420183d996f320dddb3d1094ae340c53719e0de3.zip
gcc-420183d996f320dddb3d1094ae340c53719e0de3.tar.gz
gcc-420183d996f320dddb3d1094ae340c53719e0de3.tar.bz2
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
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog7
-rw-r--r--gcc/c/c-typeck.c6
2 files changed, 9 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 2accb8f..fe83d69 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,10 @@
+2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c/51628
+ PR c/88664
+ * c-typeck.c (convert_for_assignment): Upate the
+ warn_for_address_or_pointer_of_packed_member call.
+
2019-01-16 Tom Honermann <tom@honermann.net>
Jason Merrill <jason@redhat.com>
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 6da1f32..cbd612c 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -6729,8 +6729,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
{
- warn_for_address_or_pointer_of_packed_member (false, type,
- orig_rhs);
+ warn_for_address_or_pointer_of_packed_member (type, orig_rhs);
return rhs;
}
@@ -7289,8 +7288,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
/* If RHS isn't an address, check pointer or array of packed
struct or union. */
- warn_for_address_or_pointer_of_packed_member
- (TREE_CODE (orig_rhs) != ADDR_EXPR, type, orig_rhs);
+ warn_for_address_or_pointer_of_packed_member (type, orig_rhs);
return convert (type, rhs);
}