Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/Wstringop-overflow-19.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* PR middle-end/92014 - bogus warning: writing 8 bytes into a region | |
2 of size 1 in timezone/zic.c | |
3 { dg-do compile } | |
4 { dg-options "-O2 -Wall" } */ | |
5 | |
6 struct | |
7 { | |
8 char *s1, *s2; | |
9 char c; | |
10 } z; | |
11 | |
12 | |
13 void f (char **a, int i, int j) | |
14 { | |
15 char * cp = __builtin_strchr (a[i], '%'); | |
16 | |
17 if (cp && *++cp != 's') | |
18 return; | |
19 | |
20 z.s1 = __builtin_strdup (a[i]); | |
21 if (!z.s1) __builtin_abort (); | |
22 | |
23 z.s2 = __builtin_strdup (a[j]); | |
24 if (!z.s2) __builtin_abort (); | |
25 | |
26 z.c = cp ? *cp : '\0'; // { dg-bogus "\\\[-Wstringop-overflow" } | |
27 } |