draperlaboratory / cbat_tools

Program analysis tools developed at Draper on the CBAT project.
MIT License
101 stars 14 forks source link

Reuse of BIR virtual variables #352

Open ccasin opened 2 years ago

ccasin commented 2 years ago

wp currently assumes virtual variables are not reused, but this is not guaranteed. The same virtual may be assigned to multiple times and each assignment shadows the previous ones. The assignments may even have different types, as in this snipped where #5 is assigned to with a 32-bit number and an 8-bit number.

00000063: #5 := 0x18
00000065: #5 := 0x18
...
0000006b: R1 := #5
...
00000093: #5 := low:8[R2]

This doesn't actually arise in practice (much) right now, but we should probably fix it by generating a fresh name each time a virtual is assigned to (which will require some careful thought about program order).