public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/101300] New: -fsanitize=undefined suppresses -Wuninitialized
@ 2021-07-02 14:57 llvm at rifkin dot dev
  2021-07-02 16:57 ` [Bug middle-end/101300] " msebor at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: llvm at rifkin dot dev @ 2021-07-02 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101300
           Summary: -fsanitize=undefined suppresses -Wuninitialized
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: llvm at rifkin dot dev
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

The following code should produce a Wuninitialized warning.

int foo() {
    int n = 4;
    char b[n];
    return b[2];
}

The compiler identifies the uninitialized access when compiled -Wall however it
does not when compiled with -Wall -fsanitize=undefined.

It does warn properly when compiled with -Wall -fsanitize=undefined -O1 (or any
optimization flag other than -O0).

https://godbolt.org/z/4rrKK5MYj

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

* [Bug middle-end/101300] -fsanitize=undefined suppresses -Wuninitialized
  2021-07-02 14:57 [Bug sanitizer/101300] New: -fsanitize=undefined suppresses -Wuninitialized llvm at rifkin dot dev
@ 2021-07-02 16:57 ` msebor at gcc dot gnu.org
  2021-07-02 19:25 ` msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-02 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-07-02
             Blocks|                            |24639
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
          Component|sanitizer                   |middle-end

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  The sanitization interferes with the logic at -O0.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues

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

* [Bug middle-end/101300] -fsanitize=undefined suppresses -Wuninitialized
  2021-07-02 14:57 [Bug sanitizer/101300] New: -fsanitize=undefined suppresses -Wuninitialized llvm at rifkin dot dev
  2021-07-02 16:57 ` [Bug middle-end/101300] " msebor at gcc dot gnu.org
@ 2021-07-02 19:25 ` msebor at gcc dot gnu.org
  2021-07-20 19:10 ` cvs-commit at gcc dot gnu.org
  2021-07-20 19:11 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-02 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
   Target Milestone|---                         |12.0
           Keywords|                            |patch
             Status|NEW                         |ASSIGNED
      Known to fail|                            |10.3.0, 11.1.0, 12.0, 9.3.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574385.html

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

* [Bug middle-end/101300] -fsanitize=undefined suppresses -Wuninitialized
  2021-07-02 14:57 [Bug sanitizer/101300] New: -fsanitize=undefined suppresses -Wuninitialized llvm at rifkin dot dev
  2021-07-02 16:57 ` [Bug middle-end/101300] " msebor at gcc dot gnu.org
  2021-07-02 19:25 ` msebor at gcc dot gnu.org
@ 2021-07-20 19:10 ` cvs-commit at gcc dot gnu.org
  2021-07-20 19:11 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-20 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:e07d30fdcaec4906e0dcb948fc4748bf74c15c05

commit r12-2420-ge07d30fdcaec4906e0dcb948fc4748bf74c15c05
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jul 20 13:08:39 2021 -0600

    Handle all UBSAN built-ins in -Wuninitialized [PR101300].

    Resolves:
    PR middle-end/101300 - -fsanitize=undefined suppresses -Wuninitialized for
a VLA read at -O0

    gcc/ChangeLog:
            PR middle-end/101300
            * tree-ssa-uninit.c (check_defs): Handle UBSAN built-ins.

    gcc/testsuite/ChangeLog:
            PR middle-end/101300
            * gcc.dg/uninit-pr101300.c: New test.

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

* [Bug middle-end/101300] -fsanitize=undefined suppresses -Wuninitialized
  2021-07-02 14:57 [Bug sanitizer/101300] New: -fsanitize=undefined suppresses -Wuninitialized llvm at rifkin dot dev
                   ` (2 preceding siblings ...)
  2021-07-20 19:10 ` cvs-commit at gcc dot gnu.org
@ 2021-07-20 19:11 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-20 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
      Known to fail|12.0                        |
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Done for GCC 12 in r12-2420.

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

end of thread, other threads:[~2021-07-20 19:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 14:57 [Bug sanitizer/101300] New: -fsanitize=undefined suppresses -Wuninitialized llvm at rifkin dot dev
2021-07-02 16:57 ` [Bug middle-end/101300] " msebor at gcc dot gnu.org
2021-07-02 19:25 ` msebor at gcc dot gnu.org
2021-07-20 19:10 ` cvs-commit at gcc dot gnu.org
2021-07-20 19:11 ` msebor 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).