summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/noreturn-1.C
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/opt/noreturn-1.C
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/noreturn-1.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/noreturn-1.C87
1 files changed, 87 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/noreturn-1.C b/gcc/testsuite/g++.dg/opt/noreturn-1.C
new file mode 100644
index 000000000..9b2fc0cf1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/noreturn-1.C
@@ -0,0 +1,87 @@
+// PR optimization/12965
+// Origin: <qboosh@pld-linux.org>
+// Reduced testcase: Falk Hueffner <falk@debian.org>
+
+// This ICEd on Alpha because the reload pass emitted save/restore
+// insns around a no-return call.
+
+// { dg-do compile }
+// { dg-options "-O2" }
+
+template <typename _Alloc> class allocator;
+template <class _CharT> struct char_traits;
+template <typename _CharT,
+ typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+class basic_string;
+typedef basic_string<char> string;
+
+static inline int __exchange_and_add(volatile int * __mem, int __val) {
+ int __result;
+ asm("" : "=&r"(__result));
+ return __result;
+}
+
+template<typename _Tp> struct allocator {
+ allocator() throw() { }
+ allocator(const allocator &) throw() {}
+};
+
+template<typename _CharT, typename _Traits, typename _Alloc>
+struct basic_string {
+ typedef _Alloc allocator_type;
+ struct _Rep {
+ int _M_references;
+ void _M_dispose(const _Alloc & __a) {
+ if (__exchange_and_add(&_M_references, -1) <= 0)
+ _M_destroy(__a);
+ } void _M_destroy(const _Alloc &) throw();
+ };
+ struct _Alloc_hider : _Alloc {
+ _CharT *_M_p;
+ };
+ mutable _Alloc_hider _M_dataplus;
+ _CharT *_M_data() const { return _M_dataplus._M_p; }
+ _Rep *_M_rep() const {
+ return &((reinterpret_cast<_Rep *>(_M_data()))[-1]);
+ }
+ basic_string();
+ basic_string(const _CharT * __s, const _Alloc & __a = _Alloc());
+ ~basic_string() {
+ _M_rep()->_M_dispose(this->get_allocator());
+ }
+ allocator_type get_allocator() const { return _M_dataplus; }
+};
+
+struct Egeneric {
+ void stack(const string & passage, const string & message = "") { }
+};
+
+struct infinint {
+ void detruit() throw(Egeneric);
+ template<class T> void infinint_from(T a) throw(Egeneric);
+ infinint(long a = 0) throw(Egeneric) {
+ try {
+ infinint_from(a);
+ } catch(Egeneric& e) {
+ e.stack("infinint::infinint", "long");
+ }
+ }
+ ~infinint() throw(Egeneric) {
+ try {
+ detruit();
+ } catch(Egeneric& e) { }
+ }
+};
+
+struct inode {
+ string x;
+ infinint a, c;
+ infinint ea_offset;
+ inode();
+};
+
+inode::inode()
+{
+ ea_offset = 0;
+}