From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23964 invoked by alias); 2 Jun 2012 09:48:32 -0000 Received: (qmail 23955 invoked by uid 22791); 2 Jun 2012 09:48:31 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 02 Jun 2012 09:48:09 +0000 From: "nnk at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53562] New: Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk Date: Sat, 02 Jun 2012 09:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: nnk at google dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: 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: 2012-06/txt/msg00097.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53562 Bug #: 53562 Summary: Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: nnk@google.com When compiling with -D_FORTIFY_SOURCE=1, its possible for gcc to detect, at compile time, certain buffer overflows. This behavior is documented on the gcc online documentation at http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html Currently, the only way to turn these compile warnings into errors is to enable -Werror. Unfortunately, -Werror turns EVERY warning into an error, catching unrelated warnings. Can you please add a -Werror= option to error out on compile time buffer overflow problems? Perhaps -Werror=array-bounds could be reused for this? These error messages are generated in gcc/builtins.c (expand_builtin_memory_chk is one such function).