On Mon, Feb 11, 2019 at 12:20:42PM -0700, Martin Sebor wrote:
> This is a repost of a patch for PR 88383 updated to also fix the just
> reported PR 89288 (the original patch only partially handles this case).
> The review of the first patch was derailed by questions about the design
> of the built-in so the fix for the ICE was never approved. I think
> the ICEs should be fixed for GCC 9 and any open design questions should
> be dealt with independently.
Well, it is closely coupled with the design questions.
> if (TYPE_P (oper))
> tmpdecl = build_decl (atloc, TYPE_DECL, tmpid, oper);
> + else if (DECL_P (oper))
> + tmpdecl = build_decl (atloc, TREE_CODE (oper), tmpid, TREE_TYPE (oper));
> + else if (EXPR_P (oper))
> + tmpdecl = build_decl (atloc, TYPE_DECL, tmpid, TREE_TYPE (oper));
> else
> - tmpdecl = build_decl (atloc, TREE_CODE (oper), tmpid, TREE_TYPE (oper));
> + return false;
The EXPR_P conditional makes no sense. Why should __builtin_has_attribute (1 +
1, ...)
do something (if unfolded yet) and __builtin_has_attribute (2, ...)
something different? 1 + 1 when unfolded is EXPR_P, but 2 is not.
Jakub