public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: Jason Merrill <jason@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ Patch] PR 84632 ("[8 Regression] internal compiler error: tree check: expected record_type or union_type or qual_union_type, have array_type in reduced_constant_expression_p...")
Date: Thu, 22 Mar 2018 22:26:00 -0000	[thread overview]
Message-ID: <8ec9f4c3-ef14-426e-1758-9711cf04343c@oracle.com> (raw)
In-Reply-To: <3ef910c9-fa3a-bd25-66bc-069437169304@oracle.com>

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

... with patch ;)

If you are curious where the heck that INDIRECT_REF is coming from, is 
coming from the gimplifier, cp_gimpliify_expr, via build_vec_init. Grrr.

Paolo.

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

[-- Attachment #2: patch_84632_2 --]
[-- Type: text/plain, Size: 2473 bytes --]

Index: cp/init.c
===================================================================
--- cp/init.c	(revision 258758)
+++ cp/init.c	(working copy)
@@ -1688,14 +1688,6 @@ build_aggr_init (tree exp, tree init, int flags, t
 	}
       else
 	{
-	  /* An array may not be initialized use the parenthesized
-	     initialization form -- unless the initializer is "()".  */
-	  if (init && TREE_CODE (init) == TREE_LIST)
-	    {
-	      if (complain & tf_error)
-		error ("bad array initializer");
-	      return error_mark_node;
-	    }
 	  /* Must arrange to initialize each element of EXP
 	     from elements of INIT.  */
 	  if (cv_qualified_p (type))
@@ -1705,14 +1697,15 @@ build_aggr_init (tree exp, tree init, int flags, t
 	  from_array = (itype && same_type_p (TREE_TYPE (init),
 					      TREE_TYPE (exp)));
 
-	  if (init && !from_array
-	      && !BRACE_ENCLOSED_INITIALIZER_P (init))
+	  if (init && ((!from_array
+			&& !BRACE_ENCLOSED_INITIALIZER_P (init))
+		       /* See c++/84632.  */
+		       || VAR_P (init)))
 	    {
 	      if (complain & tf_error)
-		permerror (init_loc, "array must be initialized "
-			   "with a brace-enclosed initializer");
-	      else
-		return error_mark_node;
+		error_at (init_loc, "array must be initialized "
+			  "with a brace-enclosed initializer");
+	      return error_mark_node;
 	    }
 	}
 
Index: testsuite/g++.dg/init/array49.C
===================================================================
--- testsuite/g++.dg/init/array49.C	(nonexistent)
+++ testsuite/g++.dg/init/array49.C	(working copy)
@@ -0,0 +1,6 @@
+// PR c++/84632
+// { dg-additional-options "-w" }
+
+class {
+  &a;  // { dg-error "forbids declaration" }
+} b[2] = b;  // { dg-error "initialized" }
Index: testsuite/g++.dg/torture/pr70499.C
===================================================================
--- testsuite/g++.dg/torture/pr70499.C	(revision 258758)
+++ testsuite/g++.dg/torture/pr70499.C	(working copy)
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-additional-options "-w -fpermissive -Wno-psabi" }
+// { dg-additional-options "-w -Wno-psabi" }
 // { dg-additional-options "-mavx" { target x86_64-*-* i?86-*-* } }
 
 typedef double __m256d __attribute__ ((__vector_size__ (32), __may_alias__));
@@ -30,7 +30,7 @@ struct Foo {
 template<typename Tx>  
 __attribute__((__always_inline__)) inline void inlineFunc(Tx hx[]) {
     Tx x = hx[0], y = hx[1];
-    Tx lam[1] = (x*y);
+    Tx lam[1] = {(x*y)};
 }
 
 void FooBarFunc () {

  reply	other threads:[~2018-03-22 21:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22  8:12 Paolo Carlini
2018-03-22 18:11 ` Jason Merrill
2018-03-22 19:04   ` Paolo Carlini
2018-03-22 21:19     ` Paolo Carlini
2018-03-22 21:30       ` Jason Merrill
2018-03-22 21:39         ` Paolo Carlini
2018-03-22 22:26           ` Paolo Carlini [this message]
2018-03-22 22:35             ` Jason Merrill
2018-03-23 10:48               ` Paolo Carlini
2018-03-23 12:45                 ` Jason Merrill
2018-03-26 10:30                   ` Paolo Carlini
2018-03-26 17:17                     ` Jason Merrill
2018-03-26 18:25                       ` Paolo Carlini
2018-03-26 18:33                         ` 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=8ec9f4c3-ef14-426e-1758-9711cf04343c@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).