1 // Check that ARM vector delete functions accept NULL pointers as
2 // inputs.
3 // { dg-do run { target arm*-*-* } }
4 
5 #ifdef __ARM_EABI__
6 #include <cxxabi.h>
7 
8 typedef void *(dtor_type)(void *);
9 
10 extern "C" {
11   void abort();
12   void *__aeabi_vec_dtor_cookie(void *, dtor_type);
13   void __aeabi_vec_delete(void *, dtor_type);
14   void __aeabi_vec_delete3(void *,
15 			   dtor_type,
16 			   void (*)(void *, __SIZE_TYPE__));
17   void __aeabi_vec_delete3_nodtor(void *,
18 				  void (*)(void *, __SIZE_TYPE__));
19 }
20 
21 // These functions should never be called.
dtor(void *)22 void* dtor(void *)
23 {
24   abort ();
25 }
26 
dealloc(void *,size_t)27 void dealloc(void *, size_t) {
28   abort ();
29 }
30 
main()31 int main () {
32   if (__aeabi_vec_dtor_cookie (NULL, &dtor) != NULL)
33     return 1;
34   // These do not return values, but should not crash.
35   __aeabi_vec_delete (NULL, &dtor);
36   __aeabi_vec_delete3 (NULL, &dtor, &dealloc);
37   __aeabi_vec_delete3_nodtor (NULL, &dealloc);
38 }
39 #else
main()40 int main () {}
41 #endif
42