[Bug c/94389] __attribute__((warn_unused_result)) will warn if the result is discarded as an optimisation
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 30 09:02:51 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94389
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
We end up during gimplification with:
get_flags ()
{
int D.1939;
text_mode ();
D.1939 = 0;
return D.1939;
}
which then leads to unused value. While:
int get_flags2(void) {
return text_mode() ? O_TEXT : foo ();
}
is fine and no warning is reported.
More information about the Gcc-bugs
mailing list