[Bug c/92833] ice for broken C code

2020-01-18 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:955e4e3b7057b2142658376e8450fdbda1d31737

commit r10-6067-g955e4e3b7057b2142658376e8450fdbda1d31737
Author: Jakub Jelinek 
Date:   Sat Jan 18 13:54:08 2020 +0100

testsuite: Fix dg-message syntax.

2020-01-18  Jakub Jelinek  

PR c/92833
* c-c++-common/pr92833-4.c: Fix dg-message syntax.

[Bug c/92833] ice for broken C code

2020-01-16 Thread jsm28 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

Joseph S. Myers  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |10.0

--- Comment #8 from Joseph S. Myers  ---
Fix committed, thanks.

[Bug c/92833] ice for broken C code

2020-01-16 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Joseph Myers :

https://gcc.gnu.org/g:852f0ae80555238c425e33f98df5c7077694bd9f

commit r10-6026-g852f0ae80555238c425e33f98df5c7077694bd9f
Author: Kerem Kat 
Date:   Thu Jan 16 23:42:11 2020 +

Fix ICE caused by swallowing a token in c_parser_consume_token

This patch fixes ICE on invalid code, specifically files that have
conflict-marker-like signs before EOF.

PR c/92833
gcc/c/
* c-parser.c (c_parser_consume_token): Fix peeked token stack pop
to support 4 available tokens.

gcc/testsuite/
* c-c++-common/pr92833-1.c, c-c++-common/pr92833-2.c,
c-c++-common/pr92833-3.c, c-c++-common/pr92833-4.c: New tests.

[Bug c/92833] ice for broken C code

2019-12-30 Thread keremkat+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

--- Comment #6 from Kerem Kat  ---
Created attachment 47569
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47569&action=edit
fix ice

PR c/92833
* parser.c (c_parser_consume_token): Fix peeked
token stack pop to support 4 available tokens.

* c-c++-common/pr92833-*.c: New tests.

[Bug c/92833] ice for broken C code

2019-12-30 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||tkoenig at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |keremkat+gcc at gmail 
dot com

--- Comment #5 from Thomas Koenig  ---
(In reply to Kerem Kat from comment #4)
> Please assign to me.

Happy to oblige.

[Bug c/92833] ice for broken C code

2019-12-30 Thread keremkat+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

--- Comment #4 from Kerem Kat  ---
Please assign to me.

[Bug c/92833] ice for broken C code

2019-12-30 Thread keremkat+gcc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

Kerem Kat  changed:

   What|Removed |Added

 CC||keremkat+gcc at gmail dot com

--- Comment #3 from Kerem Kat  ---
This is caused by c_parser_peek_conflict_marker peeking into 4 tokens at once
whereas c_parser_consume_token expects a maximum of 3 tokens to be peeked.

In this case, last token is EOF and it is swallowed by c_parser_consume_token,
leading to ICE within the next c_parser_skip_to_end_of_block_or_statement
invocation which tries to read pfile->buffer that was popped to become empty
via _cpp_pop_buffer.


Minimal test case is six less than signs:

<<


Full stack trace:

92833-ice.c:1:1: error: expected identifier or ‘(’ before ‘<<’ token
1 | <<
  | ^~
92833-ice.c:1:1: internal compiler error: Segmentation fault
0xe150f3 crash_signal
dir/gcc/toplev.c:328
0x187c684 _cpp_lex_direct
dir/libcpp/lex.c:2725
0x187c3e4 _cpp_lex_token
dir/libcpp/lex.c:2608
0x1886d77 cpp_get_token_1
dir/libcpp/macro.c:2707
0x8ef0e5 c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
dir/gcc/c-family/c-lex.c:458
0x8426b5 c_lex_one_token
dir/gcc/c/c-parser.c:270
0x842bbe c_parser_peek_token(c_parser*)
dir/gcc/c/c-parser.c:474
0x843ffd c_parser_skip_to_end_of_block_or_statement
dir/gcc/c/c-parser.c:1322
0x8455bd c_parser_declaration_or_fndef
dir/gcc/c/c-parser.c:2123
0x844a1d c_parser_external_declaration
dir/gcc/c/c-parser.c:1742
0x844566 c_parser_translation_unit
dir/gcc/c/c-parser.c:1615
0x884ed7 c_parse_file()
dir/gcc/c/c-parser.c:21704
0x8f9b43 c_common_parse_file()
dir/gcc/c-family/c-opts.c:1186

[Bug c/92833] ice for broken C code

2019-12-05 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

--- Comment #2 from David Binderman  ---
Something similar for this list of tokens:

 extern
 ==
 ==
 ==

[Bug c/92833] ice for broken C code

2019-12-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92833

Marek Polacek  changed:

   What|Removed |Added

   Keywords||error-recovery,
   ||ice-on-invalid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-12-05
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.