blob: 5c6fedd0d3d525136eada2cfaa3905046e929cd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/* PR c/116735 */
/* { dg-options "-std=c99" } */
/* { dg-do compile } */
struct foo {
int len;
int element[] __attribute__ ((__counted_by__ (lenx))); /* { dg-error "attribute is not a field declaration in the same structure as" } */
};
struct bar {
float count;
int array[] __attribute ((counted_by (count))); /* { dg-error "attribute is not a field declaration with an integer type" } */
};
int main ()
{
struct foo *p = __builtin_malloc (sizeof (struct foo) + 3 * sizeof (int));
struct bar *q = __builtin_malloc (sizeof (struct bar) + 3 * sizeof (int));
p->len = 3;
p->element[0] = 17;
p->element[1] = 13;
q->array[0] = 13;
q->array[2] = 17;
return 0;
}
|