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

            Bug ID: 101675
           Summary: analyzer/pr94851-2.c marked XFAIL because it fails
                    with new jump threader
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldyh at gcc dot gnu.org
                CC: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

By *.033t.forwprop1, we have the following:

  <bb 4> :
  # p_9 = PHI <p_16(2), p_22(3)>
  # last_11 = PHI <last_17(2), p_9(3)>
  if (p_9 != 0B)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 5> :
  _3 = p_9->m_name;
  _4 = (char) c_20;
  if (_3 != _4)
    goto <bb 3>; [INV]
  else
    goto <bb 6>; [INV]

  <bb 6> :
  if (p_9 != 0B)
    goto <bb 7>; [INV]
  else
    goto <bb 8>; [INV]

  <bb 7> :
  printf ("over writing mark %c\n", c_20);
  goto <bb 13>; [INV]

  <bb 8> :
  p_24 = malloc (16);
  if (p_24 == 0B)
    goto <bb 9>; [INV]
  else
    goto <bb 10>; [INV]

After the jump threader rewrite (commit
2e96b5f14e4025691b57d2301d71aa6092ed44bc), we thread the 4->6->8 path in the
early threader pass:

  Registering FSM jump thread: (4, 6) incoming edge;  (6, 8) nocopy; (6, 8) 

This causes the false edge on the first conditional to jump directly to BB8. 
Presumably this is confusing the analyzer, which is no longer warning here:

    if (curbp->b_amark == (AMARK *)NULL)
      curbp->b_amark = p;
    else
      last->m_next = p; /* { dg-warning "dereference of NULL 'last'" "deref" {
xfail *-*-* } } */

Reply via email to