Abstract
The article discusses an approach to automatical creation of imperative programs models, designed to find errors in memory operations. The approach is based on the model division into compositional parts, including control flow models, variable, data types and pointers models. Models of data types and pointers are developed from the purposes of modeling to a proper level of detail sufficient to detect errors. To analyze the correctness of a program, a reachability graph of the model Petri net is constructed, on which deadlocks, loops, and explicitly marked erroneous events are searched. The article provides an example of a program with an error in accessing a previously freed memory block in a race condition state of parallel program threads. A model constructed for the example program in terms of Petri nets allows to track the moment an error occurs in the reachability graph.