public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110734] New: Attributes cannot be applied to asm statements
@ 2023-07-19  7:45 tanksherman27 at gmail dot com
  2023-07-19  7:47 ` [Bug c++/110734] " tanksherman27 at gmail dot com
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-07-19  7:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110734
           Summary: Attributes cannot be applied to asm statements
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tanksherman27 at gmail dot com
  Target Milestone: ---

Consider the following:

[[gnu::no_reorder]]
asm ("nop");

The correct gcc warning should be that "attributes in front of statements
are ignored", signifying that the asm was correctly processed as a
statement, and the attribute dropped during that processing, but instead:

error.cpp:51:5: error: expected primary-expression before 'asm'
   51 |     asm ("nop" "\n\t"
      |     ^~~
error.cpp:50:5: warning: attributes at the beginning of statement are
ignored [-Wattributes]
   50 |     [[gnu::no_reorder]]
      |     ^~~~~~~~~~~~~~~~~~~

The compiler errors out, with the parser strangely having expected an
expression after the attribute. Afterwards, it then confusingly parses the
asm statement and discards the attribute correctly, so I am fairly certain
this is a bug. The attribute above may not be a very good example, but
there are attributes like gnu::hot and gnu::cold which are supposed to work
with asm statements.

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

end of thread, other threads:[~2023-12-05 17:04 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-19  7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
2023-07-19  7:47 ` [Bug c++/110734] " tanksherman27 at gmail dot com
2023-07-19  7:50 ` pinskia at gcc dot gnu.org
2023-07-19  7:57 ` tanksherman27 at gmail dot com
2023-07-19  9:43 ` rguenth at gcc dot gnu.org
2023-07-22  3:30 ` tanksherman27 at gmail dot com
2023-11-23  2:33 ` tanksherman27 at gmail dot com
2023-11-29 10:45 ` tanksherman27 at gmail dot com
2023-11-29 10:47 ` tanksherman27 at gmail dot com
2023-11-30 14:59 ` [Bug c++/110734] Attributes cannot be applied to asm declarations tanksherman27 at gmail dot com
2023-11-30 16:22 ` xry111 at gcc dot gnu.org
2023-11-30 16:24 ` xry111 at gcc dot gnu.org
2023-11-30 16:27 ` mpolacek at gcc dot gnu.org
2023-12-01  4:52 ` tanksherman27 at gmail dot com
2023-12-01  5:34 ` [Bug c++/110734] Attributes cannot be applied to asm statements xry111 at gcc dot gnu.org
2023-12-01  5:43 ` xry111 at gcc dot gnu.org
2023-12-01  5:51 ` [Bug c++/110734] Attributes cannot be applied to asm declaration xry111 at gcc dot gnu.org
2023-12-01  5:53 ` xry111 at gcc dot gnu.org
2023-12-01  6:22 ` tanksherman27 at gmail dot com
2023-12-01  6:23 ` tanksherman27 at gmail dot com
2023-12-01  6:56 ` jakub at gcc dot gnu.org
2023-12-02 14:11 ` tanksherman27 at gmail dot com
2023-12-05 16:39 ` cvs-commit at gcc dot gnu.org
2023-12-05 17:03 ` jakub at gcc dot gnu.org
2023-12-05 17:04 ` jakub 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).