aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-12-21 23:15:59 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-12-21 23:15:59 +0100
commit0dba79602a7e3fb62bebee58b2cd7c24115b4faf (patch)
tree5cf6b631ea6cd0b3f5aca6c10361d66c4b8c572b /gcc/c
parentbc2a38dff859fcd1ec0aedd8c7d0fb748f2dbede (diff)
downloadgcc-0dba79602a7e3fb62bebee58b2cd7c24115b4faf.zip
gcc-0dba79602a7e3fb62bebee58b2cd7c24115b4faf.tar.gz
gcc-0dba79602a7e3fb62bebee58b2cd7c24115b4faf.tar.bz2
re PR bootstrap/78817 (stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661)
PR bootstrap/78817 * tree-pass.h (make_pass_post_ipa_warn): Declare. * builtins.c (validate_arglist): Adjust get_nonnull_args call. Check for NULL pointer argument to nonnull arg here. (validate_arg): Revert 2016-12-14 changes. * calls.h (get_nonnull_args): Remove declaration. * tree-ssa-ccp.c: Include diagnostic-core.h. (pass_data_post_ipa_warn): New variable. (pass_post_ipa_warn): New class. (pass_post_ipa_warn::execute): New method. (make_pass_post_ipa_warn): New function. * tree.h (get_nonnull_args): Declare. * tree.c (get_nonnull_args): New function. * calls.c (maybe_warn_null_arg): Removed. (maybe_warn_null_arg): Removed. (initialize_argument_information): Revert 2016-12-14 changes. * passes.def: Add pass_post_ipa_warn after first ccp after IPA. c-family/ * c-common.c (struct nonnull_arg_ctx): New type. (check_function_nonnull): Return bool instead of void. Use nonnull_arg_ctx as context rather than just location_t. (check_nonnull_arg): Adjust for the new context type, set warned_p to true if a warning has been diagnosed. (check_function_arguments): Return bool instead of void. * c-common.h (check_function_arguments): Adjust prototype. c/ * c-typeck.c (build_function_call_vec): If check_function_arguments returns true, set TREE_NO_WARNING on CALL_EXPR. cp/ * typeck.c (cp_build_function_call_vec): If check_function_arguments returns true, set TREE_NO_WARNING on CALL_EXPR. * call.c (build_over_call): Likewise. From-SVN: r243874
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/c-typeck.c12
2 files changed, 12 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 65eb93d..7a5e741 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,9 @@
2016-12-21 Jakub Jelinek <jakub@redhat.com>
+ PR bootstrap/78817
+ * c-typeck.c (build_function_call_vec): If check_function_arguments
+ returns true, set TREE_NO_WARNING on CALL_EXPR.
+
PR c/77767
* c-decl.c (grokdeclarator): If *expr is non-NULL, append expression
to *expr instead of overwriting it.
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index c134280..a269682 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3110,15 +3110,15 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc,
return error_mark_node;
/* Check that the arguments to the function are valid. */
- check_function_arguments (loc, fntype, nargs, argarray);
+ bool warned_p = check_function_arguments (loc, fntype, nargs, argarray);
if (name != NULL_TREE
&& !strncmp (IDENTIFIER_POINTER (name), "__builtin_", 10))
{
if (require_constant_value)
- result =
- fold_build_call_array_initializer_loc (loc, TREE_TYPE (fntype),
- function, nargs, argarray);
+ result
+ = fold_build_call_array_initializer_loc (loc, TREE_TYPE (fntype),
+ function, nargs, argarray);
else
result = fold_build_call_array_loc (loc, TREE_TYPE (fntype),
function, nargs, argarray);
@@ -3129,6 +3129,10 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc,
else
result = build_call_array_loc (loc, TREE_TYPE (fntype),
function, nargs, argarray);
+ /* If -Wnonnull warning has been diagnosed, avoid diagnosing it again
+ later. */
+ if (warned_p && TREE_CODE (result) == CALL_EXPR)
+ TREE_NO_WARNING (result) = 1;
/* In this improbable scenario, a nested function returns a VM type.
Create a TARGET_EXPR so that the call always has a LHS, much as