summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C
blob: 76f327acaab9200d28ffbb64c901367e9a139de0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Check that ARM vector delete functions accept NULL pointers as
// inputs.
// { dg-do run { target arm*-*-* } }

#ifdef __ARM_EABI__
#include <cxxabi.h>

typedef void *(dtor_type)(void *);

extern "C" {
  void abort();
  void *__aeabi_vec_dtor_cookie(void *, dtor_type);
  void __aeabi_vec_delete(void *, dtor_type);
  void __aeabi_vec_delete3(void *, 
			   dtor_type, 
			   void (*)(void *, __SIZE_TYPE__));
  void __aeabi_vec_delete3_nodtor(void *, 
				  void (*)(void *, __SIZE_TYPE__));
}

// These functions should never be called.
void* dtor(void *)
{
  abort ();
}

void dealloc(void *, size_t) {
  abort ();
}

int main () {
  if (__aeabi_vec_dtor_cookie (NULL, &dtor) != NULL)
    return 1;
  // These do not return values, but should not crash.
  __aeabi_vec_delete (NULL, &dtor);
  __aeabi_vec_delete3 (NULL, &dtor, &dealloc);
  __aeabi_vec_delete3_nodtor (NULL, &dealloc);
}
#else
int main () {}
#endif