public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 87324 ("g++ ICE with overriding initializers: Segmentation fault")
@ 2018-09-19 14:50 Paolo Carlini
  2018-09-19 16:06 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2018-09-19 14:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

Hi,

in this simple error-recovery issue we ICE in get_class_binding_direct 
when we try to use IDENTIFIER_CONV_OP_P on the index which we nulled in 
cp_parser_initializer_list. If, instead, we assign error_mark_node to it 
we catch it later in reshape_init_class and error-recovery goes well.

Tested x86_64-linux.

Thanks, Paolo.

////////////////////


[-- Attachment #2: CL_87324 --]
[-- Type: text/plain, Size: 276 bytes --]

/cp
2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/87324
	* parser.c (cp_parser_initializer_list): Assign error_mark_node
	to the index upon error.

/testsuite
2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/87324
	* g++.dg/cpp0x/desig5.C: New.

[-- Attachment #3: patch_87324 --]
[-- Type: text/plain, Size: 997 bytes --]

Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 264419)
+++ cp/parser.c	(working copy)
@@ -22394,7 +22394,7 @@ cp_parser_initializer_list (cp_parser* parser, boo
 			  "%<.%s%> designator used multiple times in "
 			  "the same initializer list",
 			  IDENTIFIER_POINTER (designator));
-		(*v)[i].index = NULL_TREE;
+		(*v)[i].index = error_mark_node;
 	      }
 	    else
 	      IDENTIFIER_MARKED (designator) = 1;
Index: testsuite/g++.dg/cpp0x/desig5.C
===================================================================
--- testsuite/g++.dg/cpp0x/desig5.C	(nonexistent)
+++ testsuite/g++.dg/cpp0x/desig5.C	(working copy)
@@ -0,0 +1,13 @@
+// PR c++/87324
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-pedantic" }
+
+struct {
+  struct {
+    double a;
+    struct {
+      short b;
+    };
+  };
+  int c;
+} d{.a = 7, .a = 8.09};  // { dg-error "designator used multiple times in the same initializer list" }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] PR 87324 ("g++ ICE with overriding initializers: Segmentation fault")
  2018-09-19 14:50 [C++ Patch] PR 87324 ("g++ ICE with overriding initializers: Segmentation fault") Paolo Carlini
@ 2018-09-19 16:06 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-09-19 16:06 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches

OK.

On Wed, Sep 19, 2018 at 10:42 AM, Paolo Carlini
<paolo.carlini@oracle.com> wrote:
> Hi,
>
> in this simple error-recovery issue we ICE in get_class_binding_direct when
> we try to use IDENTIFIER_CONV_OP_P on the index which we nulled in
> cp_parser_initializer_list. If, instead, we assign error_mark_node to it we
> catch it later in reshape_init_class and error-recovery goes well.
>
> Tested x86_64-linux.
>
> Thanks, Paolo.
>
> ////////////////////
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-19 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 14:50 [C++ Patch] PR 87324 ("g++ ICE with overriding initializers: Segmentation fault") Paolo Carlini
2018-09-19 16:06 ` 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).