https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56856
--- Comment #13 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Author: dmalcolm Date: Mon Oct 29 23:44:10 2018 New Revision: 265609 URL: https://gcc.gnu.org/viewcvs?rev=265609&root=gcc&view=rev Log: Folding and check_function_arguments This patch eliminates the arglocs array I introduced to build_over_call in r264887, and eliminates the call to maybe_constant_value when building "fargs" (thus retaining location wrapper nodes). Instead, this patch requires that any checks within check_function_arguments that need folded arguments do their own folding. Of the various checks: (a) check_function_nonnull already calls fold_for_warn, (b) check_function_format doesn't need folding (c) check_function_sentinel needs fold_for_warn in one place, which the patch adds, and (d) check_function_restrict needs per-argument folding, which the patch adds. Given that it scans before and after resetting TREE_VISITED on each argument, it seemed best to make a copy of the array, folding each argument from the outset, rather than repeatedly calling fold_for_warn; gcc/c-family/ChangeLog: PR c++/56856 * c-common.c (check_function_sentinel): Call fold_for_warn on the argument. (check_function_restrict): Rename param "argarray" to "unfolded_argarray", and make a copy named "argarray", calling fold_for_warn on each argument. (check_function_arguments): Add note about responsibility for folding the arguments. gcc/cp/ChangeLog: PR c++/56856 * call.c (build_over_call): Eliminate the "arglocs" array, and the call to maybe_constant_value when building "fargs". Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c