diff options
author | Bernd Schmidt <bernds@redhat.com> | 2016-01-21 18:10:03 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2016-01-21 18:10:03 +0000 |
commit | 9776e6920dec9aa23adbdd7f0c264804c7fe6fdf (patch) | |
tree | 66b303926820db0d7a4362846c12773014ef8d1e /gcc/expr.c | |
parent | a71c0334f783c44a146b5003a09847571e71f366 (diff) | |
download | gcc-9776e6920dec9aa23adbdd7f0c264804c7fe6fdf.zip gcc-9776e6920dec9aa23adbdd7f0c264804c7fe6fdf.tar.gz gcc-9776e6920dec9aa23adbdd7f0c264804c7fe6fdf.tar.bz2 |
Fix PR66178, ICE due to misexpansion of constant expressions involving labels.
PR middle-end/66178
* expr.c (expand_expr_real_2) [PLUS_EXPR, MINUS_EXPR]: Don't
drop EXPAND_INITIALIZER.
* rtl.h (contains_symbolic_reference_p): Declare.
* rtlanal.c (contains_symbolic_reference_p): New function.
* simplify-rtx.c (simplify_binary_operation_1): Don't turn
a subtraction into a NOT if symbolic constants are involved.
testsuite/
PR middle-end/66178
gcc.dg/torture/pr66178.c: New test.
From-SVN: r232689
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -8381,11 +8381,11 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, if it's all in the wrong mode to form part of an address. And force_operand won't know whether to sign-extend or zero-extend. */ - if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER) - || mode != ptr_mode) + if (modifier != EXPAND_INITIALIZER + && (modifier != EXPAND_SUM || mode != ptr_mode)) { expand_operands (treeop0, treeop1, - subtarget, &op0, &op1, EXPAND_NORMAL); + subtarget, &op0, &op1, modifier); if (op0 == const0_rtx) return op1; if (op1 == const0_rtx) @@ -8424,8 +8424,8 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, if it's all in the wrong mode to form part of an address. And force_operand won't know whether to sign-extend or zero-extend. */ - if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER) - || mode != ptr_mode) + if (modifier != EXPAND_INITIALIZER + && (modifier != EXPAND_SUM || mode != ptr_mode)) goto binop; expand_operands (treeop0, treeop1, |