public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions
       [not found] <bug-90994-4@http.gcc.gnu.org/bugzilla/>
@ 2021-04-07 18:42 ` msebor at gcc dot gnu.org
  2022-08-30 13:19 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-04-07 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-04-07
      Known to fail|                            |10.2.0, 11.0, 9.2.0
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  The warning sees the IL below.  The reason for the false positive
is the assignment in bb 5 marked not handled.  The warning walks up the control
flow graph from the point of the possibly uninitialized use to the definition
of the a_33 variable (a PHI), looking for predicates that guard it to try to
determine if they are mutually exclusive with those guarding the uninitialized
operand to the PHI.  It recongnizes conditional expressions and switch
statements but nothing else (such the assignment here).  As a result, the logic
fails to detect that the conditionals prevent the uninitialized variable from
being used.

int incorrectWarning ()
{
  int D.2387;
  int D.2383;
  unsigned char b;
  unsigned char a;
  int _3;
  int _5;
  int _6;
  bool prephitmp_10;
  unsigned char _17;
  int _18;
  void * _19;
  unsigned char _20;
  void * _22;

  <bb 2> [local count: 1073741824]:
  # VUSE <.MEM_8(D)>
  _17 ={v} MEM[(volatile unsigned char *)1234B];

  <bb 9> [local count: 1073741824]:

  <bb 3> [local count: 1073741824]:
  # _18 = PHI <0(9), -1(4)>                        <<< _18 != 0 in bb 4
  # .MEM_23 = PHI <.MEM_8(D)(9), .MEM_26(4)>
  # a_33 = PHI <_17(9), a_35(D)(4)>                <<< a_33 uninitialized if
_18 != 0
  # prephitmp_10 = PHI <0(9), 1(4)>
  __asm__ __volatile__("




" :  : "X" prephitmp_10);
  if (_18 != 0)
    goto <bb 10>; [51.12%]
  else
    goto <bb 5>; [48.88%]                          <<< _18 == 0 implies a_33 =
_17(9)

  <bb 10> [local count: 548896824]:
  goto <bb 8>; [100.00%]

  <bb 4> [count: 0]:
<L8>:
  # VUSE <.MEM_8(D)>
  _19 = __builtin_eh_pointer (3);
  # .MEM_25 = VDEF <.MEM_8(D)>
  __cxa_begin_catch (_19);
  # .MEM_26 = VDEF <.MEM_25>
  __cxa_end_catch ();
  goto <bb 3>; [0.00%]

  <bb 5> [local count: 524845000]:
  # VUSE <.MEM_23>
  _20 ={v} MEM[(volatile unsigned char *)1234B];   <<< not handled

  <bb 6> [local count: 524845000]:
  _3 = (int) a_33;                                 <<< -Wmaybe-uninitialized
  # .MEM_13 = VDEF <.MEM_23>
  printval (_3);
  _5 = (int) _20;
  # .MEM_14 = VDEF <.MEM_13>
  printval (_5);
  goto <bb 8>; [100.00%]

  <bb 7> [count: 0]:
<L10>:
  # VUSE <.MEM_23>
  _22 = __builtin_eh_pointer (4);
  # .MEM_29 = VDEF <.MEM_23>
  __cxa_begin_catch (_22);
  # .MEM_30 = VDEF <.MEM_29>
  __cxa_end_catch ();

  <bb 8> [local count: 1073741824]:
  # _6 = PHI <0(6), 1(7), 1(10)>
  # .MEM_7 = PHI <.MEM_14(6), .MEM_30(7), .MEM_23(10)>
  # VUSE <.MEM_7>
  return _6;

}

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

* [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions
       [not found] <bug-90994-4@http.gcc.gnu.org/bugzilla/>
  2021-04-07 18:42 ` [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions msebor at gcc dot gnu.org
@ 2022-08-30 13:19 ` rguenth at gcc dot gnu.org
  2022-08-31 12:11 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-30 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Interestingly the factoring into gimple-predicate-analysis.cc,
r12-3640-g94c12ffac234b2 contains

-         else
-           {
-             has_valid_pred = false;
-             break;
-           }
+         else
+           {
+             /* Disabled.  See PR 90994.
+                has_valid_pred = false;  */
+             break;
+           }

in all the noise, without explanation or testcase.

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

* [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions
       [not found] <bug-90994-4@http.gcc.gnu.org/bugzilla/>
  2021-04-07 18:42 ` [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions msebor at gcc dot gnu.org
  2022-08-30 13:19 ` rguenth at gcc dot gnu.org
@ 2022-08-31 12:11 ` rguenth at gcc dot gnu.org
  2022-08-31 13:20 ` cvs-commit at gcc dot gnu.org
  2022-08-31 13:23 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-31 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm testing a real fix.

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

* [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions
       [not found] <bug-90994-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-08-31 12:11 ` rguenth at gcc dot gnu.org
@ 2022-08-31 13:20 ` cvs-commit at gcc dot gnu.org
  2022-08-31 13:23 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-31 13:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:88f29a8aa82f2788baf2f9865940d4c83012c580

commit r13-2310-g88f29a8aa82f2788baf2f9865940d4c83012c580
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Aug 31 14:04:46 2022 +0200

    tree-optimization/90994 - fix uninit diagnostics with EH

    r12-3640-g94c12ffac234b2 sneaked in a hack to avoid the diagnostic
    for the testcase in PR90994 which sees non-call EH control flow
    confusing predicate analysis.  The following patch instead adjusts
    the existing code handling EH to handle non-calls and do what I
    think was intented.

            PR tree-optimization/90994
            * gimple-predicate-analysis.cc (predicate::init_from_control_deps):
            Ignore exceptional control flow and skip the edge for the purpose
of
            predicate generation also for non-calls.

            * g++.dg/torture/pr90994.C: New testcase.

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

* [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions
       [not found] <bug-90994-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-08-31 13:20 ` cvs-commit at gcc dot gnu.org
@ 2022-08-31 13:23 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-31 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |13.0
         Resolution|---                         |FIXED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed properly for GCC 13, hacked around for GCC 12.

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90994-4@http.gcc.gnu.org/bugzilla/>
2021-04-07 18:42 ` [Bug tree-optimization/90994] Bogus Wmaybe-uninitialized with fnon-call-exceptions msebor at gcc dot gnu.org
2022-08-30 13:19 ` rguenth at gcc dot gnu.org
2022-08-31 12:11 ` rguenth at gcc dot gnu.org
2022-08-31 13:20 ` cvs-commit at gcc dot gnu.org
2022-08-31 13:23 ` 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).