public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/68548] bogus "may be used uninitialized" (predicate analysis)
       [not found] <bug-68548-4@http.gcc.gnu.org/bugzilla/>
@ 2021-03-31 20:37 ` msebor at gcc dot gnu.org
  2024-03-16 23:48 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-31 20:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|4.9.3, 5.2.0                |10.2.0, 11.0, 4.9.4, 5.5.0,
                   |                            |6.4.0, 7.2.0, 8.3.0, 9.1.0

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirmed with GCC 11.  It's not a regression.  With a patch I'm working with
GCC issues the following warning and notes confirming the analysis from comment
#1 and #2.

pr68548.c: In function ‘foo’:
pr68548.c:14:17: warning: ‘data0’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
   14 |                 bar(data0);
      |                 ^~~~~~~~~~
pr68548.c:7:18: note: when ‘(writemask & 1) == 0’
    7 |         unsigned data0;
      |                  ^~~~~
pr68548.c:7:18: note: used when ‘(writemask & 1) == 0’
pr68548.c:7:18: note: ‘data0’ was declared here

EVRP knows to fold the test for data0 != data to false but nothing substitutes
data for data0 when the value is passed to another function or returned.  So
the following, for instance, doesn't trigger a warning because the data0 - data
subtraction is folded into zero.

int x;

void baz (unsigned writemask, unsigned data) {
    unsigned remaining = X;
    unsigned data0;

    if (writemask & X) data0 = data;

    remaining &= ~writemask;
    if (remaining == 0)
      x = data0 - data;
}

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

* [Bug tree-optimization/68548] bogus "may be used uninitialized" (predicate analysis)
       [not found] <bug-68548-4@http.gcc.gnu.org/bugzilla/>
  2021-03-31 20:37 ` [Bug tree-optimization/68548] bogus "may be used uninitialized" (predicate analysis) msebor at gcc dot gnu.org
@ 2024-03-16 23:48 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-16 23:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           Keywords|                            |missed-optimization
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the trunk. A jump threading improvement fixed it.

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

end of thread, other threads:[~2024-03-16 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-68548-4@http.gcc.gnu.org/bugzilla/>
2021-03-31 20:37 ` [Bug tree-optimization/68548] bogus "may be used uninitialized" (predicate analysis) msebor at gcc dot gnu.org
2024-03-16 23:48 ` 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).