public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 84940 ("[7/8/9 Regression] internal compiler error: in build_value_init_noctor, at cp/init.c:465")
@ 2018-09-25 17:06 Paolo Carlini
  2018-09-26 15:11 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2018-09-25 17:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill, Nathan Sidwell

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

Hi,

in this error-recovery regression we ICE after a sensible diagnostic 
emitted by cp_build_unary_op, called by finish_unary_op_expr via 
build_x_unary_op. In principle we could dig deeper, but I don't think it 
makes sense for finish_unary_op_expr to go on having seen the 
error_mark_node returned by build_x_unary_op given that the purpose of 
its second half is only issuing warnings.

Tested x86_64-linux.

Thanks, Paolo.

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



[-- Attachment #2: CL_84940 --]
[-- Type: text/plain, Size: 284 bytes --]

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

	PR c++/84940
	* semantics.c (finish_unary_op_expr): Check return value of
	build_x_unary_op for error_mark_node.

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

	PR c++/84940
	* g++.dg/expr/unary4.C: New.

[-- Attachment #3: patch_84940 --]
[-- Type: text/plain, Size: 1048 bytes --]

Index: cp/semantics.c
===================================================================
--- cp/semantics.c	(revision 264578)
+++ cp/semantics.c	(working copy)
@@ -2727,13 +2727,14 @@ finish_unary_op_expr (location_t op_loc, enum tree
   /* TODO: build_x_unary_op doesn't always honor the location.  */
   result.set_location (combined_loc);
 
-  tree result_ovl, expr_ovl;
+  if (result == error_mark_node)
+    return result;
 
   if (!(complain & tf_warning))
     return result;
 
-  result_ovl = result;
-  expr_ovl = expr;
+  tree result_ovl = result;
+  tree expr_ovl = expr;
 
   if (!processing_template_decl)
     expr_ovl = cp_fully_fold (expr_ovl);
Index: testsuite/g++.dg/expr/unary4.C
===================================================================
--- testsuite/g++.dg/expr/unary4.C	(nonexistent)
+++ testsuite/g++.dg/expr/unary4.C	(working copy)
@@ -0,0 +1,8 @@
+// PR c++/84940
+// { dg-additional-options -Wno-vla }
+
+void
+foo (int x)
+{
+  struct {} a[1][x](-a[0]); // { dg-error "wrong type argument to unary minus" }
+}

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

* Re: [C++ Patch] PR 84940 ("[7/8/9 Regression] internal compiler error: in build_value_init_noctor, at cp/init.c:465")
  2018-09-25 17:06 [C++ Patch] PR 84940 ("[7/8/9 Regression] internal compiler error: in build_value_init_noctor, at cp/init.c:465") Paolo Carlini
@ 2018-09-26 15:11 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-09-26 15:11 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches, Nathan Sidwell

OK.

On Tue, Sep 25, 2018 at 12:45 PM, Paolo Carlini
<paolo.carlini@oracle.com> wrote:
> Hi,
>
> in this error-recovery regression we ICE after a sensible diagnostic emitted
> by cp_build_unary_op, called by finish_unary_op_expr via build_x_unary_op.
> In principle we could dig deeper, but I don't think it makes sense for
> finish_unary_op_expr to go on having seen the error_mark_node returned by
> build_x_unary_op given that the purpose of its second half is only issuing
> warnings.
>
> Tested x86_64-linux.
>
> Thanks, Paolo.
>
> //////////////////////
>
>

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

end of thread, other threads:[~2018-09-26 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-25 17:06 [C++ Patch] PR 84940 ("[7/8/9 Regression] internal compiler error: in build_value_init_noctor, at cp/init.c:465") Paolo Carlini
2018-09-26 15:11 ` 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).