In fold_binary() we are asserting:
gcc_assert (IS_EXPR_CODE_CLASS (kind)
&& TREE_CODE_LENGTH (code) == 2
&& op0 != NULL_TREE
&& op1 != NULL_TREE);
I am having problems with this because it's causing failures for perfectly
valid IL. With the new OpenMP IL, we have statements that have optional
operands. In particular, things like
DEFTREECODE (OMP_SINGLE, "omp_single", tcc_statement, 2)
The second argument of OMP_SINGLE is an optional list of clauses. When we
call fold() with a clause-less OMP_SINGLE, the logic takes the expression
to fold_binary() where we end up ICEing because 'op1' is NULL.
I understand that it's easier for fold_binary() to never have to worry
about NULL operands, but in this case the IL is properly formed with a
NULL operand. Should we set that operand to NOP_EXPR to pacify fold()?
Or is it better to have fold() ignore NULL operands?
Thanks.