c-family: Fix ICE on __builtin_speculation_safe_value () [PR94755]
authorJakub Jelinek <jakub@redhat.com>
Mon, 27 Apr 2020 14:05:03 +0000 (16:05 +0200)
committerJakub Jelinek <jakub@redhat.com>
Mon, 27 Apr 2020 14:10:24 +0000 (16:10 +0200)
commit26d76be7af6db75aaab662f4e93395f4ff8acb38
treec00ee59fc9ba9b3a2acb841a5d3d8f0fd371055a
parent6b6a77d25e83e071ba5d08648c5bd3953d8a0c03
c-family: Fix ICE on __builtin_speculation_safe_value () [PR94755]

When this builtin has no parameters, speculation_safe_value_resolve_call
returns BUILT_IN_NONE, but resolve_overloaded_builtin uselessly
dereferences the first param just to return error_mark_node immediately.

The following patch rearranges it so that we only read the first parameter
if fncode is not BUILT_IN_NONE.

2020-04-27  Jakub Jelinek  <jakub@redhat.com>

PR c/94755
* c-common.c (resolve_overloaded_builtin): Return error_mark_node for
fncode == BUILT_IN_NONE before initialization of first_param.

* c-c++-common/pr94755.c: New test.
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr94755.c [new file with mode: 0644]