From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F3030385BF81; Wed, 23 Feb 2022 11:04:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3030385BF81 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/104633] [12 Regression] -Winfinite-recursion diagnoses fortify wrappers Date: Wed, 23 Feb 2022 11:04:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: Wed, 23 Feb 2022 11:04:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104633 --- Comment #6 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:c8cb5098c7854a1ed07e85c6165ef0c348d6df1d commit r12-7358-gc8cb5098c7854a1ed07e85c6165ef0c348d6df1d Author: Jakub Jelinek Date: Wed Feb 23 12:03:55 2022 +0100 warn-recursion: Don't warn for __builtin_calls in gnu_inline extern inl= ine functions [PR104633] The first two testcases show different ways how e.g. the glibc _FORTIFY_SOURCE wrappers are implemented, and on Winfinite-recursion-3.c the new -Winfinite-recursion warning emits a false positive warning. It is a false positive because when a builtin with 2 names is called through the __builtin_ name (but not all builtins have a name prefixed exactly like that) from extern inline function with gnu_inline semantic= s, it doesn't mean the compiler will ever attempt to use the user inline wrapper for the call, the __builtin_ just does what the builtin function is expected to do and either expands into some compiler generated code, or if the compiler decides to emit a call it will use an actual definit= ion of the function, but that is not the extern inline gnu_inline function which is never emitted out of line. Compared to that, in Winfinite-recursion-5.c the extern inline gnu_inli= ne wrapper calls the builtin by the same name as the function's name and in that case it is infinite recursion, we actuall try to inline the recurs= ive call and also error because the recursion is infinite during inlining; without always_inline we wouldn't error but it is still infinite recurs= ion, the user has no control on how many recursive calls we actually inline. 2022-02-22 Jakub Jelinek PR c/104633 * gimple-warn-recursion.cc (pass_warn_recursion::find_function_exit): Don't warn about calls to corresponding builtin from extern inl= ine gnu_inline wrappers. * gcc.dg/Winfinite-recursion-3.c: New test. * gcc.dg/Winfinite-recursion-4.c: New test. * gcc.dg/Winfinite-recursion-5.c: New test.=