diff options
-rw-r--r-- | gcc/c-family/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/init.c | 12 |
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; |