This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR38891, using ms_abi function attribute with -mno-sse generates an internal compiler error


This is caused by the order of initializing call_used_regs.

Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk?

Regards
Xuepeng Guo

2009-02-13  Xuepeng Guo  <xuepeng.guo@intel.com>

       PR c/38891
       * config/i386/i386.h (CONDITIONAL_REGISTER_USAGE): Move the hunk of
       initialization for MS_ABI prior to the hunk of !TARGET_MMX.

Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h      (revision 144149)
+++ gcc/config/i386/i386.h      (working copy)
@@ -937,6 +937,17 @@ do {                                                                       \
        fixed_regs[j] = 1;                                              \
        call_used_regs[j] = 1;                                          \
       }                                                                        \
+    if (TARGET_64BIT                                                   \
+        && ((cfun && cfun->machine->call_abi == MS_ABI)                        \
+            || (!cfun && DEFAULT_ABI == MS_ABI)))                      \
+      {                                                                        \
+        int i;                                                         \
+        call_used_regs[4 /*RSI*/] = 0;                                  \
+        call_used_regs[5 /*RDI*/] = 0;                                  \
+       for (i = 0; i < 8; i++)                                         \
+         call_used_regs[45+i] = 0;                                     \
+       call_used_regs[27] = call_used_regs[28] = 0;                    \
+      }                                                                        \
     if (! TARGET_MMX)                                                  \
       {                                                                        \
        int i;                                                          \
@@ -968,17 +979,6 @@ do {                                                                       \
        for (i = FIRST_REX_SSE_REG; i <= LAST_REX_SSE_REG; i++)         \
          reg_names[i] = "";                                            \
       }                                                                        \
-    if (TARGET_64BIT                                                   \
-        && ((cfun && cfun->machine->call_abi == MS_ABI)                        \
-            || (!cfun && DEFAULT_ABI == MS_ABI)))                      \
-      {                                                                        \
-        int i;                                                         \
-        call_used_regs[4 /*RSI*/] = 0;                                  \
-        call_used_regs[5 /*RDI*/] = 0;                                  \
-       for (i = 0; i < 8; i++)                                         \
-         call_used_regs[45+i] = 0;                                     \
-       call_used_regs[27] = call_used_regs[28] = 0;                    \
-      }                                                                        \
   } while (0)

 /* Return number of consecutive hard regs needed starting at reg REGNO


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]