From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by server2.sourceware.org (Postfix, from userid 48) id D14CA3944422; Mon, 9 Mar 2020 10:37:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 server2.sourceware.org D14CA3944422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1583750225; bh=sxvAe9a4attTEIl6WtyY7hag7tXGkskpmzShLvo4yoE=; h=From:To:Subject:Date:From; b=t8QcUbOzKe5u48iYoycgr8AR0OLpP0yxD95ScLzN+3/H4vEALz8Qq0kjbtnoz6mbQ Flt4x/NnewHMAAozz4MD0qRInfhqKyZE1QZUTIxxP1NB2ElY2WDAUanR/wAdaWWSfx JupbfHBz47faAsdqMf5A4Cj4/yk2obhojhaOACgE= From: "frederic.recoules@univ-grenoble-alpes.fr" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: inline-asm X-Bugzilla-Version: 9.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: frederic.recoules@univ-grenoble-alpes.fr X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2020 10:37:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94097 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 =3D 0; __asm__ ("movl %1, %0" "\n\t" : "=3D&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 swa= pped constraints: int main (int argc, char *argv[]) { int x =3D 0; __asm__ ("movl %1, %0" : "=3D&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=