https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80354
John Steele Scott <toojays at toojays dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |toojays at toojays dot net --- Comment #6 from John Steele Scott <toojays at toojays dot net> --- (In reply to Stephan Bergmann from comment #5) > (In reply to Martin Sebor from comment #3) > > The warning does just what it's designed to do: point out the potential > > unhandled truncation. > > But it is unusable in practice if there is no reliable way to silence false > positives. ^^^^^----- This! A simple cast-to-void is the conventional way to indicate to the compiler that it should consider the value as having been consumed even though it wasn't really. It's a real shame if this information is not available to the code that generates this warning. (In reply to Martin Sebor from comment #1) > Besides actually handling the truncation (e.g., branching on > it and taking some action that does affect the behavior), storing the return > value in a volatile variable and reading it should suppress it. Thanks for the tip. For isolated instances this may be less invasive than what I have been contemplating (checking the return value and calling some no-op function). It would be better if there were some solution that didn't generate unnecessary code though.