https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #17 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I updated it again.  If it still doesn't work, please show me what
> you applied.

The test now pass in 64 bit mode, but not in 32 bit one:

% /opt/gcc/gcc8w/bin/gcc /opt/gcc/work/gcc/testsuite/gcc.dg/torture/pr25967-1.c
% ./a.out
% /opt/gcc/gcc8w/bin/gcc /opt/gcc/work/gcc/testsuite/gcc.dg/torture/pr25967-1.c
-m32
% ./a.out
Segmentation fault

Note that the guality tests are not run on darwin.

Patched with

--- ../_clean/gcc/testsuite/gcc.dg/torture/pr25967-1.c  2017-08-02
13:33:42.000000000 +0200
+++ gcc/testsuite/gcc.dg/torture/pr25967-1.c    2017-09-03 20:28:09.000000000
+0200
@@ -17,6 +17,12 @@ typedef unsigned int uword_t __attribute
 #define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
 #define ASMNAME2(prefix, cname) XSTRING (prefix) cname

+#if __LP64__
+# define STACK_POINTER "rsp"
+#else
+# define STACK_POINTER "esp"
+#endif
+
 struct interrupt_frame
 {
   uword_t ip;
@@ -52,7 +58,9 @@ fn (void)
 int
 main ()
 {
-  asm ("push   $" STRING (SS) ";               \
+  /* Align exception handler stack to 16 bytes.  */
+  asm ("and    $-16, %" STACK_POINTER ";       \
+        push   $" STRING (SS) ";               \
        push    $" STRING (SP) ";               \
        push    $" STRING (FLAGS) ";            \
        push    $" STRING (CS) ";               \

Reply via email to