arm compiler 5 do not fully respect volatile qualifier
问题 Consider the following code: volatile int status; status = process_package_header(&pack_header, PACK_INFO_CONST); if ((((status) == (SUCCESS_CONST)) ? ((random_delay() && ((SUCCESS_CONST) == (status))) ? 0 : side_channel_sttack_detected()) : 1)) { ... } Which generates this machine code (produced with the toolchain's objdump ): 60: f7ff fffe bl 0 <process_package_header> 64: 9000 str r0, [sp, #0] /* <- storing to memory as status is volatile */ 66: 42a0 cmp r0, r4 /* <- where is the load