From: Paolo Carlini <paolo.carlini@oracle.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Jason Merrill <jason@redhat.com>
Subject: [C++ Patch] PR 84972 ("[6/7/8 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark)...")
Date: Wed, 21 Mar 2018 09:37:00 -0000 [thread overview]
Message-ID: <15cda01c-f6ca-9f33-f9fb-11d5b50b937b@oracle.com> (raw)
[-- 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" }
next reply other threads:[~2018-03-21 9:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 9:37 Paolo Carlini [this message]
2018-03-21 18:01 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15cda01c-f6ca-9f33-f9fb-11d5b50b937b@oracle.com \
--to=paolo.carlini@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).