2011/10/6 Michael Matz <m...@suse.de>: > Hi, > > On Thu, 6 Oct 2011, Richard Guenther wrote: > >> > + && ((TREE_CODE_CLASS (TREE_CODE (arg1)) != tcc_comparison >> > + && TREE_CODE (arg1) != TRUTH_NOT_EXPR) >> > + || !FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0))))) >> >> ? simple_operand_p would have rejected both ! and comparisons. >> >> I miss a test for side-effects on arg0 (and probably simple_operand_p there, >> as well). > > He has it in the if() body. But why? The point of ANDIF/ORIF is to not > evaluate the second argument for side-effects when the first argument is > false/true already, and further to establish an order between both > evaluations. The sideeffect on the first arg is always evaluated. > AND/OR always evaluate both arguments (in unspecified order), but as he > checks the second one for being free of side effects already that alone is > already equivalent to ANDIF/ORIF. No need to check something on the first > argument. > > > Ciao, > Michael.
That's not the hole story. The difference between TRUTH_(AND|OR)IF_EXPR and TRUTH_(AND|OR)_EXPR are, that for TRUTH_(AND|OR)IF_EXPR gimplifier creates a COND expression, but for TRUTH_(AND|OR)_EXPR it doesn't. Regards, Kai