[Bug c++/95344] [9/10 Regression] Wparentheses (assignment used as truth value) on parenthesized ternary conditional E2
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 11 20:28:15 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95344
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:4c07da7bec0c952e4918323222c2baa85f0a29f1
commit r10-8278-g4c07da7bec0c952e4918323222c2baa85f0a29f1
Author: Marek Polacek <polacek@redhat.com>
Date: Thu Jun 11 16:27:59 2020 -0400
c++: Fix bogus -Wparentheses warning [PR95344]
Since r267272, which added location wrappers, cp_fold loses
TREE_NO_WARNING on a MODIFY_EXPR that finish_parenthesized_expr set, and
that results in a bogus -Wparentheses warning.
I.e., previously we had "b = 1" but now we have "VIEW_CONVERT_EXPR<bool>(b)
= 1"
and cp_fold_maybe_rvalue folds away the location wrapper and so we do
2718 x = fold_build2_loc (loc, code, TREE_TYPE (x), op0, op1);
in cp_fold and the flag is lost.
PR c++/95344
* cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
TREE_THIS_VOLATILE here.
(cp_fold): Set it here along with TREE_NO_WARNING.
* c-c++-common/Wparentheses-2.c: New test.
More information about the Gcc-bugs
mailing list