[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2018-12-30 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #34 from Dominique d'Humieres  ---
Fixed on trunk and the gcc8 branch, not present in the gcc7 branch. Closing.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2018-12-30 Thread dominiq at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #33 from dominiq at gcc dot gnu.org ---
Author: dominiq
Date: Sun Dec 30 10:51:49 2018
New Revision: 267474

URL: https://gcc.gnu.org/viewcvs?rev=267474&root=gcc&view=rev
Log:
2018-12-30  Dominique d'Humieres  

PR tree-optimization/68356
PR target/81210
PR target/81693
* gcc.dg/torture/pr68264.c: Skip on darwin.
* gcc.dg/torture/pr68037-1.c: Likewise.
* gcc.dg/torture/pr68037-2.c: Likewise.
* gcc.dg/torture/pr68037-3.c: Likewise.
* gcc.dg/torture/pr25967-1.c: Likewise.
* gcc.dg/torture/pr25967-2.c: Likewise.


Modified:
branches/gcc-8-branch/gcc/testsuite/ChangeLog
branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr25967-1.c
branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr25967-2.c
branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr68037-1.c
branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr68037-2.c
branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr68037-3.c
branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr68264.c

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2018-12-29 Thread dominiq at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #32 from dominiq at gcc dot gnu.org ---
Author: dominiq
Date: Sat Dec 29 15:05:55 2018
New Revision: 267462

URL: https://gcc.gnu.org/viewcvs?rev=267462&root=gcc&view=rev
Log:
2018-12-29  Dominique d'Humieres  

PR tree-optimization/68356
PR target/81210
PR target/81693
* gcc.dg/torture/pr68264.c: Skip on darwin.
* gcc.dg/torture/pr68037-1.c: Likewise.
* gcc.dg/torture/pr68037-2.c: Likewise.
* gcc.dg/torture/pr68037-3.c: Likewise.
* gcc.dg/torture/pr25967-1.c: Likewise.
* gcc.dg/torture/pr25967-2.c: Likewise.


MChangeLog
Mgcc.dg/torture/pr25967-1.c
Mgcc.dg/torture/pr25967-2.c
Mgcc.dg/torture/pr68037-1.c
Mgcc.dg/torture/pr68037-2.c
Mgcc.dg/torture/pr68037-3.c
Mgcc.dg/torture/pr68264.c

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/torture/pr25967-1.c
trunk/gcc/testsuite/gcc.dg/torture/pr25967-2.c
trunk/gcc/testsuite/gcc.dg/torture/pr68037-1.c
trunk/gcc/testsuite/gcc.dg/torture/pr68037-2.c
trunk/gcc/testsuite/gcc.dg/torture/pr68037-3.c
trunk/gcc/testsuite/gcc.dg/torture/pr68264.c

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2018-05-19 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

Eric Gallager  changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |dominiq at lps dot 
ens.fr

--- Comment #31 from Eric Gallager  ---
(In reply to Dominique d'Humieres from comment #30)
> I have submitted a patch some time ago at
> 
> https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00939.html
> 
> Mike asked for some changes and I got distracted before being able to
> fulfill the requests.
> 
> I can do it in the coming week, but if someone want to do it sooner, there
> is no problem.

Moving from WAITING to assigned to you then.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2018-02-19 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #30 from Dominique d'Humieres  ---
I have submitted a patch some time ago at

https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00939.html

Mike asked for some changes and I got distracted before being able to fulfill
the requests.

I can do it in the coming week, but if someone want to do it sooner, there is
no problem.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2018-02-19 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #29 from H.J. Lu  ---
(In reply to Eric Gallager from comment #28)
> (In reply to H.J. Lu from comment #27)
> > By definition of the "naked" attribute, the program is responsible
> > to manage stack.  Since simulated interrupt functions don't follow
> > the normal software calling convention and there is no attempt
> > made to accommodate it in the naked function, the outgoing stack
> > is properly aligned to requirement of software calling convention.
> > Since Darwin checks the incoming stack alignment, the failure is
> > expected.
> 
> So XFAIL it and close this bug then?

Yes.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2018-02-19 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=25967

--- Comment #28 from Eric Gallager  ---
(In reply to H.J. Lu from comment #27)
> By definition of the "naked" attribute, the program is responsible
> to manage stack.  Since simulated interrupt functions don't follow
> the normal software calling convention and there is no attempt
> made to accommodate it in the naked function, the outgoing stack
> is properly aligned to requirement of software calling convention.
> Since Darwin checks the incoming stack alignment, the failure is
> expected.

So XFAIL it and close this bug then?

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-04 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #27 from H.J. Lu  ---
By definition of the "naked" attribute, the program is responsible
to manage stack.  Since simulated interrupt functions don't follow
the normal software calling convention and there is no attempt
made to accommodate it in the naked function, the outgoing stack
is properly aligned to requirement of software calling convention.
Since Darwin checks the incoming stack alignment, the failure is
expected.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-04 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #26 from H.J. Lu  ---
Created attachment 42120
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42120&action=edit
Another testcase to show the issue on Linux

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-04 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #25 from H.J. Lu  ---
Created attachment 42119
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42119&action=edit
A testcase to show the issue on Linux

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-04 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #24 from Dominique d'Humieres  ---
> Does gcc.dg/torture/pr25967-2.c pass for both -m32 and -m64?

Nope!

% /opt/gcc/gcc8w/bin/gcc /opt/gcc/work/gcc/testsuite/gcc.dg/torture/pr25967-2.c
-g
% lldb ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) run
Process 26493 launched: './a.out' (x86_64)
Process 26493 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
frame #0: 0x7fffbcb612fa libdyld.dylib`stack_not_16_byte_aligned_error
libdyld.dylib`stack_not_16_byte_aligned_error:
->  0x7fffbcb612fa <+0>: movdqa %xmm0, (%rsp)
0x7fffbcb612ff <+5>: int3   

libdyld.dylib`_dyld_func_lookup:
0x7fffbcb61300 <+0>: pushq  %rbp
0x7fffbcb61301 <+1>: movq   %rsp, %rbp
(lldb) b main
Breakpoint 1: where = a.out`main at pr25967-2.c:58, address =
0x00010f50
(lldb) disass -a 0x00010f50
a.out`main:
0x10f50 <+0>:  andq   $-0x10, %rsp
0x10f54 <+4>:  pushq  $0x12345675   ; imm = 0x12345675 
0x10f59 <+9>:  pushq  $0x12345674   ; imm = 0x12345674 
0x10f5e <+14>: pushq  $0x12345673   ; imm = 0x12345673 
0x10f63 <+19>: pushq  $0x12345672   ; imm = 0x12345672 
0x10f68 <+24>: pushq  $0x12345671   ; imm = 0x12345671 
0x10f6d <+29>: jmp0x10eef   ; fn at pr25967-2.c:39
0x10f72 <+34>: movl   $0x0, %eax
0x10f77 <+39>: retq   

Patched with

--- ../_clean/gcc/testsuite/gcc.dg/torture/pr25967-2.c  2017-08-02
13:33:42.0 +0200
+++ gcc/testsuite/gcc.dg/torture/pr25967-2.c2017-09-04 11:54:55.0
+0200
@@ -16,6 +16,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;
@@ -48,7 +54,9 @@ fn (void)
 int
 main ()
 {
-  asm ("push   $" STRING (SS) ";   \
+  /* Align interrupt handler stack to 16 bytes.  */
+  asm ("and$-16, %" STACK_POINTER ";   \
+push   $" STRING (SS) ";   \
push$" STRING (SP) ";   \
push$" STRING (FLAGS) ";\
push$" STRING (CS) ";   \

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #23 from H.J. Lu  ---
(In reply to Dominique d'Humieres from comment #22)
> The test succeeds with -m32 (but fails with -m64) with the following change
> 
> +  /* Align exception handler stack to 16 bytes.  */
> +  asm ("and  $-8, %" STACK_POINTER ";\
> +push $" STRING (SS) ";   \

That is expected.  Does gcc.dg/torture/pr25967-2.c pass for both
-m32 and -m64?

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #22 from Dominique d'Humieres  ---
The test succeeds with -m32 (but fails with -m64) with the following change

+  /* Align exception handler stack to 16 bytes.  */
+  asm ("and$-8, %" STACK_POINTER ";\
+push   $" STRING (SS) ";   \

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #21 from Dominique d'Humieres  ---
% /opt/gcc/gcc8w/bin/gcc /opt/gcc/work/gcc/testsuite/gcc.dg/torture/pr25967-1.c
-m32 -g
% lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (i386).
(lldb) run
Process 25578 launched:
'/Users/dominiq/Documents/Fortran/g95bench/win/f90/bug/a.out' (i386)
Process 25578 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
frame #0: 0xa152b200 libdyld.dylib`misaligned_stack_error_
libdyld.dylib`misaligned_stack_error_:
->  0xa152b200 <+0>:  movdqa %xmm0, 0x10(%esp)
0xa152b206 <+6>:  movdqa %xmm1, 0x20(%esp)
0xa152b20c <+12>: movdqa %xmm2, 0x30(%esp)
0xa152b212 <+18>: movdqa %xmm3, 0x40(%esp)
(lldb) b main
Breakpoint 1: where = a.out`main + 5 at pr25967-1.c:62, address = 0x1f44
(lldb) run
There is a running process, kill it and restart?: [Y/n] y
Process 25578 exited with status = 9 (0x0009) 
Process 25583 launched:
'/Users/dominiq/Documents/Fortran/g95bench/win/f90/bug/a.out' (i386)
Process 25583 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x1f44 a.out`main at pr25967-1.c:62
   59   main ()
   60   {
   61 /* Align exception handler stack to 16 bytes.  */
-> 62 asm ("and $-16, %" STACK_POINTER ";   \
   63   push$" STRING (SS) ";   \
   64   push$" STRING (SP) ";   \
   65   push$" STRING (FLAGS) ";\
(lldb) disass -a 0x1f44
a.out`main:
0x1f3f <+0>:  calll  0x1f70; __x86.get_pc_thunk.ax
->  0x1f44 <+5>:  andl   $-0x10, %esp
0x1f47 <+8>:  pushl  $0x12345675   ; imm = 0x12345675 
0x1f4c <+13>: pushl  $0x12345674   ; imm = 0x12345674 
0x1f51 <+18>: pushl  $0x12345673   ; imm = 0x12345673 
0x1f56 <+23>: pushl  $0x12345672   ; imm = 0x12345672 
0x1f5b <+28>: pushl  $0x12345671   ; imm = 0x12345671 
0x1f60 <+33>: pushl  $0x12345670   ; imm = 0x12345670 
0x1f65 <+38>: jmp0x1ed0; fn at pr25967-1.c:38
0x1f6a <+43>: movl   $0x0, %eax
0x1f6f <+48>: retl   

% /opt/gcc/gcc8w/bin/gcc /opt/gcc/work/gcc/testsuite/gcc.dg/torture/pr25967-1.c
-g
% lldb ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) run
Process 25632 launched: './a.out' (x86_64)
Process 25632 exited with status = 0 (0x) 
(lldb) b main
Breakpoint 1: where = a.out`main at pr25967-1.c:62, address =
0x00010f4b
(lldb) run
Process 25636 launched: './a.out' (x86_64)
Process 25636 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00010f4b a.out`main at pr25967-1.c:62
   59   main ()
   60   {
   61 /* Align exception handler stack to 16 bytes.  */
-> 62 asm ("and $-16, %" STACK_POINTER ";   \
   63   push$" STRING (SS) ";   \
   64   push$" STRING (SP) ";   \
   65   push$" STRING (FLAGS) ";\
(lldb) disass -a 0x00010f4b
a.out`main:
->  0x10f4b <+0>:  andq   $-0x10, %rsp
0x10f4f <+4>:  pushq  $0x12345675   ; imm = 0x12345675 
0x10f54 <+9>:  pushq  $0x12345674   ; imm = 0x12345674 
0x10f59 <+14>: pushq  $0x12345673   ; imm = 0x12345673 
0x10f5e <+19>: pushq  $0x12345672   ; imm = 0x12345672 
0x10f63 <+24>: pushq  $0x12345671   ; imm = 0x12345671 
0x10f68 <+29>: pushq  $0x12345670   ; imm = 0x12345670 
0x10f6d <+34>: jmp0x10ed2   ; fn at pr25967-1.c:40
0x10f72 <+39>: movl   $0x0, %eax
0x10f77 <+44>: retq

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #20 from H.J. Lu  ---
(In reply to Dominique d'Humieres from comment #19)
> > Do you know why it fails in 32-bit mode?
> 
> Nope! Are you sure that %esp is the stack in 32 bit mode?

Yes, %esp is correct for 32-bit mode.  Please compile
gcc.dg/torture/pr25967-1.c with -g and run it under debugger.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #19 from Dominique d'Humieres  ---
> Do you know why it fails in 32-bit mode?

Nope! Are you sure that %esp is the stack in 32 bit mode?

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #18 from H.J. Lu  ---
(In reply to Dominique d'Humieres from comment #17)
> > 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
> 

Do you know why it fails in 32-bit mode?

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #17 from Dominique d'Humieres  ---
> 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.0 +0200
+++ gcc/testsuite/gcc.dg/torture/pr25967-1.c2017-09-03 20:28:09.0
+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) ";   \

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #16 from H.J. Lu  ---
(In reply to Dominique d'Humieres from comment #14)
> > Please try my new patch.
> 
> AFAICT it is not different from the one I have already applied (why the
> duplications?).

I updated it again.  If it still doesn't work, please show me what
you applied.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

H.J. Lu  changed:

   What|Removed |Added

  Attachment #42109|0   |1
is obsolete||

--- Comment #15 from H.J. Lu  ---
Created attachment 42110
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42110&action=edit
A new patch

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #14 from Dominique d'Humieres  ---
> Please try my new patch.

AFAICT it is not different from the one I have already applied (why the
duplications?).

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #13 from H.J. Lu  ---
(In reply to Dominique d'Humieres from comment #11)
> > Where is
> >
> > and$0xfff0,%rsp
> 
> I cannot find it!-(
> 
> > my patch added?
> 
> Yes.

Please try my new patch.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

H.J. Lu  changed:

   What|Removed |Added

  Attachment #41917|0   |1
is obsolete||

--- Comment #12 from H.J. Lu  ---
Created attachment 42109
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42109&action=edit
An updated patch

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-09-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #11 from Dominique d'Humieres  ---
> Where is
>
> and$0xfff0,%rsp

I cannot find it!-(

> my patch added?

Yes.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #10 from H.J. Lu  ---
(In reply to Dominique d'Humieres from comment #9)
> (lldb) b main
> Breakpoint 2: where = a.out`main at pr25967-1.c:55, address =
> 0x00010f4f
> (lldb) disass -a 0x00010f4f
> a.out`main:
> 0x10f4f <+0>:  pushq  $0x12345675   ; imm = 0x12345675 
> 0x10f54 <+5>:  pushq  $0x12345674   ; imm = 0x12345674 
> 0x10f59 <+10>: pushq  $0x12345673   ; imm = 0x12345673 
> 0x10f5e <+15>: pushq  $0x12345672   ; imm = 0x12345672 
> 0x10f63 <+20>: pushq  $0x12345671   ; imm = 0x12345671 
> 0x10f68 <+25>: pushq  $0x12345670   ; imm = 0x12345670 
> 0x10f6d <+30>: jmp0x10ee8   ; fn at
> pr25967-1.c:34
> 0x10f72 <+35>: movl   $0x0, %eax
> 0x10f77 <+40>: retq

Where is

and$0xfff0,%rsp

my patch added?

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #9 from Dominique d'Humieres  ---
(lldb) b main
Breakpoint 2: where = a.out`main at pr25967-1.c:55, address =
0x00010f4f
(lldb) disass -a 0x00010f4f
a.out`main:
0x10f4f <+0>:  pushq  $0x12345675   ; imm = 0x12345675 
0x10f54 <+5>:  pushq  $0x12345674   ; imm = 0x12345674 
0x10f59 <+10>: pushq  $0x12345673   ; imm = 0x12345673 
0x10f5e <+15>: pushq  $0x12345672   ; imm = 0x12345672 
0x10f63 <+20>: pushq  $0x12345671   ; imm = 0x12345671 
0x10f68 <+25>: pushq  $0x12345670   ; imm = 0x12345670 
0x10f6d <+30>: jmp0x10ee8   ; fn at pr25967-1.c:34
0x10f72 <+35>: movl   $0x0, %eax
0x10f77 <+40>: retq

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #8 from H.J. Lu  ---
(In reply to Dominique d'Humieres from comment #7)
> > Created attachment 41917 [details]
> > A patch
> >
> > Please try this.
> 
> Sorry it does not work:
> 

Please compile gcc.dg/torture/pr25967-1.c with -g and run
it under debugger:

(gdb) r
Starting program: /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/a.out 
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.25-7.0.fc26.x86_64

Breakpoint 3, fn ()
at
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/torture/pr25967-1.c:43
43asm volatile ("lea " WORD_SIZE "(%%" STACK_POINTER "), %0\n\t"
(gdb) p/x $rsp
$1 = 0x7fffd570
 (gdb) disass main
Dump of assembler code for function main:
   0x00400450 <+0>: and$0xfff0,%rsp
   0x00400454 <+4>: pushq  $0x12345675
   0x00400459 <+9>: pushq  $0x12345674
   0x0040045e <+14>:pushq  $0x12345673
   0x00400463 <+19>:pushq  $0x12345672
   0x00400468 <+24>:pushq  $0x12345671
   0x0040046d <+29>:pushq  $0x12345670
   0x00400472 <+34>:jmpq   0x400557 
   0x00400477 <+39>:xor%eax,%eax
   0x00400479 <+41>:retq   
End of assembler dump.
(gdb) c
Continuing.

Breakpoint 1, 0x7ffe9b3ab1e0 in exit () from /lib64/libc.so.6
(gdb) p/x $rsp
$2 = 0x7fffd568
(gdb) 

Please find out why your stack isn't aligned to 16 bytes when exit is
called.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #7 from Dominique d'Humieres  ---
> Created attachment 41917 [details]
> A patch
>
> Please try this.

Sorry it does not work:

=== gcc Summary for unix/-m64 ===

# of unexpected failures14
# of unresolved testcases   14

=== gcc Summary ===

# of unexpected failures28
# of unresolved testcases   28

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #6 from H.J. Lu  ---
Created attachment 41917
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41917&action=edit
A patch

Please try this.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #5 from Uroš Bizjak  ---
Just guessing, but maybe _exit doesn't like misaligned stack on MacOS. We may
need to emit some dummy pushes to keep it aligned.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #4 from Dominique d'Humieres  ---
Created attachment 41915
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41915&action=edit
Assemby for pr25967-1

> Please compile it with -g and provide stack backtrace.

This is what I have done. bt is

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
  * frame #0: 0x7fff9e17d2fa libdyld.dylib`stack_not_16_byte_aligned_error

> Please also provide the assembly codes of fn and main.

Assembly attached.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #3 from H.J. Lu  ---
Please compile it with -g and provide stack backtrace.
Please also provide the assembly codes of fn and main.

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

--- Comment #2 from Dominique d'Humieres  ---
> Please show gdb backtrace as well as disassemble fn/main.

The best I can do without further directive

Current executable set to './a.out' (x86_64).
(lldb) run
Process 25263 launched: './a.out' (x86_64)
Process 25263 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
frame #0: 0x7fff9e17d2fa libdyld.dylib`stack_not_16_byte_aligned_error
libdyld.dylib`stack_not_16_byte_aligned_error:
->  0x7fff9e17d2fa <+0>: movdqa %xmm0, (%rsp)
0x7fff9e17d2ff <+5>: int3   

libdyld.dylib`_dyld_func_lookup:
0x7fff9e17d300 <+0>: pushq  %rbp
0x7fff9e17d301 <+1>: movq   %rsp, %rbp
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
  * frame #0: 0x7fff9e17d2fa libdyld.dylib`stack_not_16_byte_aligned_error

[Bug target/81693] FAIL: gcc.dg/torture/pr25967-*.c -O* execution test on darwin

2017-08-03 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81693

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-08-03
 CC||hjl.tools at gmail dot com
 Ever confirmed|0   |1

--- Comment #1 from H.J. Lu  ---
Please show gdb backtrace as well as disassemble fn/main.