diff mbox

RS6000 PATCH for c++/57415 (ICE on altivec tests)

Message ID 51A9604F.2010706@redhat.com
State New
Headers show

Commit Message

Jason Merrill June 1, 2013, 2:45 a.m. UTC
The issue here was that rs6000-c.c was creating COMPOUND_LITERAL_EXPR, 
which the C++ front end doesn't understand.  For C++ let's create 
TARGET_EXPRs instead.

Tested powerpc64-unknown-linux-gnu.  OK for trunk?

Comments

David Edelsohn June 1, 2013, 8:39 p.m. UTC | #1
On Fri, May 31, 2013 at 10:45 PM, Jason Merrill <jason@redhat.com> wrote:
> The issue here was that rs6000-c.c was creating COMPOUND_LITERAL_EXPR, which
> the C++ front end doesn't understand.  For C++ let's create TARGET_EXPRs
> instead.
>
> Tested powerpc64-unknown-linux-gnu.  OK for trunk?

The patch fixes the testsuite failure, but I now have a massive number
of new libstdc++ failures on AIX and I don't yet know the cause.

- David
diff mbox

Patch

commit a640247e7cdf04126e8a9278394ed99c6a3d5d50
Author: Jason Merrill <jason@redhat.com>
Date:   Thu May 30 16:01:11 2013 -0400

    	PR c++/57415
    	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
    	Use TARGET_EXPR for C++.

diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 801b5bb..50ff8d3 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -3822,11 +3822,20 @@  altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
       TREE_USED (decl) = 1;
       TREE_TYPE (decl) = arg1_type;
       TREE_READONLY (decl) = TYPE_READONLY (arg1_type);
-      DECL_INITIAL (decl) = arg1;
-      stmt = build1 (DECL_EXPR, arg1_type, decl);
-      TREE_ADDRESSABLE (decl) = 1;
-      SET_EXPR_LOCATION (stmt, loc);
-      stmt = build1 (COMPOUND_LITERAL_EXPR, arg1_type, stmt);
+      if (c_dialect_cxx ())
+	{
+	  stmt = build4 (TARGET_EXPR, arg1_type, decl, arg1,
+			 NULL_TREE, NULL_TREE);
+	  SET_EXPR_LOCATION (stmt, loc);
+	}
+      else
+	{
+	  DECL_INITIAL (decl) = arg1;
+	  stmt = build1 (DECL_EXPR, arg1_type, decl);
+	  TREE_ADDRESSABLE (decl) = 1;
+	  SET_EXPR_LOCATION (stmt, loc);
+	  stmt = build1 (COMPOUND_LITERAL_EXPR, arg1_type, stmt);
+	}
 
       innerptrtype = build_pointer_type (arg1_inner_type);
 
@@ -3901,11 +3910,20 @@  altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
       TREE_USED (decl) = 1;
       TREE_TYPE (decl) = arg1_type;
       TREE_READONLY (decl) = TYPE_READONLY (arg1_type);
-      DECL_INITIAL (decl) = arg1;
-      stmt = build1 (DECL_EXPR, arg1_type, decl);
-      TREE_ADDRESSABLE (decl) = 1;
-      SET_EXPR_LOCATION (stmt, loc);
-      stmt = build1 (COMPOUND_LITERAL_EXPR, arg1_type, stmt);
+      if (c_dialect_cxx ())
+	{
+	  stmt = build4 (TARGET_EXPR, arg1_type, decl, arg1,
+			 NULL_TREE, NULL_TREE);
+	  SET_EXPR_LOCATION (stmt, loc);
+	}
+      else
+	{
+	  DECL_INITIAL (decl) = arg1;
+	  stmt = build1 (DECL_EXPR, arg1_type, decl);
+	  TREE_ADDRESSABLE (decl) = 1;
+	  SET_EXPR_LOCATION (stmt, loc);
+	  stmt = build1 (COMPOUND_LITERAL_EXPR, arg1_type, stmt);
+	}
 
       innerptrtype = build_pointer_type (arg1_inner_type);