Commit acafbcde by Ian Lance Taylor Committed by Ian Lance Taylor

varasm.c (narrowing_initializer_constant_valid_p): Return NULL_TREE if ENDTYPE is not an integer.

	* varasm.c (narrowing_initializer_constant_valid_p): Return
	NULL_TREE if ENDTYPE is not an integer.

From-SVN: r140502
parent f22b7039
2008-09-19 Ian Lance Taylor <iant@google.com>
* varasm.c (narrowing_initializer_constant_valid_p): Return
NULL_TREE if ENDTYPE is not an integer.
2008-09-19 Andrew Pinski <andrew_pinski@playstation.sony.com> 2008-09-19 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/30930 PR tree-opt/30930
......
...@@ -4064,9 +4064,10 @@ constructor_static_from_elts_p (const_tree ctor) ...@@ -4064,9 +4064,10 @@ constructor_static_from_elts_p (const_tree ctor)
} }
/* A subroutine of initializer_constant_valid_p. VALUE is either a /* A subroutine of initializer_constant_valid_p. VALUE is either a
MINUS_EXPR or a POINTER_PLUS_EXPR, and ENDTYPE is a narrowing MINUS_EXPR or a POINTER_PLUS_EXPR. This looks for cases of VALUE
conversion to something smaller than a pointer. This returns which are valid when ENDTYPE is an integer of any size; in
null_pointer_node if the resulting value is an absolute constant particular, this does not accept a pointer minus a constant. This
returns null_pointer_node if the VALUE is an absolute constant
which can be used to initialize a static variable. Otherwise it which can be used to initialize a static variable. Otherwise it
returns NULL. */ returns NULL. */
...@@ -4075,6 +4076,9 @@ narrowing_initializer_constant_valid_p (tree value, tree endtype) ...@@ -4075,6 +4076,9 @@ narrowing_initializer_constant_valid_p (tree value, tree endtype)
{ {
tree op0, op1; tree op0, op1;
if (!INTEGRAL_TYPE_P (endtype))
return NULL_TREE;
op0 = TREE_OPERAND (value, 0); op0 = TREE_OPERAND (value, 0);
op1 = TREE_OPERAND (value, 1); op1 = TREE_OPERAND (value, 1);
......
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