diff options
author | Marek Polacek <polacek@redhat.com> | 2014-05-21 19:07:30 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-05-21 19:07:30 +0000 |
commit | 1edb7356d55721eb4160580ff6f42a1ad1269ced (patch) | |
tree | ecedb772a0e3b5484c52b54f1dc10a8a1f602023 /gcc | |
parent | 289395899601bacfaa9f9f93c454b85337867c5b (diff) | |
download | gcc-1edb7356d55721eb4160580ff6f42a1ad1269ced.zip gcc-1edb7356d55721eb4160580ff6f42a1ad1269ced.tar.gz gcc-1edb7356d55721eb4160580ff6f42a1ad1269ced.tar.bz2 |
re PR sanitizer/61272 ([UBSAN] ICE in is_ubsan_builtin_p(tree_node*), gcc/ubsan.c:534)
PR sanitizer/61272
* ubsan.c (is_ubsan_builtin_p): Turn assert into a condition.
* g++.dg/ubsan/pr61272.C: New test.
From-SVN: r210723
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ubsan/pr61272.C | 24 | ||||
-rw-r--r-- | gcc/ubsan.c | 6 |
4 files changed, 37 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4be825c..8caf9c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-05-21 Marek Polacek <polacek@redhat.com> + + PR sanitizer/61272 + * ubsan.c (is_ubsan_builtin_p): Turn assert into a condition. + 2014-05-21 Martin Jambor <mjambor@suse.cz> * doc/invoke.texi (Optimize Options): Document parameters diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6fe22f6..876967a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-05-21 Marek Polacek <polacek@redhat.com> + + PR sanitizer/61272 + * g++.dg/ubsan/pr61272.C: New test. + 2014-05-21 Cesar Philippidis <cesar@codesourcery.com> Sandra Loosemore <sandra@codesourcery.com> diff --git a/gcc/testsuite/g++.dg/ubsan/pr61272.C b/gcc/testsuite/g++.dg/ubsan/pr61272.C new file mode 100644 index 0000000..064678d --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr61272.C @@ -0,0 +1,24 @@ +// PR sanitizer/61272 +// { dg-do compile } +// { dg-options "-fsanitize=undefined -std=c++11" } + +namespace std +{ + template < typename _Tp > class allocator; + template < typename _Alloc > struct allocator_traits { + private: + template < typename _Tp > auto construct ( _Alloc & __a, _Tp * __p)-> // { dg-error "is private" } + decltype (_S_construct (__a, __p)) { } + }; + namespace __gnu_cxx + { + template < typename _Alloc > struct __alloc_traits:std::allocator_traits < _Alloc > // { dg-error "within this context" } + { + typedef std::allocator_traits < _Alloc > _Base_type; + using _Base_type::construct; + }; + template < typename _Tp, typename _Alloc > struct _Vector_base { typedef typename __gnu_cxx::__alloc_traits < _Alloc >::template rebind < _Tp >::other _Tp_alloc_type; }; // { dg-error "no class template" } + template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector : protected _Vector_base < _Tp, _Alloc > { }; + template < typename NumberT > struct Point2d { }; + typedef Point2d < int >GdsPoint; + class GdsPointList : public vector < GdsPoint > {};}} diff --git a/gcc/ubsan.c b/gcc/ubsan.c index 11461d0..585569c 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -531,9 +531,9 @@ ubsan_instrument_unreachable (location_t loc) bool is_ubsan_builtin_p (tree t) { - gcc_checking_assert (TREE_CODE (t) == FUNCTION_DECL); - return strncmp (IDENTIFIER_POINTER (DECL_NAME (t)), - "__builtin___ubsan_", 18) == 0; + return TREE_CODE (t) == FUNCTION_DECL + && strncmp (IDENTIFIER_POINTER (DECL_NAME (t)), + "__builtin___ubsan_", 18) == 0; } /* Expand UBSAN_NULL internal call. */ |