URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [builtin-object-size-9.c] - Rev 298
Compare with Previous | Blame | View Log
/* { dg-do run } */ /* { dg-options "-O2" } */ typedef __SIZE_TYPE__ size_t; extern void *malloc (size_t); extern void free (void *); extern void abort (void); union U { struct S { int a; int b; } s; int t; }; struct T { int c; char d[1]; }; int main (void) { union U *u = malloc (sizeof (struct S) + sizeof (struct T) + 6); struct T *t = (struct T *) (&u->s + 1); if (__builtin_object_size (t->d, 1) != sizeof (struct T) + 6 - __builtin_offsetof (struct T, d)) abort (); free (u); return 0; }