mtag: fix get_mtag() for recorded states and for arrays
commit81f478855e968a4ea7ee677141a6818e018b4268
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 8 Jan 2018 22:26:15 +0000 (9 01:26 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 8 Jan 2018 22:26:15 +0000 (9 01:26 +0300)
treedd38c2593eb5ddc89c4e26b214e0331b7402dc98
parent178046e79d909ed34278e9b87badec4325beb3b7
mtag: fix get_mtag() for recorded states and for arrays

In the original code, get_mtag() only worked for toplevel_mtags().  We're
passing the mtags around and calculating them, but they basically weren't
used at all.

The majority of this code is about arrays though.  As I commit this now
(I wrote it before Christmas vacation), I'm not positive the details are
correct...  But the idea is, whenever you have a pointer then you have a
corresponding mtag.  So if you have an array of pointers then each element
in the array gets an mtag.  But what if you have an array of int and you
do &foo[4]?  Then probably the foo array should have an mtag and we use an
offset off that.

But anyway, my test case was an array of pointer and I wanted to give each
element an mtag so I hash the base mtag and the offset to generate it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_mtag.c