OSDN Git Service

2007-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jun 2007 19:15:50 +0000 (19:15 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jun 2007 19:15:50 +0000 (19:15 +0000)
        PR middle-end/31579
        * expr.c (expand_expr_addr_expr_1): Call expand_expr
        for the offset with the modifier as EXPAND_INITIALIZER
        if the modifier is EXPAND_INITIALIZER.
        (expand_expr_real_1 <case INTEGER_CST>): Don't force to
        a register if we had an overflow.

2007-06-12  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/31579
         * g++.dg/torture/pr31579.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125655 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr31579.C [new file with mode: 0644]

index 398f241..e5a53a2 100644 (file)
@@ -1,3 +1,12 @@
+2007-06-12  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR middle-end/31579
+       * expr.c (expand_expr_addr_expr_1): Call expand_expr
+       for the offset with the modifier as EXPAND_INITIALIZER
+       if the modifier is EXPAND_INITIALIZER.
+       (expand_expr_real_1 <case INTEGER_CST>): Don't force to
+       a register if we had an overflow.
+
 2007-06-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * real.c (real_isfinite): New.
index 2a4629a..9c91c4e 100644 (file)
@@ -6695,7 +6695,9 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
 
       if (modifier != EXPAND_NORMAL)
        result = force_operand (result, NULL);
-      tmp = expand_expr (offset, NULL_RTX, tmode, EXPAND_NORMAL);
+      tmp = expand_expr (offset, NULL_RTX, tmode, 
+                        modifier == EXPAND_INITIALIZER
+                         ? EXPAND_INITIALIZER : EXPAND_NORMAL);
 
       result = convert_memory_address (tmode, result);
       tmp = convert_memory_address (tmode, tmp);
@@ -7118,15 +7120,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
       temp = immed_double_const (TREE_INT_CST_LOW (exp),
                                 TREE_INT_CST_HIGH (exp), mode);
 
-      /* ??? If overflow is set, fold will have done an incomplete job,
-        which can result in (plus xx (const_int 0)), which can get
-        simplified by validate_replace_rtx during virtual register
-        instantiation, which can result in unrecognizable insns.
-        Avoid this by forcing all overflows into registers.  */
-      if (TREE_OVERFLOW (exp)
-         && modifier != EXPAND_INITIALIZER)
-       temp = force_reg (mode, temp);
-
       return temp;
 
     case VECTOR_CST:
index dff2389..ee237de 100644 (file)
@@ -1,3 +1,8 @@
+2007-06-12  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR middle-end/31579
+        * g++.dg/torture/pr31579.C: New testcase.
+
 2007-06-12  Ian Lance Taylor  <iant@google.com>
 
        PR libstdc++/29286
diff --git a/gcc/testsuite/g++.dg/torture/pr31579.C b/gcc/testsuite/g++.dg/torture/pr31579.C
new file mode 100644 (file)
index 0000000..1effa66
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+// middle-end/31579
+// Expand was crashing while expanding the tree for the initializer
+
+struct Industry {
+ unsigned char produced_cargo[2];
+};
+unsigned int a = (((unsigned long)&reinterpret_cast<const volatile
+char&>((((Industry*)(char*)8)->produced_cargo[0]))) - 8);
+