c - How would you implement dereferencing of pointers in z3 -


trying analyze c programs z3 in python, , got trouble pointers. working terms like:

float * buffer = (float*)malloc(5*sizeof(float)) 

i interpret buffer bitvec(32) value *buffer should real(). should ok, assertions should write terms

*(buffer+3) or *(buffer+i)  

how should assertions written if indexing out

*(buffer-1) or *(buffer+10) 

one solution encode program heap map h locations values. in z3, array theory can used encode maps.

pointers/addresses integer locations, integer arithmetic encodes pointer arithmetic; allow constraints such h(buffer + i) > 0 in encoding. if encode oo-language, use pair (receiver, field name) encode addresses. e.g. h(r, f) > 0 correspond r.f > 0. note map encoding naturally accounts aliasing, e.g. if buffer1 == buffer2 , i == 3 h(buffer1 + i) == h(buffer + 3).

see paper heaps , data structures: challenge automated provers interesting comparison of map-based heap encodings.

map-based encodings typically used tools based on verification condition, such frama-c, dafny , boogie. tools based on symbolic execution, such silicon (which part of viper verification infrastructure) , verifast typically use different encoding; see, e.g. heap-dependent expressions in separation logic .


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -