From: Marek Polacek Date: Thu, 9 Apr 2015 18:30:34 +0000 (+0000) Subject: re PR middle-end/65554 (ICE: verify_gimple failed) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86c5a5c3bba487a03c0288c912641275e3df812b;p=gcc.git re PR middle-end/65554 (ICE: verify_gimple failed) PR middle-end/65554 * gimple-fold.c (gimple_fold_builtin_memory_op): Update comment. (fold_ctor_reference): Use STRIP_USELESS_TYPE_CONVERSION instead of STRIP_NOPS. * g++.dg/opt/pr65554.C: New test. Co-Authored-By: Jakub Jelinek From-SVN: r221954 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d1a189fdaa..32149ba7029 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-04-09 Marek Polacek + Jakub Jelinek + + PR middle-end/65554 + * gimple-fold.c (gimple_fold_builtin_memory_op): Update comment. + (fold_ctor_reference): Use STRIP_USELESS_TYPE_CONVERSION instead + of STRIP_NOPS. + 2015-04-09 Segher Boessenkool PR rtl-optimization/65693 diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index f89220c5a68..9458f965452 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -769,7 +769,7 @@ var_decl_component_p (tree var) } /* Fold function call to builtin mem{{,p}cpy,move}. Return - NULL_TREE if no simplification can be made. + false if no simplification can be made. If ENDP is 0, return DEST (like memcpy). If ENDP is 1, return DEST+LEN (like mempcpy). If ENDP is 2, return DEST+LEN-1 (like stpcpy). @@ -5472,7 +5472,7 @@ fold_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset, ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl); ret = fold_unary (VIEW_CONVERT_EXPR, type, ret); if (ret) - STRIP_NOPS (ret); + STRIP_USELESS_TYPE_CONVERSION (ret); return ret; } /* For constants and byte-aligned/sized reads try to go through diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 710e299bbf0..a44374f643e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-04-09 Marek Polacek + Jakub Jelinek + + PR middle-end/65554 + * g++.dg/opt/pr65554.C: New test. + 2015-04-09 Jakub Jelinek PR c++/65690 diff --git a/gcc/testsuite/g++.dg/opt/pr65554.C b/gcc/testsuite/g++.dg/opt/pr65554.C new file mode 100644 index 00000000000..70e43a44e26 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr65554.C @@ -0,0 +1,124 @@ +// PR middle-end/65554 +// { dg-do compile { target c++11 } } +// { dg-options "-O" } + +namespace std +{ + struct B { enum { __value }; }; + template struct C + { + static _Iterator _S_base (_Iterator p1) { return p1; } + }; + template using _RequireInputIter = int; + template _Iterator __niter_base (_Iterator p1) + { + return std::C <_Iterator>::_S_base (p1); + } + template _Iterator __miter_base (_Iterator p1) + { + return std::C <_Iterator>::_S_base (p1); + } + struct D + { + template static _Tp *__copy_m (_Tp * p1, _Tp * p2, _Tp *) + { + int _Num = p2 - p1; + __builtin_memmove (0, p1, sizeof (_Tp) * _Num); + } + }; + template void __copy_move_a (_II p1, _II p2, _OI p3) + { + D::__copy_m (p1, p2, p3); + } + template void __copy_move_a2 (_II p1, _II p2, _OI p3) + { + __copy_move_a <0> (std::__niter_base (p1), std::__niter_base (p2), std::__niter_base (p3)); + } + template void copy (_II p1, _II p2, _OI p3) + { + __copy_move_a2 (std::__miter_base (p1), std::__miter_base (p2), p3); + } +} +template struct F { typedef _Tp *pointer; }; +namespace std +{ + template using __allocator_base = F <_Tp>; + template struct allocator:__allocator_base <_Tp> {}; + template struct initializer_list + { + typedef _E *const_iterator; + _E *_M_array; + unsigned long _M_len; + const_iterator begin () { return _M_array; } + const_iterator end () { return begin () + 1; } + }; + template struct allocator_traits + { + template static typename _Tp::pointer _S_pointer_helper (_Tp *); + typedef decltype (_S_pointer_helper ((_Alloc *) 0)) __pointer; + typedef __pointer pointer; + }; +} +template struct __alloc_traits: +std::allocator_traits > {}; +namespace std +{ + struct G + { + template static _ForwardIterator __uninit_copy (_InputIterator p1, _InputIterator p2, _ForwardIterator p3) + { + copy (p1, p2, p3); + } + }; + template void + uninitialized_copy (_InputIterator p1, _InputIterator p2, _ForwardIterator p3) + { + G::__uninit_copy (p1, p2, p3); + } + template void __uninitialized_copy_a (_InputIterator p1, _InputIterator p2, _ForwardIterator p3, allocator <_Tp> &) + { + uninitialized_copy (p1, p2, p3); + } + struct H + { + typedef std::allocator _Tp_alloc_type; + typedef __alloc_traits <_Tp_alloc_type>::pointer pointer; + _Tp_alloc_type & _M_get_Tp_allocator (); + }; + template > struct J: H + { + void operator= (initializer_list <_Tp> p1) + { + this->assign (p1.begin (), p1.end ()); + } + template > void assign (_InputIterator p1, _InputIterator p2) + { + _M_assign_dispatch (p1, p2, 0); + } + pointer _M_allocate_and_copy___result; + template void _M_allocate_and_copy (int, _ForwardIterator p2, _ForwardIterator p3) + { + __uninitialized_copy_a (p2, p3, _M_allocate_and_copy___result, _M_get_Tp_allocator ()); + } + template void _M_assign_dispatch (_InputIterator p1, _InputIterator p2, int) + { + _M_assign_aux (p1, p2, 0); + } + template void _M_assign_aux (_ForwardIterator, _ForwardIterator, int); + }; + template + template void J <_Tp, _Alloc>::_M_assign_aux (_ForwardIterator p1, _ForwardIterator p2, int) + { + _M_allocate_and_copy (0, p1, p2); + } + class I + { + void tabCompletion (std::J &) const; + }; + void + I::tabCompletion (J &) const + { + J extra; + extra = { "foo" }; + } +}