OSDN Git Service

Fix ppc -m64 constant address expression expansion bug.
authorfjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Aug 2005 15:55:52 +0000 (15:55 +0000)
committerfjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Aug 2005 15:55:52 +0000 (15:55 +0000)
Oked by Richard Henderson.

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

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/gcc.c-torture/execute/const-addr-expr-1.c [new file with mode: 0644]

index 62801c9..40dcbe3 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-31  Fariborz Jahanian <fjahanian@apple.com>
+
+       * expr.c (expand_expr_real_1): Compare size of address 
+       mode to target's address mode size in deciding expansion of 
+       the constant address.
+
 2005-08-31  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/23477
index e75d335..e44a54f 100644 (file)
@@ -7673,7 +7673,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
            }
 
          else if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
-                  && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_INT
+                  && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
                   && TREE_CONSTANT (TREE_OPERAND (exp, 0)))
            {
              rtx constant_part;
diff --git a/gcc/testsuite/gcc.c-torture/execute/const-addr-expr-1.c b/gcc/testsuite/gcc.c-torture/execute/const-addr-expr-1.c
new file mode 100644 (file)
index 0000000..dc34368
--- /dev/null
@@ -0,0 +1,33 @@
+#include        <stdio.h>
+#include        <stdlib.h>
+extern void abort();
+
+typedef struct foo
+{
+        int     uaattrid;
+        char    *name;
+} FOO;
+
+FOO     Upgrade_items[] =
+{
+        {1, "1"},
+        {2, "2"},
+        {0, NULL}
+};
+
+int     *Upgd_minor_ID = 
+        (int *) &((Upgrade_items + 1)->uaattrid);
+
+int     *Upgd_minor_ID1 = 
+        (int *) &((Upgrade_items)->uaattrid);
+
+int
+main(int argc, char **argv)
+{
+       if (*Upgd_minor_ID != 2)
+         abort();
+
+       if (*Upgd_minor_ID1 != 1)
+         abort();
+       return 0;
+}