OSDN Git Service

2010-02-26 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2010 13:34:38 +0000 (13:34 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Feb 2010 13:34:38 +0000 (13:34 +0000)
PR tree-optimization/43188
* tree-vect-stmts.c (get_vectype_for_scalar_type): Do not build
vector types of over-aligned element type.

* gcc.c-torture/compile/pr43188.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157088 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr43188.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 5c889ad..047ba5e 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-26  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/43188
+       * tree-vect-stmts.c (get_vectype_for_scalar_type): Do not build
+       vector types of over-aligned element type.
+
 2010-02-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/43175
index 8c78047..09fc468 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-26  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/43188
+       * gcc.c-torture/compile/pr43188.c: New testcase.
+
 2010-02-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/43175
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43188.c b/gcc/testsuite/gcc.c-torture/compile/pr43188.c
new file mode 100644 (file)
index 0000000..bbc6f42
--- /dev/null
@@ -0,0 +1,6 @@
+int *__attribute__((__aligned__(16))) *p;
+
+int main (void)
+{
+  return **p;
+}
index 9923090..ce604b3 100644 (file)
@@ -4405,13 +4405,18 @@ tree
 get_vectype_for_scalar_type (tree scalar_type)
 {
   enum machine_mode inner_mode = TYPE_MODE (scalar_type);
-  int nbytes = GET_MODE_SIZE (inner_mode);
+  unsigned int nbytes = GET_MODE_SIZE (inner_mode);
   int nunits;
   tree vectype;
 
   if (nbytes == 0 || nbytes >= UNITS_PER_SIMD_WORD (inner_mode))
     return NULL_TREE;
 
+  /* We can't build a vector type of elements with alignment bigger than
+     their size.  */
+  if (nbytes < TYPE_ALIGN_UNIT (scalar_type))
+    return NULL_TREE;
+
   /* FORNOW: Only a single vector size per mode (UNITS_PER_SIMD_WORD)
      is expected.  */
   nunits = UNITS_PER_SIMD_WORD (inner_mode) / nbytes;