public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7539] x86: Disallow unsupported EH return
@ 2022-03-08 17:56 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2022-03-08 17:56 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:23ed4df521db9d66782d3f9cf291fc2564cf313a

commit r12-7539-g23ed4df521db9d66782d3f9cf291fc2564cf313a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Mar 4 05:53:14 2022 -0800

    x86: Disallow unsupported EH return
    
    Disallow stack realignment and regparm nested function with EH return
    since they don't work together.
    
    gcc/
    
            PR target/104781
            * config/i386/i386.cc (ix86_expand_epilogue): Sorry if there is
            stack realignment or regparm nested function with EH return.
    
    gcc/testsuite/
    
            PR target/104781
            * gcc.target/i386/eh_return-1.c: Add -mincoming-stack-boundary=4.
            * gcc.target/i386/eh_return-2.c: Likewise.

Diff:
---
 gcc/config/i386/i386.cc                     | 11 +++++++----
 gcc/testsuite/gcc.target/i386/eh_return-1.c |  2 +-
 gcc/testsuite/gcc.target/i386/eh_return-2.c |  2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index efa947f9795..4121f986221 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -9444,12 +9444,15 @@ ix86_expand_epilogue (int style)
 	  rtx sa = EH_RETURN_STACKADJ_RTX;
 	  rtx_insn *insn;
 
-	  /* %ecx can't be used for both DRAP register and eh_return.  */
-	  if (crtl->drap_reg)
-	    gcc_assert (REGNO (crtl->drap_reg) != CX_REG);
+	  /* Stack realignment doesn't work with eh_return.  */
+	  if (crtl->stack_realign_needed)
+	    sorry ("Stack realignment not supported with "
+		   "%<__builtin_eh_return%>");
 
 	  /* regparm nested functions don't work with eh_return.  */
-	  gcc_assert (!ix86_static_chain_on_stack);
+	  if (ix86_static_chain_on_stack)
+	    sorry ("regparm nested function not supported with "
+		   "%<__builtin_eh_return%>");
 
 	  if (frame_pointer_needed)
 	    {
diff --git a/gcc/testsuite/gcc.target/i386/eh_return-1.c b/gcc/testsuite/gcc.target/i386/eh_return-1.c
index b21fd75fc93..43f94f01a97 100644
--- a/gcc/testsuite/gcc.target/i386/eh_return-1.c
+++ b/gcc/testsuite/gcc.target/i386/eh_return-1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -march=haswell -mno-avx512f -mtune-ctrl=avx256_move_by_pieces" } */
+/* { dg-options "-O2 -mincoming-stack-boundary=4 -march=haswell -mno-avx512f -mtune-ctrl=avx256_move_by_pieces" } */
 
 struct _Unwind_Context
 {
diff --git a/gcc/testsuite/gcc.target/i386/eh_return-2.c b/gcc/testsuite/gcc.target/i386/eh_return-2.c
index f23f4492dac..cb762f92cc2 100644
--- a/gcc/testsuite/gcc.target/i386/eh_return-2.c
+++ b/gcc/testsuite/gcc.target/i386/eh_return-2.c
@@ -1,6 +1,6 @@
 /* PR target/101772  */
 /* { dg-do compile } */
-/* { dg-additional-options "-O0 -march=x86-64 -mstackrealign" } */
+/* { dg-additional-options "-O0 -mincoming-stack-boundary=4 -march=x86-64 -mstackrealign" } */
 
 struct _Unwind_Context _Unwind_Resume_or_Rethrow_this_context;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-08 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 17:56 [gcc r12-7539] x86: Disallow unsupported EH return H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).