This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Warn about unused RHS of COMPOUND_EXPR (PR c/59871)
- From: Marek Polacek <polacek at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Tue, 21 Jan 2014 23:54:03 +0100
- Subject: Re: [C PATCH] Warn about unused RHS of COMPOUND_EXPR (PR c/59871)
- Authentication-results: sourceware.org; auth=none
- References: <20140121183810 dot GM8907 at redhat dot com> <20140121185013 dot GP892 at tucnak dot redhat dot com> <20140121223058 dot GR8907 at redhat dot com> <20140121223442 dot GS892 at tucnak dot redhat dot com>
On Tue, Jan 21, 2014 at 11:34:42PM +0100, Jakub Jelinek wrote:
> On Tue, Jan 21, 2014 at 11:30:58PM +0100, Marek Polacek wrote:
> > I made another small change: in the second hunk, in
> > emit_side_effect_warnings, I got rid of the while, since it seems to
> > me we never get COMPOUND_EXPR in TREE_OPERAND (r, 1).
>
> For bar (), 1, 2, 3, 4, 5, 6, 7, 8; sure, but what about
> (1, (2, (3, (4, (5, (6, (bar (), 7))))))); ?
For that `expr' that emit_side_effect_warnings gets is:
<compound_expr 0x7ffe2724b848
type <integer_type 0x7ffe27144690 int public SI
size <integer_cst 0x7ffe271463c0 constant 32>
unit size <integer_cst 0x7ffe271463e0 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffe27144690 precision 32 min <integer_cst 0x7ffe27146360 -2147483648> max <integer_cst 0x7ffe27146380 2147483647>
pointer_to_this <pointer_type 0x7ffe27150738>>
side-effects
arg 0 <call_expr 0x7ffe2726a840 type <integer_type 0x7ffe27144690 int>
side-effects
fn <addr_expr 0x7ffe2725a720 type <pointer_type 0x7ffe2726e0a8>
constant arg 0 <function_decl 0x7ffe27250600 bar>
uu.c:19:32>
uu.c:19:32>
arg 1 <integer_cst 0x7ffe2725a760 type <integer_type 0x7ffe27144690 int> constant 7>
uu.c:19:5>
so we should be fine even in that case.
Marek