aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-05-07 14:54:20 +0200
committerJakub Jelinek <jakub@redhat.com>2020-05-07 14:54:20 +0200
commit9b95bb52b40c05e630278fe5cd61a79a3c4f620a (patch)
tree29849696b5aaca2bd9d1d0f79263c4f4cd62d6ba /gcc/c-family/c-common.c
parent9cd70f3f0fa45cbe899da5ecd0b0c6da0657fd62 (diff)
downloadgcc-9b95bb52b40c05e630278fe5cd61a79a3c4f620a.zip
gcc-9b95bb52b40c05e630278fe5cd61a79a3c4f620a.tar.gz
gcc-9b95bb52b40c05e630278fe5cd61a79a3c4f620a.tar.bz2
c-family: Fix error-recovery ICE on __builtin_speculation_safe_value [PR94968]
If the second argument of __builtin_speculation_safe_value is error_mark_node (or has such a type), we ICE during useless_typ_conversion_p. 202-05-07 Jakub Jelinek <jakub@redhat.com> PR c/94968 * c-common.c (speculation_safe_value_resolve_params): Return false if error_operand_p (val2). (resolve_overloaded_builtin) <case BUILT_IN_SPECULATION_SAFE_VALUE_N>: Remove extraneous semicolon. * gcc.dg/pr94968.c: New test.
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r--gcc/c-family/c-common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 4e46178..d164f1e 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -6716,6 +6716,8 @@ speculation_safe_value_resolve_params (location_t loc, tree orig_function,
tree val2 = (*params)[1];
if (TREE_CODE (TREE_TYPE (val2)) == ARRAY_TYPE)
val2 = default_conversion (val2);
+ if (error_operand_p (val2))
+ return false;
if (!(TREE_TYPE (val) == TREE_TYPE (val2)
|| useless_type_conversion_p (TREE_TYPE (val), TREE_TYPE (val2))))
{
@@ -7400,7 +7402,7 @@ resolve_overloaded_builtin (location_t loc, tree function,
{
tree new_function, first_param, result;
enum built_in_function fncode
- = speculation_safe_value_resolve_call (function, params);;
+ = speculation_safe_value_resolve_call (function, params);
if (fncode == BUILT_IN_NONE)
return error_mark_node;