This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C PATCH] Warn about unused RHS of COMPOUND_EXPR (PR c/59871)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]