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-options "-O2 -Warray-bounds -Wrestrict" } */
7
8 void* memcpy ();
9 void* memmove ();
10 char* stpcpy ();
11 char* strcat ();
12 char* strcpy ();
13 char* strncat ();
14 char* strncpy ();
15
test_memcpy_0()16 void* test_memcpy_0 ()
17 {
18 return memcpy ();
19 }
20
test_memcpy_1(void * d)21 void* test_memcpy_1 (void *d)
22 {
23 return memcpy (d);
24 }
25
test_memcpy_2(void * d,const void * s)26 void* test_memcpy_2 (void *d, const void *s)
27 {
28 return memcpy (d, s);
29 }
30
31
test_memmove_0()32 void* test_memmove_0 ()
33 {
34 return memmove ();
35 }
36
test_memmove_1(void * d)37 void* test_memmove_1 (void *d)
38 {
39 return memmove (d);
40 }
41
test_memmove_2(void * d,const void * s)42 void* test_memmove_2 (void *d, const void *s)
43 {
44 return memmove (d, s);
45 }
46
47
test_stpcpy_0()48 void* test_stpcpy_0 ()
49 {
50 return stpcpy ();
51 }
52
test_stpcpy_1(char * d)53 void* test_stpcpy_1 (char *d)
54 {
55 return stpcpy (d);
56 }
57
58
test_strcat_0()59 char* test_strcat_0 ()
60 {
61 return strcat ();
62 }
63
test_strcat_1(char * d)64 char* test_strcat_1 (char *d)
65 {
66 return strcat (d);
67 }
68
69
test_strcpy_0()70 void* test_strcpy_0 ()
71 {
72 return strcpy ();
73 }
74
test_strcpy_1(char * d)75 void* test_strcpy_1 (char *d)
76 {
77 return strcpy (d);
78 }
79
80
test_strncat_0()81 char* test_strncat_0 ()
82 {
83 return strncat ();
84 }
85
test_strncat_1(char * d)86 char* test_strncat_1 (char *d)
87 {
88 return strncat (d);
89 }
90
test_strncat_2(char * d,const char * s)91 char* test_strncat_2 (char *d, const char *s)
92 {
93 return strncat (d, s);
94 }
95
96
test_strncpy_0()97 void* test_strncpy_0 ()
98 {
99 return strncpy ();
100 }
101
test_strncpy_1(char * d)102 void* test_strncpy_1 (char *d)
103 {
104 return strncpy (d);
105 }
106
test_strncpy_2(char * d,const char * s)107 void* test_strncpy_2 (char *d, const char *s)
108 {
109 return strncpy (d, s);
110 }
111