https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115025

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> Note on the trunk is_prime is all optimized away.

Which is correct as the result of is_prime is not used and it will have no side
effects.

Adding:

                asm(""::"r"(nprimes));
After the calling loop in main fixes that.

Note there is also an improvement in no longer needing to call sqrt function
since GCC now knows it won't set errno because of the cast from integer.

Reply via email to