From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1353C3856DCA; Wed, 19 Jul 2023 07:46:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1353C3856DCA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689752760; bh=V65SNG+tBwUMvlVwbxnpTT6hKaC6B59XpxWoJDmFaKw=; h=From:To:Subject:Date:From; b=hFUi7LEsu4kCCSUGHrquyQRl+mCG9tslj/yqb/FIi0k9jtj6ln+B/vgfd/zBBdmw3 DxYjJ4d0zYKQ26RUR+V/vpt5SV4rm4Ipig+M+jVFiM+fywfBiLI4SsFgRt7gWgWBt1 AN65P15h0jjYsycKG34XrRsIcCiAm8ftwahn6llg= From: "tanksherman27 at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tanksherman27 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110734 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.=