re PR middle-end/35043 (ICE in tree-data-ref because signed_type_for_types returns...
authorRichard Guenther <rguenther@suse.de>
Mon, 4 Feb 2008 13:30:00 +0000 (13:30 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 4 Feb 2008 13:30:00 +0000 (13:30 +0000)
2008-02-04  Richard Guenther  <rguenther@suse.de>

PR middle-end/35043
* gimplify.c (gimplify_init_ctor_eval): Convert array indices
to TYPE_DOMAINs base type instead of using bitsizetype here.

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

From-SVN: r132091

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr35043.c [new file with mode: 0644]

index 089f82f239dd0ea6765274a056c5ef87d266a2ba..1665f9e1afa41ea0ce133ad19a2d8b71d97dda27 100644 (file)
@@ -1,3 +1,9 @@
+2008-02-04  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/35043
+       * gimplify.c (gimplify_init_ctor_eval): Convert array indices
+       to TYPE_DOMAINs base type instead of using bitsizetype here.
+
 2008-02-03  Jason Merrill  <jason@redhat.com>
 
        * print-tree.c (print_node) [CONSTRUCTOR]: Print elements.
index fe708471944b1e200f1b5341cf580dbb89881371..04ed39c533a5c0fc7d69bed92a0524f7c92255b5 100644 (file)
@@ -3096,6 +3096,10 @@ gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
 
       if (array_elt_type)
        {
+         /* Do not use bitsizetype for ARRAY_REF indices.  */
+         if (TYPE_DOMAIN (TREE_TYPE (object)))
+           purpose = fold_convert (TREE_TYPE (TYPE_DOMAIN (TREE_TYPE (object))),
+                                   purpose);
          cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object),
                         purpose, NULL_TREE, NULL_TREE);
        }
index 1490a372b0a3b3d8e998610545785d9db6ffefb1..1be9baf30c6af41b43a2f6b770c3459929c2219c 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-04  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/35043
+       * gcc.c-torture/compile/pr35043.c: New testcase.
+
 2008-02-03  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        * g++.dg/tree-ssa/ivopts-1.C: Remove xfail for hppa*-*-*.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35043.c b/gcc/testsuite/gcc.c-torture/compile/pr35043.c
new file mode 100644 (file)
index 0000000..29c6852
--- /dev/null
@@ -0,0 +1,20 @@
+typedef long unsigned int size_t;
+typedef struct   {
+      long double dat[2];
+} gsl_complex_long_double;
+typedef struct {
+    size_t size;
+    size_t stride;
+    long double *data;
+} gsl_vector_complex_long_double;
+void gsl_vector_complex_long_double_set_zero (gsl_vector_complex_long_double * v) 
+{
+    long double * const data = v->data;
+    const size_t n = v->size;
+    const size_t stride = v->stride;
+    const gsl_complex_long_double zero = { { 0.0L,0.0L} } ;
+    size_t i;
+    for (i = 0; i < n; i++)     
+        *(gsl_complex_long_double *) (data + 2 * i * stride) = zero;
+}
+