c/99224 - avoid ICEing on invalid __builtin_next_arg
authorRichard Biener <rguenther@suse.de>
Wed, 24 Feb 2021 08:18:05 +0000 (09:18 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 24 Feb 2021 09:24:14 +0000 (10:24 +0100)
commit084963dcaca2f0836366fdb001561e29ecbfb483
tree82d4dda97d0aad40838f141f07ea0bfb05f2c382
parent71e24b060145e2eed070a52bdd0a13e37f60db77
c/99224 - avoid ICEing on invalid __builtin_next_arg

This avoids crashes with __builtin_next_arg on non-parameters.  For
the specific testcase we arrive with an anonymous SSA_NAME so that
SSA_NAME_VAR becomes NULL and we crash.

2021-02-24  Richard Biener  <rguenther@suse.de>

PR c/99224
* builtins.c (fold_builtin_next_arg): Avoid NULL arg.

* gcc.dg/pr99224.c: New testcase.
gcc/builtins.c
gcc/testsuite/gcc.dg/pr99224.c [new file with mode: 0644]