* [C++ Patch] PR 84972 ("[6/7/8 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark)...")
@ 2018-03-21 9:37 Paolo Carlini
2018-03-21 18:01 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2018-03-21 9:37 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
Hi,
as I told Marek in the audit trail, I'm working on a more complete patch
consistently changing maybe_deduce_size_from_array_init for various
error recovery issues (see the trail of c++/84632 too), but since this
specific regression ultimately started with a previous change of mine
and it's very simple I decided to send it now, for 8.1.0. Essentially,
the idea is setting TREE_TYPE (decl) to error_mark_node - the normal
error recovery mechanism in this function via cp_complete_array_type -
also when the early check_array_designated_initializer fails.
Tested x86_64-linux, Paolo.
//////////////////////////
[-- Attachment #2: CL_84972 --]
[-- Type: text/plain, Size: 312 bytes --]
/cp
2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84972
* decl.c (maybe_deduce_size_from_array_init): Set TREE_TYPE to
error_mark_node when check_array_designated_initializer fails.
/testsuite
2018-03-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84972
* g++.dg/ext/desig10.C: New.
[-- Attachment #3: patch_84972 --]
[-- Type: text/plain, Size: 773 bytes --]
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 258706)
+++ cp/decl.c (working copy)
@@ -5467,7 +5467,9 @@ maybe_deduce_size_from_array_init (tree decl, tree
failure = 1;
}
- if (!failure)
+ if (failure)
+ TREE_TYPE (decl) = error_mark_node;
+ else
{
failure = cp_complete_array_type (&TREE_TYPE (decl), initializer,
do_default);
Index: testsuite/g++.dg/ext/desig10.C
===================================================================
--- testsuite/g++.dg/ext/desig10.C (nonexistent)
+++ testsuite/g++.dg/ext/desig10.C (working copy)
@@ -0,0 +1,4 @@
+// PR c++/84972
+// { dg-additional-options "-w" }
+
+char(a[])({.a = 0}); // { dg-error "designated initializer" }
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ Patch] PR 84972 ("[6/7/8 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark)...")
2018-03-21 9:37 [C++ Patch] PR 84972 ("[6/7/8 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark)...") Paolo Carlini
@ 2018-03-21 18:01 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-03-21 18:01 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches
OK.
On Wed, Mar 21, 2018 at 5:28 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> as I told Marek in the audit trail, I'm working on a more complete patch
> consistently changing maybe_deduce_size_from_array_init for various error
> recovery issues (see the trail of c++/84632 too), but since this specific
> regression ultimately started with a previous change of mine and it's very
> simple I decided to send it now, for 8.1.0. Essentially, the idea is setting
> TREE_TYPE (decl) to error_mark_node - the normal error recovery mechanism in
> this function via cp_complete_array_type - also when the early
> check_array_designated_initializer fails.
>
> Tested x86_64-linux, Paolo.
>
> //////////////////////////
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-21 17:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-21 9:37 [C++ Patch] PR 84972 ("[6/7/8 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark)...") Paolo Carlini
2018-03-21 18:01 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).