Bug 65066 - [5 Regression] ICE: Segmentation fault with -Wformat=2
Summary: [5 Regression] ICE: Segmentation fault with -Wformat=2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 5.0
: P1 normal
Target Milestone: 5.0
Assignee: Marek Polacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-15 08:40 UTC by Markus Trippelsdorf
Modified: 2015-02-17 11:31 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-02-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2015-02-15 08:40:08 UTC
markus@x4 /tmp % cat rt_names.i
extern int sscanf(__const char *__restrict __s,
                  __const char *__restrict __format, ...);
int *a;
void foo() { sscanf(0, "0x%x  #", a); }

markus@x4 /tmp % gcc -Wformat=2 -c rt_names.i
rt_names.i: In function ‘foo’:
rt_names.i:4:1: internal compiler error: Segmentation fault
 void foo() { sscanf(0, "0x%x  #", a); }
 ^
0xaed31f crash_signal
        ../../gcc/gcc/toplev.c:383
0x57c131 check_format_types
        ../../gcc/gcc/c-family/c-format.c:2495
0x57c131 check_format_info_main
        ../../gcc/gcc/c-family/c-format.c:2326
0x6a6ec8 check_format_arg
        ../../gcc/gcc/c-family/c-format.c:1623
0x6a7604 check_format_info
        ../../gcc/gcc/c-family/c-format.c:1358
0x6a7604 check_function_format(tree_node*, int, tree_node**)
        ../../gcc/gcc/c-family/c-format.c:1028
0x6949a7 check_function_arguments(tree_node const*, int, tree_node**)
        ../../gcc/gcc/c-family/c-common.c:9540
0x6293dd build_function_call_vec(unsigned int, vec<unsigned int, va_heap, vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc, vl_embed>*)
        ../../gcc/gcc/c/c-typeck.c:2994
0x64b44a c_parser_postfix_expression_after_primary
        ../../gcc/gcc/c/c-parser.c:7894
0x644a36 c_parser_postfix_expression
        ../../gcc/gcc/c/c-parser.c:7715
0x6470fa c_parser_unary_expression
        ../../gcc/gcc/c/c-parser.c:6602
0x647d0f c_parser_cast_expression
        ../../gcc/gcc/c/c-parser.c:6440
0x647ef2 c_parser_binary_expression
        ../../gcc/gcc/c/c-parser.c:6255
0x648a55 c_parser_conditional_expression
        ../../gcc/gcc/c/c-parser.c:6031
0x649030 c_parser_expr_no_commas
        ../../gcc/gcc/c/c-parser.c:5949
0x649702 c_parser_expression
        ../../gcc/gcc/c/c-parser.c:8022
0x64a129 c_parser_expression_conv
        ../../gcc/gcc/c/c-parser.c:8055
0x642988 c_parser_statement_after_labels
        ../../gcc/gcc/c/c-parser.c:5115
0x644183 c_parser_compound_statement_nostart
        ../../gcc/gcc/c/c-parser.c:4701
0x65605e c_parser_compound_statement
        ../../gcc/gcc/c/c-parser.c:4538
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Probably started with r220677.
Comment 1 Marek Polacek 2015-02-15 12:14:51 UTC
Ouch.
Comment 2 Marek Polacek 2015-02-16 11:17:04 UTC
Author: mpolacek
Date: Mon Feb 16 11:16:33 2015
New Revision: 220732

URL: https://gcc.gnu.org/viewcvs?rev=220732&root=gcc&view=rev
Log:
	PR c/65066
	* c-format.c (check_format_types): Handle null param.

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

Added:
    trunk/gcc/testsuite/gcc.dg/pr65066.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-format.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Marek Polacek 2015-02-16 11:17:50 UTC
Fixed.