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.
This commit is contained in:
parent
3966726333
commit
37ad257c06
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-additional-options "-fno-signed-zeros" } */
|
||||
|
||||
|
||||
double distance3d_sqr_pt4d_pt4d(void);
|
||||
|
||||
int update_r_k_curr_cluster;
|
||||
void update_r_k(void) {
|
||||
double curr_distance = distance3d_sqr_pt4d_pt4d();
|
||||
for (int cluster; cluster; cluster++)
|
||||
if (0 < curr_distance) {
|
||||
curr_distance = 0;
|
||||
update_r_k_curr_cluster = cluster;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue