There is code in the expanders which is supposed to avoid emitting calls to pure functions which have their result ignored, but it doesn't appear to work when the function called is represented as a COND_EXPR.
-- Summary: const / pure call with ignored argument emitted. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amylaar at gcc dot gnu dot org GCC host triplet: i686-pc-linux-gnu OtherBugsDependingO 28289 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28306