diff options
author | Mark Mitchell <mark@codesourcery.com> | 2008-06-27 23:02:06 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2008-06-27 23:02:06 +0000 |
commit | b8df34454c0159dc0ec7aef94c127222c94f7ca7 (patch) | |
tree | ee424efdc156b1f33628dbcfd0142c57a4aa60c3 | |
parent | 0ac69b47fbd5c46b29f27ce9ab10ff63498ceeee (diff) | |
download | gcc-b8df34454c0159dc0ec7aef94c127222c94f7ca7.zip gcc-b8df34454c0159dc0ec7aef94c127222c94f7ca7.tar.gz gcc-b8df34454c0159dc0ec7aef94c127222c94f7ca7.tar.bz2 |
vec.cc (__aeabi_vec_dtor_cookie): Handle NULL array address.
2008-06-27 Mark Mitchell <mark@codesourcery.com>
* libsupc++/vec.cc (__aeabi_vec_dtor_cookie): Handle NULL array
address.
(__aeabi_vec_delete): Likewise.
(__aeabi_vec_delete3): Likewise.
(__aeabi_vec_delete3_nodtor): Likewise.
2008-06-27 Mark Mitchell <mark@codesourcery.com>
* g++.dg/abi/arm_cxa_vec2.C: New test.
From-SVN: r137207
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C | 41 | ||||
-rw-r--r-- | libstdc++-v3/ChangeLog | 8 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/vec.cc | 12 |
4 files changed, 65 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d0d635d..d4de302 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-06-27 Mark Mitchell <mark@codesourcery.com> + + * g++.dg/abi/arm_cxa_vec2.C: New test. + 2008-06-28 Jakub Jelinek <jakub@redhat.com> PR c++/36364 diff --git a/gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C b/gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C new file mode 100644 index 0000000..76f327a --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/arm_cxa_vec2.C @@ -0,0 +1,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 diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1531ff3..cfb15d2 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2008-06-27 Mark Mitchell <mark@codesourcery.com> + + * libsupc++/vec.cc (__aeabi_vec_dtor_cookie): Handle NULL array + address. + (__aeabi_vec_delete): Likewise. + (__aeabi_vec_delete3): Likewise. + (__aeabi_vec_delete3_nodtor): Likewise. + 2008-06-27 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_algo.h (is_partitioned): Add in C++0x mode. diff --git a/libstdc++-v3/libsupc++/vec.cc b/libstdc++-v3/libsupc++/vec.cc index 67caec8..a29bbc7 100644 --- a/libstdc++-v3/libsupc++/vec.cc +++ b/libstdc++-v3/libsupc++/vec.cc @@ -461,6 +461,9 @@ namespace __aeabiv1 __aeabi_vec_dtor_cookie (void *array_address, abi::__cxa_cdtor_type destructor) { + if (!array_address) + return NULL; + abi::__cxa_vec_dtor (array_address, reinterpret_cast<std::size_t *>(array_address)[-1], reinterpret_cast<std::size_t *>(array_address)[-2], @@ -473,6 +476,9 @@ namespace __aeabiv1 __aeabi_vec_delete (void *array_address, abi::__cxa_cdtor_type destructor) { + if (!array_address) + return; + abi::__cxa_vec_delete (array_address, reinterpret_cast<std::size_t *>(array_address)[-2], 2 * sizeof (std::size_t), @@ -484,6 +490,9 @@ namespace __aeabiv1 abi::__cxa_cdtor_type destructor, void (*dealloc) (void *, std::size_t)) { + if (!array_address) + return; + abi::__cxa_vec_delete3 (array_address, reinterpret_cast<std::size_t *>(array_address)[-2], 2 * sizeof (std::size_t), @@ -494,6 +503,9 @@ namespace __aeabiv1 __aeabi_vec_delete3_nodtor (void *array_address, void (*dealloc) (void *, std::size_t)) { + if (!array_address) + return; + abi::__cxa_vec_delete3 (array_address, reinterpret_cast<std::size_t *>(array_address)[-2], 2 * sizeof (std::size_t), |