[Bug inline-asm/52813] %rsp in clobber list is silently ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 Eric Gallager changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #12 from Eric Gallager --- (In reply to Christophe Lyon from comment #11) > (In reply to Eric Gallager from comment #10) > > So after these 2, has this been fixed now? > OK for me. OK.
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 Christophe Lyon changed: What|Removed |Added CC||clyon at gcc dot gnu.org --- Comment #11 from Christophe Lyon --- (In reply to Eric Gallager from comment #10) > So after these 2, has this been fixed now? OK for me.
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 --- Comment #10 from Eric Gallager --- (In reply to rsand...@gcc.gnu.org from comment #8) > Author: rsandifo > Date: Tue Jan 15 16:46:54 2019 > New Revision: 267941 > > URL: https://gcc.gnu.org/viewcvs?rev=267941=gcc=rev > Log: > PR inline-asm/52813 revisited > > The original patch for this PR made it an error to list the stack > pointer in the clobber list of an inline asm. However, the general > feeling seemed to be that going straight to a hard error was too harsh, > since there's quite a bit of existing code that has the clobber. > > This patch implements the compromise discussed on IRC of making it > a -Wdeprecated warning instead. > > 2019-01-15 Richard Sandiford > > gcc/ > PR inline-asm/52813 > * doc/extend.texi: Document that listing the stack pointer in the > clobber list of an asm is a deprecated feature. > * common.opt (Wdeprecated): Moved from c-family/c.opt. > * cfgexpand.c (asm_clobber_reg_is_valid): Issue a -Wdeprecated > warning instead of an error for clobbers of the stack pointer. > Add a note explaining why. > > gcc/c-family/ > PR inline-asm/52813 > * c.opt (Wdeprecated): Move documentation and variable to common.opt. > > gcc/d/ > PR inline-asm/52813 > * lang.opt (Wdeprecated): Reference common.opt instead of c.opt. > > gcc/testsuite/ > PR inline-asm/52813 > * gcc.target/i386/pr52813.c (test1): Turn the diagnostic into a > -Wdeprecated warning and expect a following note:. > > Modified: > trunk/gcc/ChangeLog > trunk/gcc/c-family/ChangeLog > trunk/gcc/c-family/c.opt > trunk/gcc/cfgexpand.c > trunk/gcc/common.opt > trunk/gcc/d/ChangeLog > trunk/gcc/d/lang.opt > trunk/gcc/doc/extend.texi > trunk/gcc/testsuite/ChangeLog > trunk/gcc/testsuite/gcc.target/i386/pr52813.c (In reply to Christophe Lyon from comment #9) > Author: clyon > Date: Fri Jan 18 09:57:41 2019 > New Revision: 268066 > > URL: https://gcc.gnu.org/viewcvs?rev=268066=gcc=rev > Log: > [ARM][testsuite] follow-up to PR target/52813 and target/11807 fix. > > 2019-01-18 Christophe Lyon > > * gcc.target/arm/pr77904.c: Add dg-warning for sp clobber. > > > Modified: > trunk/gcc/testsuite/ChangeLog > trunk/gcc/testsuite/gcc.target/arm/pr77904.c So after these 2, has this been fixed now?
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 --- Comment #9 from Christophe Lyon --- Author: clyon Date: Fri Jan 18 09:57:41 2019 New Revision: 268066 URL: https://gcc.gnu.org/viewcvs?rev=268066=gcc=rev Log: [ARM][testsuite] follow-up to PR target/52813 and target/11807 fix. 2019-01-18 Christophe Lyon * gcc.target/arm/pr77904.c: Add dg-warning for sp clobber. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/arm/pr77904.c
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 --- Comment #8 from rsandifo at gcc dot gnu.org --- Author: rsandifo Date: Tue Jan 15 16:46:54 2019 New Revision: 267941 URL: https://gcc.gnu.org/viewcvs?rev=267941=gcc=rev Log: PR inline-asm/52813 revisited The original patch for this PR made it an error to list the stack pointer in the clobber list of an inline asm. However, the general feeling seemed to be that going straight to a hard error was too harsh, since there's quite a bit of existing code that has the clobber. This patch implements the compromise discussed on IRC of making it a -Wdeprecated warning instead. 2019-01-15 Richard Sandiford gcc/ PR inline-asm/52813 * doc/extend.texi: Document that listing the stack pointer in the clobber list of an asm is a deprecated feature. * common.opt (Wdeprecated): Moved from c-family/c.opt. * cfgexpand.c (asm_clobber_reg_is_valid): Issue a -Wdeprecated warning instead of an error for clobbers of the stack pointer. Add a note explaining why. gcc/c-family/ PR inline-asm/52813 * c.opt (Wdeprecated): Move documentation and variable to common.opt. gcc/d/ PR inline-asm/52813 * lang.opt (Wdeprecated): Reference common.opt instead of c.opt. gcc/testsuite/ PR inline-asm/52813 * gcc.target/i386/pr52813.c (test1): Turn the diagnostic into a -Wdeprecated warning and expect a following note:. Modified: trunk/gcc/ChangeLog trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c.opt trunk/gcc/cfgexpand.c trunk/gcc/common.opt trunk/gcc/d/ChangeLog trunk/gcc/d/lang.opt trunk/gcc/doc/extend.texi trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/i386/pr52813.c
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 Dimitar Dimitrov changed: What|Removed |Added CC||dinuxbg at gmail dot com --- Comment #7 from Dimitar Dimitrov --- Suggested fix has been posted for review: https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00532.html
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 Eric Gallager changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2017-07-28 CC||egallager at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #6 from Eric Gallager --- (In reply to Ralph Corderoy from comment #5) > The examples clearly show the problem and it bites me here. Please change > the status to confirmed. OK.
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 Ralph Corderoy ralph-gccbugzilla at inputplus dot co.uk changed: What|Removed |Added CC||ralph-gccbugzilla at ||inputplus dot co.uk --- Comment #5 from Ralph Corderoy ralph-gccbugzilla at inputplus dot co.uk 2012-05-28 23:06:51 UTC --- The examples clearly show the problem and it bites me here. Please change the status to confirmed.
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 Uros Bizjak ubizjak at gmail dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID --- Comment #1 from Uros Bizjak ubizjak at gmail dot com 2012-04-01 09:21:09 UTC --- The compiler doesn't analyse asm string.
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 Josh Haberman jhaberman at gmail dot com changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID | --- Comment #2 from Josh Haberman jhaberman at gmail dot com 2012-04-01 15:54:27 UTC --- I don't expect the compiler to analyze the asm string. I expect the compiler to respect my clobber list. I told GCC that I would clobber %rsp. Any other register that I put in the clobber list causes GCC to save that register to the stack or to another register before the asm and restore it from the stack/register after the asm. For example: -- #include stdlib.h int main() { int x = rand(); asm volatile (movq $0, %%rax : : : %rax); return x; } $ gcc -Wall -O3 -fomit-frame-pointer -c -o test.o test.c $ objdump -d -r -M intel test.o test.o: file format elf64-x86-64 Disassembly of section .text.startup: main: 0:48 83 ec 08 subrsp,0x8 4:e8 00 00 00 00 call 9 main+0x9 5: R_X86_64_PC32rand-0x4 9:89 c2movedx,eax b:48 c7 c0 00 00 00 00 movrax,0x0 12:89 d0moveax,edx 14:48 83 c4 08 addrsp,0x8 18:c3 ret -- Notice that it saved eax to edx before my asm and restored it afterwards. This works for every register except %rsp, which is silently ignored if you try to list it in the clobber list. This is a bug.
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 --- Comment #3 from Uros Bizjak ubizjak at gmail dot com 2012-04-01 18:58:27 UTC --- (In reply to comment #2) I don't expect the compiler to analyze the asm string. I expect the compiler to respect my clobber list. I told GCC that I would clobber %rsp. Any other register that I put in the clobber list causes GCC to save that register to the stack or to another register before the asm and restore it from the stack/register after the asm. For example: %rsp is considered a fixed register, used for fixed purposes all throughout the compiled code and are therefore not available for general allocation. So, save %rsp at the beginning of your asm code and restore it at the end.
[Bug inline-asm/52813] %rsp in clobber list is silently ignored
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52813 --- Comment #4 from Josh Haberman jhaberman at gmail dot com 2012-04-01 19:23:14 UTC --- I understand that GCC may not be able to save/restore %rsp like it does other registers. But if that's the case, GCC should throw an error if the user puts %rsp in the clobber list, instead of silently ignoring it. Otherwise how is the user supposed to know that %rsp will not be saved except through trial and error?