Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-17 Thread Jason Merrill
On Wed, Jan 17, 2018 at 4:07 PM, Jakub Jelinek wrote: > On Wed, Jan 17, 2018 at 02:31:29PM -0500, Jason Merrill wrote: >> > First, thanks for your messages. Personally, at this late time for 8, I >> > vote for something like my most recent grokdeclarator fix and yours above >>

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-17 Thread Jakub Jelinek
On Wed, Jan 17, 2018 at 02:31:29PM -0500, Jason Merrill wrote: > > First, thanks for your messages. Personally, at this late time for 8, I > > vote for something like my most recent grokdeclarator fix and yours above > > for 83824. Then, for 9, or even 8.2, the more encompassing change for all

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-17 Thread Jason Merrill
On Sat, Jan 13, 2018 at 7:59 AM, Paolo Carlini wrote: > Hi Jakub, all, > >> On 13 Jan 2018, at 12:32, Jakub Jelinek wrote: >> >>> On Sat, Jan 13, 2018 at 12:12:02PM +0100, Jakub Jelinek wrote: >>> Or we could not add those error_mark_nodes and >>>

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-13 Thread Paolo Carlini
Hi Jakub, all, > On 13 Jan 2018, at 12:32, Jakub Jelinek wrote: > >> On Sat, Jan 13, 2018 at 12:12:02PM +0100, Jakub Jelinek wrote: >> Or we could not add those error_mark_nodes and >> gcc_assert (seen_error () || cp_parser_error_occurred (parser)); > > This fixes the

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-13 Thread Jakub Jelinek
On Sat, Jan 13, 2018 at 12:12:02PM +0100, Jakub Jelinek wrote: > Or we could not add those error_mark_nodes and > gcc_assert (seen_error () || cp_parser_error_occurred (parser)); This fixes the testcase: --- gcc/cp/parser.c.jj 2018-01-11 18:58:48.386391801 +0100 +++ gcc/cp/parser.c

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-13 Thread Jakub Jelinek
On Sat, Jan 13, 2018 at 12:10:22PM +0100, Jakub Jelinek wrote: > On Fri, Jan 12, 2018 at 01:13:17PM -0500, Jason Merrill wrote: > > On Thu, Jan 11, 2018 at 5:11 PM, Paolo Carlini > > wrote: > > > On 11/01/2018 21:33, Jason Merrill wrote: > > >> On 01/10/2018 06:50 PM,

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-13 Thread Jakub Jelinek
On Fri, Jan 12, 2018 at 01:13:17PM -0500, Jason Merrill wrote: > On Thu, Jan 11, 2018 at 5:11 PM, Paolo Carlini > wrote: > > On 11/01/2018 21:33, Jason Merrill wrote: > >> On 01/10/2018 06:50 PM, Paolo Carlini wrote: > >>> > >>> thus the below is a rather "dull"

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-12 Thread Paolo Carlini
Hi, On 12/01/2018 19:13, Jason Merrill wrote: Hmm, I think dropping the attributes is reasonable for grokdeclarator to do as error-recovery, similarly to how it discards an ill-formed exception-specification. But let's assert seen_error() in that case. Agreed. The below passes testing.

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-12 Thread Jason Merrill
On Thu, Jan 11, 2018 at 5:11 PM, Paolo Carlini wrote: > On 11/01/2018 21:33, Jason Merrill wrote: >> On 01/10/2018 06:50 PM, Paolo Carlini wrote: >>> >>> thus the below is a rather "dull" solution at the level of >>> cplus_decl_attributes itself:

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-11 Thread Paolo Carlini
Hi, On 11/01/2018 21:33, Jason Merrill wrote: On 01/10/2018 06:50 PM, Paolo Carlini wrote: thus the below is a rather "dull" solution at the level of cplus_decl_attributes itself: cp_check_const_attributes is tweaked to check for error_mark_node at each outer iteration This shouldn't be

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-11 Thread Jason Merrill
On 01/10/2018 06:50 PM, Paolo Carlini wrote: thus the below is a rather "dull" solution at the level of cplus_decl_attributes itself: cp_check_const_attributes is tweaked to check for error_mark_node at each outer iteration This shouldn't be necessary; we should have returned error_mark_node

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-11 Thread Paolo Carlini
... today I played a bit with the other idea inspired by your feedback. Irrespective of the special issue at hand, it seems in principle interesting to me that when we are sure that we aren't parsing tentatively anymore we can do something more radical for the sake of better error recovery.

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-10 Thread Paolo Carlini
Hi again, thus the below is a rather "dull" solution at the level of cplus_decl_attributes itself: cp_check_const_attributes is tweaked to check for error_mark_node at each outer iteration and consistently return a bool, which is then checked by the caller in order to possibly bail out (this

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-10 Thread Paolo Carlini
Hi, On 10/01/2018 17:58, Jason Merrill wrote: On Wed, Jan 10, 2018 at 11:33 AM, Paolo Carlini wrote: Hi, On 10/01/2018 16:32, Jason Merrill wrote: On Fri, Dec 22, 2017 at 7:34 PM, Paolo Carlini wrote: in this error recovery issue

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-10 Thread Jason Merrill
On Wed, Jan 10, 2018 at 11:33 AM, Paolo Carlini wrote: > Hi, > > On 10/01/2018 16:32, Jason Merrill wrote: >> >> On Fri, Dec 22, 2017 at 7:34 PM, Paolo Carlini >> wrote: >>> >>> in this error recovery issue cp_check_const_attributes and more

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-10 Thread Paolo Carlini
Hi, On 10/01/2018 16:32, Jason Merrill wrote: On Fri, Dec 22, 2017 at 7:34 PM, Paolo Carlini wrote: in this error recovery issue cp_check_const_attributes and more generally cplus_decl_attributes have lots of troubles handling the error_mark_node returned by

Re: [C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2018-01-10 Thread Jason Merrill
On Fri, Dec 22, 2017 at 7:34 PM, Paolo Carlini wrote: > in this error recovery issue cp_check_const_attributes and more generally > cplus_decl_attributes have lots of troubles handling the error_mark_node > returned by cp_parser_std_attribute_spec_seq, as called by >

[C++ Patch] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")

2017-12-22 Thread Paolo Carlini
Hi, in this error recovery issue cp_check_const_attributes and more generally cplus_decl_attributes have lots of troubles handling the error_mark_node returned by cp_parser_std_attribute_spec_seq, as called by cp_parser_direct_declarator. I fiddled quite a bit with these parsing facilities