On Mon, 8 Dec 2014, Jakub Jelinek wrote: > On Mon, Dec 08, 2014 at 01:24:12PM +0100, Richard Biener wrote: > > I'm not pushing this further for stage3, but for stage1 I'd like > > to eventually address this by splitting up builtin_info_type's > > 'implicit_p' into a flags array providing implicit_p, declared_p, > > used_p and maybe declared_in_system_header_p. Would you be > > willing to fill in the gap computing "used_p" in the C frontend? > > The used_p thing might be problematic, I'd expect that several packages > use libm functions somewhere in dead code or when it is folded into > a constant and don't link with -lm, if those dead or optimized away > uses would be counted as uses nevertheless, then if optimizers create new > libm references because of those, I'd be afraid such programs wouldn't link > anymore.
Same applies to your STPCPY special-casing, even without introducing a use. The alternative is to decide "used" in the middle-end at one point, for example at the end of all_lowering_passes where hopefully we have constant folded and removed dead code enough. We can also compute an overall "uses libm" flag to fix the testcase I reported (of course we'd like to re-compute that at LTO time). Do you think that's better? It's of course less well-defined what is a "use" of exp10 then (as opposed to what Joseph specified with a reference outside of sizeof() and similar contexts). Richard.