From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14099 invoked by alias); 6 Feb 2013 13:47:02 -0000 Received: (qmail 12397 invoked by uid 48); 6 Feb 2013 13:46:09 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/54582] gap in FORTIFY checking of buffer lengths Date: Wed, 06 Feb 2013 13:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg00533.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54582 --- Comment #9 from Jakub Jelinek 2013-02-06 13:46:05 UTC --- 1) this is -D_FORTIFY_SOURCE warning, you can invent other warnings elsewhere 2) with -D_FORTIFY_SOURCE, e.g. sprintf is an inline function, so the FE sees it as a call to an inline function with some argument, you need to inline it, figure out what the inline does, then fold the builtins used in the inline. Also consider char buf[2]; char *p; p = buf; sprintf(buf, "ab%d", n); Unless you move the optimization passes into the FE, you aren't going to warn about this properly in the FE. Insisting on a FE warning in this case is just dumb.