From: Martin Sebor Date: Sun, 8 Nov 2015 17:53:51 +0000 (+0000) Subject: Clean up fallout on ILP32 from r229831. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb11eb157cf07500e2915da8a72f2f3a501cc5ae;p=gcc.git Clean up fallout on ILP32 from r229831. gcc/ PR c++/67942 * cp/init.c (warn_placement_new_too_small): Convert integer operand of POINTER_PLUS_EXPR to ssize_t to determine its signed value. c-family/ * c.opt (Wplacement-new): Add a period to the end of a sentence. From-SVN: r229959 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 7a2781d3c7e..1b296ca364e 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2015-11-08 Martin Sebor + + * c.opt (Wplacement-new): Add a period to the end of a sentence. + 2015-11-07 Richard Sandiford * c-common.c: Don't undef DEF_BUILTIN. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 5f38018d35e..f066400c6c5 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -778,7 +778,7 @@ Warn if inherited methods are unimplemented. Wplacement-new C++ Var(warn_placement_new) Init(1) Warning -Warn for placement new expressions with undefined behavior +Warn for placement new expressions with undefined behavior. Wredundant-decls C ObjC C++ ObjC++ Var(warn_redundant_decls) Warning diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc92a5f0561..11ca9ab584a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-11-08 Martin Sebor + + PR c++/67942 + * cp/init.c (warn_placement_new_too_small): Convert integer + operand of POINTER_PLUS_EXPR to ssize_t to determine its signed + value. + 2015-11-06 David Malcolm * error.c (cp_printer): Update for new "caret_p" param for diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 337797c986b..b45281f517d 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2321,12 +2321,14 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) if (TREE_CODE (oper) == POINTER_PLUS_EXPR) { /* If the offset is comple-time constant, use it to compute a more - accurate estimate of the size of the buffer. Otherwise, use - the size of the entire array as an optimistic estimate (this - may lead to false negatives). */ - const_tree adj = TREE_OPERAND (oper, 1); + accurate estimate of the size of the buffer. Since the operand + of POINTER_PLUS_EXPR is represented as an unsigned type, convert + it to signed first. + Otherwise, use the size of the entire array as an optimistic + estimate (this may lead to false negatives). */ + tree adj = TREE_OPERAND (oper, 1); if (CONSTANT_CLASS_P (adj)) - adjust += tree_to_uhwi (adj); + adjust += tree_to_shwi (convert (ssizetype, adj)); else use_obj_size = true;