public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "frederic.recoules@univ-grenoble-alpes.fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/94097] New: GCC fails to allocate "rm" input constraint when no more register is left Date: Mon, 09 Mar 2020 10:37:05 +0000 [thread overview] Message-ID: <bug-94097-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94097 Bug ID: 94097 Summary: GCC fails to allocate "rm" input constraint when no more register is left Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: inline-asm Assignee: unassigned at gcc dot gnu.org Reporter: frederic.recoules@univ-grenoble-alpes.fr Target Milestone: --- Consider the following code snippet: int main (int argc, char *argv[]) { int x = 0; __asm__ ("movl %1, %0" "\n\t" : "=&a" (argc) : "rm" (x) : "ebx", "ecx", "edx", "edi", "esi", "ebp"); return argc; } GCC 9.0 fails because the constraints are "impossible" but 'x' can still be given by memory reference. For instance, in the following code, that is quasi equivalent, but with swapped constraints: int main (int argc, char *argv[]) { int x = 0; __asm__ ("movl %1, %0" : "=&rm" (argc) : "a" (x) : "ebx", "ecx", "edx", "edi", "esi", "ebp"); return argc; } It produces the following assembly, where a new cell is freshly allocated on the stack to hold the value: main: pushl %ebp xorl %eax, %eax pushl %edi pushl %esi pushl %ebx subl $4, %esp #APP movl %eax, (%esp) #NOAPP movl (%esp), %eax addl $4, %esp popl %ebx popl %esi popl %edi popl %ebp ret
reply other threads:[~2020-03-09 10:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94097-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).