aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-09-19 22:30:12 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2008-09-19 22:30:12 +0000
commitacafbcde95f106dafa58c6d9daca16ea3aa93668 (patch)
tree1ae404ea64580a3b8bc92fcb342708a000a24684 /gcc/varasm.c
parentf22b7039d8ad71c2ceaf754087e4e52b18801201 (diff)
downloadgcc-acafbcde95f106dafa58c6d9daca16ea3aa93668.zip
gcc-acafbcde95f106dafa58c6d9daca16ea3aa93668.tar.gz
gcc-acafbcde95f106dafa58c6d9daca16ea3aa93668.tar.bz2
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
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e74adae..b3f9990 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4064,9 +4064,10 @@ constructor_static_from_elts_p (const_tree ctor)
}
/* A subroutine of initializer_constant_valid_p. VALUE is either a
- MINUS_EXPR or a POINTER_PLUS_EXPR, and ENDTYPE is a narrowing
- conversion to something smaller than a pointer. This returns
- null_pointer_node if the resulting value is an absolute constant
+ MINUS_EXPR or a POINTER_PLUS_EXPR. This looks for cases of VALUE
+ which are valid when ENDTYPE is an integer of any size; in
+ 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
returns NULL. */
@@ -4075,6 +4076,9 @@ narrowing_initializer_constant_valid_p (tree value, tree endtype)
{
tree op0, op1;
+ if (!INTEGRAL_TYPE_P (endtype))
+ return NULL_TREE;
+
op0 = TREE_OPERAND (value, 0);
op1 = TREE_OPERAND (value, 1);