[Bug] Attributes cannot be applied to asm statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry for posting this here, I am unable to create an issue in the gcc
tracker

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. Could someone help me post this to the bug tracker?
Thanks in advance

best regards,
Julian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux