[Bug rtl-optimization/71793] Volatile local variable passed by value is (wrongly?) optimised away, but the containing loop is not

db0451 at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 18 13:35:00 GMT 2016


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

--- Comment #4 from DB <db0451 at gmail dot com> ---
(In reply to Richard Biener from comment #3)
> Well, if you look at the out-of-line copies of the function then he is
> correct.
> But the inline copy in main() does not have this constraint and is still
> mishandled.  Note I didn't yet investigate closer what is going on.

For the out-of-line copies, surely they are not allowed to leave a declared as
volatile argument in a register and thereby break volatility? That seems
contrary to the requirements of the storage class. I'd expect special handling
to allocate a value on the stack prior to calling and refer to that in the
function instead.


More information about the Gcc-bugs mailing list