+2012-02-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/52074
+ * expr.c (expand_expr_addr_expr_1): For CONSTANT_CLASS_P or CONST_DECL
+ if modifier < EXPAND_SUM call force_operand on the result.
+
2012-02-07 Joern Rennecke <joern.rennecke@embecosm.com>
* config/epiphany/epiphany.h (ASM_DECLARE_FUNCTION_SIZE): Redefine,
generating ADDR_EXPR of something that isn't an LVALUE. The only
exception here is STRING_CST. */
if (CONSTANT_CLASS_P (exp))
- return XEXP (expand_expr_constant (exp, 0, modifier), 0);
+ {
+ result = XEXP (expand_expr_constant (exp, 0, modifier), 0);
+ if (modifier < EXPAND_SUM)
+ result = force_operand (result, target);
+ return result;
+ }
/* Everything must be something allowed by is_gimple_addressable. */
switch (TREE_CODE (exp))
case CONST_DECL:
/* Expand the initializer like constants above. */
- return XEXP (expand_expr_constant (DECL_INITIAL (exp), 0, modifier), 0);
+ result = XEXP (expand_expr_constant (DECL_INITIAL (exp),
+ 0, modifier), 0);
+ if (modifier < EXPAND_SUM)
+ result = force_operand (result, target);
+ return result;
case REALPART_EXPR:
/* The real part of the complex number is always first, therefore
--- /dev/null
+/* PR middle-end/52074 */
+
+struct S { const char *d, *e; } __attribute__((packed));
+
+void
+foo (const char **p, struct S *q)
+{
+ *p = "abcdef";
+ q->d = "ghijk";
+}