diff options
author | Andrew Pinski <apinski@marvell.com> | 2021-06-27 13:14:48 -0700 |
---|---|---|
committer | Andrew Pinski <apinski@marvell.com> | 2021-06-27 16:14:29 -0700 |
commit | 37ad257c06d88fdb810be336d212c1ab54b99dad (patch) | |
tree | 6258d2870778902595f9fca7b943dbb082181443 /gcc/fold-const.c | |
parent | 3966726333b2a4cf54333549c8331d833364266e (diff) | |
download | gcc-37ad257c06d88fdb810be336d212c1ab54b99dad.zip gcc-37ad257c06d88fdb810be336d212c1ab54b99dad.tar.gz gcc-37ad257c06d88fdb810be336d212c1ab54b99dad.tar.bz2 |
Fix PR 101230: ICE in fold_cond_expr_with_comparison
This fixes PR 101230 where I had messed up and forgot that
invert_tree_comparison can return ERROR_MARK if the comparsion
is not invertable (floating point types).
Committed as obvious after a bootstrap/test on x86_64-linux-gnu-gnu
gcc/ChangeLog:
PR middle-end/101230
* fold-const.c (fold_ternary_loc): Check
the return value of invert_tree_comparison.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr101230-1.c: New test.
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e2110b6..dfccbae 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -12837,10 +12837,11 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, tree arg00 = TREE_OPERAND (arg0, 0); tree arg01 = TREE_OPERAND (arg0, 1); comp_code = invert_tree_comparison (comp_code, HONOR_NANS (arg00)); - tem = fold_cond_expr_with_comparison (loc, type, comp_code, - arg00, - arg01, - op2, op1); + if (comp_code != ERROR_MARK) + tem = fold_cond_expr_with_comparison (loc, type, comp_code, + arg00, + arg01, + op2, op1); if (tem) return tem; } |