[PATCH] Fix missing gimplification of vector constructors

Richard Biener rguenther@suse.de
Mon Sep 22 12:45:00 GMT 2014


The following fixes non-GIMPLE constructors slipping through the
gimplifier.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-09-22  Richard Biener  <rguenther@suse.de>

	* gimplify.c (gimplify_init_constructor): Do not leave
	non-GIMPLE vector constructors around.
	* tree-cfg.c (verify_gimple_assign_single): Verify that
	CONSTRUCTORs have gimple elements.

Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c	(revision 215450)
+++ gcc/gimplify.c	(working copy)
@@ -4021,12 +4021,6 @@ gimplify_init_constructor (tree *expr_p,
 		break;
 	      }
 
-	    /* Don't reduce an initializer constant even if we can't
-	       make a VECTOR_CST.  It won't do anything for us, and it'll
-	       prevent us from representing it as a single constant.  */
-	    if (initializer_constant_valid_p (ctor, type))
-	      break;
-
 	    TREE_CONSTANT (ctor) = 0;
 	  }
 
Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c	(revision 215450)
+++ gcc/tree-cfg.c	(working copy)
@@ -4207,8 +4233,20 @@ verify_gimple_assign_single (gimple stmt
 		  debug_generic_stmt (rhs1);
 		  return true;
 		}
+	      if (!is_gimple_val (elt_v))
+		{
+		  error ("vector CONSTRUCTOR element is not a GIMPLE value");
+		  debug_generic_stmt (rhs1);
+		  return true;
+		}
 	    }
 	}
+      else if (CONSTRUCTOR_NELTS (rhs1) != 0)
+	{
+	  error ("non-vector CONSTRUCTOR with elements");
+	  debug_generic_stmt (rhs1);
+	  return true;
+	}
       return res;
     case OBJ_TYPE_REF:
     case ASSERT_EXPR:



More information about the Gcc-patches mailing list