OSDN Git Service

PR target/38988
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Jan 2009 07:58:07 +0000 (07:58 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 28 Jan 2009 07:58:07 +0000 (07:58 +0000)
* config/i386/i386.md (set_rip_rex64): Wrap operand 1 in label_ref.
(set_got_offset_rex64): Ditto.

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

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/pr38988.c [new file with mode: 0644]

index ad51b27..5300a86 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-28  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/38988
+       * config/i386/i386.md (set_rip_rex64): Wrap operand 1 in label_ref.
+       (set_got_offset_rex64): Ditto.
+
 2009-01-27  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/38941
        used to index the memory access.  Do not pass loop_p.
        Fix comment.  Stop recursion on tcc_constant or tcc_declaration.
        (expand_scalar_variables_stmt): Pass to expand_scalar_variables_expr
-       the gimple_stmt_iterator where it inserts new code.  Do not pass loop_p.
+       the gimple_stmt_iterator where it inserts new code.
+       Do not pass loop_p.
        (copy_bb_and_scalar_dependences): Do not pass loop_p.
        (translate_clast): Update call to copy_bb_and_scalar_dependences.
 
index 6543cf5..89a3b17 100644 (file)
 
 (define_insn "set_rip_rex64"
   [(set (match_operand:DI 0 "register_operand" "=r")
-       (unspec:DI [(match_operand:DI 1 "" "")] UNSPEC_SET_RIP))]
+       (unspec:DI [(label_ref (match_operand 1 "" ""))] UNSPEC_SET_RIP))]
   "TARGET_64BIT"
   "lea{q}\t{%l1(%%rip), %0|%0, %l1[rip]}"
   [(set_attr "type" "lea")
 
 (define_insn "set_got_offset_rex64"
   [(set (match_operand:DI 0 "register_operand" "=r")
-       (unspec:DI [(match_operand:DI 1 "" "")] UNSPEC_SET_GOT_OFFSET))]
+       (unspec:DI
+         [(label_ref (match_operand 1 "" ""))]
+         UNSPEC_SET_GOT_OFFSET))]
   "TARGET_64BIT"
   "movabs{q}\t{$_GLOBAL_OFFSET_TABLE_-%l1, %0|%0, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_-%l1}"
   [(set_attr "type" "imov")
diff --git a/gcc/testsuite/gcc.target/i386/pr38988.c b/gcc/testsuite/gcc.target/i386/pr38988.c
new file mode 100644 (file)
index 0000000..8e2c8ea
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-O2 -fpic -mcmodel=large" } */
+
+typedef long unsigned int size_t;
+typedef void (*func_ptr) (void);
+
+static func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
+
+void
+__do_global_dtors_aux (void)
+{
+  extern func_ptr __DTOR_END__[];
+  size_t dtor_idx = 0;
+  const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
+  func_ptr f;
+
+  while (dtor_idx < max_idx)
+    {
+      f = __DTOR_LIST__[++dtor_idx];
+      f ();
+    }
+}