From 1147e84e7bfea55331be6b2ebfcb12fa555943a0 Mon Sep 17 00:00:00 2001 From: No Author Date: Thu, 11 Dec 2003 07:48:07 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'gcc-3_3-branch'. From-SVN: r74529 --- gcc/testsuite/g++.dg/opt/noreturn-1.C | 87 +++++++++++++++++++++ gcc/testsuite/g77.f-torture/compile/13060.f | 13 +++ gcc/testsuite/gcc.dg/overflow-1.c | 25 ++++++ 3 files changed, 125 insertions(+) create mode 100644 gcc/testsuite/g++.dg/opt/noreturn-1.C create mode 100644 gcc/testsuite/g77.f-torture/compile/13060.f create mode 100644 gcc/testsuite/gcc.dg/overflow-1.c 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 000000000000..9b2fc0cf16a8 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/noreturn-1.C @@ -0,0 +1,87 @@ +// PR optimization/12965 +// Origin: +// Reduced testcase: Falk Hueffner + +// This ICEd on Alpha because the reload pass emitted save/restore +// insns around a no-return call. + +// { dg-do compile } +// { dg-options "-O2" } + +template class allocator; +template struct char_traits; +template , + typename _Alloc = allocator<_CharT> > +class basic_string; +typedef basic_string string; + +static inline int __exchange_and_add(volatile int * __mem, int __val) { + int __result; + asm("" : "=&r"(__result)); + return __result; +} + +template struct allocator { + allocator() throw() { } + allocator(const allocator &) throw() {} +}; + +template +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 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; +} diff --git a/gcc/testsuite/g77.f-torture/compile/13060.f b/gcc/testsuite/g77.f-torture/compile/13060.f new file mode 100644 index 000000000000..200117b02711 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/compile/13060.f @@ -0,0 +1,13 @@ + subroutine geo2() + implicit none + + integer ms,n,ne(2) + + ne(1) = 1 + ne(2) = 2 + ms = 1 + + call call_me(ne(1)*ne(1)) + + n = ne(ms) + end diff --git a/gcc/testsuite/gcc.dg/overflow-1.c b/gcc/testsuite/gcc.dg/overflow-1.c new file mode 100644 index 000000000000..db51a5ef129e --- /dev/null +++ b/gcc/testsuite/gcc.dg/overflow-1.c @@ -0,0 +1,25 @@ +/* PR optimization/13318 */ +/* Origin: */ +/* Reduced testcase: Wolfgang Bangerth */ + +/* Verify that the big multiplier doesn't cause an integer + overflow in the loop optimizer. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct S { + int key; + int rnext,rprev; +}; + +void foo(struct S* H) +{ + int i, k; + for (i=0; i<2; i++){ + struct S* cell=H+k; + cell->key=i*(0xffffffffUL/2); + cell->rnext=k+(1-i); + cell->rprev=k+(1-i); + } +} -- 2.47.2