public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53562] New: Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk
@ 2012-06-02  9:48 nnk at google dot com
  2012-06-02 10:25 ` [Bug c/53562] " manu at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nnk at google dot com @ 2012-06-02  9:48 UTC (permalink / raw)
  To: gcc-bugs

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).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/53562] Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk
  2012-06-02  9:48 [Bug c/53562] New: Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk nnk at google dot com
@ 2012-06-02 10:25 ` manu at gcc dot gnu.org
  2014-08-21  0:09 ` manu at gcc dot gnu.org
  2022-11-28 22:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2012-06-02 10:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53562

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-06-02 10:25:01 UTC ---
Untested patch:

Index: builtins.c
===================================================================
--- builtins.c  (revision 187627)
+++ builtins.c  (working copy)
@@ -12527,8 +12527,8 @@

       if (! integer_all_onesp (size) && tree_int_cst_lt (size, len))
        {
-         warning_at (tree_nonartificial_location (exp),
-                     0, "%Kcall to %D will always overflow destination
buffer",
+         warning_at (tree_nonartificial_location (exp), OPT_Wfortify_source, 
+                      "%Kcall to %D will always overflow destination buffer",
                      exp, get_callee_fndecl (exp));
          return NULL_RTX;
        }
Index: common.opt
===================================================================
--- common.opt  (revision 187627)
+++ common.opt  (working copy)
@@ -539,6 +539,10 @@
 Common Var(flag_fatal_errors)
 Exit on the first error occurred

+Wfortify-source
+Common Var(warn_fortify_source) Init(1) Warning
+Warnings produced by FORTIFY_SOURCE
+
 Wframe-larger-than=


You will also need to add something to doc/invoke.texi, Changelog,
bootstrap+test and submit to gcc-patches.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/53562] Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk
  2012-06-02  9:48 [Bug c/53562] New: Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk nnk at google dot com
  2012-06-02 10:25 ` [Bug c/53562] " manu at gcc dot gnu.org
@ 2014-08-21  0:09 ` manu at gcc dot gnu.org
  2022-11-28 22:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2014-08-21  0:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53562

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-08-21
                 CC|                            |davidxl at gcc dot gnu.org,
                   |                            |dnovillo at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I think we want this. It would be nice if the Google guys took care of it. ;-)
>From gcc-bugs-return-458925-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 21 00:28:07 2014
Return-Path: <gcc-bugs-return-458925-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26047 invoked by alias); 21 Aug 2014 00:28:07 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 25976 invoked by uid 55); 21 Aug 2014 00:28:02 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/44054] Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color
Date: Thu, 21 Aug 2014 00:28:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.6.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu 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-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-44054-4-xySNwvZr3R@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-44054-4@http.gcc.gnu.org/bugzilla/>
References: <bug-44054-4@http.gcc.gnu.org/bugzilla/>
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-SW-Source: 2014-08/txt/msg01422.txt.bz2
Content-length: 1018

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44054

--- Comment #15 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Author: manu
Date: Thu Aug 21 00:27:25 2014
New Revision: 214251

URL: https://gcc.gnu.org/viewcvs?rev=214251&root=gcc&view=rev
Log:
gcc/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR fortran/44054
    * diagnostic.c: Set default caret.
    (diagnostic_show_locus): Use it. Tell pretty-printer that a new
    line is needed.
    * diagnostic.h (struct diagnostic_context):


gcc/fortran/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR fortran/44054
    * error.c (gfc_diagnostic_build_locus_prefix): New function.
    (gfc_diagnostic_starter): Follow Fortran FE diagnostics.
    (gfc_diagnostic_finalizer): Do not call default finalizer.



Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/diagnostic.c
    trunk/gcc/diagnostic.h
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/error.c
>From gcc-bugs-return-458926-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 21 01:04:49 2014
Return-Path: <gcc-bugs-return-458926-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13711 invoked by alias); 21 Aug 2014 01:04:48 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13669 invoked by uid 48); 21 Aug 2014 01:04:42 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/62185] New warning for "defined as a struct here but previously declared as a class" / [-Wmismatched-tags]
Date: Thu, 21 Aug 2014 01:04:00 -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: 5.0
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
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: cc
Message-ID: <bug-62185-4-Z9yIQzfSdW@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62185-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62185-4@http.gcc.gnu.org/bugzilla/>
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-SW-Source: 2014-08/txt/msg01423.txt.bz2
Content-length: 602

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62185

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
As said in PR61339, it would be nice to add this to the list of non-bugs.
Meanwhile, I added a FAQ to the wiki:
https://gcc.gnu.org/wiki/FAQ#Wmismatched-tags

Feel free to improve it!
>From gcc-bugs-return-458927-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 21 01:05:08 2014
Return-Path: <gcc-bugs-return-458927-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14553 invoked by alias); 21 Aug 2014 01:05:07 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 14500 invoked by uid 48); 21 Aug 2014 01:05:02 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61339] add mismatch between struct and class to non-bugs
Date: Thu, 21 Aug 2014 01:05:00 -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: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: manu 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-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61339-4-4DiucxGzXK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61339-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61339-4@http.gcc.gnu.org/bugzilla/>
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-SW-Source: 2014-08/txt/msg01424.txt.bz2
Content-length: 252

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61339

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Meanwhile, I added a FAQ to the wiki:
https://gcc.gnu.org/wiki/FAQ#Wmismatched-tags

Feel free to improve it !
>From gcc-bugs-return-458928-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 21 01:08:59 2014
Return-Path: <gcc-bugs-return-458928-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17804 invoked by alias); 21 Aug 2014 01:08:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 17735 invoked by uid 48); 21 Aug 2014 01:08:55 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61339] add mismatch between struct and class to non-bugs
Date: Thu, 21 Aug 2014 01:08:00 -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: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: pinskia 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-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-61339-4-jE8LS5jGil@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61339-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61339-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg01425.txt.bz2
Content-length: 443

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida339

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 62185 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/53562] Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk
  2012-06-02  9:48 [Bug c/53562] New: Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk nnk at google dot com
  2012-06-02 10:25 ` [Bug c/53562] " manu at gcc dot gnu.org
  2014-08-21  0:09 ` manu at gcc dot gnu.org
@ 2022-11-28 22:16 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53562

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |7.0
           Keywords|                            |diagnostic

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-28 22:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-02  9:48 [Bug c/53562] New: Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk nnk at google dot com
2012-06-02 10:25 ` [Bug c/53562] " manu at gcc dot gnu.org
2014-08-21  0:09 ` manu at gcc dot gnu.org
2022-11-28 22:16 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).