Re: [PATCH] Fix ICE with COMPLEX_EXPR in fold_negate_expr (PR middle-end/79536)

2017-02-17 Thread Richard Biener
On Fri, 17 Feb 2017, Marek Polacek wrote: > For "(int) -x", which is a NOP_EXPR, negate_expr_p returns true, which means > that fold_negate_expr cannot return NULL_TREE. But that's what happens here, > leading to a crash in fold_build2. negate_expr_p has (as well as negate_expr) > STRIP_SIGN_NOP

[PATCH] Fix ICE with COMPLEX_EXPR in fold_negate_expr (PR middle-end/79536)

2017-02-16 Thread Marek Polacek
For "(int) -x", which is a NOP_EXPR, negate_expr_p returns true, which means that fold_negate_expr cannot return NULL_TREE. But that's what happens here, leading to a crash in fold_build2. negate_expr_p has (as well as negate_expr) STRIP_SIGN_NOPS, so the "(int) -x" becomes "-x", but fold_negate_