aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.cc')
-rw-r--r--gcc/fold-const.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 5f48ced..014f421 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -5085,6 +5085,11 @@ simple_operand_p (const_tree exp)
#pragma weak, etc). */
&& ! TREE_PUBLIC (exp)
&& ! DECL_EXTERNAL (exp)
+ /* DECL_VALUE_EXPR will expand to something non-simple. */
+ && ! ((VAR_P (exp)
+ || TREE_CODE (exp) == PARM_DECL
+ || TREE_CODE (exp) == RESULT_DECL)
+ && DECL_HAS_VALUE_EXPR_P (exp))
/* Weakrefs are not safe to be read, since they can be NULL.
They are !TREE_PUBLIC && !DECL_EXTERNAL but still
have DECL_WEAK flag set. */