* [Bug c++/110734] Attributes cannot be applied to asm statements
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 ` tanksherman27 at gmail dot com
2023-07-19 7:50 ` pinskia at gcc dot gnu.org
` (22 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-07-19 7:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Julian Waters <tanksherman27 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|unknown |13.1.1
--- Comment #1 from Julian Waters <tanksherman27 at gmail dot com> ---
Set version to 13.1, but this problem is very likely in every version
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
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
` (21 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-19 7:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
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
` (20 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-07-19 7:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #2 from Julian Waters <tanksherman27 at gmail dot com> ---
Is this accurately described as an enhancement? This is erroneous behaviour
with something that is already meant to be a feature in gcc (applying
attributes to statements, as seen inside parser.cc), not a feature request for
new behaviour
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (2 preceding siblings ...)
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
` (19 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-19 9:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
CC| |hubicka at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-07-19
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
But a toplevel asm isn't a "statement" in the sense of parsing. Still
confirmed. Note that I'm not sure we can handle no-reorder for toplevel
asms, IIRC they are not entities in the symtab. I don't remember off head
where they are recorded either ...
Btw, I don't get
t.c:3:1: warning: attributes at the beginning of statement are ignored
[-Wattributes]
3 | [[gnu::no_reorder]]
| ^~~~~~~~~~~~~~~~~~~
unless I wrap your source inside a function. Was your testcase complete?
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (3 preceding siblings ...)
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
` (18 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-07-22 3:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #4 from Julian Waters <tanksherman27 at gmail dot com> ---
My mistake, I forgot to mention that it was indeed inside a function body. I
can't seem to figure out what in parser.cc is causing this bug, anything on
your end?
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (4 preceding siblings ...)
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
` (17 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-11-23 2:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #5 from Julian Waters <tanksherman27 at gmail dot com> ---
Note: Trying this with a top level asm gives me:
$ g++ -O3 -flto=auto -std=c++14 -pedantic -Wpedantic -fno-omit-frame-pointer
exceptions.cpp
exceptions.cpp:8:1: error: expected unqualified-id before 'asm'
8 | asm ("nop");
| ^~~
So while it seems the errors are different, it fundamentally is the same issue
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (5 preceding siblings ...)
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
` (16 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-11-29 10:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Julian Waters <tanksherman27 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tanksherman27 at gmail dot com
--- Comment #6 from Julian Waters <tanksherman27 at gmail dot com> ---
Created attachment 56717
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56717&action=edit
Attribute for asm declarations
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (6 preceding siblings ...)
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
` (15 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-11-29 10:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #7 from Julian Waters <tanksherman27 at gmail dot com> ---
I have a new attribute proposed for asm declarations that fixes this issue, but
I need help from reviews to proceed with fixing up the patch properly
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declarations
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (7 preceding siblings ...)
2023-11-29 10:47 ` tanksherman27 at gmail dot com
@ 2023-11-30 14:59 ` tanksherman27 at gmail dot com
2023-11-30 16:22 ` xry111 at gcc dot gnu.org
` (14 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-11-30 14:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Julian Waters <tanksherman27 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #56717|0 |1
is obsolete| |
--- Comment #8 from Julian Waters <tanksherman27 at gmail dot com> ---
Created attachment 56732
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56732&action=edit
Attribute for asm declarations
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declarations
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (8 preceding siblings ...)
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
` (13 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-11-30 16:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
--- Comment #9 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Julian Waters from comment #8)
> Created attachment 56732 [details]
> Attribute for asm declarations
Please just fix this issue (i.e. make [[gnu::no_reorder]] work) instead of
adding fancy new features. Now we are in stage 3 of GCC 14 so any fancy new
feature should be deferred into stage 1 of GCC 15.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declarations
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (9 preceding siblings ...)
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
` (12 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-11-30 16:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #10 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #9)
> (In reply to Julian Waters from comment #8)
> > Created attachment 56732 [details]
> > Attribute for asm declarations
>
> Please just fix this issue (i.e. make [[gnu::no_reorder]] work) instead of
> adding fancy new features. Now we are in stage 3 of GCC 14 so any fancy new
> feature should be deferred into stage 1 of GCC 15.
Ok, I see you are only using no_reorder as an example. Then try to make the
existing attributes work instead of adding a new one.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declarations
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (10 preceding siblings ...)
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
` (11 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-11-30 16:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #10)
> (In reply to Xi Ruoyao from comment #9)
> > (In reply to Julian Waters from comment #8)
> > > Created attachment 56732 [details]
> > > Attribute for asm declarations
> >
> > Please just fix this issue (i.e. make [[gnu::no_reorder]] work) instead of
> > adding fancy new features. Now we are in stage 3 of GCC 14 so any fancy new
> > feature should be deferred into stage 1 of GCC 15.
>
> Ok, I see you are only using no_reorder as an example. Then try to make the
> existing attributes work instead of adding a new one.
I agree. I can hardly see the need for a new and a very complicated attribute.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declarations
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (11 preceding siblings ...)
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
` (10 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-12-01 4:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #12 from Julian Waters <tanksherman27 at gmail dot com> ---
Will do, will save the new attribute for gcc 15 and just fix the attribute
specifier sequence here
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (12 preceding siblings ...)
2023-12-01 4:52 ` tanksherman27 at gmail dot com
@ 2023-12-01 5:34 ` xry111 at gcc dot gnu.org
2023-12-01 5:43 ` xry111 at gcc dot gnu.org
` (9 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-01 5:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Attributes cannot be |Attributes cannot be
|applied to asm declarations |applied to asm statements
--- Comment #13 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Re-titling as there is no such a concept "asm declarations".
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm statements
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (13 preceding siblings ...)
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
` (8 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-01 5:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
--- Comment #14 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Wait a minute. [[gnu::no_reorder]] is a function or variable attribute, so
it's just not intended to be used for an asm statement. Actually it won't work
for any statement:
int x;
int main()
{
[[gnu::no_reorder]]
x += 1;
}
gives:
t.c: In function 'main':
t.c:5:9: warning: 'no_reorder' attribute ignored [-Wattributes]
5 | x += 1;
| ^
We have "statement attributes" (fallthrough and assume) but the doc is clear
that they can only be set on null statements, while asm statements are not null
statements.
Now to me this is just an invalid PR. Or am I missing something?
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (14 preceding siblings ...)
2023-12-01 5:43 ` xry111 at gcc dot gnu.org
@ 2023-12-01 5:51 ` xry111 at gcc dot gnu.org
2023-12-01 5:53 ` xry111 at gcc dot gnu.org
` (7 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-01 5:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Attributes cannot be |Attributes cannot be
|applied to asm statements |applied to asm declaration
Status|WAITING |NEW
--- Comment #15 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Alright, this is a C++ issue and I mistakenly assumed it was C.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (15 preceding siblings ...)
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
` (6 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-12-01 5:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #16 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #15)
> Alright, this is a C++ issue and I mistakenly assumed it was C.
Note that in C++ we have some inconsistency with the standard. In the standard
asm(...) are "declarations" but in GNU C++ asm(...) are always "statements".
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (16 preceding siblings ...)
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
` (5 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-12-01 6:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #17 from Julian Waters <tanksherman27 at gmail dot com> ---
Looking at the source of the C++ parser it doesn't seem like asm (""); is
considered a statement but rather is correctly parsed as a declaration, see
cp_parser_block_declaration and cp_parser_declaration_statement. The no_reorder
attribute is just a demonstration, I am aware it is not meant for asm
declarations, rather the error is in how the error message is formed, eg error:
expected primary-expression before 'asm' instead of error: expected
primary-expression before 'asm'
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (17 preceding siblings ...)
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
` (4 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-12-01 6:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #18 from Julian Waters <tanksherman27 at gmail dot com> ---
Oops, I meant warning: 'no_reorder' attribute ignored [-Wattributes] in my
above comment
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (18 preceding siblings ...)
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
` (3 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-01 6:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Attributes have been allowed on asm in C++ only since 2017's
https://cplusplus.github.io/CWG/issues/2262.html
which we apparently don't implement. See
https://gcc.gnu.org/projects/cxx-dr-status.html
It is not clear whether that change has been effectively applied as a DR and
thus whether it should apply to earlier standards as well (guess starting with
C++11) or not.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (19 preceding siblings ...)
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
` (2 subsequent siblings)
23 siblings, 0 replies; 25+ messages in thread
From: tanksherman27 at gmail dot com @ 2023-12-02 14:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #20 from Julian Waters <tanksherman27 at gmail dot com> ---
cppreference at least seems to indicate it retroactively applies to C++11
https://en.cppreference.com/w/cpp/language/asm
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (20 preceding siblings ...)
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
23 siblings, 0 replies; 25+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-05 16:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:e5153e7d63b4cd9a3df490809c4f3fe1e94d3d37
commit r14-6187-ge5153e7d63b4cd9a3df490809c4f3fe1e94d3d37
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Dec 5 17:38:46 2023 +0100
c++: Implement C++ DR 2262 - Attributes for asm-definition [PR110734]
Seems in 2017 attribute-specifier-seq[opt] was added to asm-declaration
and the change was voted in as a DR.
The following patch implements it by parsing the attributes and warning
about them.
I found one attribute parsing bug I'll send a fix for momentarily.
And there is another thing I wonder about: with -Wno-attributes= we are
supposed to ignore the attributes altogether, but we are actually still
warning about them when we emit these generic warnings about ignoring
all attributes which appertain to this and that (perhaps with some
exceptions we first remove from the attribute chain), like:
void foo () { [[foo::bar]]; }
with -Wattributes -Wno-attributes=foo::bar
Shouldn't we call some helper function in cases like this and warn
not when std_attrs (or how the attribute chain var is called) is non-NULL,
but if it is non-NULL and contains at least one non-attribute_ignored_p
attribute? cp_parser_declaration at least tries:
if (std_attrs != NULL_TREE && !attribute_ignored_p (std_attrs))
warning_at (make_location (attrs_loc, attrs_loc, parser->lexer),
OPT_Wattributes, "attribute ignored");
but attribute_ignored_p here checks the first attribute rather than the
whole chain. So it will incorrectly not warn if there is an ignored
attribute followed by non-ignored.
2023-12-05 Jakub Jelinek <jakub@redhat.com>
PR c++/110734
* parser.cc (cp_parser_block_declaration): Implement C++ DR 2262
- Attributes for asm-definition. Call cp_parser_asm_definition
even if RID_ASM token is only seen after sequence of standard
attributes.
(cp_parser_asm_definition): Parse standard attributes before
RID_ASM token and warn for them with -Wattributes.
* g++.dg/DRs/dr2262.C: New test.
* g++.dg/cpp0x/gen-attrs-76.C (foo, bar): Don't expect errors
on attributes on asm definitions.
* g++.dg/gomp/attrs-11.C: Remove 2 expected errors.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (21 preceding siblings ...)
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
23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-05 17:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
DR now implemented for GCC 12 (but gnu::no_reorder support for namespace scope
asms would be more work; I think we don't reorder toplevel asms anyway).
^ permalink raw reply [flat|nested] 25+ messages in thread
* [Bug c++/110734] Attributes cannot be applied to asm declaration
2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com
` (22 preceding siblings ...)
2023-12-05 17:03 ` jakub at gcc dot gnu.org
@ 2023-12-05 17:04 ` jakub at gcc dot gnu.org
23 siblings, 0 replies; 25+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-05 17:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |14.0
--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 25+ messages in thread