From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 71AB03945C06; Tue, 13 Apr 2021 18:47:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71AB03945C06 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/100068] New: inconsistent handling of noreturn on nested function declarations Date: Tue, 13 Apr 2021 18:47:12 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.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 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2021 18:47:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100068 Bug ID: 100068 Summary: inconsistent handling of noreturn on nested function declarations Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- For the test case below, in f1() GCC (in both C and C++ modes) emits just o= ne call to g1() while Clang, ICC emit two. Visual C gives an error for the noreturn mismatch between the two declarations of g1(). In f0(), all compilers emit just one call to g0() (Visual C with optimizati= on; without optimization it warns about the second call to g0() being unreachab= le). $ cat a.c && gcc -O -S -Wall -fdump-tree-optimized=3D/dev/stdout a.c void f0 (void) { extern __attribute__ ((noreturn)) int g0 (void); { extern int g0 (void); } g0 (); g0 (); // eliminated by all tested compilers } void f1 (void) {=20 extern int g1 (void); { extern __attribute__ ((noreturn)) int g1 (void); } g1 (); g1 (); // eliminated by GCC, emitted by Clang and ICC }=20 ;; Function f0 (f0, funcdef_no=3D0, decl_uid=3D1943, cgraph_uid=3D1, symbol= _order=3D0) (executed once) void f0 () { [local count: 1073741824]: g0 (); } ;; Function f1 (f1, funcdef_no=3D1, decl_uid=3D1952, cgraph_uid=3D2, symbol= _order=3D1) (executed once) void f1 () { [local count: 1073741824]: g1 (); }=