[Bug tree-optimization/81958] [9/10/11 Regression] spurious -Wmaybe-uninitialized warning in gcc-8, or with -O1

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 2 19:36:52 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|spurious                    |[9/10/11 Regression]
                   |-Wmaybe-uninitialized       |spurious
                   |warning in gcc-8, or with   |-Wmaybe-uninitialized
                   |-O1                         |warning in gcc-8, or with
                   |                            |-O1
      Known to fail|                            |10.2.0, 11.0, 8.3.0, 9.3.0
                 CC|                            |msebor at gcc dot gnu.org
      Known to work|                            |7.3.0
   Last reconfirmed|2017-09-30 00:00:00         |2021-4-2

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirming with GCC 11 as a GCC 8 regression introduced in r249013. It fails
the same with -O1 and -O2.  I think the warning seems to be doing what it's
designed to do.  The IL below annotated with my comments in bb 7 shows that
there is a patch along which the use is uninitialized.

void lpfc_debug_dump_all_queues (unsigned int maxidx)
{
  unsigned long ivtmp.7;
  unsigned int eqidx;
  struct lpfc_queue * eq;
  struct lpfc_queue * cq_phba.0_1;
  struct lpfc_queue * _2;
  int _5;
  unsigned int _23;
  long unsigned int _24;

  <bb 2> [count: 0]:
  # .MEM_12 = VDEF <.MEM_11(D)>
  printk ();
  # VUSE <.MEM_12>
  cq_phba.0_1 = cq_phba;
  goto <bb 4>; [0.00%]

  <bb 3> [count: 0]:
  # VUSE <.MEM_12>
  _2 = cq_phba.0_1->hba_eq;
  _24 = ivtmp.7_25 * 16;
  eq_16 = _2 + _24;
  # VUSE <.MEM_12>
  _5 = eq_16->queue_id;
  ivtmp.7_26 = ivtmp.7_25 + 1;
  if (_5 != 0)
    goto <bb 9>; [0.00%]
  else
    goto <bb 8>; [0.00%]

  <bb 9> [count: 0]:
  goto <bb 7>; [100.00%]

  <bb 8> [count: 0]:

  <bb 4> [count: 0]:
  # eq_7 = PHI <eq_14(D)(2), eq_16(8)>
  # ivtmp.7_25 = PHI <0(2), ivtmp.7_26(8)>
  _23 = (unsigned int) ivtmp.7_25;
  if (maxidx_15(D) > _23)
    goto <bb 3>; [0.00%]
  else
    goto <bb 5>; [0.00%]

  <bb 5> [count: 0]:
  if (maxidx_15(D) == _23)
    goto <bb 6>; [0.00%]
  else
    goto <bb 10>; [0.00%]

  <bb 10> [count: 0]:
  goto <bb 7>; [100.00%]

  <bb 6> [count: 0]:
  # VUSE <.MEM_12>
  eq_18 = cq_phba.0_1->hba_eq;

  <bb 7> [count: 0]:
  ## eq_7(10) = PHI <eq_14(D)(2), eq_16(8)>
  ## eq_7(10) = eq_14(D)(2) (unconditional: 2 -> 4)
  ## eq_9 = eq_7 = eq_14(D)(2)
  ##   if (maxidx_15(D) <= _23 && maxidx_15(D) != _23: 4 -> 5, 5 -> 10, 10 ->
7)
  # eq_9 = PHI <eq_7(10), eq_18(6), eq_16(9)>
  # .MEM_19 = VDEF <.MEM_12>
  printk (eq_9); [tail call]
  # VUSE <.MEM_19>
  return;

}

Before r249013 there is no uninitialized read from eq in the IL:

; Function lpfc_debug_dump_all_queues (lpfc_debug_dump_all_queues,
funcdef_no=0, decl_uid=1800, cgraph_uid=0, symbol_order=1)

lpfc_debug_dump_all_queues (unsigned int maxidx)
{
  unsigned int eqidx;
  struct lpfc_queue * eq;
  struct lpfc_queue * prephitmp_1;
  unsigned long _2;
  int _5;
  struct lpfc_queue * _20;
  int _22;
  struct lpfc_queue * pretmp_23;
  struct lpfc_queue * pretmp_24;
  struct lpfc_queue * cq_phba.0_25;
  struct lpfc_queue * _26;
  unsigned long _28;

  <bb 2> [14.44%]:
  printk ();
  if (maxidx_15(D) != 0)
    goto <bb 4>; [92.50%]
  else
    goto <bb 3>; [7.50%]

  <bb 3> [1.08%]:
  pretmp_23 = cq_phba;
  pretmp_24 = pretmp_23->hba_eq;
  goto <bb 7>; [100.00%]

  <bb 4> [13.32%]:
  cq_phba.0_25 = cq_phba;
  _26 = cq_phba.0_25->hba_eq;
  _22 = _26->queue_id;
  if (_22 != 0)
    goto <bb 9>; [7.50%]
  else
    goto <bb 10>; [92.50%]

  <bb 10> [12.32%]:
  goto <bb 6>; [100.00%]

  <bb 9> [1.00%]:
  goto <bb 8>; [100.00%]

  <bb 5> [79.18%]:
  _2 = (unsigned long) eq_29;
  _28 = _2 + 16;
  _20 = (struct lpfc_queue *) _28;
  _5 = MEM[base: _20, offset: 0B];
  if (_5 != 0)
    goto <bb 11>; [7.50%]
  else
    goto <bb 12>; [92.50%]

  <bb 11> [5.94%]:
  goto <bb 8>; [100.00%]

  <bb 12> [73.24%]:

  <bb 6> [85.60%]:
  # eqidx_27 = PHI <eqidx_17(12), 0(10)>
  # eq_29 = PHI <_20(12), _26(10)>
  eqidx_17 = eqidx_27 + 1;
  if (maxidx_15(D) != eqidx_17)
    goto <bb 5>; [92.50%]
  else
    goto <bb 13>; [7.50%]

  <bb 13> [6.42%]:

  <bb 7> [5.44%]:
  # prephitmp_1 = PHI <_26(13), pretmp_24(3)>

  <bb 8> [14.44%]:
  # eq_9 = PHI <_26(9), prephitmp_1(7), _20(11)>
  printk (eq_9); [tail call]
  return;

}


More information about the Gcc-bugs mailing list