public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/93432] variable is used uninitialized, but gcc shows no warning
       [not found] <bug-93432-4@http.gcc.gnu.org/bugzilla/>
@ 2020-06-08 10:21 ` manu at gcc dot gnu.org
  2020-07-13 12:10 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2020-06-08 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
It warns in gcc 10.1. It may good idea to add this one as a testcase, since it
seems it got fixed without noticing.

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

* [Bug c/93432] variable is used uninitialized, but gcc shows no warning
       [not found] <bug-93432-4@http.gcc.gnu.org/bugzilla/>
  2020-06-08 10:21 ` [Bug c/93432] variable is used uninitialized, but gcc shows no warning manu at gcc dot gnu.org
@ 2020-07-13 12:10 ` manu at gcc dot gnu.org
  2022-02-25 15:45 ` vincent-gcc at vinc17 dot net
  2022-08-31 13:44 ` [Bug tree-optimization/93432] " rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2020-07-13 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |easyhack

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
This just needs a testcase to prevent regressing...

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

* [Bug c/93432] variable is used uninitialized, but gcc shows no warning
       [not found] <bug-93432-4@http.gcc.gnu.org/bugzilla/>
  2020-06-08 10:21 ` [Bug c/93432] variable is used uninitialized, but gcc shows no warning manu at gcc dot gnu.org
  2020-07-13 12:10 ` manu at gcc dot gnu.org
@ 2022-02-25 15:45 ` vincent-gcc at vinc17 dot net
  2022-08-31 13:44 ` [Bug tree-optimization/93432] " rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2022-02-25 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent-gcc at vinc17 dot net

--- Comment #6 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Manuel López-Ibáñez from comment #4)
> It warns in gcc 10.1. It may good idea to add this one as a testcase, since
> it seems it got fixed without noticing.

Has this really been fixed, or does it work now just by chance?

This looks like PR18501, where the concerned variable is initialized only at
one place in the loop. Here, "z = 1" is followed by "z=z+1", so that this is
equivalent to "z = 2". But if in the code, I do this change, the warning
disappears (tested with gcc-12 (Debian 12-20220222-1) 12.0.1 20220222
(experimental) [master r12-7325-g2f59f067610] and -O1, -O2, -O3).

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

* [Bug tree-optimization/93432] variable is used uninitialized, but gcc shows no warning
       [not found] <bug-93432-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-02-25 15:45 ` vincent-gcc at vinc17 dot net
@ 2022-08-31 13:44 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-31 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |tree-optimization
           Keywords|easyhack                    |

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
It works by chance when optimizing but not optimizing too much.  -O3 unrolls
the loop and runs into CCP aka PR18501, we get

  <bb 2> [local count: 97603129]:
  if (y_5(D) <= 9)
    goto <bb 18>; [33.00%]
  else
    goto <bb 19>; [67.00%]

  <bb 18> [local count: 32209032]:
  _11 = z_6(D) + 1;

  <bb 19> [local count: 97603129]:
  # prephitmp_17 = PHI <2(2), _11(18)>

and CCP says _11 is UNDEFINED and merges it with 2 to 2.  For me even GCC 9.3.1
warns, so does GCC 7.5, both even with -O3.

We do not warn at -O0 but that's by design - we think doing the predicate based
uninit analysis early (on the unoptimized IL) would be too noisy.

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

end of thread, other threads:[~2022-08-31 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93432-4@http.gcc.gnu.org/bugzilla/>
2020-06-08 10:21 ` [Bug c/93432] variable is used uninitialized, but gcc shows no warning manu at gcc dot gnu.org
2020-07-13 12:10 ` manu at gcc dot gnu.org
2022-02-25 15:45 ` vincent-gcc at vinc17 dot net
2022-08-31 13:44 ` [Bug tree-optimization/93432] " rguenth 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).