aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2015-11-08 17:53:51 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2015-11-08 10:53:51 -0700
commiteb11eb157cf07500e2915da8a72f2f3a501cc5ae (patch)
tree701653eab6d0055435f0479ba96a6dd5dfa3d261 /gcc
parent3e4d188a5fe6df5994af7ee800614305afb7f8f7 (diff)
downloadgcc-eb11eb157cf07500e2915da8a72f2f3a501cc5ae.zip
gcc-eb11eb157cf07500e2915da8a72f2f3a501cc5ae.tar.gz
gcc-eb11eb157cf07500e2915da8a72f2f3a501cc5ae.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/c.opt2
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/init.c12
4 files changed, 19 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 7a2781d..1b296ca 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -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.
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 5f38018..f066400 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 fc92a5f..11ca9ab 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 337797c..b45281f 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;