public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101584] New: missing -Wuninitialized with an allocated object after a built-in call
@ 2021-07-22 21:35 msebor at gcc dot gnu.org
  2021-07-22 23:06 ` [Bug tree-optimization/101584] " msebor at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-22 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101584
           Summary: missing -Wuninitialized with an allocated object after
                    a built-in call
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The puts() calls below should be diagnosed by -Wuninitialized but aren't
because the alias analysis the warning relies on determines that the argument
and the result returned by malloc() or the VLA might alias each other.

$ cat a.c && gcc -O2 -S -Wall /build/tmp/a.c
void f  (const char *s)
{ 
  char *p = __builtin_malloc (__builtin_strlen (s));

  __builtin_printf ("%s", s);

  __builtin_puts (p);   // missing -Wununitialized
}


void g  (const char *s)
{
  char a[__builtin_strlen (s)];

  __builtin_printf ("%s", s);

  __builtin_puts (a);   // missing -Wununitialized
}

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

* [Bug tree-optimization/101584] missing -Wuninitialized with an allocated object after a built-in call
  2021-07-22 21:35 [Bug tree-optimization/101584] New: missing -Wuninitialized with an allocated object after a built-in call msebor at gcc dot gnu.org
@ 2021-07-22 23:06 ` msebor at gcc dot gnu.org
  2021-07-27 22:05 ` cvs-commit at gcc dot gnu.org
  2021-07-27 22:05 ` msebor at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-22 23:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
           Keywords|                            |patch
   Last reconfirmed|                            |2021-07-22

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

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

* [Bug tree-optimization/101584] missing -Wuninitialized with an allocated object after a built-in call
  2021-07-22 21:35 [Bug tree-optimization/101584] New: missing -Wuninitialized with an allocated object after a built-in call msebor at gcc dot gnu.org
  2021-07-22 23:06 ` [Bug tree-optimization/101584] " msebor at gcc dot gnu.org
@ 2021-07-27 22:05 ` cvs-commit at gcc dot gnu.org
  2021-07-27 22:05 ` msebor at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-27 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:6aacd901b800ee8a2a03123669b299a08aad0504

commit r12-2544-g6aacd901b800ee8a2a03123669b299a08aad0504
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jul 27 16:02:54 2021 -0600

    Let -Wuninitialized assume built-ins don't change const arguments
[PR101584].

    PR tree-optimization/101584 - missing -Wuninitialized with an allocated
object after a built-in call

    gcc/ChangeLog:

            PR tree-optimization/101584
            * tree-ssa-uninit.c (builtin_call_nomodifying_p): New function.
            (check_defs): Call it.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/101584
            * gcc.dg/uninit-38.c: Remove assertions.
            * gcc.dg/uninit-41.c: New test.

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

* [Bug tree-optimization/101584] missing -Wuninitialized with an allocated object after a built-in call
  2021-07-22 21:35 [Bug tree-optimization/101584] New: missing -Wuninitialized with an allocated object after a built-in call msebor at gcc dot gnu.org
  2021-07-22 23:06 ` [Bug tree-optimization/101584] " msebor at gcc dot gnu.org
  2021-07-27 22:05 ` cvs-commit at gcc dot gnu.org
@ 2021-07-27 22:05 ` msebor at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-07-27 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.0
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Done for GCC 12.

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

end of thread, other threads:[~2021-07-27 22:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 21:35 [Bug tree-optimization/101584] New: missing -Wuninitialized with an allocated object after a built-in call msebor at gcc dot gnu.org
2021-07-22 23:06 ` [Bug tree-optimization/101584] " msebor at gcc dot gnu.org
2021-07-27 22:05 ` cvs-commit at gcc dot gnu.org
2021-07-27 22:05 ` 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).