[C++ PATCH] Fix build_noexcept_spec ICE (PR c++/54207)

Jason Merrill jason@redhat.com
Thu Dec 6 14:07:00 GMT 2012


On 12/06/2012 02:24 AM, Jakub Jelinek wrote:
> +  if (TREE_CODE (expr) == INTEGER_CST)
> +    {
> +      if (operand_equal_p (expr, boolean_true_node, 0))
> +	return noexcept_true_spec;
> +      else if (operand_equal_p (expr, boolean_false_node, 0))
> +	return noexcept_false_spec;
> +    }

These are the only two possibilities for a boolean INTEGER_CST, so let's 
assert that it's false if it isn't true.

You can then leave the 'else' on the "if (expr == error_mark_node)".

> +      if (TREE_CODE (expr) == INTEGER_CST)
> +	{
> +	  if (operand_equal_p (expr, boolean_true_node, 0)
> +	      || operand_equal_p (expr, boolean_false_node, 0))
> +	    new_specs = expr;
> +	}

And here you don't need to check the value at all unless in an assert.

Jason



More information about the Gcc-patches mailing list