From: Richard Guenther Date: Mon, 4 Feb 2008 13:30:00 +0000 (+0000) Subject: re PR middle-end/35043 (ICE in tree-data-ref because signed_type_for_types returns... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a1640dbb3257532e6d3603c78a5f379f7682dc3;p=gcc.git re PR middle-end/35043 (ICE in tree-data-ref because signed_type_for_types returns NULL) 2008-02-04 Richard Guenther 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 089f82f239d..1665f9e1afa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-02-04 Richard Guenther + + 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 * print-tree.c (print_node) [CONSTRUCTOR]: Print elements. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index fe708471944..04ed39c533a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1490a372b0a..1be9baf30c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-02-04 Richard Guenther + + PR middle-end/35043 + * gcc.c-torture/compile/pr35043.c: New testcase. + 2008-02-03 John David Anglin * 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 index 00000000000..29c685207b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr35043.c @@ -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; +} +