aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index eb3b457..143dcad 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -13038,6 +13038,9 @@ fold_indirect_ref_1 (tree type, tree op0)
{
tree op = TREE_OPERAND (sub, 0);
tree optype = TREE_TYPE (op);
+ /* *&CONST_DECL -> to the value of the const decl. */
+ if (TREE_CODE (op) == CONST_DECL)
+ return DECL_INITIAL (op);
/* *&p => p; make sure to handle *&"str"[cst] here. */
if (type == optype)
{