builtin-has-attribute-4.c: Skip on 32-bit hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / gcc.dg / Wstringop-overflow-4.c
blob74596c4c9945acb29d54a26ccadacf9adebe6809
1 /* { dg-do compile }
2 { dg-options "-O2 -Wstringop-overflow" } */
4 extern char* strchr (const char*, int);
5 extern char* strcpy (char*, const char*);
6 extern void* malloc (__SIZE_TYPE__);
7 extern __SIZE_TYPE__ strlen (const char *);
8 struct define_item {
9 int len;
10 char value[1];
13 struct define_item * foo(char *name)
15 char * p;
16 char * value;
17 struct define_item * ptr;
19 p = strchr (name, '=');
20 if (1 && p) {
21 value = p+1;
22 } else
23 value = "1";
25 ptr = malloc(sizeof(struct define_item) + strlen(value));
26 strcpy(ptr->value, value); /* { dg-bogus "bytes into a region" } */
27 return ptr;