Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard.
2016-02-16 Richard Biener <rguent...@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; }