From: Lili Cui <lili....@intel.com>

Hi Uros,

I need to remove another assertion in the shrink wrap separate patch. Added two 
cases for changing the CHECK_STACK_LIMIT value.

The default values for CHECK_STACK_LIMIT for target wingw and option 
-mstack-arg-probe are 4000 and (-1) respectively. In this case, shrink wrap 
separate will go to the branch. This assertion needs to be removed.

Sergei verified the patch in his environment, and it passed the test.
Bootstrapped & regtested on x86-64-pc-linux-gnu.

Ok for master?

Thanks,
Lili.


gcc/ChangeLog:

        PR target/120741
        * config/i386/i386.cc (ix86_expand_prologue):
        Remove 1 assertions.

gcc/testsuite/ChangeLog:

        PR target/120741
        * gcc.target/i386/pr120741.c: New test.
        * gcc.target/i386/shrink-wrap-separate-mingw.c: Likewise.
---
 gcc/config/i386/i386.cc                       |  2 --
 gcc/testsuite/gcc.target/i386/pr120741.c      | 22 +++++++++++++++++++
 .../i386/shrink-wrap-separate-mingw.c         | 22 +++++++++++++++++++
 3 files changed, 44 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr120741.c
 create mode 100644 gcc/testsuite/gcc.target/i386/shrink-wrap-separate-mingw.c

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index fc3105919f4..84081ab1267 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -9443,8 +9443,6 @@ ix86_expand_prologue (void)
     }
   else
     {
-      gcc_assert (!crtl->shrink_wrapped_separate);
-
       rtx eax = gen_rtx_REG (Pmode, AX_REG);
       rtx r10 = NULL;
       const bool sp_is_cfa_reg = (m->fs.cfa_reg == stack_pointer_rtx);
diff --git a/gcc/testsuite/gcc.target/i386/pr120741.c 
b/gcc/testsuite/gcc.target/i386/pr120741.c
new file mode 100644
index 00000000000..b59a58c48b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr120741.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mstack-arg-probe" } */
+
+short __mingw_swformat_format;
+__builtin_va_list __mingw_swformat_arg;
+int __mingw_swformat_fc;
+typedef struct {
+  void *fp;
+  int bch[1024];
+} _IFP;
+void __mingw_swformat(_IFP *s) {
+  if (s->fp)
+    while (__mingw_swformat_format)
+      if (__mingw_swformat_fc == 'A')
+       *__builtin_va_arg(__mingw_swformat_arg, double *) = 0;
+}
+void
+__mingw_vswscanf (void)
+{
+  _IFP ifp;
+  __mingw_swformat(&ifp);
+}
diff --git a/gcc/testsuite/gcc.target/i386/shrink-wrap-separate-mingw.c 
b/gcc/testsuite/gcc.target/i386/shrink-wrap-separate-mingw.c
new file mode 100644
index 00000000000..58635e49647
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/shrink-wrap-separate-mingw.c
@@ -0,0 +1,22 @@
+/* { dg-do compile { target *-*-mingw* *-*-cygwin* } } */
+/* { dg-options "-std=gnu99 -O2" } */
+
+short __mingw_swformat_format;
+__builtin_va_list __mingw_swformat_arg;
+int __mingw_swformat_fc;
+typedef struct {
+  void *fp;
+  int bch[1024];
+} _IFP;
+void __mingw_swformat(_IFP *s) {
+  if (s->fp)
+    while (__mingw_swformat_format)
+      if (__mingw_swformat_fc == 'A')
+        *__builtin_va_arg(__mingw_swformat_arg, double *) = 0;
+}
+void
+__mingw_vswscanf (void)
+{
+  _IFP ifp;
+  __mingw_swformat(&ifp);
+}
-- 
2.34.1

Reply via email to