public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105046] New: [enhancement] Allow inline-assembly clobbers to overlap inputs
@ 2022-03-24 18:45 ehem+gccbugs at m5p dot com
  2022-03-24 19:10 ` [Bug middle-end/105046] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ehem+gccbugs at m5p dot com @ 2022-03-24 18:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105046

            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-Registers

"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 class
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 clobber
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 clobbered
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 introduced
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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-25 21:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 18:45 [Bug c/105046] New: [enhancement] Allow inline-assembly clobbers to overlap inputs ehem+gccbugs at m5p dot com
2022-03-24 19:10 ` [Bug middle-end/105046] " pinskia at gcc dot gnu.org
2022-03-24 19:11 ` pinskia at gcc dot gnu.org
2022-03-24 19:27 ` jakub at gcc dot gnu.org
2022-03-24 21:11 ` [Bug c/105046] " ehem+gccbugs at m5p dot com
2022-03-24 21:16 ` jakub at gcc dot gnu.org
2022-03-24 21:51 ` ehem+gccbugs at m5p dot com
2022-03-25 21:14 ` ehem+gccbugs at m5p dot com

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).