re PR c/65066 (ICE: Segmentation fault with -Wformat=2)

PR c/65066
	* c-format.c (check_format_types): Handle null param.

	* gcc.dg/pr65066.c: New test.

From-SVN: r220732
This commit is contained in:
Marek Polacek 2015-02-16 11:16:33 +00:00 committed by Marek Polacek
parent d39023b4d5
commit 3d5cb23da1
4 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2015-02-16 Marek Polacek <polacek@redhat.com>
PR c/65066
* c-format.c (check_format_types): Handle null param.
2015-02-13 Marek Polacek <polacek@redhat.com>
PR c/65040

View File

@ -2492,6 +2492,7 @@ check_format_types (location_t loc, format_wanted_type *types)
&& TREE_CODE (cur_type) == INTEGER_TYPE
&& warn_format_signedness
&& TYPE_UNSIGNED (wanted_type)
&& cur_param != NULL_TREE
&& TREE_CODE (cur_param) == NOP_EXPR)
{
tree t = TREE_TYPE (TREE_OPERAND (cur_param, 0));

View File

@ -1,3 +1,8 @@
2015-02-16 Marek Polacek <polacek@redhat.com>
PR c/65066
* gcc.dg/pr65066.c: New test.
2015-02-16 Ilya Enkovich <ilya.enkovich@intel.com>
* gcc.dg/pr65002.C: Move ...

View File

@ -0,0 +1,12 @@
/* PR c/65066 */
/* { dg-do compile } */
/* { dg-options "-Wformat=2" } */
extern int sscanf (const char *restrict, const char *restrict, ...);
int *a;
void
foo ()
{
sscanf (0, "0x%x #", a); /* { dg-warning "expects argument of type" } */
}