re PR middle-end/57134 (ICE with -mstrict-align and inline assembly on ppc64)
authorAlan Modra <amodra@gmail.com>
Fri, 14 Jun 2013 08:37:30 +0000 (18:07 +0930)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 14 Jun 2013 08:37:30 +0000 (18:07 +0930)
PR middle-end/57134
PR middle-end/57586
* expr.c (expand_expr_real_1 <normal_inner_ref>): Pass
EXPAND_MEMORY and EXPAND_WRITE to recursive call.  Don't use
bitfield expansion when EXPAND_MEMORY.
(expand_expr_real_1 <VIEW_CONVERT_EXPR>): Pass modifier likewise.

* gcc.dg/pr57134.c: New.

From-SVN: r200086

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr57134.c [new file with mode: 0644]

index 5096b2e5f8580f97a634faaaae84fdf025115c5b..e7d352c1edca179443543f4cc2422dfab85d14ae 100644 (file)
@@ -1,3 +1,12 @@
+2013-06-14  Alan Modra  <amodra@gmail.com>
+
+       PR middle-end/57134
+       PR middle-end/57586
+       * expr.c (expand_expr_real_1 <normal_inner_ref>): Pass
+       EXPAND_MEMORY and EXPAND_WRITE to recursive call.  Don't use
+       bitfield expansion when EXPAND_MEMORY.
+       (expand_expr_real_1 <VIEW_CONVERT_EXPR>): Pass modifier likewise.
+
 2013-06-13  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000.c (rs6000_option_override_internal): Move
index 2cdb87ca9b429969fff70b38a7303f175f8516a9..c68f489e8de4a1715581f469f4a9416bf3043621 100644 (file)
@@ -9909,11 +9909,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
                          && modifier != EXPAND_STACK_PARM
                          ? target : NULL_RTX),
                         VOIDmode,
-                        (modifier == EXPAND_INITIALIZER
-                         || modifier == EXPAND_CONST_ADDRESS
-                         || modifier == EXPAND_STACK_PARM)
-                        ? modifier : EXPAND_NORMAL);
-
+                        modifier == EXPAND_SUM ? EXPAND_NORMAL : modifier);
 
        /* If the bitfield is volatile, we want to access it in the
           field's mode, not the computed mode.
@@ -10072,6 +10068,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
                      || (MEM_P (op0)
                          && (MEM_ALIGN (op0) < GET_MODE_ALIGNMENT (mode1)
                              || (bitpos % GET_MODE_ALIGNMENT (mode1) != 0))))
+                    && modifier != EXPAND_MEMORY
                     && ((modifier == EXPAND_CONST_ADDRESS
                          || modifier == EXPAND_INITIALIZER)
                         ? STRICT_ALIGNMENT
@@ -10271,10 +10268,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
                              && modifier != EXPAND_STACK_PARM
                              ? target : NULL_RTX),
                             VOIDmode,
-                            (modifier == EXPAND_INITIALIZER
-                             || modifier == EXPAND_CONST_ADDRESS
-                             || modifier == EXPAND_STACK_PARM)
-                            ? modifier : EXPAND_NORMAL);
+                            modifier == EXPAND_SUM ? EXPAND_NORMAL : modifier);
 
            if (MEM_P (orig_op0))
              {
index 0d4c54e2dd66eb2bcbb8eb234d92e9f4ea596d91..a209086b41b1f09c9f508fe86f11d40d5dc317a1 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-14  Alan Modra  <amodra@gmail.com>
+
+       PR middle-end/57134
+       * gcc.dg/pr57134.c: New.
+
 2013-06-14  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/57596
diff --git a/gcc/testsuite/gcc.dg/pr57134.c b/gcc/testsuite/gcc.dg/pr57134.c
new file mode 100644 (file)
index 0000000..94ff092
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target stdint_types } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mstrict-align" { target { powerpc*-*-linux* powerpc*-*-elf* } } } */
+
+#include <stdint.h>
+
+typedef struct {
+  int64_t counter;
+} atomic64_t;
+
+struct buffer_page {
+  void *a, *b;
+  atomic64_t entries;
+};
+
+static __inline__ __attribute__((always_inline)) int64_t
+atomic64_read(const atomic64_t *v)
+{
+ int64_t t;
+ __asm__ __volatile__("# %0, %1" : "=r"(t) : "m"(v->counter));
+ return t;
+}
+
+int rb_remove_pages(void *p)
+{
+  struct buffer_page *blah = (void *)((intptr_t) p & -4);
+  return atomic64_read(&blah->entries);
+}