Commit 7d07a93a by Marek Polacek Committed by Marek Polacek

re PR c/83966 (ICE in check_function_arguments at gcc/c-family/c-common.c:5617)

	PR c/83966
	* c-format.c (check_function_format): Check current_function_decl.

	* gcc.dg/format/Wsuggest-attribute-1.c: New test.

From-SVN: r257159
parent 7672aa9b
2018-01-29 Marek Polacek <polacek@redhat.com>
PR c/83966
* c-format.c (check_function_format): Check current_function_decl.
2018-01-27 Jakub Jelinek <jakub@redhat.com> 2018-01-27 Jakub Jelinek <jakub@redhat.com>
* c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix * c-cppbuiltin.c (c_cpp_builtins): Use ggc_strdup for the fp_suffix
......
...@@ -1110,7 +1110,9 @@ check_function_format (tree attrs, int nargs, tree *argarray, ...@@ -1110,7 +1110,9 @@ check_function_format (tree attrs, int nargs, tree *argarray,
from the format attribute if the called function is decorated from the format attribute if the called function is decorated
with it. Avoid using calls with string literal formats for with it. Avoid using calls with string literal formats for
guidance since those are unlikely to be viable candidates. */ guidance since those are unlikely to be viable candidates. */
if (warn_suggest_attribute_format && info.first_arg_num == 0 if (warn_suggest_attribute_format
&& current_function_decl != NULL_TREE
&& info.first_arg_num == 0
&& (format_types[info.format_type].flags && (format_types[info.format_type].flags
& (int) FMT_FLAG_ARG_CONVERT) & (int) FMT_FLAG_ARG_CONVERT)
/* c_strlen will fail for a function parameter but succeed /* c_strlen will fail for a function parameter but succeed
......
2018-01-29 Marek Polacek <polacek@redhat.com>
PR c/83966
* gcc.dg/format/Wsuggest-attribute-1.c: New test.
2018-01-29 Richard Biener <rguenther@suse.de> 2018-01-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/84057 PR tree-optimization/84057
......
/* PR c/83966 */
/* { dg-do compile } */
/* { dg-options "-Wsuggest-attribute=format" } */
#include "format.h"
va_list va;
const char *f;
__typeof (vsnprintf ("foo", 0U, f, va)) T;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment