GCC does not optimize out functions without side effects with asm statements inside loop even if return velue is ignored

Hans-Peter Nilsson hp@bitrange.com
Mon Oct 9 07:12:00 GMT 2017


On Sat, 7 Oct 2017, Andrew Pinski wrote:
> On Sat, Oct 7, 2017 at 2:22 PM, Saldyrkine, Mikhail
> <Mikhail.Saldyrkine@gs.com> wrote:
> > The " uint64_t test_noasm(uint64_t idx)" has same loop and the function is optimized out.
>
> There is a difference there, objects is limited to 1024.  Loading past
> the array bounds is undefined.

But that possibility doesn't seem to me a valid reason to keep
the asm from being optimized away.  If I were the OP, I'd file
an enhancement request in the bugzilla.

brgds, H-P



More information about the Gcc-bugs mailing list