[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-21 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
Version|unknown |9.0
 Resolution|--- |FIXED
   Target Milestone|--- |9.0

--- Comment #11 from H.J. Lu  ---
Fixed for GCC 9 and on GCC 6/7/8 branches.

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-21 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #10 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Tue Aug 21 16:38:17 2018
New Revision: 263745

URL: https://gcc.gnu.org/viewcvs?rev=263745=gcc=rev
Log:
x86: Always update EH return address in word_mode

On x86, return address is always popped in word_mode.  eh_return needs
to put EH return address in word_mode on stack.

gcc/

Backport from mainline
PR target/87014
* config/i386/i386.md (eh_return): Always update EH return
address in word_mode.

gcc/testsuite/

Backport from mainline
PR target/87014
* g++.dg/torture/pr87014.C: New file.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr87014.C
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/i386/i386.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-21 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #9 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Tue Aug 21 16:27:22 2018
New Revision: 263744

URL: https://gcc.gnu.org/viewcvs?rev=263744=gcc=rev
Log:
x86: Always update EH return address in word_mode

On x86, return address is always popped in word_mode.  eh_return needs
to put EH return address in word_mode on stack.

gcc/

Backport from mainline
PR target/87014
* config/i386/i386.md (eh_return): Always update EH return
address in word_mode.

gcc/testsuite/

Backport from mainline
PR target/87014
* g++.dg/torture/pr87014.C: New file.

Added:
branches/gcc-7-branch/gcc/testsuite/g++.dg/torture/pr87014.C
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/config/i386/i386.md
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-21 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #8 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Tue Aug 21 16:17:35 2018
New Revision: 263743

URL: https://gcc.gnu.org/viewcvs?rev=263743=gcc=rev
Log:
x86: Always update EH return address in word_mode

On x86, return address is always popped in word_mode.  eh_return needs
to put EH return address in word_mode on stack.

gcc/

Backport from mainline
PR target/87014
* config/i386/i386.md (eh_return): Always update EH return
address in word_mode.

gcc/testsuite/

Backport from mainline
PR target/87014
* g++.dg/torture/pr87014.C: New file.

Added:
branches/gcc-8-branch/gcc/testsuite/g++.dg/torture/pr87014.C
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/config/i386/i386.md
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-20 Thread hjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #7 from hjl at gcc dot gnu.org  ---
Author: hjl
Date: Mon Aug 20 19:14:04 2018
New Revision: 263672

URL: https://gcc.gnu.org/viewcvs?rev=263672=gcc=rev
Log:
x86: Always update EH return address in word_mode

On x86, return address is always popped in word_mode.  eh_return needs
to put EH return address in word_mode on stack.

gcc/

PR target/87014
* config/i386/i386.md (eh_return): Always update EH return
address in word_mode.

gcc/testsuite/

PR target/87014
* g++.dg/torture/pr87014.C: New file.

Added:
trunk/gcc/testsuite/g++.dg/torture/pr87014.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.md
trunk/gcc/testsuite/ChangeLog

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-20 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

Uroš Bizjak  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #6 from Uroš Bizjak  ---
Adding CC.

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-20 Thread theonetruecamper at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #5 from camper  ---
test case (-O0):

using ll = long long;

void fillstack() {
ll foo[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
}

void f(ll=-1,ll=-1,ll=-1,ll=-1,ll=-1,ll=-1,ll arg7_on_stack=-1) {
throw 0;
}

void g() {
try {
f();
} catch(int) {
}
}

int main() {
   fillstack();
   g();
}

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-19 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #4 from Andreas Schwab  ---
It's a 32bit store, not a load.

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-19 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #3 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #2)
> > movl%eax, 8(%ebp,%ecx)# !
> 
> This is a 32bit zero extending load.

Meaning the top 32bits of the rax register are zero.

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-19 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #2 from Andrew Pinski  ---
>   movl%eax, 8(%ebp,%ecx)# !

This is a 32bit zero extending load.

[Bug target/87014] [x32] __builtin_eh_return should use 64-bit mov to set return address

2018-08-19 Thread theonetruecamper at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87014

--- Comment #1 from camper  ---
Created attachment 44557
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44557=edit
[x32] use 64-bit mov to set return address in eh_return

compiles to:
movlhandler(%rip), %eax
movloffset(%rip), %edx
movl%edx, %ecx
movl%eax, %eax
movq%rax, 8(%ebp,%ecx)
movq-16(%ebp), %rax
movq-8(%ebp), %rdx
leal8(%rbp,%rcx), %ecx
movl0(%ebp), %ebp
movl%ecx, %esp
ret