https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102679
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- If you have everything in one stmt, gcc handles that too, see int foo (int *b, long long sqr) { sqr += (long long)*b * *b; return sqr; } int bar (int *b, long long sqr) { return sqr + (long long)*b * *b; } The reason why it isn't done in foo too is that we don't have a type demotion pass but do that on GENERIC only in the FEs. But the type demotion pass would then need to be accompanied by a type promotion pass that would promote for vectorization and expansion purposes when promotions are beneficial. And, the demotions (whether the ones we do currently in the FE or those that would be done in the type demotion pass) have some drawbacks too, in particular e.g. that for signed integer arithmetics the demoted arithmetic needs to be done in unsigned type / wrapping behavior. I think we have some dups of this, don't remember the bug numbers though.