I wrote a simple test of division and remainder results that should always be
true ((a/b)*b+(a%b)==a, with a hardcoded constant for b). In testing a current
source tree (trunk rev 127954), I found that the test properly went away...
unless I later printed out the quotient and remainder values. If I passed them
to printf, the test is still performed, even though it can't fail, and its
intermediate values are not used.
--
Summary: guaranteed-true test not optimized away when input
values later used
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: raeburn at raeburn dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33257