https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120471

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
cp_build_array_ref does:
4003        case COND_EXPR:
4004          ret = build_conditional_expr
4005                   (loc, TREE_OPERAND (array, 0),
4006                   cp_build_array_ref (loc, TREE_OPERAND (array, 1), idx,
4007                                       complain),
4008                   cp_build_array_ref (loc, TREE_OPERAND (array, 2), idx,
4009                                       complain),
4010                   complain);
That looks dangerous, IMNSHO there should be idx = cp_save_expr (idx); before
it as it uses idx multiple times.  That will result in better code I think if
idx is some really large expression.

Reply via email to