[Bug c++/83045] [8 Regression] -Wreturn-type regression in C++
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 20 10:12:00 GMT 2017
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?
More information about the Gcc-bugs
mailing list