From: Jakub Jelinek Date: Thu, 7 May 2020 12:54:20 +0000 (+0200) Subject: c-family: Fix error-recovery ICE on __builtin_speculation_safe_value [PR94968] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b95bb52b40c05e630278fe5cd61a79a3c4f620a;p=gcc.git 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 PR c/94968 * c-common.c (speculation_safe_value_resolve_params): Return false if error_operand_p (val2). (resolve_overloaded_builtin) : Remove extraneous semicolon. * gcc.dg/pr94968.c: New test. --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a7faf829bd6..2e3eb086831 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +202-05-07 Jakub Jelinek + + PR c/94968 + * c-common.c (speculation_safe_value_resolve_params): Return false if + error_operand_p (val2). + (resolve_overloaded_builtin) : + Remove extraneous semicolon. + 2020-05-06 qing zhao PR c/94230 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 4e46178d595..d164f1e2f1f 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e226435f159..227aa639f74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +202-05-07 Jakub Jelinek + + PR c/94968 + * gcc.dg/pr94968.c: New test. + 2020-05-07 Richard Biener PR tree-optimization/57359 diff --git a/gcc/testsuite/gcc.dg/pr94968.c b/gcc/testsuite/gcc.dg/pr94968.c new file mode 100644 index 00000000000..e8b282139c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr94968.c @@ -0,0 +1,8 @@ +/* PR c/94968 */ +/* { dg-do compile } */ + +int +foo (void) +{ + __builtin_speculation_safe_value (1, x); /* { dg-error "undeclared" } */ +} /* { dg-message "each undeclared identifier is reported only once" "" { target *-*-* } .-1 } */