Just an update on this issue.
Finally, I resolved this issue with the following solution:
For the source code (portion):
"
struct annotated {
size_t foo;
char array[] __attribute__((counted_by (foo)));
};
p2->array[8] = 0;
“
C FE will generate the following: (*.005t.original)
Hi,
1. For the following source code (portion):
struct annotated {
size_t foo;
char b;
char array[] __attribute__((counted_by (foo)));
};
static void noinline bar ()
{
struct annotated *p2 = alloc_buf (10);
p2->array[8] = 0;
return;
}
2. I modified C FE to generate the following