expr.c (string_constant): Handle &MEM_REF.
authorRichard Guenther <rguenther@suse.de>
Fri, 26 Aug 2011 11:23:37 +0000 (11:23 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 26 Aug 2011 11:23:37 +0000 (11:23 +0000)
2011-08-26  Richard Guenther  <rguenther@suse.de>

* expr.c (string_constant): Handle &MEM_REF.

From-SVN: r178100

gcc/ChangeLog
gcc/expr.c

index 55a5a84f386eb58ca3493b4e1fce158741f67ef9..c8d97d83e3bfc6cf100382861f7b94ffe216ffa9 100644 (file)
@@ -1,3 +1,7 @@
+2011-08-26  Richard Guenther  <rguenther@suse.de>
+
+       * expr.c (string_constant): Handle &MEM_REF.
+
 2011-08-26  Andrew Stubbs  <ams@codesourcery.com>
 
        * config/arm/arm.c (struct four_ints): New type.
index a6746d1b50e87ff1ad97caedaa8dd9c76ab2140b..e29f3f6f4f9fece7820c8a46658ea3cc25940c4f 100644 (file)
@@ -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;
     }