public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/104236] New: asm statements containing %= assembler templates getting merged
@ 2022-01-26  0:54 ndesaulniers at google dot com
  2022-01-26  1:18 ` [Bug rtl-optimization/104236] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ndesaulniers at google dot com @ 2022-01-26  0:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104236
           Summary: asm statements containing %= assembler templates
                    getting merged
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ndesaulniers at google dot com
                CC: bp at alien8 dot de, jpoimboe at redhat dot com,
                    pinskia at gcc dot gnu.org, segher at kernel dot crashing.org
  Target Milestone: ---

https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Volatile and
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#AssemblerTemplate mention

    > Under certain circumstances, GCC may duplicate (or remove duplicates
    > of) your assembly code when optimizing. This can lead to unexpected
    > duplicate symbol errors during compilation if your asm code defines
    > symbols or labels. Using ‘%=’ (see AssemblerTemplate) may help resolve
    > this problem.
    >
    > ‘%=’ Outputs a number that is unique to each instance of the asm
    > statement in the entire compilation. This option is useful when
    > creating local labels and referring to them multiple times in a single
    > template that generates multiple assembler instructions.

I think I might have found a case where GCC is folding two asm strings that
look identical, but technically contain a %= assembler template.  Perhaps
there's somewhere that checks for parameter equality, and misses checking
whether an asm string contains %= ? (or perhaps %= needs to be expanded
sooner?)

Test files are in:
https://gist.github.com/nickdesaulniers/c2c37edcdbaf3a2deb914d2ea8011a96

I would have expected the inline asm string containing `.Lreachable%=:` (in
media_request_object_complete()) to appear twice in the emitted asm output.  If
I modify one of the two `.Lreachable` asm strings by one character, then I see
both emitted.

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

end of thread, other threads:[~2022-01-26  1:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26  0:54 [Bug bootstrap/104236] New: asm statements containing %= assembler templates getting merged ndesaulniers at google dot com
2022-01-26  1:18 ` [Bug rtl-optimization/104236] " pinskia at gcc dot gnu.org
2022-01-26  1:25 ` pinskia at gcc dot gnu.org
2022-01-26  1:39 ` ndesaulniers at google dot com
2022-01-26  1:44 ` pinskia at gcc dot gnu.org
2022-01-26  1:52 ` pinskia at gcc dot gnu.org

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