public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sam at gentoo dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108796] New: GCC 13 accepts [[noreturn]] attribute without -std=c2x Date: Wed, 15 Feb 2023 03:07:33 +0000 [thread overview] Message-ID: <bug-108796-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796 Bug ID: 108796 Summary: GCC 13 accepts [[noreturn]] attribute without -std=c2x Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sam at gentoo dot org Target Milestone: --- Created attachment 54462 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54462&action=edit foo.i GCC 13 (13.0.1 20230212) seems to accept [[noreturn]] as an attribute even when not in C2x mode. This leads to a build failure with sudo-1.9.13 (https://github.com/sudo-project/sudo/issues/239) since https://github.com/sudo-project/sudo/commit/e707ffe58b3ccfe5c72f54c38eac1d7069d5021e. Clang 16.0.0_rc2 does not accept it unless passing -std=c2x. Is this intentional or not? Thanks. foo.c: ``` #include <stdlib.h> [[noreturn]] void foo(void) { abort(); } int main() { foo(); } ``` ``` $ gcc-13 --version gcc-13 (Gentoo Hardened 13.0.1_pre20230212 p8) 13.0.1 20230212 (experimental) Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc-13 -std=c2x -O2 /tmp/foo.c # fine $ gcc-13 -std=c99 -O2 /tmp/foo.c # fine $ gcc-13 -O2 /tmp/foo.c -o /tmp/foo # fine $ clang-16 --version clang version 16.0.0 # actually 16.0.0_rc2 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/16/bin Configuration file: /etc/clang/clang.cfg $ clang-16 -O2 /tmp/foo.c -o /tmp/foo /tmp/foo.c:3:2: error: expected expression [[noreturn]] void foo(void) { ^ /tmp/foo.c:3:14: error: expected identifier or '(' [[noreturn]] void foo(void) { ^ /tmp/foo.c:8:2: error: call to undeclared function 'foo'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] foo(); ^ 3 errors generated. $ clang-16 -std=c2x -O2 /tmp/foo.c -o /tmp/foo # fine ```
next reply other threads:[~2023-02-15 3:07 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-15 3:07 sam at gentoo dot org [this message] 2023-02-15 3:10 ` [Bug c/108796] " sam at gentoo dot org 2023-02-15 3:11 ` sam at gentoo dot org 2023-02-15 3:44 ` sam at gentoo dot org 2023-02-15 3:46 ` pinskia at gcc dot gnu.org 2023-02-15 3:47 ` [Bug c/108796] Can't intermix C2x and GNU style attributes pinskia at gcc dot gnu.org 2023-02-15 21:02 ` joseph at codesourcery dot com 2023-02-16 13:14 ` aaron at aaronballman dot com 2023-02-16 19:20 ` joseph at codesourcery dot com 2023-02-16 20:06 ` aaron at aaronballman dot com 2023-02-16 22:34 ` aaron at aaronballman dot com 2024-01-14 10:26 ` pinskia 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-108796-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: linkBe 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).