Closed MattWindsor91 closed 5 years ago
Sometimes the chain is even weirder, which'd require a degree of flow analysis. Here's an actual example:
P0 | P1 ;
movl [t0sZM4], ZUy | movl [t1sZM4], ZUx ;
movl EAX, [t0sZM4] | movl EAX, [t1sZM4] ;
movl EAX, [EAX] | movl EAX, [EAX] ;
movl [t0sZM12], EAX | movl [t1sZM12], EAX ;
movl EAX, [t0sZM12] | movl EAX, [t1sZM12] ;
movl [ZUt0r0], EAX | movl [ZUt1r0], EAX ;
movl [t0sZM8], ZUx | movl [t1sZM8], ZUy ;
movl [t0sZM16], 1 | movl [t1sZM16], 1 ;
movl EAX, [t0sZM16] | movl EAX, [t1sZM16] ;
movl EDX, EAX | movl EDX, EAX ;
movl EAX, [t0sZM8] | movl EAX, [t1sZM8] ;
movl [EAX], EDX | movl [EAX], EDX ;
A few days ago, I added a heuristic uses_immediate_heap_symbol
(it's in Abstract_operands
, but seems to have ended up unexpected) that checks to see if any of the operands are a heap symbol used as an immediate value (like ZUy
above). This was supposed to be the start of implementing a fix for this, but I got sidetracked.
Things that need doing:
Most of today has been spent finding out, the hard way, that:
%EAX
(read from register) and (%EAX)
(register indirect);%EAX
as 'unknown', and doesn't have a leg for it.This has landed in act now, though in a fairly rigid form that might need further pruning.
Some compilers like to emit chains of
mov
s like this:Herd doesn't like the idea of manipulating memory addresses in this way, and complains about the syntax of the first instruction.
It's not clear what the best way to fix these issues is. If we were sanitising this at the act level, we'd need to detect this particular flow and convert it to
mov EAX, [heap]
. But this might change the semantics of the program!This might be something we can extend Herd to understand, but it sounds a bit sketchy.