public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tanksherman27 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/110734] New: Attributes cannot be applied to asm statements
Date: Wed, 19 Jul 2023 07:45:59 +0000	[thread overview]
Message-ID: <bug-110734-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-07-19  7:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19  7:45 tanksherman27 at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110734-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).