diff options
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 8330e65..1394f18 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -1859,7 +1859,13 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, init_loc = c_parser_peek_token (parser)->location; rich_location richloc (line_table, init_loc); start_init (NULL_TREE, asm_name, global_bindings_p (), &richloc); + /* A parameter is initialized, which is invalid. Don't + attempt to instrument the initializer. */ + int flag_sanitize_save = flag_sanitize; + if (nested && !empty_ok) + flag_sanitize = 0; init = c_parser_expr_no_commas (parser, NULL); + flag_sanitize = flag_sanitize_save; if (TREE_CODE (init.value) == COMPONENT_REF && DECL_C_BIT_FIELD (TREE_OPERAND (init.value, 1))) error_at (here, @@ -1917,7 +1923,13 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, init_loc = c_parser_peek_token (parser)->location; rich_location richloc (line_table, init_loc); start_init (d, asm_name, global_bindings_p (), &richloc); + /* A parameter is initialized, which is invalid. Don't + attempt to instrument the initializer. */ + int flag_sanitize_save = flag_sanitize; + if (TREE_CODE (d) == PARM_DECL) + flag_sanitize = 0; init = c_parser_initializer (parser); + flag_sanitize = flag_sanitize_save; finish_init (); } if (oacc_routine_data) |