From 321358d4e4b17f1c4c0cfb88541d4e8c2720be5d Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 26 Aug 2011 11:23:37 +0000 Subject: [PATCH] expr.c (string_constant): Handle &MEM_REF. 2011-08-26 Richard Guenther * expr.c (string_constant): Handle &MEM_REF. From-SVN: r178100 --- gcc/ChangeLog | 4 ++++ gcc/expr.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55a5a84f386..c8d97d83e3b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2011-08-26 Richard Guenther + + * expr.c (string_constant): Handle &MEM_REF. + 2011-08-26 Andrew Stubbs * config/arm/arm.c (struct four_ints): New type. diff --git a/gcc/expr.c b/gcc/expr.c index a6746d1b50e..e29f3f6f4f9 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -10168,6 +10168,17 @@ string_constant (tree arg, tree *ptr_offset) fold_convert (sizetype, lower_bound)); } } + else if (TREE_CODE (TREE_OPERAND (arg, 0)) == MEM_REF) + { + array = TREE_OPERAND (TREE_OPERAND (arg, 0), 0); + offset = TREE_OPERAND (TREE_OPERAND (arg, 0), 1); + if (TREE_CODE (array) != ADDR_EXPR) + return 0; + array = TREE_OPERAND (array, 0); + if (TREE_CODE (array) != STRING_CST + && TREE_CODE (array) != VAR_DECL) + return 0; + } else return 0; } -- 2.30.2