Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/strlenopt-38.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* PR tree-optimization/83444 */ | |
2 /* { dg-do compile } */ | |
3 /* { dg-options "-O2 -fdump-tree-optimized" } */ | |
4 /* { dg-final { scan-tree-dump-not "abort \\(\\)" "optimized" } } */ | |
5 | |
6 #include "strlenopt.h" | |
7 | |
8 void | |
9 foo (void) | |
10 { | |
11 char a[5] = "012"; | |
12 strcpy (a, ""); | |
13 if (strlen (a) != 0) | |
14 abort (); | |
15 } | |
16 | |
17 void | |
18 bar (void) | |
19 { | |
20 char a[5] = "012"; | |
21 char b[7] = ""; | |
22 strcpy (a, b); | |
23 if (strlen (a) != 0) | |
24 abort (); | |
25 } | |
26 | |
27 struct S { char a[4]; char b[5]; char c[7]; }; | |
28 | |
29 void | |
30 baz (void) | |
31 { | |
32 struct S s; | |
33 strcpy (s.b, "012"); | |
34 strcpy (s.c, ""); | |
35 strcpy (s.b, s.c); | |
36 if (s.b[0] != 0) | |
37 abort (); | |
38 } | |
39 | |
40 void | |
41 boo (void) | |
42 { | |
43 struct S s; | |
44 strcpy (s.b, "012"); | |
45 strcpy (s.c, ""); | |
46 strcpy (s.b, s.c); | |
47 if (strlen (s.b) != 0) | |
48 abort (); | |
49 } |