mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-03-06 21:30:27 +00:00
Don't optimize out certain volatile stores.
This could occur due to the new native-code peephole optimizations for stz instructions, which can collapse consecutive identical ones down to one instruction. This is OK most of the time, but not when dealing with volatile variables, so disable it in that case. The following test case shows the issue (look at the generated code): #pragma optimize -1 volatile int a; int main(void) { a = 0; a = 0; }
This commit is contained in:
parent
38345e4ca2
commit
44714767e5
@ -1744,12 +1744,14 @@ var
|
||||
if npeep[ns].opcode = npeep[ns+1].opcode then
|
||||
if npeep[ns].operand = npeep[ns+1].operand then
|
||||
if npeep[ns].name = npeep[ns+1].name then
|
||||
Remove(ns+1);
|
||||
if not volatile then
|
||||
Remove(ns+1);
|
||||
|
||||
m_stz_dir, m_stz_dirX:
|
||||
if npeep[ns].opcode = npeep[ns+1].opcode then
|
||||
if npeep[ns].operand = npeep[ns+1].operand then
|
||||
Remove(ns+1);
|
||||
if not volatile then
|
||||
Remove(ns+1);
|
||||
|
||||
otherwise: ;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user