1 /* PR tree-optimization/83603 - ICE in builtin_memref at
2 gcc/gimple-ssa-warn-restrict.c:238
3 Test to verify that invalid calls to built-in functions declared
4 without a prototype don't cause an ICE.
5 { dg-do compile }
6 { dg-prune-output "conflicting types for built-in" }
7 { dg-options "-O2 -Warray-bounds -Wrestrict" } */
8
9 void* memcpy ();
10 void* memmove ();
11 char* stpcpy ();
12 char* strcat ();
13 char* strcpy ();
14 char* strncat ();
15 char* strncpy ();
16
test_memcpy_0()17 void* test_memcpy_0 ()
18 {
19 return memcpy ();
20 }
21
test_memcpy_1(void * d)22 void* test_memcpy_1 (void *d)
23 {
24 return memcpy (d);
25 }
26
test_memcpy_2(void * d,const void * s)27 void* test_memcpy_2 (void *d, const void *s)
28 {
29 return memcpy (d, s);
30 }
31
32
test_memmove_0()33 void* test_memmove_0 ()
34 {
35 return memmove ();
36 }
37
test_memmove_1(void * d)38 void* test_memmove_1 (void *d)
39 {
40 return memmove (d);
41 }
42
test_memmove_2(void * d,const void * s)43 void* test_memmove_2 (void *d, const void *s)
44 {
45 return memmove (d, s);
46 }
47
48
test_stpcpy_0()49 void* test_stpcpy_0 ()
50 {
51 return stpcpy ();
52 }
53
test_stpcpy_1(char * d)54 void* test_stpcpy_1 (char *d)
55 {
56 return stpcpy (d);
57 }
58
59
test_strcat_0()60 char* test_strcat_0 ()
61 {
62 return strcat ();
63 }
64
test_strcat_1(char * d)65 char* test_strcat_1 (char *d)
66 {
67 return strcat (d);
68 }
69
70
test_strcpy_0()71 void* test_strcpy_0 ()
72 {
73 return strcpy ();
74 }
75
test_strcpy_1(char * d)76 void* test_strcpy_1 (char *d)
77 {
78 return strcpy (d);
79 }
80
81
test_strncat_0()82 char* test_strncat_0 ()
83 {
84 return strncat ();
85 }
86
test_strncat_1(char * d)87 char* test_strncat_1 (char *d)
88 {
89 return strncat (d);
90 }
91
test_strncat_2(char * d,const char * s)92 char* test_strncat_2 (char *d, const char *s)
93 {
94 return strncat (d, s);
95 }
96
97
test_strncpy_0()98 void* test_strncpy_0 ()
99 {
100 return strncpy ();
101 }
102
test_strncpy_1(char * d)103 void* test_strncpy_1 (char *d)
104 {
105 return strncpy (d);
106 }
107
test_strncpy_2(char * d,const char * s)108 void* test_strncpy_2 (char *d, const char *s)
109 {
110 return strncpy (d, s);
111 }
112
113 /* { dg-prune-output "\\\[-Wbuiltin-declaration-mismatch]" } */
114