From 05550e5b8b1877318d13845b31d1dbb28cce0d9d Mon Sep 17 00:00:00 2001 From: aldyh Date: Mon, 19 Dec 2011 19:33:05 +0000 Subject: [PATCH] Commit forgotten testcase that goes along with this PR. PR middle-end/51411 * trans-mem.c (ipa_tm_create_version): Unset DECL_WEAK. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182493 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/g++.dg/tm/pr51411-2.C | 49 +++++++++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/tm/pr51411.C | 7 ++++++ 2 files changed, 56 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tm/pr51411-2.C create mode 100644 gcc/testsuite/g++.dg/tm/pr51411.C diff --git a/gcc/testsuite/g++.dg/tm/pr51411-2.C b/gcc/testsuite/g++.dg/tm/pr51411-2.C new file mode 100644 index 0000000..4105d66 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr51411-2.C @@ -0,0 +1,49 @@ +// { dg-do compile } +// { dg-options "-fgnu-tm -O0" } + +namespace std { +template struct char_traits; + +template class allocator { +}; + +template struct less { + bool operator()(const _Tp& __x, const _Tp& __y) const { + return __x < __y; + } +}; + +template > class map { +public: + _Compare _M_key_compare; + bool find(const _Key& __x) { + return _M_key_compare(__x, __x); + } +}; + +template, typename _Alloc = allocator<_CharT> > class basic_string { +public: + bool compare(const basic_string& __str) const { + return 0; + } +}; + +typedef basic_string string; + +template +inline bool operator<(const basic_string<_CharT, _Traits>& __lhs, const basic_string<_CharT, _Traits>& __rhs) { + return __lhs.compare(__rhs); +} + +extern template class basic_string; + +} + +std::map units; + +__attribute__((transaction_callable)) +void get(const std::string &name) { + units.find(name); +} + +// { dg-final { scan-assembler "_ZGTtNKSs7compareERKSs:" } } diff --git a/gcc/testsuite/g++.dg/tm/pr51411.C b/gcc/testsuite/g++.dg/tm/pr51411.C new file mode 100644 index 0000000..df20b87 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr51411.C @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options "-fgnu-tm -O" } + +struct A +{ + __attribute__ ((transaction_safe)) virtual void virtfoo () { } +}; -- 2.7.4