This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Get rid of spurious warning (PR c/60036)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 4 Feb 2014 17:18:38 +0000
- Subject: Re: [C PATCH] Get rid of spurious warning (PR c/60036)
- Authentication-results: sourceware.org; auth=none
- References: <20140204170205 dot GM8907 at redhat dot com>
On Tue, 4 Feb 2014, Marek Polacek wrote:
> Starting with revision 206620, if we have LHS op= RHS and RHS has
> side effects, we preevaluate RHS first, which means that we wrap it
> in C_MAYBE_CONST_EXPR_EXPR + SAVE_EXPR. This regressed -Wconversion,
> since we now issue bogus warnings. The reason is that conversion_warning
> doesn't grok C_MAYBE_CONST_EXPR_EXPR/SAVE_EXPR, meaning that it
> just calls unsafe_conversion_p on it that warns. But for e.g. relational
> and equality operators that's useless as those always yield 0 or 1.
> This patch fixes this by unwrapping the expr first.
>
> Regtested/bootstrapped on x86_64-linux, ok for trunk?
OK.
--
Joseph S. Myers
joseph@codesourcery.com