Clean up fallout on ILP32 from r229831.
authorMartin Sebor <msebor@redhat.com>
Sun, 8 Nov 2015 17:53:51 +0000 (17:53 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Sun, 8 Nov 2015 17:53:51 +0000 (10:53 -0700)
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

gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/init.c

index 7a2781d..1b296ca 100644 (file)
@@ -1,3 +1,7 @@
+2015-11-08  Martin Sebor  <msebor@redhat.com>
+
+       * c.opt (Wplacement-new): Add a period to the end of a sentence.
+
 2015-11-07  Richard Sandiford  <richard.sandiford@arm.com>
 
        * c-common.c: Don't undef DEF_BUILTIN.
index 5f38018..f066400 100644 (file)
@@ -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
index fc92a5f..11ca9ab 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-08  Martin Sebor  <msebor@redhat.com>
+
+       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  <dmalcolm@redhat.com>
 
        * error.c (cp_printer): Update for new "caret_p" param for
index 337797c..b45281f 100644 (file)
@@ -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;