From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5E3CA3858D33; Wed, 15 Feb 2023 03:07:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E3CA3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676430455; bh=FSmwBf857QqgE7EF2/JKPn7RGiGrLglYhxckahGZLiA=; h=From:To:Subject:Date:From; b=SxKsdb4R7dkLym1ya8WUCa/G1CZvCuAAPtoPfqeY9/YPrTnS2xcnAHMsiai5GP7L9 eyaOhjSsF6O0RAmlnojCCjTNkJu9/P8Q/f9WyfMtAJCrqxC+rNu2kAtLsvcdjFrtTt vZzKNxZUyR70sumr5hUXsT2XrYETNwCgggbQ3n60= From: "sam at gentoo dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sam at gentoo dot org 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 attachments.created 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=3D108796 Bug ID: 108796 Summary: GCC 13 accepts [[noreturn]] attribute without -std=3Dc2x 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=3D54462&action=3Dedit 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/e707ffe58b3ccfe5c72f54c38eac1d7= 069d5021e. Clang 16.0.0_rc2 does not accept it unless passing -std=3Dc2x. Is this intentional or not? Thanks. foo.c: ``` #include [[noreturn]] void foo(void) { abort(); } int main() { foo(); } ``` ``` $ gcc-13 --version gcc-13 (Gentoo Hardened 13.0.1_pre20230212 p8) 13.0.1 20230212 (experimenta= l) 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=3Dc2x -O2 /tmp/foo.c # fine $ gcc-13 -std=3Dc99 -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=3Dc2x -O2 /tmp/foo.c -o /tmp/foo # fine ```=