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

            Bug ID: 85787
           Summary: malloc_candidate_p fails to detect malloc attribute on
                    nested phis
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prathamesh3492 at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

For the following test-case, g should have been detected as malloc-like
function by malloc_candidate_p().

void *g (int cond1, int cond2, int cond3)
{
  void *ret;
  void *a;
  void *b;

  if (cond1)
    a = __builtin_malloc (10);
  else
    a = __builtin_malloc (20);

  if (cond2)
    b = __builtin_malloc (30);
  else
    b = __builtin_malloc (40);

  if (cond3)
    ret = a;
  else
    ret = b;

  return ret;
}

Reply via email to