[PATCH] Fix PR69801
H.J. Lu
hjl.tools@gmail.com
Tue Feb 16 17:39:00 GMT 2016
On Tue, Feb 16, 2016 at 12:35 AM, Richard Biener <rguenther@suse.de> wrote:
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
>
> Richard.
>
> 2016-02-16 Richard Biener <rguenther@suse.de>
>
> PR middle-end/69801
> * fold-const.c (operand_equal_p): For COND_EXPR zero operand
> mask OEP_ADDRESS_OF.
>
> * gcc.dg/pr69801.c: New testcase.
>
> Index: gcc/fold-const.c
> ===================================================================
> *** gcc/fold-const.c (revision 233418)
> --- gcc/fold-const.c (working copy)
> *************** operand_equal_p (const_tree arg0, const_
> *** 3118,3123 ****
> --- 3118,3128 ----
> TREE_OPERAND (arg1, 0), flags));
>
> case COND_EXPR:
> + if (! OP_SAME (1) || ! OP_SAME (2))
> + return 0;
> + flags &= ~OEP_ADDRESS_OF;
> + return OP_SAME (0);
> +
> case VEC_COND_EXPR:
> case DOT_PROD_EXPR:
> return OP_SAME (0) && OP_SAME (1) && OP_SAME (2);
> Index: gcc/testsuite/gcc.dg/pr69801.c
> ===================================================================
> *** gcc/testsuite/gcc.dg/pr69801.c (revision 0)
> --- gcc/testsuite/gcc.dg/pr69801.c (working copy)
> ***************
> *** 0 ****
> --- 1,7 ----
> + /* { dg-do compile } */
> +
> + struct {
> + char c[1];
> + } b, c;
> + int d, e;
> + void fn1() { e ? (d ? b : c).c : (d ? b : c).c; }
I got
output is:
/export/gnu/import/git/gcc-test-ia32corei7/src-trunk/gcc/testsuite/gcc.dg/pr69801.c:
In function 'fn1':^M
/export/gnu/import/git/gcc-test-ia32corei7/src-trunk/gcc/testsuite/gcc.dg/pr69801.c:7:32:
error: non-lvalue array in conditional expression^M
FAIL: gcc.dg/pr69801.c (test for excess errors)
--
H.J.
More information about the Gcc-patches
mailing list