source: CIVL/examples/mem/mem_tests/mem_contains_complex-bad2.cvl

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 411 bytes
RevLine 
[da65ee2]1#include<mem.cvh>
2#include<stdlib.h>
3
4struct T {
5 int (*x)[100];
6} ** a;
7
8int main() {
9 a = (struct T **)malloc(sizeof(struct T*));
10 *a = (struct T*)malloc(sizeof(struct T));
11 (*a)->x = (int (*)[100])malloc(sizeof(int[100]) * 10);
12
13 //violated: (*a) refers the whole struct, (*a)->x refers to array pointed by the field...
14 $assert($mem_contains(*a, (*a)->x));
15
16 free((*a)->x);
17 free(*a);
18 free(a);
19}
Note: See TracBrowser for help on using the repository browser.