From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4AFD73858D3C; Thu, 24 Mar 2022 18:45:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AFD73858D3C From: "ehem+gccbugs at m5p dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105046] New: [enhancement] Allow inline-assembly clobbers to overlap inputs Date: Thu, 24 Mar 2022 18:45:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: inline-asm X-Bugzilla-Severity: normal X-Bugzilla-Who: ehem+gccbugs at m5p dot com 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: Thu, 24 Mar 2022 18:45:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105046 Bug ID: 105046 Summary: [enhancement] Allow inline-assembly clobbers to overlap inputs Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: inline-asm Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ehem+gccbugs at m5p dot com Target Milestone: --- From: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Clobbers-and-Scratch-R= egisters "Clobber descriptions may not in any way overlap with an input or output operand. For example, you may not have an operand describing a register cla= ss with one member when listing that register in the clobber list. Variables declared to live in specific registers (see Explicit Register Variables) and used as asm input or output operands must have no part mentioned in the clo= bber description. In particular, there is no way to specify that input operands = get modified without also specifying them as output operands." Inline assembly language SHOULD be able to clobber inputs. Forcing clobber= ed inputs to be declared as outputs (which also forces them to be lvalues) is a recipe for introducing bugs into programs. The documentation leaves me with the impression this restriction was introd= uced with the initial implementation of extended inline assembly language (likely pre-2000). I suspect improvements in the back-end likely mean this can be readily removed. I'm unsure about allowing outputs to overlap clobbers. If the clobber list= is treated as a list of registers/memory which are modified, then it would make sense to allow outputs to be clobbered. Issue is whether this is allowing programmers to be sloppy and cause more bugs, versus making the job easier. Alternatively a '-' prefix could be added for marking inputs which are clobbered in the assembly language. This could be a nicer expression, but changes the language.=