aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.com>2016-06-08 11:41:54 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2016-06-08 11:41:54 +0000
commit73d73b480363b6809af94db86468f68b88d54e52 (patch)
tree83332f8f99a5b020a773efc4a68e6eef9266e1a4
parentbdd15d0c8e23904cc6feb137d54b29821a2f188d (diff)
downloadgcc-73d73b480363b6809af94db86468f68b88d54e52.zip
gcc-73d73b480363b6809af94db86468f68b88d54e52.tar.gz
gcc-73d73b480363b6809af94db86468f68b88d54e52.tar.bz2
re PR debug/71432 (-fcompare-debug failure (length))
PR debug/71432 PR ada/71413 * tree-ssa-strlen.c (handle_builtin_memcmp): Ignore debug insns. * g++.dg/debug/pr71432.C: New test. From-SVN: r237208
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/debug/pr71432.C140
-rw-r--r--gcc/tree-ssa-strlen.c2
4 files changed, 154 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7b2d10f..df5b0df 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-08 Bernd Schmidt <bschmidt@redhat.com>
+
+ PR debug/71432
+ PR ada/71413
+ * tree-ssa-strlen.c (handle_builtin_memcmp): Ignore debug insns.
+
2016-06-08 Jiong Wang <jiong.wang@arm.com>
* config/aarch64/aarch64-builtins.def (faddp): New builtins for modes in
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7c943cc..b40b6c0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-08 Bernd Schmidt <bschmidt@redhat.com>
+
+ PR debug/71432
+ PR ada/71413
+ * g++.dg/debug/pr71432.C: New test.
+
2016-06-08 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gcc.dg/vect/section-anchors-vect-70.c: Rename to aligned-section-anchors-vect-71.c.
diff --git a/gcc/testsuite/g++.dg/debug/pr71432.C b/gcc/testsuite/g++.dg/debug/pr71432.C
new file mode 100644
index 0000000..6356331
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/pr71432.C
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+namespace std
+{
+ typedef long unsigned int size_t;
+ inline namespace __cxx11
+ {
+ } }
+
+extern "C++"
+{
+ namespace std
+ {
+ template < typename _Tp > struct __is_char
+ {
+ };
+ template <> struct __is_char <char >
+ {
+ enum
+ { __value = 1 };
+ };
+ } namespace __gnu_cxx
+ {
+ template < bool, typename > struct __enable_if
+ {
+ };
+ template < typename _Tp > struct __enable_if <true, _Tp >
+ {
+ typedef _Tp __type;
+ };
+ }
+}
+
+namespace __gnu_cxx
+{
+ template < typename _Tp > class new_allocator
+ {
+ };
+}
+
+namespace std
+{
+ template < typename _Tp > using __allocator_base =
+ __gnu_cxx::new_allocator < _Tp >;
+template < typename _Tp > class allocator:public __allocator_base < _Tp >
+ {
+ };
+ template < typename _Alloc > struct allocator_traits
+ {
+ };
+ template < typename _Tp > struct allocator_traits <allocator < _Tp >>
+ {
+ using size_type = std::size_t;
+ template < typename _Up > using rebind_alloc = allocator < _Up >;
+ };
+}
+
+namespace __gnu_cxx
+{
+ template < typename _Alloc > struct __alloc_traits:std::allocator_traits <_Alloc >
+ {
+ typedef std::allocator_traits < _Alloc > _Base_type;
+ template < typename _Tp > struct rebind
+ {
+ typedef typename _Base_type::template rebind_alloc < _Tp > other;
+ };
+ };
+}
+
+namespace std
+{
+ template < class _CharT > struct char_traits;
+ namespace __cxx11
+ {
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT >, typename _Alloc =
+ allocator < _CharT > >class basic_string;
+ typedef basic_string < char >string;
+ }
+}
+
+namespace std
+{
+ template <> struct char_traits <char >
+ {
+ typedef char char_type;
+ static int compare (const char_type * __s1, const char_type * __s2,
+ size_t __n)
+ {
+ return __builtin_memcmp (__s1, __s2, __n);
+ }
+ };
+
+ namespace __cxx11
+ {
+ template < typename _CharT, typename _Traits, typename _Alloc >
+ class basic_string
+ {
+ typedef typename __gnu_cxx::__alloc_traits <_Alloc >::template rebind < _CharT >::other _Char_alloc_type;
+ typedef __gnu_cxx::__alloc_traits < _Char_alloc_type > _Alloc_traits;
+ typedef typename _Alloc_traits::size_type size_type;
+
+ public:
+ size_type size ()const noexcept
+ {
+ }
+ const _CharT *data () const noexcept
+ {
+ }
+ };
+ }
+
+ template < typename _CharT > inline typename __gnu_cxx::__enable_if <
+ __is_char < _CharT >::__value,
+ bool >::__type operator== (const basic_string < _CharT > &__lhs,
+ const basic_string < _CharT > &__rhs) noexcept
+ {
+ return !std::char_traits < _CharT >::compare (__lhs.data (),
+ __rhs.data (),
+ __lhs.size ());
+ }
+};
+
+class CLIParameterType
+{
+ const std::string & getSwitchOption (unsigned int i) const
+ {
+ } unsigned int getSwitchOptionCount () const
+ {
+ } int checkSwitched (const std::string & value) const;
+};
+
+int
+CLIParameterType::checkSwitched (const std::string & value) const
+{
+ int contains = false;
+ for (unsigned int i = 0; !contains && i < getSwitchOptionCount () ;)
+ contains = getSwitchOption (i) == value;
+}
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 5e2d7db..700d6ce 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1867,6 +1867,8 @@ handle_builtin_memcmp (gimple_stmt_iterator *gsi)
{
gimple *ustmt = USE_STMT (use_p);
+ if (is_gimple_debug (ustmt))
+ continue;
if (gimple_code (ustmt) == GIMPLE_ASSIGN)
{
gassign *asgn = as_a <gassign *> (ustmt);