Commit c08de514 by Alan Lawrence Committed by Alan Lawrence

Fix whitespace+typo from "Share code from fold_array_ctor_reference with fold."

	* fold-const.c (get_array_ctor_element_at_index): Fix whitespace, typo.

From-SVN: r230159
parent 03f39145
2015-11-11 Alan Lawrence <alan.lawrence@arm.com>
* fold-const.c (get_array_ctor_element_at_index): Fix whitespace, typo.
2015-11-11 Jiong Wang <jiong.wang@arm.com> 2015-11-11 Jiong Wang <jiong.wang@arm.com>
Jim Wilson <wilson@gcc.gnu.org> Jim Wilson <wilson@gcc.gnu.org>
...@@ -11887,16 +11887,16 @@ get_array_ctor_element_at_index (tree ctor, offset_int access_index) ...@@ -11887,16 +11887,16 @@ get_array_ctor_element_at_index (tree ctor, offset_int access_index)
offset_int low_bound = 0; offset_int low_bound = 0;
if (TREE_CODE (TREE_TYPE (ctor)) == ARRAY_TYPE) if (TREE_CODE (TREE_TYPE (ctor)) == ARRAY_TYPE)
{
tree domain_type = TYPE_DOMAIN (TREE_TYPE (ctor));
if (domain_type && TYPE_MIN_VALUE (domain_type))
{ {
/* Static constructors for variably sized objects makes no sense. */ tree domain_type = TYPE_DOMAIN (TREE_TYPE (ctor));
gcc_assert (TREE_CODE (TYPE_MIN_VALUE (domain_type)) == INTEGER_CST); if (domain_type && TYPE_MIN_VALUE (domain_type))
index_type = TREE_TYPE (TYPE_MIN_VALUE (domain_type)); {
low_bound = wi::to_offset (TYPE_MIN_VALUE (domain_type)); /* Static constructors for variably sized objects makes no sense. */
gcc_assert (TREE_CODE (TYPE_MIN_VALUE (domain_type)) == INTEGER_CST);
index_type = TREE_TYPE (TYPE_MIN_VALUE (domain_type));
low_bound = wi::to_offset (TYPE_MIN_VALUE (domain_type));
}
} }
}
if (index_type) if (index_type)
access_index = wi::ext (access_index, TYPE_PRECISION (index_type), access_index = wi::ext (access_index, TYPE_PRECISION (index_type),
...@@ -11912,29 +11912,29 @@ get_array_ctor_element_at_index (tree ctor, offset_int access_index) ...@@ -11912,29 +11912,29 @@ get_array_ctor_element_at_index (tree ctor, offset_int access_index)
tree cfield, cval; tree cfield, cval;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), cnt, cfield, cval) FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), cnt, cfield, cval)
{
/* Array constructor might explicitely set index, or specify range
* or leave index NULL meaning that it is next index after previous
* one. */
if (cfield)
{ {
if (TREE_CODE (cfield) == INTEGER_CST) /* Array constructor might explicitly set index, or specify a range,
max_index = index = wi::to_offset (cfield); or leave index NULL meaning that it is next index after previous
one. */
if (cfield)
{
if (TREE_CODE (cfield) == INTEGER_CST)
max_index = index = wi::to_offset (cfield);
else
{
gcc_assert (TREE_CODE (cfield) == RANGE_EXPR);
index = wi::to_offset (TREE_OPERAND (cfield, 0));
max_index = wi::to_offset (TREE_OPERAND (cfield, 1));
}
}
else else
{ {
gcc_assert (TREE_CODE (cfield) == RANGE_EXPR); index += 1;
index = wi::to_offset (TREE_OPERAND (cfield, 0)); if (index_type)
max_index = wi::to_offset (TREE_OPERAND (cfield, 1)); index = wi::ext (index, TYPE_PRECISION (index_type),
} TYPE_SIGN (index_type));
} max_index = index;
else }
{
index += 1;
if (index_type)
index = wi::ext (index, TYPE_PRECISION (index_type),
TYPE_SIGN (index_type));
max_index = index;
}
/* Do we have match? */ /* Do we have match? */
if (wi::cmpu (access_index, index) >= 0 if (wi::cmpu (access_index, index) >= 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment