AnsweredAssumed Answered

arm-none-eabi-gcc 4.9.3: local varible optimize away even if volatile added

Question asked by huang xiaofeng on Jun 8, 2018
Latest reply on Jun 18, 2018 by Jorge Antonio Alcala Vazquez

I post a question in KDS: variable optimized out when compile with O2 and LTO option , and the last question is that:

as a sample followed:

local variable optimized out even if volatile added

 

 

when compiled with O2 and linked with LTO, the local varible addr will be optimized away even if the volatile added, maybe there has relation with the gcc's version.

I searched google, test some answer, and found no one satisfied.

Outcomes