Hi Diego,
On Thu, 12 Jan 2006, Diego Novillo wrote:
> In fold_binary() we are asserting:
>
> gcc_assert (IS_EXPR_CODE_CLASS (kind)
> && TREE_CODE_LENGTH (code) == 2
> && op0 != NULL_TREE
> && op1 != NULL_TREE);
...
> DEFTREECODE (OMP_SINGLE, "omp_single", tcc_statement, 2)
Interesting!
If tcc_statement is the best tree_code_class for OMP_SINGLE, then I think
its reasonable for fold_binary to be more forgiving. For example, the
least intrusive fix is to change the assert to:
gcc_assert (IS_EXPR_CODE_CLASS (kind) && TREE_CODE_LENGTH (code) == 2);
if (op0 == NULL_TREE || op1 == NULL_TREE)
return NULL_TREE;
If there are useful high level optimizations of OMP_SINGLE, that could
be applied by fold, then this issue needs a little more thought so that
fold_binary can be restructured based upon TREE_CODE_CLASS to avoid any
potential NULL pointer dereferences.
Anyone feel strongly for or against the above change? I'd prefer not
to have to bloat the trees we use with non-NULL operands, just to work
around the sanity checks we have. The types of error caught by this
assertion should be extremely rare.
Thoughts?
Roger
--