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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-11-20
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, problem is following: before the patch we emitted return statement
that was caught in tree-cfg.c. Now we end up with:

test2 (int a)
{
  <bb 2> :
  if (a != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  __builtin_abort ();

  <bb 4> :
  __builtin_unreachable ();

}

Thus the warnings in tree-cfg can't see that. On the other hand, having a
function that doesn't do an abnormal return:

test2 (int a)
{
  <bb 2> :
  if (a != 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  foo ();

  <bb 4> :
  __builtin_unreachable ();

}

C++ FE warning is triggered:

/home/marxin/Programming/testcases/pr83045-2.c: In function ‘int test2(int)’:
/home/marxin/Programming/testcases/pr83045-2.c:15:1: warning: no return
statement in function returning non-void [-Wreturn-type]

That said, I don't know how to fix that properly?

Reply via email to