From: Jason Merrill Date: Sun, 26 Jan 2020 05:25:19 +0000 (-0500) Subject: c++: avoid ICE with __builtin_memset (PR90997). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=da11ffbba8741e085095f49037860de8e8701a1f;p=gcc.git c++: avoid ICE with __builtin_memset (PR90997). warn_for_memset calls fold_for_warn, which calls fold_non_dependent_expr, so also calling instantiate_non_dependent_expr here is undesirable. PR c++/90997 * semantics.c (finish_call_expr): Don't call instantiate_non_dependent_expr before warn_for_memset. --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0dc1ad21228..0b17abae3a3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-01-26 Jason Merrill + + PR c++/90997 + * semantics.c (finish_call_expr): Don't call + instantiate_non_dependent_expr before warn_for_memset. + 2020-01-25 Marek Polacek PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3b88f1520bc..a489e2cf399 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2664,7 +2664,6 @@ finish_call_expr (tree fn, vec **args, bool disallow_virtual, tree arg2 = (*orig_args)[2]; int literal_mask = ((literal_integer_zerop (arg1) << 1) | (literal_integer_zerop (arg2) << 2)); - arg2 = instantiate_non_dependent_expr (arg2); warn_for_memset (input_location, arg0, arg2, literal_mask); } diff --git a/gcc/testsuite/g++.dg/ext/builtin14.C b/gcc/testsuite/g++.dg/ext/builtin14.C new file mode 100644 index 00000000000..38d5a39fd73 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/builtin14.C @@ -0,0 +1,4 @@ +// PR c++/90997 + +template void f () +{ __builtin_memset (0, 0, int(0.)); }