vapier      15/10/02 21:23:01

  Modified:             README.history
  Added:                69_all_gcc-5-ms_abi-pr66838.patch
  Log:
  add upstream fix for miscompiles w/ms_abi attributes #549768 by Alexandre 
Rostovtsev

Revision  Changes    Path
1.3                  src/patchsets/gcc/5.2.0/gentoo/README.history

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/5.2.0/gentoo/README.history?rev=1.3&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/5.2.0/gentoo/README.history?rev=1.3&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/5.2.0/gentoo/README.history?r1=1.2&r2=1.3

Index: README.history
===================================================================
RCS file: /var/cvsroot/gentoo/src/patchsets/gcc/5.2.0/gentoo/README.history,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- README.history      25 Aug 2015 16:47:40 -0000      1.2
+++ README.history      2 Oct 2015 21:23:01 -0000       1.3
@@ -1,3 +1,6 @@
+1.2            02 Oct 2015
+       + 69_all_gcc-5-ms_abi-pr66838.patch
+
 1.1            25 Aug 2015
        U 74_all_gcc5_isl-dl.patch
 



1.1                  
src/patchsets/gcc/5.2.0/gentoo/69_all_gcc-5-ms_abi-pr66838.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/5.2.0/gentoo/69_all_gcc-5-ms_abi-pr66838.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/5.2.0/gentoo/69_all_gcc-5-ms_abi-pr66838.patch?rev=1.1&content-type=text/plain

Index: 69_all_gcc-5-ms_abi-pr66838.patch
===================================================================
https://bugs.gentoo.org/549768
https://gcc.gnu.org/PR66838

>From 7dc80fc8bf531c5fe17a88fe505d1cd63867c190 Mon Sep 17 00:00:00 2001
From: uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 17 Jul 2015 13:50:38 +0000
Subject: [PATCH]        Backport from mainline:

2015-07-15  Uros Bizjak  <[email protected]>

        PR rtl-optimization/66838
        * postreload.c (reload_cse_move2add): Also process
        CALL_INSN_FUNCTION_USAGE when resetting information of
        call-clobbered registers.

testsuite/ChangeLog:

        Backport from mainline:
        2015-07-15  Uros Bizjak  <[email protected]>

        PR rtl-optimization/66838
        * gcc.target/i386/pr66838.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@225935 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog                           | 12 ++++++++++-
 gcc/postreload.c                        | 17 ++++++++++++++++
 gcc/testsuite/ChangeLog                 |  8 ++++++++
 gcc/testsuite/gcc.target/i386/pr66838.c | 36 +++++++++++++++++++++++++++++++++
 4 files changed, 72 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr66838.c

diff --git a/gcc/postreload.c b/gcc/postreload.c
index 3e2802d..58b586a 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -2164,12 +2164,29 @@ reload_cse_move2add (rtx_insn *first)
         unknown values.  */
       if (CALL_P (insn))
        {
+         rtx link;
+
          for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--)
            {
              if (call_used_regs[i])
                /* Reset the information about this register.  */
                reg_mode[i] = VOIDmode;
            }
+
+         for (link = CALL_INSN_FUNCTION_USAGE (insn); link;
+              link = XEXP (link, 1))
+           {
+             rtx setuse = XEXP (link, 0);
+             rtx usage_rtx = XEXP (setuse, 0);
+             if (GET_CODE (setuse) == CLOBBER
+                 && REG_P (usage_rtx))
+               {
+                 unsigned int end_regno = END_REGNO (usage_rtx);
+                 for (unsigned int r = REGNO (usage_rtx); r < end_regno; ++r)
+                   /* Reset the information about this register.  */
+                   reg_mode[r] = VOIDmode;
+               }
+           }
        }
     }
   return changed;
diff --git a/gcc/testsuite/gcc.target/i386/pr66838.c 
b/gcc/testsuite/gcc.target/i386/pr66838.c
new file mode 100644
index 0000000..46effed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr66838.c
@@ -0,0 +1,36 @@
+/* { dg-do run { target lp64 } } */
+/* { dg-options "-O2" } */
+
+void abort (void);
+
+char global;
+
+__attribute__((sysv_abi, noinline, noclone))
+void sysv_abi_func(char const *desc, void *local)
+{
+  register int esi asm ("esi");
+  register int edi asm ("edi");
+  
+  if (local != &global)
+    abort ();
+
+  /* Clobber some of the extra SYSV ABI registers.  */
+  asm volatile ("movl\t%2, %0\n\tmovl\t%2, %1"
+               : "=r" (esi), "=r" (edi)
+               : "i" (0xdeadbeef));
+}
+
+__attribute__((ms_abi, noinline, noclone))
+void ms_abi_func ()
+{
+  sysv_abi_func ("1st call", &global);
+  sysv_abi_func ("2nd call", &global);
+  sysv_abi_func ("3rd call", &global);
+}
+
+int
+main(void)
+{
+  ms_abi_func();
+  return 0;
+}
-- 
2.5.2





Reply via email to