URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-src/gcc-4.2.2/gcc/testsuite/g++.dg/opt
- from Rev 149 to Rev 154
- ↔ Reverse comparison
Rev 149 → Rev 154
/nrv9.C
0,0 → 1,28
// PR c++/19317 |
// If we do both NRV and caller-side return slot opt for ga = f() |
// constructing la sets ga.i to 0 too soon. |
|
extern "C" void abort(); |
|
struct A |
{ |
int i; |
int pad[32]; // force return in memory |
A(): i(0) {} |
A(int ia): i(ia) {} |
}; |
|
A ga(42); |
|
A f() |
{ |
A la; |
if (ga.i != 42) |
abort(); |
return la; |
} |
|
int main() |
{ |
ga = f (); |
} |
nrv9.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr19768.C
===================================================================
--- pr19768.C (nonexistent)
+++ pr19768.C (revision 154)
@@ -0,0 +1,29 @@
+// PR tree-opt/19768
+// tree DSE was removing one store to LL.currentLevel
+// but forgot that since the vop was in an abnormal PHI
+// that we have to update the SSA_NAME which we propagate
+// into the abnormal PHI
+
+// { dg-do compile }
+// { dg-options "-O" }
+
+struct LeveLogger
+{
+ int currentLevel;
+};
+extern LeveLogger LL;
+struct gg
+{
+ ~gg ( void )
+ { LL.currentLevel = 1; }
+};
+void f(void);
+void g ( void )
+{
+ gg sll;
+ {
+ gg sll;
+ f();
+ }
+ f();
+}
pr19768.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: rtti2.C
===================================================================
--- rtti2.C (nonexistent)
+++ rtti2.C (revision 154)
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+// We used to ICE in compare_values as the types for a comparison
+// were not the same kind of types.
+
+struct class1
+{
+ virtual ~class1 ();
+};
+struct class2 : class1 { };
+
+void f(class1 * oo)
+{
+ class2 * oj = dynamic_cast (oo) ;
+ if (oj)
+ delete oo;
+}
rtti2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv10.C
===================================================================
--- nrv10.C (nonexistent)
+++ nrv10.C (revision 154)
@@ -0,0 +1,48 @@
+// PR c++/25979
+// Bug: we were eliding too many temporaries, so that a1 was used
+// as both 'a' and 'x' in the second operator+.
+// { dg-do run }
+
+struct A
+{
+ A() : data1_(0), data2_(0) {}
+ A(int i, int j) : data1_(i), data2_(j) {}
+ A operator+(int);
+ friend A operator+(int, const A&);
+ ~A() {}
+//private:
+ int data1_;
+ int data2_;
+};
+
+extern bool x;
+
+extern "C" void abort ();
+
+int main()
+{
+ A a1(1,2);
+ a1 = (x ? a1 + 3 : 3 + a1);
+ if (a1.data1_ != 3 || a1.data2_ != 2)
+ abort ();
+}
+
+bool x = false;
+
+A
+A::operator+(int i)
+{
+ A a;
+ a = *this;
+ a.data2_ = i;
+ return a;
+}
+
+A
+operator+(int i, const A& x)
+{
+ A a;
+ a = x;
+ a.data1_ = i;
+ return a;
+}
nrv10.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: vt1.C
===================================================================
--- vt1.C (nonexistent)
+++ vt1.C (revision 154)
@@ -0,0 +1,11 @@
+// Test whether vtable for S is not put into read-only section.
+// { dg-do compile { target fpic } }
+// { dg-options "-O2 -fpic -fno-rtti" }
+// Origin: Jakub Jelinek
+
+struct S
+{
+ virtual void vm (void) {};
+} x;
+
+// { dg-final { scan-assembler-not "section\[^\n\r\]*_ZTV1S\[^\n\r\]*\"\[^w\"\n\r\]*\"" } }
vt1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: static3.C
===================================================================
--- static3.C (nonexistent)
+++ static3.C (revision 154)
@@ -0,0 +1,36 @@
+// { dg-do link }
+// { dg-options "-O2" }
+
+class Foo {
+public:
+ // No out-of-class definition is provided for these class members.
+ // That's technically a violation of the standard, but no diagnostic
+ // is required, and, as a QOI issue, we should optimize away all
+ // references.
+ static const int erf = 0;
+ static const int foo = 1;
+};
+
+int one()
+{
+ return Foo::foo;
+}
+
+int two()
+{
+ return Foo::foo + Foo::erf;
+}
+
+int three(int x)
+{
+ return x ? Foo::erf : Foo::foo;
+}
+
+int i;
+
+int main ()
+{
+ one ();
+ two ();
+ three (i);
+}
static3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv14.C
===================================================================
--- nrv14.C (nonexistent)
+++ nrv14.C (revision 154)
@@ -0,0 +1,39 @@
+// PR c++/32992
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+struct A
+{
+ long int a1;
+ long int a2;
+ long int a3;
+};
+
+struct B
+{
+ long int f[3];
+ operator A ()
+ {
+ union
+ {
+ long int t[3];
+ A a;
+ };
+ for (int i = 0; i < 3; i++)
+ t[i] = f[i];
+ return a;
+ }
+};
+
+int
+main ()
+{
+ B b = { {1, 3, 5} };
+ A a = b;
+
+ if (a.a1 != b.f[0] || a.a2 != b.f[1] || a.a3 != b.f[2])
+ abort ();
+ return 0;
+}
nrv14.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: alias2.C
===================================================================
--- alias2.C (nonexistent)
+++ alias2.C (revision 154)
@@ -0,0 +1,74 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" int printf (const char*, ...);
+
+struct _Deque_iterator {
+ int _M_cur;
+ int x[2];
+ int* _M_node;
+
+ _Deque_iterator() : _M_cur(0), _M_node(0) {}
+ _Deque_iterator(const _Deque_iterator& __x)
+ : _M_cur(__x._M_cur),
+ _M_node(__x._M_node) {}
+};
+
+class _Deque_base
+{
+public:
+ int yy;
+
+ _Deque_base()
+ : _M_start()
+ { _M_initialize_map(); }
+ ~_Deque_base();
+
+ void _M_initialize_map();
+ _Deque_iterator _M_start;
+};
+
+
+_Deque_base::~_Deque_base() {
+ printf ("bb %x %x\n", this, *_M_start._M_node);
+}
+
+void
+_Deque_base::_M_initialize_map()
+{
+ yy = 0x123;
+ printf ("aa %x %x\n", this, yy);
+
+ _M_start._M_node = &yy;
+ _M_start._M_cur = yy;
+}
+
+
+class deque : protected _Deque_base
+{
+public:
+ deque () {}
+ deque(const deque& __x) {}
+ ~deque() {
+ _Deque_iterator i = _M_start;
+ }
+};
+
+
+
+class GeometryAddress {
+public:
+ GeometryAddress(deque addressStack) {}
+};
+
+void yyy (const GeometryAddress& gb)
+{
+}
+
+deque temp1;
+
+int main()
+{
+ yyy (GeometryAddress (temp1));
+ return 0;
+}
alias2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: operator1.C
===================================================================
--- operator1.C (nonexistent)
+++ operator1.C (revision 154)
@@ -0,0 +1,10 @@
+// Tests whether g++ can handle large number of operators
+// { dg-do compile }
+
+#define OP0(n) struct I##n { int i; }; operator I##n ();
+#define OP1(n) OP0(n)
+#define OP2(n) OP1(n##0) OP1(n##1) OP1(n##2) OP1(n##3) OP1(n##4)
+#define OP3(n) OP2(n##0) OP2(n##1) OP2(n##2) OP2(n##3) OP2(n##4)
+struct S {
+ OP3(0) OP3(1) OP3(2) OP3(3) OP3(4) OP3(5)
+};
operator1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17411-1.C
===================================================================
--- pr17411-1.C (nonexistent)
+++ pr17411-1.C (revision 154)
@@ -0,0 +1,21 @@
+// PR middle-end/17411
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct CalibData {
+ float mean_pedestal;
+};
+
+struct pair
+{
+ CalibData second;
+ pair(const CalibData& __b) : second(__b) { }
+};
+
+void insert(const pair& __x);
+
+void foo()
+{
+ insert(pair(CalibData()));
+}
+
pr17411-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline10.C
===================================================================
--- inline10.C (nonexistent)
+++ inline10.C (revision 154)
@@ -0,0 +1,20 @@
+// PR c++/25010
+// { dg-options "-O2" }
+
+#pragma interface
+
+struct T
+{
+ T *p;
+
+ void baz ()
+ {
+ p->baz ();
+ }
+};
+
+void foo (T *p)
+{
+ p->baz ();
+}
+
inline10.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: return-slot1.C
===================================================================
--- return-slot1.C (nonexistent)
+++ return-slot1.C (revision 154)
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A
+{
+ A();
+ virtual A foo() const;
+};
+
+void bar()
+{
+ const A& a=A();
+ a.foo();
+}
return-slot1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr14029.C
===================================================================
--- pr14029.C (nonexistent)
+++ pr14029.C (revision 154)
@@ -0,0 +1,41 @@
+// { dg-do run }
+// { dg-options "-O2" }
+// We used to mis-compile this testcase as we did not know that
+// &a+offsetof(b,a) was the same as &a.b
+
+struct Iterator {
+ int * ptr;
+
+ Iterator(int * i) : ptr(i) { }
+ void operator++() { ++ptr; }
+ int *const & base() const { return ptr; }
+};
+
+
+Iterator find_7(Iterator first, Iterator last)
+{
+ int trip_count = (last.base() - first.base()) >> 1;
+
+ for ( ; trip_count > 0 ; --trip_count) {
+ if (*first.ptr == 7) return first;
+ ++first;
+
+ if (*first.ptr == 7) return first;
+ ++first;
+ }
+
+ switch(last.base() - first.base()) {
+ case 1:
+ if (*first.ptr == 7) return first;
+ ++first;
+ case 0:
+ default:
+ return last;
+ }
+}
+
+int main() {
+ int as[5] = {4,4,4,4,7};
+ return (find_7(Iterator(&as[0]), Iterator(&as[5])).ptr == &as[5]);
+};
+
pr14029.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: switch1.C
===================================================================
--- switch1.C (nonexistent)
+++ switch1.C (revision 154)
@@ -0,0 +1,23 @@
+// { dg-options "-O1" }
+
+template
+int f(T t) {
+ switch (t) {
+ case 1:
+ return 5;
+ case 2:
+ return 6;
+ case 3:
+ return -4;
+ case 4:
+ return 8;
+ case 5:
+ return 12;
+ case 6:
+ return 13;
+ default:
+ return -27;
+ }
+}
+
+template int f(int);
switch1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr23714.C
===================================================================
--- pr23714.C (nonexistent)
+++ pr23714.C (revision 154)
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions" }
+
+void run (void) {
+ float stack[1];
+ float *sp = stack;
+ try
+ {
+ float value2 = ((float) *(--sp));
+ float value1 = ((float) *(--sp));
+ *(sp++) = (value1 - value2);
+ }
+ catch (int *ex)
+ {
+ }
+}
pr23714.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr22167.C
===================================================================
--- pr22167.C (nonexistent)
+++ pr22167.C (revision 154)
@@ -0,0 +1,32 @@
+// Derived from PR22167, which failed on some RISC targets. The call to
+// foo() has two successors, one normal and one exceptional, and both
+// successors use &a[0] and x. Expressions involving &a[0] can be hoisted
+// before the call but those involving x cannot.
+// { dg-options "-Os" }
+// { dg-do run }
+
+int a[4];
+
+struct S {
+ S() : x (0) {}
+ ~S() { a[0] = x; }
+ int x;
+};
+
+void
+foo (int *x)
+{
+ if (*x == 1)
+ throw 1;
+ *x = 1;
+}
+
+int
+main()
+{
+ S s;
+ foo (&s.x);
+ if (a[0] == s.x)
+ a[0]++;
+ return a[0];
+}
pr22167.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cfg4.C
===================================================================
--- cfg4.C (nonexistent)
+++ cfg4.C (revision 154)
@@ -0,0 +1,45 @@
+// PR optimization/13067
+// Origin:
+
+// This used to fail on the tree-ssa because of "out-of-ssa"
+// We might have a valid variable, but not a valid value when trying to find
+// useless statements created by out-of-ssa translation. In this case
+// val will be set to null, then later dereferenced. Bad.
+
+// { dg-do compile }
+// { dg-options "-Os" }
+
+
+
+struct Iterator
+{
+ Iterator operator++();
+};
+
+void GetChar(char* aChar);
+
+void foo(char aChar)
+{
+ char quote;
+ Iterator end;
+
+ while (1) {
+ if (aChar == '"')
+ GetChar(&aChar);
+
+ switch (aChar) {
+ case 'a':
+ ++end;
+ if (quote) {
+ if (quote == aChar) {
+ quote = 0;
+ }
+ } else {
+ quote = aChar;
+ }
+ }
+ }
+}
+
+
+
cfg4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr23454.C
===================================================================
--- pr23454.C (nonexistent)
+++ pr23454.C (revision 154)
@@ -0,0 +1,41 @@
+/* PR rtl-optimization/23454 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void foo ();
+int a, b;
+char c;
+long long d, e;
+
+static inline int
+bar (const long long s, const long long t)
+{
+ return ((s < t) ? -1 : s > t ? 1 : 0);
+}
+
+int fn ();
+int f;
+
+void
+baz (int x)
+{
+ long long g = fn ();
+ if (f)
+ {
+ b++;
+ return;
+ }
+ if (g == 0)
+ a++;
+ if (x)
+ foo ();
+ if (!c)
+ c = 1;
+ else if (g != 0)
+ {
+ if (bar (g, d) < 0)
+ d = g;
+ if (bar (g, e) > 0)
+ e = g;
+ }
+}
pr23454.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr19317-1.C
===================================================================
--- pr19317-1.C (nonexistent)
+++ pr19317-1.C (revision 154)
@@ -0,0 +1,39 @@
+// PR c++/19317
+// { dg-options "-O2" }
+// { dg-do run }
+// Origin: Dirk Mueller
+
+extern "C" void abort (void);
+
+struct A
+{
+ A () { d = e = 0; f = -1; }
+ A (int x) : d (0), e (0), f (x) { }
+ A b (const A &r) const;
+ int d;
+ int e;
+ int f;
+};
+
+A
+A::b (const A & r) const
+{
+ A t;
+ t.f = f < r.f ? f : r.f;
+ return t;
+}
+
+int
+main ()
+{
+ A a (100);
+ a = a.b (A (10));
+ if (a.f != 10)
+ abort ();
+
+ A c (10);
+ A d (100);
+ c = d.b (c);
+ if (c.f != 10)
+ abort ();
+}
pr19317-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr19650.C
===================================================================
--- pr19650.C (nonexistent)
+++ pr19650.C (revision 154)
@@ -0,0 +1,71 @@
+// { dg-options "-O1 -w -fpermissive" }
+// { dg-do "run" }
+// Tests the fold bug described in PR 19650.
+#include
+#include
+#define test(a) ((a) ? 1 : 0)
+
+typedef int (*arg_cmp_func)();
+
+class Item_func
+{
+public:
+ enum Functype { UNKNOWN_FUNC, EQ_FUNC, EQUAL_FUNC };
+ virtual enum Functype functype() const { return UNKNOWN_FUNC; }
+};
+
+class Item_bool_func2 : public Item_func
+{
+public:
+ virtual enum Functype functype() const { return EQUAL_FUNC; }
+};
+
+class Arg_comparator
+{
+public:
+ Item_bool_func2 *owner;
+ arg_cmp_func func;
+ static arg_cmp_func comparator_matrix[4][2];
+
+ int Arg_comparator::set_compare_func(Item_bool_func2 *item, int type)
+ {
+ owner = item;
+
+ /****************** problematic line is here ************************/
+
+ func = comparator_matrix[type][test(owner->functype() == Item_func::EQUAL_FUNC)];
+ return 0;
+ }
+};
+
+int compare_string() { return 0; }
+int compare_e_string() { return 0; }
+int compare_real() { return 0; }
+int compare_e_real() { return 0; }
+int compare_int_signed() { return 0; }
+int compare_e_int() { return 0; }
+int compare_row() { return 0; }
+int compare_e_row() { return 0; }
+
+arg_cmp_func Arg_comparator::comparator_matrix[4][2] =
+ {{&compare_string, &compare_e_string},
+ {&compare_real, &compare_e_real},
+ {&compare_int_signed, &compare_e_int},
+ {&compare_row, &compare_e_row}};
+
+void myfunc (const char*p, arg_cmp_func f1, arg_cmp_func f2) __attribute__((noinline));
+void myfunc (const char*p, arg_cmp_func f1, arg_cmp_func f2)
+{
+ if (f1!=f2)
+ abort ();
+}
+
+int main()
+{
+ Arg_comparator cmp;
+ Item_bool_func2 equal_func;
+
+ cmp.set_compare_func(&equal_func, 0);
+ myfunc("cmp.func is %p (expected %p)\n", cmp.func, &compare_e_string);
+}
+
pr19650.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: interface1.h
===================================================================
--- interface1.h (nonexistent)
+++ interface1.h (revision 154)
@@ -0,0 +1,8 @@
+#pragma interface "interface1.h"
+
+struct Test {
+ void f();
+};
+
+inline void Test::f() {
+}
interface1.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: reload2.C
===================================================================
--- reload2.C (nonexistent)
+++ reload2.C (revision 154)
@@ -0,0 +1,42 @@
+// PR 10352
+// { dg-do compile }
+// { dg-options -O2 }
+
+extern double fabs(double x);
+
+typedef struct { float x, y; } S;
+typedef struct _T T;
+
+extern void fT( T *p );
+extern T *h();
+extern S g( );
+
+static
+int f(void)
+{
+ T *t=0;
+ int c=0;
+ S s;
+
+ const S exp_s = {0.,0.};
+
+ if(!(t = h()))
+ {
+ c++;
+ }
+
+ if(!c)
+ {
+ s = g();
+ if( (fabs( (s.x) - (exp_s.x) ) > 1 )
+ || (fabs( (s.y) - (exp_s.y) ) > 1 ) )
+ {
+ c++;
+ }
+ }
+
+ if(t)
+ fT(t);
+
+ return c;
+}
reload2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: dtor1.C
===================================================================
--- dtor1.C (nonexistent)
+++ dtor1.C (revision 154)
@@ -0,0 +1,27 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+int i;
+
+struct S {
+ S ();
+ S (const S&);
+ ~S ();
+};
+
+S::S () { ++i; }
+S::S (const S&) { ++i; }
+S::~S () { --i; }
+
+inline void f (S) {
+}
+
+int main () {
+ {
+ S s;
+ f (s);
+ }
+
+ return i;
+}
+
dtor1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: complex4.C
===================================================================
--- complex4.C (nonexistent)
+++ complex4.C (revision 154)
@@ -0,0 +1,16 @@
+// PR 24362
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef __complex__ double cdouble;
+cdouble elt_zero();
+const cdouble *pointer();
+
+cdouble trace(void)
+{
+ cdouble output = elt_zero();
+ const cdouble *data = pointer();
+ output += data[1];
+ return output;
+}
+
complex4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cse1.C
===================================================================
--- cse1.C (nonexistent)
+++ cse1.C (revision 154)
@@ -0,0 +1,12 @@
+// PR optimization/6759
+// This testcase ICEd on SPARC because folded REG_EQUAL
+// note was note stored back and fold_rtx left invalid rtx
+// in it.
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A
+{
+ long long a;
+ A (unsigned short d) : a (d) {}
+} x (65535);
cse1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: template1.C
===================================================================
--- template1.C (nonexistent)
+++ template1.C (revision 154)
@@ -0,0 +1,19 @@
+// { dg-options "-O2" }
+// { dg-final { scan-assembler-not "\n_?_ZN1AILi0EE4foo1Ev\[: \t\n\]" } }
+
+template
+struct A {
+ void foo1 () throw ();
+ void foo2 ();
+
+ void UNRELATED ();
+};
+
+template <> void A<0>::UNRELATED ();
+
+template inline void A::foo1 () throw () {}
+template inline void A::foo2 () {}
+
+void bar (A<0> &a) {
+ a.foo1 ();
+}
template1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr25857.C
===================================================================
--- pr25857.C (nonexistent)
+++ pr25857.C (revision 154)
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int foo();
+int i;
+
+struct A
+{
+ ~A() { if (this != (A*)(&i)) foo(); }
+};
+
+struct B
+{
+ A a1, a2, a3, a4;
+ ~B() { foo(); }
+};
+
+B b;
pr25857.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: unroll2.C
===================================================================
--- unroll2.C (nonexistent)
+++ unroll2.C (revision 154)
@@ -0,0 +1,27 @@
+// PR tree-opt/28937
+// Complete unroll forgot to update the statement usage
+// which meant we ICEd in add_virtual_operand.
+
+// { dg-do compile }
+// { dg-options "-O2" }
+
+
+class SHA256
+{
+ unsigned m_digest;
+ unsigned long long m_count;
+ unsigned char _buffer[64];
+ static void Transform (unsigned * data);
+ void WriteByteBlock (unsigned t);
+};
+void SHA256::WriteByteBlock (unsigned t)
+{
+ unsigned data32[16];
+ Transform (data32);
+ unsigned long long lenInBits = m_count;
+ if (t != (64 - 8))
+ return;
+ for (int i = 0; i < 2; i++)
+ _buffer[t++] = (unsigned char)lenInBits;
+}
+
unroll2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr14888.C
===================================================================
--- pr14888.C (nonexistent)
+++ pr14888.C (revision 154)
@@ -0,0 +1,22 @@
+// PR target/14888
+// This used to ICE because the truncdfsf2 isn't completely eliminated
+
+// { dg-do compile }
+// { dg-options "-O2 -ffast-math" }
+
+class xcomplex
+{
+public:
+ float re, im;
+
+ xcomplex &operator*= (const float &fact)
+ { re*=fact; im*=fact; return *this; }
+};
+
+void foo (xcomplex &almT, xcomplex &almG)
+{
+ double gb;
+ almT*=gb;
+ almG*=gb*42;
+}
+
pr14888.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17697-3.C
===================================================================
--- pr17697-3.C (nonexistent)
+++ pr17697-3.C (revision 154)
@@ -0,0 +1,28 @@
+// PR tree-optimization/17697
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" int strcmp (const char *s, const char *t);
+
+namespace A
+{
+ extern int strcmp (const char *s, const char *t);
+}
+
+inline int
+A::strcmp (const char *s, const char *t)
+{
+ return ::strcmp (s, t);
+}
+
+int
+foo (const char *x)
+{
+ return A::strcmp ("", x);
+}
+
+int
+main ()
+{
+ return foo ("") != 0 || foo ("a") == 0;
+}
pr17697-3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline2.C
===================================================================
--- inline2.C (nonexistent)
+++ inline2.C (revision 154)
@@ -0,0 +1,18 @@
+// { dg-do link }
+// { dg-options "-O1 -finline-functions" }
+
+static void g ();
+
+void f()
+{
+ void g();
+ g();
+}
+
+void g()
+{
+}
+
+int main () {
+ f ();
+}
inline2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: asm2.C
===================================================================
--- asm2.C (nonexistent)
+++ asm2.C (revision 154)
@@ -0,0 +1,11 @@
+/* PR inline-asm/15740 */
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+void foo(void)
+{
+ int a, b;
+ a = 1;
+ b = a + 1;
+ asm ("" : : "m" (a));
+}
asm2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: reg-stack2.C
===================================================================
--- reg-stack2.C (nonexistent)
+++ reg-stack2.C (revision 154)
@@ -0,0 +1,34 @@
+// PR target/9786
+// Origin:
+
+// This used to fail on x86 because the reg-stack pass deleted
+// an insn that could seemingly trap (but actually doesn't)
+// without updating the CFG.
+
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions" }
+
+struct D1 {
+ float l;
+ D1 GS() const {D1 d;float f=.299*l;d.l=f;return d;}
+ static D1 G() {return D1();}
+};
+
+struct D2 {
+ D1 g;
+ D2(const D1& gi) : g(gi) {}
+ D2 GS() const {return D2(g.GS());}
+};
+
+class A {
+ public:
+ virtual ~A() {}
+};
+
+class B : public A {
+ public:
+ B(const D2& mi);
+ D2 fm;
+};
+
+B::B(const D2 &mi) : fm(mi.GS()) {}
reg-stack2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: bitfield1.C
===================================================================
--- bitfield1.C (nonexistent)
+++ bitfield1.C (revision 154)
@@ -0,0 +1,18 @@
+// PR c++/26534
+// { dg-do run }
+// { dg-options "-w -O2" }
+
+struct X
+{
+ unsigned a:4;
+};
+
+unsigned i;
+
+int main()
+{
+ struct X x = { 63u };
+ i = x.a;
+ if (i != 15)
+ return 1;
+}
bitfield1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline6.C
===================================================================
--- inline6.C (nonexistent)
+++ inline6.C (revision 154)
@@ -0,0 +1,14 @@
+// PR c++/13081
+// { dg-options "-O2" }
+// { dg-final { scan-assembler-not "\n_?_Z3fooIlET_S0_\[: \t\n\]" } }
+
+template T foo(T);
+
+template inline T foo(T t)
+{
+ return t;
+}
+
+void bar (long& l) {
+ l = foo(l);
+}
inline6.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: range-test-1.C
===================================================================
--- range-test-1.C (nonexistent)
+++ range-test-1.C (revision 154)
@@ -0,0 +1,216 @@
+// Test fold-const.c (fold_range_test) optimizations.
+// { dg-do run } */
+// { dg-options "-O2" } */
+
+#ifndef __RANGE_TEST_HDR_INCL
+#define __RANGE_TEST_HDR_INCL
+/* Protect against fix-header weakness */
+#include
+#include
+#include
+#endif
+
+#if (INT_MAX == 2147483647) && (INT_MIN == -2147483648) \
+ && (SCHAR_MIN == -128) && (SCHAR_MAX == 127) \
+ && (UCHAR_MIN == 0) && (UCHAR_MAX == 255)
+
+#ifndef T
+
+enum integers
+{
+ int_smallest = INT_MIN,
+ int_2ndsmallest = INT_MIN + 1,
+ int_3rdsmallest = INT_MIN + 2,
+ int_minus2 = -2,
+ int_minus1 = -1,
+ int_zero = 0,
+ int_one = 1,
+ int_two = 2,
+ int_3rdlargest = INT_MAX - 2,
+ int_2ndlargest = INT_MAX - 1,
+ int_largest = INT_MAX
+};
+
+enum smallenum
+{
+ smalle_minus4 = -4,
+ smalle_minus3 = -3,
+ smalle_minus2 = -2,
+ smalle_minus1 = -1,
+ smalle_zero = 0,
+ smalle_one = 1,
+ smalle_two = 2,
+ smalle_three = 3
+};
+
+enum enum2
+{
+ enum2_two = 2,
+ enum2_three = 3,
+ enum2_four = 4,
+ enum2_five = 5
+};
+
+enum enum3
+{
+ enum3_zero,
+ enum3_one,
+ enum3_two,
+ enum3_three,
+ enum3_four,
+ enum3_five,
+ enum3_six,
+ enum3_seven
+};
+
+int var;
+void
+check ()
+{
+ ++var;
+}
+
+#define T(IDX, TYPE, TEST, YESARR, NOARR) \
+void __attribute__((noinline)) \
+test##IDX (TYPE x) \
+{ \
+ if (TEST) \
+ check (); \
+}
+#include "range-test-1.C"
+#undef T
+
+int
+main ()
+{
+ int i, fails = 0;
+
+#define C ,
+#define T(IDX, TYPE, TEST, YESARR, NOARR) \
+ { \
+ static TYPE yesarr##IDX [] = YESARR; \
+ static TYPE noarr##IDX [] = NOARR; \
+ for (i = 0; i < (int) (sizeof (yesarr##IDX) / sizeof (TYPE)); ++i) \
+ { \
+ var = 0; \
+ test##IDX (yesarr##IDX [i]); \
+ if (var != 1) \
+ printf ("test" #IDX " failed for yesarr [%u]\n", i), ++fails; \
+ } \
+ var = 0; \
+ for (i = 0; i < (int) (sizeof (noarr##IDX) / sizeof (TYPE)); ++i) \
+ { \
+ test##IDX (noarr##IDX [i]); \
+ if (var != 0) \
+ printf ("test" #IDX " failed for noarr [%u]\n", i), ++fails; \
+ } \
+ }
+#include "range-test-1.C"
+#undef T
+
+ if (fails)
+ abort ();
+
+ exit (0);
+}
+
+#else
+
+/* Use `C' instead of `,' below to separate array entries. */
+
+/* These ought to be all optimized into single comparison. */
+T(1, unsigned int, x == 0 || x == 1,
+ { 0 C 1 }, { -1U C 2 C 12 C 35 C 0x7fffffff C 0x80000000 })
+T(2, unsigned int, x == 0 || x == -1U || x == -2U,
+ { 0 C -1U C -2U }, { -3U C -6U C 1 C 2 C 12 C 35 C 0x7fffffff C 0x80000000 })
+T(3, unsigned int, x == 0 || x == 1 || x == 2,
+ { 0 C 1 C 2 }, { -3U C -6U C -1U C -2U C 12 C 35 C 0x7fffffff C 0x80000000 })
+T(4, unsigned int, x == 3 || x == 4 || x == 5 || x == 6,
+ { 3 C 4 C 5 C 6 }, { -3U C 0 C 1 C 2 C 7 C 8 C 12 C 0x7fffffff C 0x80000000 })
+T(5, unsigned int, x == -3U || x == -4U || x == -5U || x == -6U,
+ { -3U C -4U C -5U C -6U }, { -7U C -8U C -2U C -1U C 1 C 2 C 0x7fffffff C 0x80000000 })
+T(6, unsigned int, x == -3U || x == -4U || x == -5U,
+ { -3U C -4U C -5U }, { -6U C -7U C -8U C -2U C -1U C 1 C 2 C 0x7fffffff C 0x80000000 })
+T(7, char *, x == (char *) -3UL || x == (char *) -4UL || x == (char *) -5UL,
+ { (char *) -3UL C (char *) -4UL C (char *) -5UL },
+ { (char *) -6UL C (char *) -20UL C (char *) -2UL C (char *) -1UL C (char *) 0
+ C (char *) 1UL C (char *) 35UL C (char *) 0x7fffffffUL C (char *) 0x80000000UL })
+T(8, unsigned long, x == -2UL || x == -1UL || x == 0,
+ { 0 C -1UL C -2UL }, { -3UL C -6UL C 1 C 2 C 12 C 35 C 0x7fffffff C 0x80000000 })
+T(9, unsigned long, x >= -4UL || x <= 8,
+ { -4UL C -3UL C -2UL C -1UL C 0 C 1 C 2 C 3 C 4 C 5 C 6 C 7 C 8 },
+ { -7UL C -5UL C 9 C 10 C 61 C 127 C 0x7fffffff C 0x80000000 })
+T(10, signed char, x == 0 || x == -1 || x == -2 || x == -3,
+ { 0 C -1 C -2 C -3 }, { -4 C -5 C 1 C 2 C 3 C 35 C -24 })
+T(11, int, x == 0 || x == 1,
+ { 0 C 1 }, { -1 C 2 C 12 C 35 C INT_MAX C INT_MIN })
+T(12, int, x == 0 || x == -1 || x == -2,
+ { 0 C -1 C -2 }, { -3 C -6 C 1 C 2 C 12 C 35 C INT_MAX C INT_MIN })
+T(13, int, x == 0 || x == 1 || x == 2,
+ { 0 C 1 C 2 }, { -3 C -6 C -1 C -2 C 12 C 35 C INT_MAX C INT_MIN })
+T(14, int, x == 3 || x == 4 || x == 5 || x == 6,
+ { 3 C 4 C 5 C 6 }, { -3 C 0 C 1 C 2 C 7 C 8 C 12 C INT_MAX C INT_MIN })
+T(15, int, x == -3 || x == -4 || x == -5 || x == -6,
+ { -3 C -4 C -5 C -6 }, { -7 C -8 C -2 C -1 C 1 C 2 C INT_MAX C INT_MIN })
+T(16, int, x == -3 || x == -4 || x == -5,
+ { -3 C -4 C -5 }, { -6 C -7 C -8 C -2 C -1 C 1 C 2 C INT_MAX C INT_MIN })
+T(17, unsigned int, (x >= -8U && x <= -3U) || x == -2U || x == -1U || x == 0 || x == 1 || x == 2,
+ { -8U C -7U C -6U C -5U C -4U C -3U C -2U C -1U C 0 C 1 C 2 },
+ { -9U C -10U C 3 C 4 C 12 C -54U C INT_MAX C INT_MIN })
+T(18, int, (x >= -8 && x <= -3) || x == -2 || x == -1 || x == 0 || x == 1 || x == 2,
+ { -8 C -7 C -6 C -5 C -4 C -3 C -2 C -1 C 0 C 1 C 2 },
+ { -9 C -10 C 3 C 4 C 12 C -54 C INT_MAX C INT_MIN })
+T(19, unsigned long, x <= 16 || (x >= 18 && x <= -1UL),
+ { -3UL C -6UL C -1UL C 0 C 1 C 2 C 12 C 15 C 16 C 18 C 19 C 35 C 0x7fffffff
+ C 0x80000000 }, { 17 })
+T(20, char *, x == (char *) -1UL || x == 0,
+ { (char *) -1UL C 0 }, { (char *) -6UL C (char *) -20UL C (char *) -2UL
+ C (char *) 1UL C (char *) 35UL C (char *) 0x7fffffffUL C (char *) 0x80000000UL })
+T(21, integers, x == int_zero || x == int_one,
+ { int_zero C int_one }, { int_minus1 C int_two C int_largest C int_smallest })
+T(22, int, x == INT_MIN || x == INT_MAX,
+ { INT_MIN C INT_MAX },
+ { -1 C 0 C 1 C INT_MAX - 1 C INT_MAX - 2 C INT_MIN + 1 C INT_MIN + 2 })
+T(23, int, x == INT_MIN + 1 || x == INT_MIN + 2 || x == INT_MIN || x == INT_MAX,
+ { INT_MIN + 1 C INT_MIN + 2 C INT_MIN C INT_MAX },
+ { -1 C 0 C 1 C INT_MAX - 1 C INT_MAX - 2 C INT_MIN + 3 C INT_MIN + 4 })
+T(24, signed char, x == SCHAR_MIN || x == SCHAR_MAX,
+ { SCHAR_MIN C SCHAR_MAX },
+ { -1 C 0 C 1 C SCHAR_MAX - 1 C SCHAR_MAX - 2 C SCHAR_MIN + 1 C SCHAR_MIN + 2 })
+T(25, integers, x == int_smallest || x == int_largest,
+ { int_smallest C int_largest }, { int_minus1 C int_zero C int_one
+ C int_2ndsmallest C int_2ndlargest C int_3rdsmallest C int_3rdlargest })
+
+/* These should be optimized into unconditional jumps. */
+T(o1, unsigned long, x <= 16 || (x >= 17 && x <= -1UL),
+ { -3UL C -6UL C -1UL C 0 C 1 C 2 C 12 C 15 C 16 C 17 C 18 C 19 C 35 C 0x7fffffff
+ C 0x80000000 }, { })
+T(o2, unsigned long, x <= -3UL || (x == -2UL || x == -1UL),
+ { -3UL C -6UL C -1UL C 0 C 1 C 2 C 12 C 15 C 16 C 17 C 18 C 19 C 35 C 0x7fffffff
+ C 0x80000000 }, { })
+
+/* These should be eventually optimized into a single comparison. */
+T(td1, unsigned char, x == 0 || x == 4 || x == 1 || x == 5 || x == 2 || x == 6 || x == 3,
+ { 0 C 1 C 2 C 3 C 4 C 5 C 6 }, { 7 C 8 C 127 C 128 C 254 C 255 })
+
+/* These should not be optimized into a single comparison. */
+T(n1, smallenum, x == smalle_minus4 || x == smalle_three,
+ { smalle_minus4 C smalle_three }, { smalle_minus3 C smalle_minus2 C smalle_minus1
+ C smalle_zero C smalle_one C smalle_two })
+T(n2, enum2, x == enum2_two || x == enum2_five,
+ { enum2_two C enum2_five }, { enum2_three C enum2_four })
+T(n3, enum3, x == enum3_zero || x == enum3_seven,
+ { enum3_zero C enum3_seven }, { enum3_one C enum3_two C enum3_three C enum3_four
+ C enum3_five C enum3_six })
+
+#endif
+
+#else
+
+int
+main (void)
+{
+ return 0;
+}
+
+#endif
range-test-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: fold3.C
===================================================================
--- fold3.C (nonexistent)
+++ fold3.C (revision 154)
@@ -0,0 +1,21 @@
+// PR middle-end/15069
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+typedef enum {
+ FOUR = 4,
+ FIVE = 5
+} direction_t;
+
+int main ()
+{
+ direction_t four = FOUR;
+ int flags = (four & 4L) ? (32L | 128L) : 0;
+ flags &= 32L;
+
+ if (flags == 0)
+ abort ();
+}
+
fold3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: const4.C
===================================================================
--- const4.C (nonexistent)
+++ const4.C (revision 154)
@@ -0,0 +1,9 @@
+// PR c++/21454
+// Test whether A is put into .rodata section on platforms
+// that have it.
+// { dg-do compile }
+
+const int a[] __attribute__ ((__used__)) = { 0, 1, 2, 3 };
+
+// The MMIX port always switches to the .data section at the end of a file.
+// { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* } } }
const4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: bool1.C
===================================================================
--- bool1.C (nonexistent)
+++ bool1.C (revision 154)
@@ -0,0 +1,25 @@
+// PR opt/13869
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+int test ()
+{
+ bool my_bool = true;
+ for (int i = 0; i < 10; ++i)
+ {
+ if (!my_bool)
+ ;
+ else
+ my_bool = false;
+ };
+ return my_bool;
+}
+
+int main ()
+{
+ if (test ())
+ abort ();
+ return 0;
+}
bool1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: devirt1.C
===================================================================
--- devirt1.C (nonexistent)
+++ devirt1.C (revision 154)
@@ -0,0 +1,7 @@
+// { dg-do compile }
+// { dg-options "-O" }
+// { dg-final { scan-assembler "xyzzy" } }
+
+struct S { S(); virtual void xyzzy(); };
+inline void foo(S *s) { s->xyzzy(); }
+void bar() { S s; foo(&s); }
devirt1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: eh2.C
===================================================================
--- eh2.C (nonexistent)
+++ eh2.C (revision 154)
@@ -0,0 +1,34 @@
+// PR 6764
+// { dg-do run }
+// { dg-options "-O -fomit-frame-pointer" }
+
+extern "C" void abort ();
+
+class test
+{
+ public:
+ test * const me;
+ test () : me(this) { }
+ ~test () { if (me != this) abort (); }
+};
+
+void x1 ()
+{
+ test w1;
+ throw 1;
+}
+
+void x2 ()
+{
+ test w2;
+ x1 ();
+}
+
+int main (void)
+{
+ try {
+ x2 ();
+ } catch (...) {
+ }
+ return 0;
+}
eh2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr13066-1.C
===================================================================
--- pr13066-1.C (nonexistent)
+++ pr13066-1.C (revision 154)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+class nsIURI;
+
+struct nsCOMPtr
+{
+ operator nsIURI*() const
+ {
+ return mRawPtr;
+ }
+
+ nsIURI *mRawPtr;
+};
+
+void func()
+{
+ nsCOMPtr u1;
+ if (!u1 == !u1)
+ return;
+}
+
pr13066-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr20931.C
===================================================================
--- pr20931.C (nonexistent)
+++ pr20931.C (revision 154)
@@ -0,0 +1,13 @@
+// PR middle-end
+// This testcase ICEd because fold checking saw a type change which
+// is allowed as TYPE_CONTAINS_PLACEHOLDER_INTERNAL could change.
+// { dg-do compile }
+// { dg-options "-O2" }
+
+int
+__finite (double __x) throw ()
+{
+ return (__extension__
+ (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
+ | 0x800fffffu) + 1) >> 31));
+}
pr20931.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: interface2.C
===================================================================
--- interface2.C (nonexistent)
+++ interface2.C (revision 154)
@@ -0,0 +1,19 @@
+// Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 2 Jun 2005
+
+// PR 21280
+// Origin: Jens Maurer
+
+#include "interface2.h"
+
+struct A
+{
+ A() { }
+ virtual ~A() { }
+};
+
+int main()
+{
+ A a;
+ C c(a);
+}
interface2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: enum1.C
===================================================================
--- enum1.C (nonexistent)
+++ enum1.C (revision 154)
@@ -0,0 +1,30 @@
+// Verify that we don't confuse precision and mode for enums.
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort();
+
+enum E {
+ zero = 0,
+ test = 0xbb
+};
+
+static bool foo(unsigned char *x)
+{
+ E e = static_cast(*x);
+ switch (e)
+ {
+ case test:
+ return true;
+ default:
+ return false;
+ }
+}
+
+int main()
+{
+ unsigned char dummy = test;
+ if (! foo(&dummy))
+ abort ();
+ return 0;
+}
enum1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ptrmem3.C
===================================================================
--- ptrmem3.C (nonexistent)
+++ ptrmem3.C (revision 154)
@@ -0,0 +1,23 @@
+// { dg-options "-O1" }
+
+#include
+struct A {
+ A(int arg) : ia(arg) {}
+ int x,y,z,ia;
+ int mf(int arg) { return arg + ia; }
+};
+int func(int A::*pdm, int (A::*pmf)(int)) // 2. regular function
+{
+ A oa(2);
+ return ((&oa)->*pdm) + (oa.*pmf)(2);
+}
+int main()
+{
+ int val;
+
+ int A::*pda = &A::ia;
+ int (A::*pmfa)(int) = &A::mf;
+ val = func( pda, pmfa );
+ if(val != 6)
+ printf("val=%d, expect 6 \n", val);
+}
ptrmem3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv2.C
===================================================================
--- nrv2.C (nonexistent)
+++ nrv2.C (revision 154)
@@ -0,0 +1,28 @@
+// Test for the named return value optimization, this time with inlining.
+// { dg-do run }
+// { dg-options -O2 }
+
+int c;
+int d;
+
+struct A
+{
+ A() { ++c; }
+ A(const A&) { ++c; };
+ ~A() { ++d; }
+};
+
+inline A f ()
+{
+ A a;
+ return a;
+}
+
+int main ()
+{
+ {
+ A a = f ();
+ }
+
+ return !(c == 1 && c == d);
+}
nrv2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: temp2.C
===================================================================
--- temp2.C (nonexistent)
+++ temp2.C (revision 154)
@@ -0,0 +1,62 @@
+// { dg-do run }
+
+// Copyright (C) 2006 Free Software Foundation, Inc.
+
+// Originally from PR 16681, found also in init/array15.C
+// This variant of the testcase verifies that we do not create
+// a temporary on the stack, which is PR 27620.
+
+int i;
+
+extern "C"
+void *memcpy (void *dest, const void *src, __SIZE_TYPE__ n)
+{
+ char *d = (char *) dest;
+ const char *s = (const char *) src;
+ while (n--)
+ d[n] = s[n];
+ ++i;
+ return dest;
+}
+
+struct foo {
+ unsigned char buffer[41112];
+ foo() ;
+ bool check () const;
+};
+
+foo::foo ()
+ : buffer()
+{}
+
+bool foo::check () const
+{
+ for (unsigned ix = sizeof (buffer); ix--;)
+ if (buffer[ix])
+ return false;
+ return true;
+}
+
+void *operator new (__SIZE_TYPE__ size, void *p)
+{
+ return p;
+}
+
+char heap[50000];
+
+int main ()
+{
+ for (unsigned ix = sizeof (heap); ix--;)
+ heap[ix] = ix;
+
+ i = 0;
+ foo *f = new (heap) foo ();
+
+ if (i != 0)
+ return 1;
+ if (!f->check ())
+ return 1;
+ return 0;
+}
+
+
temp2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17724-4.C
===================================================================
--- pr17724-4.C (nonexistent)
+++ pr17724-4.C (revision 154)
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern "C" char *strcpy (char* d, const char* s);
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+ A a;
+ try
+ {
+ char z[22];
+ if (this->E) B (z, "");
+ return 0;
+ }
+ catch (int &f) { return -1; }
+}
pr17724-4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: loop1.C
===================================================================
--- loop1.C (nonexistent)
+++ loop1.C (revision 154)
@@ -0,0 +1,24 @@
+// PR rtl-optimization/16590
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort();
+
+struct iterator {
+ char * p;
+ int *dummy;
+};
+
+static iterator pend(char * start) {
+ iterator p = {start, 0};
+ if (p.p == start) p.p = start+5;
+ --p.p;
+ return p;
+}
+
+int main() {
+ char mem[4+1];
+
+ if(pend(mem).p != mem+4)
+ abort ();
+}
loop1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv6.C
===================================================================
--- nrv6.C (nonexistent)
+++ nrv6.C (revision 154)
@@ -0,0 +1,26 @@
+// PR c++/9993
+// Bug: We were failing to destroy b.
+
+// { dg-do run }
+
+int c, d;
+
+struct Object {
+ Object() { ++c; }
+ Object(const Object&) { ++c; }
+ ~Object() { ++d; }
+};
+
+Object function() {
+ int i = 0;
+ do {
+ Object b;
+ if (i++ == 2)
+ return b;
+ } while (1);
+}
+
+int main() {
+ function();
+ return c != d;
+}
nrv6.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: array1.C
===================================================================
--- array1.C (nonexistent)
+++ array1.C (revision 154)
@@ -0,0 +1,20 @@
+// Copyright (C) 2004 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 29 Nov 2004
+
+// PR 18672:ICE gimplifying incomplete array type.
+// Origin: Magnus Fromreide
+
+struct A;
+
+struct D {
+ static A ary[];
+};
+extern A ary[];
+
+void Foo (A const *);
+
+void Bar ()
+{
+ Foo (D::ary);
+ Foo (::ary);
+}
array1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv11.C
===================================================================
--- nrv11.C (nonexistent)
+++ nrv11.C (revision 154)
@@ -0,0 +1,58 @@
+// PR middle-end/25977
+// Bug: We were assuming that the return slot of the current function is
+// always safe to use as the return slot for another call, because its
+// address cannot escape. But its address can escape if we perform the
+// named return value optimization.
+
+// { dg-do run }
+
+struct A
+{
+ A( int left, int top, int width, int height )
+ : x1(left), y1(top), x2(left+width-1), y2(top+height-1) {}
+
+ //A(const A& o) : x1(o.x1), y1(o.y1), x2(o.x2), y2(o.y2) {}
+ //A& operator=(const A& o ) { x1=o.x1; y1=o.y1; x2=o.x2; y2=o.y2; return *this; }
+
+ A operator&(const A &r) const
+ {
+ A tmp(0, 0, -1, -1);
+ tmp.x1 = ((r.x1) < (x1) ? (x1) : (r.x1));
+ tmp.x2 = ((x2) < (r.x2) ? (x2) : (r.x2));
+ tmp.y1 = ((r.y1) < (y1) ? (y1) : (r.y1));
+ tmp.y2 = ((y2) < (r.y2) ? (y2) : (r.y2));
+ return tmp;
+ }
+
+ int x1;
+ int y1;
+ int x2;
+ int y2;
+};
+
+bool operator==( const A &r1, const A &r2 )
+{
+ return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
+}
+
+static A test()
+{
+ A all = A( 0, 0, 1024, 768);
+ A a = all;
+ A r = all;
+ a = a & r;
+ return a;
+}
+
+extern "C" void abort(void);
+
+int main( int argc, char ** argv )
+{
+ A all = A( 0, 0, 1024, 768);
+ A a = test();
+
+ if ( ! ( a == all))
+ abort();
+
+ return 0;
+}
nrv11.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cleanup1.C
===================================================================
--- cleanup1.C (nonexistent)
+++ cleanup1.C (revision 154)
@@ -0,0 +1,171 @@
+// PR middle-end/6247
+// This testcase was miscompiled on IA-32 because a single stack slot
+// was used for 2 different variables at the same time.
+// The function H::h1 was miscompiled.
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+struct A
+{
+ A () { a = 1; }
+ void a1 () { a++; }
+ bool a2 () { return !--a; }
+ unsigned int a;
+};
+
+struct B : public A
+{
+ B () : b (0) { a1 (); }
+ void b1 ();
+ const char *b;
+};
+
+struct C
+{
+ C ();
+ C (const C &);
+ ~C () { if (c->a2 ()) { if (c == c0) c0 = 0; c->b1 (); } }
+ C &operator= (const C &);
+ static C c1 (const char *x, int y = -1);
+ C (int, bool);
+ void a2 ();
+ B *c;
+ static B *c0;
+};
+
+B *C::c0 = __null;
+
+template struct D
+{
+ D (const T& t) : d (t) {}
+ D () {}
+ D *next, *prev;
+ T d;
+};
+
+template struct E
+{
+ D *e;
+ E () : e (0) {}
+ E (D *p) : e (p) {}
+ E (const E& x) : e (x.e) {}
+ const T& operator* () const { return e->d; }
+ T& operator* () { return e->d; }
+ bool operator== (const E& x) const { return e == x.e; }
+ bool operator!= (const E& x) const { return e != x.e; }
+ E operator++ (int) { E x = *this; e = e->next; return x; }
+};
+
+template struct F : public A
+{
+ F () { f = new D; f->next = f->prev = f; f0 = 0; }
+ ~F () {}
+ D *f;
+ unsigned int f0;
+
+ F (const F& x) : A ()
+ {
+ f = new D; f->next = f->prev = f; f0 = 0;
+ E b (x.f->next);
+ E e (x.f);
+ E i (f);
+ while (b != e)
+ f1 (i, *b++);
+ }
+
+ E f1 (E x, const T& y)
+ {
+ D *p = new D (y);
+ p->next = x.e;
+ p->prev = x.e->prev;
+ x.e->prev->next = p;
+ x.e->prev = p;
+ f0++;
+ return p;
+ }
+};
+
+template struct G
+{
+ E g1 () { g3 (); return E (g->f); }
+ E g2 (const T& x) { g3 (); return g->f1 (g1 (), x); }
+ void g3 () { if (g->a > 1) { g->a2 (); g = new F (*g); } }
+ F* g;
+};
+
+struct H
+{
+ virtual ~H () {};
+ virtual void h1 ();
+ struct I
+ {
+ I () {}
+ I (C r, C p) : i1 (r), i2 (p) {}
+ C i1, i2;
+ };
+ G h;
+};
+
+void H::h1 ()
+{
+ h.g2 (I (C::c1 ("s1"), C::c1 ("t")));
+ h.g2 (I (C::c1 ("s2"), C::c1 ("t")));
+ h.g2 (I (C::c1 ("s3"), C::c1 ("t")));
+}
+
+void B::b1 ()
+{
+}
+
+C C::c1 (const char *x, int y)
+{
+ C z;
+
+ if (y != -1)
+ abort ();
+ z.c = new B;
+ z.c->b = x;
+ return z;
+}
+
+C::C () : c (__null)
+{
+}
+
+C::C (const C &x)
+{
+ c = x.c;
+ c->a1 ();
+}
+
+int main ()
+{
+ H h;
+ h.h.g = new F ();
+ h.h1 ();
+ if (h.h.g->f0 != 3)
+ abort ();
+ D *p;
+ int i;
+ for (i = 0, p = h.h.g->f; i < 4; i++, p = p->next)
+ {
+ if (i == 0 && (p->d.i1.c != __null || p->d.i2.c != __null))
+ abort ();
+ if (i > 0
+ && (p->d.i1.c->b[0] != 's'
+ || p->d.i1.c->b[1] != '0' + i
+ || p->d.i1.c->b[2] != '\0'
+ || __builtin_strcmp (p->d.i2.c->b, "t")))
+ abort ();
+ if (p->prev->next != p)
+ abort ();
+ if (p->next->prev != p)
+ abort ();
+ if (i == 3 && p->next != h.h.g->f)
+ abort ();
+ }
+ exit (0);
+}
cleanup1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: expect1.C
===================================================================
--- expect1.C (nonexistent)
+++ expect1.C (revision 154)
@@ -0,0 +1,17 @@
+// PR c++/13239
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+struct Y {
+ int i;
+};
+
+bool foo () { return true; }
+Y bar () { Y y = {0}; return y; }
+
+int main ()
+{
+ __builtin_expect (foo () && (bar ().i) == 0, 0) ? 0 : (abort (), 1);
+}
expect1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: static4.C
===================================================================
--- static4.C (nonexistent)
+++ static4.C (revision 154)
@@ -0,0 +1,15 @@
+// PR 13898
+// Make sure the two X variables get assigned unique assembler names
+// if they are promoted to static storage.
+
+// { dg-do compile }
+
+int g(int i) {
+ if (i<1) {
+ const int x[3] = { 1,2,3 };
+ return x[i];
+ } else {
+ const int x[3] = { 4,5,6 };
+ return x[i];
+ }
+}
static4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: local1.C
===================================================================
--- local1.C (nonexistent)
+++ local1.C (revision 154)
@@ -0,0 +1,20 @@
+// { dg-options "-O" }
+
+struct Outer {
+ struct Inner { virtual bool f() = 0; };
+ void g(Inner &) const;
+};
+
+inline void h(const Outer &o)
+{
+ struct Local : public Outer::Inner {
+ virtual bool f() {};
+ };
+ Local l;
+ o.g(l);
+}
+
+void f(Outer &req) {
+ h (req);
+}
+
local1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: alias3.C
===================================================================
--- alias3.C (nonexistent)
+++ alias3.C (revision 154)
@@ -0,0 +1,45 @@
+// { dg-options "-O2" }
+
+// Contributed by Nathan Sidwell 22 Dec 2003
+// Origin: rsandifo@redhat.com
+
+// PR c++/13387. Alias sets were incorrect
+
+struct C {
+ C(short *p = 0, int i = 0) : ptr (p), index (i) {}
+ short operator*() { return ptr[index]; }
+ short *ptr;
+ int index;
+};
+
+C f1 (C) __attribute__ ((noinline));
+C f1 (C x)
+{
+ return x;
+}
+
+void f2 (short)__attribute__ ((noinline));;
+short s;
+
+void f2 (short s_)
+{
+ s = s_;
+}
+
+C g (C x)__attribute__ ((noinline));
+C g (C x)
+{
+ x = f1 (x);
+ f2 (*x);
+ return x;
+}
+
+int main ()
+{
+ short p[2] = { 0x1234, 0x5678 };
+ C x (p, 1);
+
+ g (x);
+
+ return s != p[1];
+}
alias3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cfg1.C
===================================================================
--- cfg1.C (nonexistent)
+++ cfg1.C (revision 154)
@@ -0,0 +1,36 @@
+// PR optimization/11083
+// Origin:
+// Reduced testcase by Wolfgang Bangerth
+
+// The compiler used to keep unreachable basic blocks after dead edges
+// had been purged, which fooled the LCM code of the GCSE pass.
+
+// { dg-do compile }
+// { dg-options "-O2 -fnon-call-exceptions" }
+
+extern void *memmove (void *, const void *, unsigned int) throw ();
+
+struct S {
+ int *q;
+
+ S(int *i) : q(i) {}
+};
+
+struct X {
+ int *p;
+
+ void foo(S first, S last) {
+ try { memmove(0, 0, last.q - first.q); }
+ catch(...) { throw; }
+ }
+
+ void bar (const X& x);
+};
+
+void X::bar (const X& x)
+{
+ const unsigned int xlen = S(x.p).q - S(x.p).q;
+
+ if (xlen > 0)
+ foo(S(x.p), S(x.p));
+}
cfg1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: reg-stack.C
===================================================================
--- reg-stack.C (nonexistent)
+++ reg-stack.C (revision 154)
@@ -0,0 +1,47 @@
+// PR target/6087
+// The code that moves around insns emitted by reg-stack to cope with
+// exception edges lost the REG_DEAD note indicating a pop. Which
+// eventually fills up the register stack resulting in Z == NaN.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort ();
+
+struct Base
+{
+ virtual ~Base() {}
+};
+
+struct Foo : public Base
+{
+ Foo ();
+};
+
+double x = 3;
+double y = 4;
+
+double bar ()
+{
+ double z = x*x+y*y;
+ if (z != 25.0)
+ throw 1;
+ return z;
+}
+
+Foo::Foo ()
+{
+ bar ();
+}
+
+int main ()
+{
+ try {
+ int i;
+ for (i = 0; i < 10; ++i)
+ new Foo;
+ } catch (...) {
+ abort ();
+ }
+ return 0;
+}
reg-stack.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nothrow1.C
===================================================================
--- nothrow1.C (nonexistent)
+++ nothrow1.C (revision 154)
@@ -0,0 +1,25 @@
+// Test that the nothrow optimization works properly.
+// { dg-do compile }
+// { dg-options "-O -fdump-tree-optimized" }
+
+extern void blah() throw();
+
+int i, j, k;
+
+int main()
+{
+ try
+ {
+ ++i;
+ blah();
+ ++j;
+ }
+ catch (...)
+ {
+ return -42;
+ }
+}
+
+// The catch block should be optimized away.
+// { dg-final { scan-tree-dump-times "-42" 0 "optimized" } }
+// { dg-final { cleanup-tree-dump "optimized" } }
nothrow1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr15551.C
===================================================================
--- pr15551.C (nonexistent)
+++ pr15551.C (revision 154)
@@ -0,0 +1,26 @@
+// PR target/15551
+// This used to crash on pentium4-pc-cygwin due to an alloca problem.
+// Testcase submitted by Hans Horn to mingw bug tracker
+//
+// { dg-do run }
+// { dg-options "-O3" }
+
+#include
+#include
+#include
+using namespace std;
+
+ostream* logfile;
+
+int main () {
+
+ logfile = new ofstream("bar", ios::out);
+
+ char expList[20000];
+ strcpy(expList, "foo");
+
+ delete logfile;
+ remove ("bar");
+
+ return 0;
+}
pr15551.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: switch2.C
===================================================================
--- switch2.C (nonexistent)
+++ switch2.C (revision 154)
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern int foo (int);
+
+void
+bar (void)
+{
+ char tmp = foo (0);
+ switch (tmp)
+ {
+ case 1: foo (1); break;
+ case 2: foo (2); break;
+ case 3: foo (3); break;
+ case 4: foo (4); break;
+ case 5: foo (5); break;
+ case 6: foo (6); break;
+ case 7: foo (7); break;
+ case 255: foo (8); break;
+ default: break;
+ }
+}
+
switch2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr19317-2.C
===================================================================
--- pr19317-2.C (nonexistent)
+++ pr19317-2.C (revision 154)
@@ -0,0 +1,32 @@
+// PR c++/19317
+// { dg-options "-O2" }
+// { dg-do run }
+
+extern "C" void abort (void);
+
+struct A
+{
+ A () { d = e = 0; f = -1; }
+ A (int x) : d (0), e (0), f (x) { }
+ A b () const;
+ int d;
+ int e;
+ int f;
+};
+
+A
+A::b () const
+{
+ A t;
+ t.f = 10 + this->f;
+ return t;
+}
+
+int
+main ()
+{
+ A a (100);
+ a = a.b ();
+ if (a.f != 110)
+ abort ();
+}
pr19317-2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ptrintsum1.C
===================================================================
--- ptrintsum1.C (nonexistent)
+++ ptrintsum1.C (revision 154)
@@ -0,0 +1,29 @@
+// PR c++/4401
+// This testcase was miscompiled on 64-bit platforms, resulting to
+// operating on a[0x100000000] instead of a[0].
+// { dg-do run }
+// { dg-options "-O2" }
+
+char *a;
+char b[] = "AAAA";
+
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+void foo (void)
+{
+ unsigned int i, j;
+
+ i = 2;
+ j = 3;
+ a[i + 1 - j] += i;
+}
+
+int main (void)
+{
+ a = b;
+ foo ();
+ if (b[0] != 'A' + 2)
+ abort ();
+ exit (0);
+}
ptrintsum1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: float1.C
===================================================================
--- float1.C (nonexistent)
+++ float1.C (revision 154)
@@ -0,0 +1,21 @@
+// PR optimization/11637
+// Origin:
+
+// This used to fail to assemble on x86 because a decimal
+// floating point litteral was emitted, which originated
+// from a bogus REG_EQUAL note not removed by the combiner.
+
+// { dg-do assemble }
+// { dg-options "-O2 -fnon-call-exceptions" }
+
+void f(long int seed);
+
+void g(float &o)
+{
+ float a = 0.05f;
+ float b = 1.0 - a;
+ float c = 1.0 + a;
+
+ f(0);
+ o = a;
+}
float1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr24780.C
===================================================================
--- pr24780.C (nonexistent)
+++ pr24780.C (revision 154)
@@ -0,0 +1,14 @@
+// PR c++/24780
+// { dg-do compile }
+
+template
+struct Move {
+ Move();
+ static Move const MOVES[2][2];
+};
+template
+ Move const Move::MOVES[2][2]={};
+typedef Move const MoveClass;
+void moves(int x, int y) {
+ &MoveClass::MOVES[x][y];
+}
pr24780.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: interface2.h
===================================================================
--- interface2.h (nonexistent)
+++ interface2.h (revision 154)
@@ -0,0 +1,11 @@
+#pragma interface
+
+template
+struct C
+{
+ explicit C(const T& t) : a(t) { }
+ virtual ~C() { }
+ T a;
+};
+
+
interface2.h
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: complex1.C
===================================================================
--- complex1.C (nonexistent)
+++ complex1.C (revision 154)
@@ -0,0 +1,9 @@
+// PR tree-opt/21994
+// { dg-do compile }
+// { dg-options "-O2" }
+
+_Complex float f(void);
+_Complex float g(void) throw()
+{
+ return f();
+}
complex1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr24665.C
===================================================================
--- pr24665.C (nonexistent)
+++ pr24665.C (revision 154)
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef unsigned long T;
+typedef volatile T* const hwreg_t;
+struct RegisterLayout
+{
+ T intmask;
+};
+struct Controller_t
+{
+ Controller_t();
+ inline void
+ disableInterrupt()
+ {
+ *mpMaskRegister = 0;
+ };
+ static hwreg_t mpMaskRegister;
+};
+
+extern char SimulatedRegisters[];
+
+hwreg_t Controller_t::mpMaskRegister
+ = &(reinterpret_cast(SimulatedRegisters))->intmask;
+
+Controller_t::Controller_t()
+{
+ disableInterrupt();
+}
pr24665.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: complex5.C
===================================================================
--- complex5.C (nonexistent)
+++ complex5.C (revision 154)
@@ -0,0 +1,16 @@
+// PR 24365
+// { dg-do compile }
+// { dg-options "-O2" }
+
+typedef __complex__ double cdouble;
+inline cdouble to_complex(double r) {
+ cdouble z;
+ __real__ z = r;
+ return z;
+}
+cdouble elt_zero() {
+ cdouble a = to_complex(0.0);
+ a+=1.0;
+ return a;
+}
+
complex5.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cse2.C
===================================================================
--- cse2.C (nonexistent)
+++ cse2.C (revision 154)
@@ -0,0 +1,39 @@
+// This testcase caused ICE on IA-32 in simplify_unary_operation
+// CSE did not assume SUBREGs changing mode from integral to floating.
+// { dg-do run { target i?86-*-* sparc*-*-* x86_64-*-* } }
+// { dg-options "-O2" }
+
+struct A
+{
+ union
+ {
+ float f;
+ unsigned int w;
+ } a;
+
+ static inline const A foo (void)
+ {
+ return A ((unsigned int) (__extension__ ((union { unsigned l; float d; })
+ { l: 0x3f800000 }).d));
+ }
+ inline A (float f) { a.f = f; }
+ A ();
+ inline A (unsigned int w) { a.w = w; }
+};
+
+A::A()
+{
+ *this = foo ();
+}
+
+A a;
+
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+int main ()
+{
+ if (a.a.w != 1)
+ abort ();
+ exit (0);
+}
cse2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr18968.C
===================================================================
--- pr18968.C (nonexistent)
+++ pr18968.C (revision 154)
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-options "-O1" }
+struct X
+{
+ int i;
+};
+struct Y : virtual X {};
+struct Z : Y {};
+struct A
+{
+ Z* p;
+ A();
+};
+A::A() : p(0)
+{
+ ((X*)(Y*)p)->i++;
+}
+
pr18968.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline3.C
===================================================================
--- inline3.C (nonexistent)
+++ inline3.C (revision 154)
@@ -0,0 +1,40 @@
+// PR opt/6793
+// We failed to supress inlining of a varargs function when it's a template.
+// { dg-do compile }
+// { dg-options "-O3" }
+
+#include
+
+typedef __SIZE_TYPE__ size_t;
+
+template < class Type > class VectorNd
+{
+ size_t size;
+ Type *data;
+ public:
+
+ VectorNd (size_t _size, size_t count, ...)
+ : size (_size)
+ {
+ data = new Type[size];
+
+ va_list ap;
+
+ va_start (ap, count);
+
+ for (size_t i = 0; i < count; i++)
+ data[i] = va_arg (ap, Type);
+
+ va_end (ap);
+ }
+
+ ~VectorNd ()
+ {
+ delete [] data;
+ }
+};
+
+int main ()
+{
+ VectorNd vector (3, 3, 1.0, 2.0, 3.0);
+}
inline3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: preinc1.C
===================================================================
--- preinc1.C (nonexistent)
+++ preinc1.C (revision 154)
@@ -0,0 +1,59 @@
+// PR optimization/6086
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort (void);
+
+struct A
+{
+ A (int x, int y);
+ int a, b;
+ int foo () { return a; }
+ int bar () { return b; }
+};
+
+struct B
+{
+ virtual ~B ();
+ virtual A baz () const;
+};
+
+struct C
+{
+ A foo () const;
+ B *c;
+};
+
+A C::foo () const
+{
+ int x, y;
+ x = c->baz ().foo ();
+ y = c->baz ().bar ();
+ return A (x, y);
+}
+
+A B::baz () const
+{
+ return A (4, 8);
+}
+
+A::A (int x, int y)
+{
+ a = x;
+ b = y;
+}
+
+B::~B ()
+{
+}
+
+int
+main ()
+{
+ C the_c;
+ B the_b;
+ the_c.c = &the_b;
+ if (the_c.foo().a != 4)
+ abort ();
+ return 0;
+}
preinc1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: reg-stack3.C
===================================================================
--- reg-stack3.C (nonexistent)
+++ reg-stack3.C (revision 154)
@@ -0,0 +1,21 @@
+// PR target/12712
+// Origin: Markus Schoder
+
+// This used to segfault on x86 because the reg-stack pass
+// created an unreachable basic block by purging an outgoing
+// edge, and was not prepared to handle it.
+
+// { dg-do compile }
+
+struct A
+{
+ ~A();
+ float f(float x);
+ float g() const {return 0;}
+};
+
+void h()
+{
+ A a, b;
+ a.f(b.g() + 1);
+}
reg-stack3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cond1.C
===================================================================
--- cond1.C (nonexistent)
+++ cond1.C (revision 154)
@@ -0,0 +1,24 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+struct D { int x; };
+struct W
+{
+ W () {}
+ D & operator * () { return d; }
+ D d;
+};
+
+int
+foo (int y)
+{
+ W m;
+ (*m).x = (y > 1 ? y : 0);
+ return (*m).x;
+}
+
+int
+main ()
+{
+ return (foo (6) != 6);
+}
cond1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline7.C
===================================================================
--- inline7.C (nonexistent)
+++ inline7.C (revision 154)
@@ -0,0 +1,7 @@
+// PR c++/13543
+// { dg-do compile }
+// { dg-options "-O3" }
+
+struct basic_string { basic_string(const basic_string&); };
+basic_string operator+(const basic_string& lhs, char);
+void dumpNode(basic_string start) { dumpNode(start + 'a'); }
inline7.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: const1.C
===================================================================
--- const1.C (nonexistent)
+++ const1.C (revision 154)
@@ -0,0 +1,129 @@
+// This testcase was miscompiled on IA-64 to read from unitialized memory
+// and dereference it.
+// { dg-do run }
+// { dg-options "-O2" }
+
+struct A
+{
+ A () { a = 1; }
+ void a1 () { a++; }
+ bool a2 () { return !--a; }
+ unsigned int a;
+};
+
+struct B {};
+
+template struct C
+{
+ C () {}
+ C (const T& t) : c (t) {}
+ C *next, *prev;
+ T c;
+};
+
+template struct D
+{
+ C *d;
+ D () : d (0) {}
+ D (C *x) : d (x) {}
+ D (const D& x) : d (x.d) {}
+ bool operator!= (const D& x) const { return d != x.d; }
+ const T& operator* () const { return d->c; }
+ D operator++ (int) { D t = *this; d = d->next; return t; }
+};
+
+template struct E
+{
+ C *e;
+ E () : e (0) {}
+ E (C *p) : e (p) {}
+ E (const E& x) : e (x.e) {}
+ E (const D& x) : e (x.e) {}
+ bool operator!= (const E& x) const { return e != x.e; }
+ const T& operator* () const { return e->c; }
+ E& operator++ () { e = e->next; return *this; }
+};
+
+template struct F : public A
+{
+ C *f;
+ unsigned long f0;
+ F () { f = new C; f->next = f->prev = f; f0 = 0; }
+ F (const F& x) : A ()
+ {
+ f = new C; f->next = f->prev = f; f0 = 0;
+ D b (x.f->next), e (x.f), i (f);
+ while (b != e)
+ f1 (i, *b++);
+ }
+
+ ~F ()
+ {
+ C *p = f->next;
+ while (p != f)
+ {
+ C *x = p->next;
+ delete p;
+ p = x;
+ }
+ delete f;
+ }
+
+ D f1 (D x, const T& y)
+ {
+ C *p = new C (y);
+ p->next = x.d;
+ p->prev = x.d->prev;
+ x.d->prev->next = p;
+ x.d->prev = p;
+ f0++;
+ return p;
+ }
+};
+
+template struct G
+{
+ F *g;
+ G () { g = new F; }
+ G (const G& x) { g = x.g; g->a1 (); }
+ ~G () {}
+ G& operator= (const G& x) { x.g->a1 (); g = x.g; return *this; }
+ D g1 () { g4 (); return D (g->f); }
+ E g1 () const { return E (g->f); }
+ E g2 () const { return E (g->f->next); }
+ D g3 (const T& x) { g4 (); return g->f1 (g1 (), x); }
+ void g4 () { if (g->a > 1) { g->a2 (); g = new F (*g); } }
+
+ G operator+ (const G& x) const
+ {
+ G x2 (*this);
+ for (E i = x.g2 (); i != x.g1 (); ++i)
+ x2.g3 (*i);
+ return x2;
+ }
+
+ G& operator+= (const G& x)
+ {
+ for (E i = x.g2 (); i != x.g1 (); ++i)
+ g3 (*i);
+ return *this;
+ }
+};
+
+struct H : public G
+{
+ H () {}
+ H (const H& x) : G (x) {}
+ H (const G& x) : G (x) {}
+};
+
+void foo ();
+
+int
+main ()
+{
+ H a = H () + H ();
+ a += H ();
+ H b;
+ b = H () + H ();
+}
const1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: range-test-2.C
===================================================================
--- range-test-2.C (nonexistent)
+++ range-test-2.C (revision 154)
@@ -0,0 +1,96 @@
+// Test fold-const.c (fold_range_test) optimizations.
+// { dg-do run } */
+// { dg-options "-O2" } */
+
+#include
+#include
+#include
+
+#if (INT_MAX == 2147483647) && (INT_MIN == -2147483648) \
+ && (SCHAR_MIN == -128) && (SCHAR_MAX == 127) \
+ && (UCHAR_MIN == 0) && (UCHAR_MAX == 255)
+
+#ifndef T
+
+enum enum3
+{
+ enum3_zero,
+ enum3_one,
+ enum3_two,
+ enum3_three,
+ enum3_four,
+ enum3_five,
+ enum3_six,
+ enum3_seven
+};
+
+int var;
+void
+check ()
+{
+ ++var;
+}
+
+#define T(IDX, TYPE, TEST, YESARR, NOARR) \
+void __attribute__((noinline)) \
+test##IDX (TYPE x) \
+{ \
+ if (TEST) \
+ check (); \
+}
+#include "range-test-2.C"
+#undef T
+
+int
+main ()
+{
+ int i, fails = 0;
+
+#define C ,
+#define T(IDX, TYPE, TEST, YESARR, NOARR) \
+ { \
+ static TYPE yesarr##IDX [] = YESARR; \
+ static TYPE noarr##IDX [] = NOARR; \
+ for (i = 0; i < (int) (sizeof (yesarr##IDX) / sizeof (TYPE)); ++i) \
+ { \
+ var = 0; \
+ test##IDX (yesarr##IDX [i]); \
+ if (var != 1) \
+ printf ("test" #IDX " failed for yesarr [%u]\n", i), ++fails; \
+ } \
+ var = 0; \
+ for (i = 0; i < (int) (sizeof (noarr##IDX) / sizeof (TYPE)); ++i) \
+ { \
+ test##IDX (noarr##IDX [i]); \
+ if (var != 0) \
+ printf ("test" #IDX " failed for noarr [%u]\n", i), ++fails; \
+ } \
+ }
+#include "range-test-2.C"
+#undef T
+
+ if (fails)
+ abort ();
+
+ exit (0);
+}
+
+#else
+
+/* Use `C' instead of `,' below to separate array entries. */
+
+T(26, enum3, x == enum3_one || x == enum3_two || x == enum3_three,
+ { enum3_one C enum3_two C enum3_three }, { enum3_zero C enum3_four
+ C enum3_five C enum3_six C enum3_seven })
+
+#endif
+
+#else
+
+int
+main (void)
+{
+ return 0;
+}
+
+#endif
range-test-2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: builtins1.C
===================================================================
--- builtins1.C (nonexistent)
+++ builtins1.C (revision 154)
@@ -0,0 +1,14 @@
+// PR c++/14791
+// Test if builtins with FILE * arguments work
+// { dg-options "-O2 -Wformat" }
+
+typedef struct _FILE FILE;
+FILE *stderr;
+extern "C" int printf (__const char *__restrict, ...);
+extern "C" int fprintf (FILE *__restrict, __const char *__restrict, ...);
+
+int main ()
+{
+ printf ("%d\n", 1, 1); // { dg-warning "too many arguments for format" }
+ fprintf (stderr, "%d\n", 1, 1); // { dg-warning "too many arguments for format" }
+}
builtins1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr30252.C
===================================================================
--- pr30252.C (nonexistent)
+++ pr30252.C (revision 154)
@@ -0,0 +1,226 @@
+/* { dg-do run } */
+/* { dg-options "-O -fstrict-aliasing" } */
+
+extern "C" void abort (void);
+namespace sigc {
+ template
+ struct type_trait
+ {
+ typedef T_type& pass;
+ typedef const T_type& take;
+ typedef T_type* pointer;
+ };
+ template
+ struct is_base_and_derived
+ {
+ struct big {
+ char memory[64];
+ };
+ static big is_base_class_(...);
+ static char is_base_class_(typename type_trait::pointer);
+ static const bool value =
+ sizeof(is_base_class_(reinterpret_cast::pointer>(0))) ==
+ sizeof(char);
+ };
+ struct nil;
+ struct functor_base {};
+ template ::value>
+ struct functor_trait
+ {
+ };
+ template
+ struct functor_trait
+ {
+ typedef typename T_functor::result_type result_type;
+ typedef T_functor functor_type;
+ };
+ template
+ class pointer_functor1 : public functor_base
+ {
+ typedef T_return (*function_type)(T_arg1);
+ function_type func_ptr_;
+ public:
+ typedef T_return result_type;
+ explicit pointer_functor1(function_type _A_func): func_ptr_(_A_func) {}
+ T_return operator()(typename type_trait::take _A_a1) const
+ { return func_ptr_(_A_a1); }
+ };
+ template
+ inline pointer_functor1
+ ptr_fun1(T_return (*_A_func)(T_arg1))
+ { return pointer_functor1(_A_func); }
+ struct adaptor_base : public functor_base {};
+ template ::value>
+ struct deduce_result_type
+ { typedef typename functor_trait::result_type type; };
+ template
+ struct adaptor_functor : public adaptor_base
+ {
+ template
+ struct deduce_result_type
+ { typedef typename sigc::deduce_result_type::type type; };
+ typedef typename functor_trait::result_type result_type;
+ result_type
+ operator()() const;
+ template
+ typename deduce_result_type::type
+ operator()(T_arg1 _A_arg1) const
+ { return functor_(_A_arg1); }
+ explicit adaptor_functor(const T_functor& _A_functor)
+ : functor_(_A_functor)
+ {}
+ mutable T_functor functor_;
+ };
+ template
+ typename adaptor_functor::result_type
+ adaptor_functor::operator()() const
+ { return functor_(); }
+ template ::value> struct adaptor_trait;
+ template
+ struct adaptor_trait
+ {
+ typedef T_functor adaptor_type;
+ };
+ template
+ struct adaptor_trait
+ {
+ typedef typename functor_trait::functor_type functor_type;
+ typedef adaptor_functor adaptor_type;
+ };
+ template
+ struct adapts : public adaptor_base
+ {
+ typedef typename adaptor_trait::adaptor_type adaptor_type;
+ explicit adapts(const T_functor& _A_functor)
+ : functor_(_A_functor)
+ {}
+ mutable adaptor_type functor_;
+ };
+ template
+ struct reference_wrapper
+ {
+ };
+ template
+ struct unwrap_reference
+ {
+ typedef T_type type;
+ };
+ template
+ class bound_argument
+ {
+ public:
+ bound_argument(const T_type& _A_argument)
+ : visited_(_A_argument)
+ {}
+ inline T_type& invoke()
+ { return visited_; }
+ T_type visited_;
+ };
+ template
+ class bound_argument< reference_wrapper >
+ {
+ };
+ template
+ struct bind_functor;
+ template
+ struct bind_functor<-1, T_functor, T_type1> : public adapts
+ {
+ typedef typename adapts::adaptor_type adaptor_type;
+ typedef typename adaptor_type::result_type result_type;
+ result_type
+ operator()()
+ {
+ return this->functor_.template operator()::type>::pass> (bound1_.invoke());
+ }
+ bind_functor(typename type_trait::take _A_func, typename type_trait::take _A_bound1)
+ : adapts(_A_func), bound1_(_A_bound1)
+ {}
+ bound_argument bound1_;
+ };
+ template
+ inline bind_functor<-1, T_functor,
+ T_type1>
+ bind(const T_functor& _A_func, T_type1 _A_b1)
+ { return bind_functor<-1, T_functor,
+ T_type1>
+ (_A_func, _A_b1);
+ }
+ namespace internal {
+ struct slot_rep;
+ typedef void* (*hook)(slot_rep *);
+ struct slot_rep
+ {
+ hook call_;
+ };
+ }
+ class slot_base : public functor_base
+ {
+ public:
+ typedef internal::slot_rep rep_type;
+ explicit slot_base(rep_type* rep)
+ : rep_(rep)
+ {
+ }
+ mutable rep_type *rep_;
+ };
+ namespace internal {
+ template
+ struct typed_slot_rep : public slot_rep
+ {
+ typedef typename adaptor_trait::adaptor_type adaptor_type;
+ adaptor_type functor_;
+ inline typed_slot_rep(const T_functor& functor)
+ : functor_(functor)
+ {
+ }
+ };
+ template
+ struct slot_call0
+ {
+ static void *call_it(slot_rep* rep)
+ {
+ typedef typed_slot_rep typed_slot;
+ typed_slot *typed_rep = static_cast(rep);
+ return (typed_rep->functor_)();
+ }
+ static hook address()
+ {
+ return &call_it;
+ }
+ };
+ }
+
+ class slot0 : public slot_base
+ {
+ public:
+ typedef void * (*call_type)(rep_type*);
+ inline void *operator()() const
+ {
+ return slot_base::rep_->call_ (slot_base::rep_);
+ }
+ template
+ slot0(const T_functor& _A_func)
+ : slot_base(new internal::typed_slot_rep(_A_func))
+ {
+ slot_base::rep_->call_ = internal::slot_call0::address();
+ }
+ };
+}
+struct A
+{
+ static void *foo (void *p) { return p; }
+ typedef sigc::slot0 C;
+ C bar();
+};
+A::C A::bar ()
+{
+ return sigc::bind (sigc::ptr_fun1 (&A::foo), (void*)0);
+}
+int main (void)
+{
+ A a;
+ if (a.bar ()() != 0)
+ abort ();
+}
pr30252.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: eh3.C
===================================================================
--- eh3.C (nonexistent)
+++ eh3.C (revision 154)
@@ -0,0 +1,33 @@
+// PR target/18841
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+int r, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5;
+
+struct S
+{
+ ~S() { r = i1 + i2 + i3 + i4 + i5; }
+};
+
+void foo()
+{
+ S s;
+ throw 1;
+}
+
+void bar()
+{
+ try {
+ foo();
+ } catch (...) {
+ }
+}
+
+int main()
+{
+ bar();
+ if (r != 1 + 2 + 3 + 4 + 5)
+ abort ();
+}
eh3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17724-1.C
===================================================================
--- pr17724-1.C (nonexistent)
+++ pr17724-1.C (revision 154)
@@ -0,0 +1,23 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+namespace N { char *strcpy (char *, const char *); }
+extern "C" char *strcpy (char *, const char *) throw ();
+inline char *N::strcpy (char *s, const char *t) { return ::strcpy (s, t); }
+
+struct S { ~S (); };
+int foo ();
+
+int
+main ()
+{
+ S s;
+ int a;
+ char b[64];
+ N::strcpy (b, "ABCDEFGHIJKLM");
+ while ((a = foo ()) != -1)
+ if (a)
+ return -1;
+ return 0;
+}
pr17724-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: anonunion1.C
===================================================================
--- anonunion1.C (nonexistent)
+++ anonunion1.C (revision 154)
@@ -0,0 +1,25 @@
+// PR c++/5748
+// This testcase ICEd because used flag from the anon union variables
+// was not propagated back to the anon union itself, causing addressof
+// not to be replaced with stack slot.
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A {
+ A ();
+ ~A ();
+ int foo ();
+ int bar (void *x, int y);
+};
+
+int A::foo()
+{
+ union {
+ int a;
+ int b;
+ };
+
+ if (bar (&a, sizeof (int)) != 32)
+ return 16;
+ return 0;
+}
anonunion1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr20991.C
===================================================================
--- pr20991.C (nonexistent)
+++ pr20991.C (revision 154)
@@ -0,0 +1,34 @@
+// PR middle-end/20991
+// { dg-options "-O2" }
+// { dg-do compile }
+
+struct S
+{
+ virtual inline int foo () const;
+ virtual inline bool bar () const;
+ virtual int baz (int) const;
+};
+
+inline int S::foo () const
+{
+ return 1;
+}
+
+inline bool S::bar () const
+{
+ return foo () == 0;
+}
+
+void A ()
+{
+ S s;
+ if (s.bar ())
+ s.foo ();
+}
+
+void B ()
+{
+ S s;
+ if (s.bar ())
+ s.foo ();
+}
pr20991.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17724-5.C
===================================================================
--- pr17724-5.C (nonexistent)
+++ pr17724-5.C (revision 154)
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern char *strcpy (char* d, const char* s) throw ();
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+ A a;
+ try
+ {
+ char z[22];
+ if (this->E) B (z, "");
+ return 0;
+ }
+ catch (int &f) { return -1; }
+}
pr17724-5.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv3.C
===================================================================
--- nrv3.C (nonexistent)
+++ nrv3.C (revision 154)
@@ -0,0 +1,24 @@
+// PR optimization/6189
+// Bug: we forgot about foo's nrv after writing it out.
+// { dg-options -O3 }
+// { dg-do run }
+
+struct A
+{
+ int i;
+};
+
+
+A foo ()
+{
+ A a;
+ a.i = 42;
+ return a;
+}
+
+
+int main()
+{
+ A b = foo();
+ return b.i != 42;
+}
nrv3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ptrmem4.C
===================================================================
--- ptrmem4.C (nonexistent)
+++ ptrmem4.C (revision 154)
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O3" }
+
+struct X { void foo (); };
+
+template
+inline void spawn (void (X::*fun_ptr)()) {}
+
+void bar () {
+ void (X::*const comp)() = &X::foo;
+ spawn (comp);
+}
ptrmem4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr26179.C
===================================================================
--- pr26179.C (nonexistent)
+++ pr26179.C (revision 154)
@@ -0,0 +1,22 @@
+/* The problem here is that Load PRE on the tree level
+ forgot to handle RETURN_DECL which causes us to ICE. */
+
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct a
+{
+ int i;
+};
+void h(struct a&);
+void l(void);
+
+struct a g(void)
+{
+ struct a fl;
+ h(fl);
+ if (fl.i)
+ l();
+ fl.i+=2;
+ return fl;
+}
pr26179.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: loop2.C
===================================================================
--- loop2.C (nonexistent)
+++ loop2.C (revision 154)
@@ -0,0 +1,24 @@
+// PR middle-end/22484
+// { dg-do compile }
+// { dg-options "-O3" }
+
+struct A { ~A(); };
+typedef bool B;
+
+bool foo();
+
+bool bar(A&)
+{
+ B b = true;
+
+ for (int i = 0; i < 2 && b; ++i)
+ b = foo();
+
+ return b;
+}
+
+void baz()
+{
+ A a;
+ if (bar(a)) foo();
+}
loop2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv7.C
===================================================================
--- nrv7.C (nonexistent)
+++ nrv7.C (revision 154)
@@ -0,0 +1,13 @@
+// PR c++/15461
+
+struct A {
+ int i;
+};
+
+inline A foo () {
+ int j = 1;
+ A a = { j };
+ return a;
+}
+
+A tv = foo();
nrv7.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: longbranch1.C
===================================================================
--- longbranch1.C (nonexistent)
+++ longbranch1.C (revision 154)
@@ -0,0 +1,36 @@
+// PR c++/5964
+// This testcase failed to link on sparc -m64 -O0, because instruction
+// lengths were incorrectly computed
+// { dg-do link }
+// { dg-options "-O0" }
+
+#define makecode for (int i = 1; i < 1000; ++i) i *= 3
+#define muchcode \
+ makecode; makecode; makecode; makecode; makecode; makecode; \
+ makecode; makecode; makecode; makecode; makecode; makecode; \
+ makecode; makecode; makecode; makecode; makecode; makecode; \
+ makecode; makecode; makecode; makecode; makecode; makecode
+
+#define verymuchcode \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode; \
+ muchcode; muchcode; muchcode; muchcode; muchcode; muchcode
+
+int
+main (int argc, char **argv)
+{
+loop:
+ verymuchcode;
+ delete[] argv;
+ goto loop;
+}
longbranch1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: static1.C
===================================================================
--- static1.C (nonexistent)
+++ static1.C (revision 154)
@@ -0,0 +1,20 @@
+// PR c++/6073
+// This testcase ICEd because finish_struct_bits changed
+// A's and const A's TYPE_MODE from QI to BLK, but did
+// not change a's DECL_MODE because its mode was not
+// TYPE_MAIN_VARIANT.
+
+struct A
+{
+ static const A a;
+ ~A ();
+};
+
+void bar (A x);
+void foo ();
+
+void
+foo ()
+{
+ bar (A::a);
+}
static1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: thunk1.C
===================================================================
--- thunk1.C (nonexistent)
+++ thunk1.C (revision 154)
@@ -0,0 +1,42 @@
+// PR 6788
+// Test that the thunk adjusts the this pointer properly.
+// { dg-do run }
+
+extern "C" void abort ();
+
+struct A
+{
+ virtual void foo() = 0;
+ char large[33*1024];
+};
+
+struct B
+{
+ virtual void foo() = 0;
+};
+
+struct C : public A, public B
+{
+ virtual void foo();
+};
+
+static C *match;
+
+void C::foo()
+{
+ if (this != match)
+ abort ();
+}
+
+void bar(B *x)
+{
+ x->foo();
+}
+
+int main()
+{
+ C obj;
+ match = &obj;
+ bar(&obj);
+ return 0;
+}
thunk1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: expect2.C
===================================================================
--- expect2.C (nonexistent)
+++ expect2.C (revision 154)
@@ -0,0 +1,11 @@
+// PR c++/13392
+// { dg-do compile }
+// { dg-options "-O0" }
+
+extern "C" void abort (void);
+struct X { ~X () throw() {} };
+bool foo (X s = X ()) { return false; }
+void bar ()
+{
+ __builtin_expect (foo () && true, 1) ? 0 : (abort (), 0);
+}
expect2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: delay-slot-1.C
===================================================================
--- delay-slot-1.C (nonexistent)
+++ delay-slot-1.C (revision 154)
@@ -0,0 +1,111 @@
+/* PR rtl-optimization/23585 */
+/* Testcase by Matti Rintala */
+
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+template
+class const_mem_fun_t
+{
+public:
+ explicit
+ const_mem_fun_t(_Ret (_Tp::*__pf)() const)
+ : _M_f(__pf) {}
+
+ _Ret
+ operator()(const _Tp* __p) const
+ { return (__p->*_M_f)(); }
+private:
+ _Ret (_Tp::*_M_f)() const;
+};
+
+template
+class const_mem_fun_ref_t
+{
+public:
+ explicit
+ const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const)
+ : _M_f(__pf) {}
+
+ _Ret
+ operator()(const _Tp& __r) const
+ { return (__r.*_M_f)(); }
+private:
+ _Ret (_Tp::*_M_f)() const;
+};
+
+template
+class const_mem_fun1_t
+{
+public:
+ explicit
+ const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const)
+ : _M_f(__pf) {}
+
+ _Ret
+ operator()(const _Tp* __p, _Arg __x) const
+ { return (__p->*_M_f)(__x); }
+private:
+ _Ret (_Tp::*_M_f)(_Arg) const;
+};
+
+
+template
+class const_mem_fun1_ref_t
+{
+public:
+ explicit
+ const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const)
+ : _M_f(__pf) {}
+
+ _Ret
+ operator()(const _Tp& __r, _Arg __x) const
+ { return (__r.*_M_f)(__x); }
+private:
+ _Ret (_Tp::*_M_f)(_Arg) const;
+};
+
+template
+inline const_mem_fun_t<_Ret, _Tp>
+mem_fun(_Ret (_Tp::*__f)() const)
+{ return const_mem_fun_t<_Ret, _Tp>(__f); }
+
+template
+inline const_mem_fun_ref_t<_Ret, _Tp>
+mem_fun_ref(_Ret (_Tp::*__f)() const)
+{ return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
+
+template
+inline const_mem_fun1_t<_Ret, _Tp, _Arg>
+mem_fun(_Ret (_Tp::*__f)(_Arg) const)
+{ return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+
+template
+inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
+mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
+{ return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+
+class Klasse {
+public:
+ void vf0c() const;
+ void vf1c(const int&) const;
+};
+
+int main()
+{
+ Klasse obj;
+ const Klasse& objc = obj;
+
+ mem_fun(&Klasse::vf0c)(&objc);
+ mem_fun(&Klasse::vf1c)(&objc, 1);
+
+ mem_fun_ref(&Klasse::vf0c)(objc);
+ mem_fun_ref(&Klasse::vf1c)(objc, 1);
+ return 0;
+}
+
+void Klasse::vf0c() const
+{}
+
+void Klasse::vf1c(const int&) const
+{}
delay-slot-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: static5.C
===================================================================
--- static5.C (nonexistent)
+++ static5.C (revision 154)
@@ -0,0 +1,29 @@
+// PR c++/31809
+// { dg-do run }
+// { dg-options "-O2" }
+
+struct S
+{
+ unsigned v;
+ static inline S f (unsigned a);
+};
+
+inline S
+S::f (unsigned a)
+{
+ static S t = { a };
+ return t;
+}
+
+const static S s = S::f (26);
+
+extern "C" void abort (void);
+
+int
+main ()
+{
+ S t = s;
+ if (t.v != 26)
+ abort ();
+ return 0;
+}
static5.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: alias4.C
===================================================================
--- alias4.C (nonexistent)
+++ alias4.C (revision 154)
@@ -0,0 +1,56 @@
+// PR c++/27768
+// Alias grouping was losing some may_aliases, causing us to think
+// the store to w.p was dead.
+
+// { dg-do run }
+// { dg-options "-O2" }
+
+int N = 1;
+
+struct VA
+{
+ int *p, *q, *r;
+
+ VA() : p(), q() {}
+ VA(const VA&) : p(), q() {}
+ ~VA() { if (p) --N; }
+};
+
+inline void foo(VA, VA, VA) {}
+
+struct VB
+{
+ VA va;
+
+ VB() {}
+
+ VB(const VB&)
+ {
+ va.p = new int(va.q - va.p);
+ va.r = va.p + (va.q - va.p);
+ foo(va, va, va);
+ }
+};
+
+struct VC : VB { char c; };
+struct V : VC {};
+
+struct WA
+{
+ struct X {};
+ X **p, **q, **r;
+
+ WA() : p() {}
+ ~WA() { if (p) --N; }
+};
+
+struct W : WA {};
+
+int main()
+{
+ {
+ V v, u(v);
+ W w;
+ }
+ return N;
+}
alias4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr15054.C
===================================================================
--- pr15054.C (nonexistent)
+++ pr15054.C (revision 154)
@@ -0,0 +1,36 @@
+// PR middle-end/15054
+// This used to abort due to overlapping stack temporaries.
+
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort (void);
+
+struct pointer
+{
+ void* ptr;
+
+ pointer(void* x = 0) : ptr(x) {}
+ pointer(const pointer& x) : ptr(x.ptr) {}
+};
+
+struct element
+{
+ int canary;
+
+ element() : canary(123) { }
+ ~element() { pointer(); if (canary != 123) abort (); }
+};
+
+inline pointer
+insert(const element& x)
+{
+ return pointer(new element(x));
+}
+
+int
+main (void)
+{
+ insert(element());
+ return 0;
+}
pr15054.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr23056.C
===================================================================
--- pr23056.C (nonexistent)
+++ pr23056.C (revision 154)
@@ -0,0 +1,9 @@
+// PR c++/23056
+// { dg-do compile }
+
+template struct S { virtual ~S(); };
+void foo ()
+{
+ static_cast("Foo");
+}
+S a;
pr23056.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cfg2.C
===================================================================
--- cfg2.C (nonexistent)
+++ cfg2.C (revision 154)
@@ -0,0 +1,38 @@
+// PR optimization/12215
+// Origin:
+// Reduced testcase by Wolfgang Bangerth
+
+// This used to fail because the CSE pass destroyed the CFG in presence
+// of trapping loads, which led to the deletion of basic blocks.
+
+// { dg-do compile }
+// { dg-options "-O2 -fno-gcse -fnon-call-exceptions" }
+
+
+struct B {
+ ~B() throw() {}
+};
+
+struct X {
+ X(const char*, const B&);
+ ~X() {}
+};
+
+bool m();
+void f(int &i, float &arg0);
+
+void g (const char **argv) {
+ float val;
+ int i = 1;
+
+ try {
+ while ( i < 1 )
+ {
+ X arg(argv[i], B());
+ if (m())
+ throw(0);
+
+ f(i, val);
+ }
+ } catch (...) {}
+}
cfg2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mmx1.C
===================================================================
--- mmx1.C (nonexistent)
+++ mmx1.C (revision 154)
@@ -0,0 +1,65 @@
+// PR optimization/4994
+// This testcase ICEd because movsi was not supporting direct
+// mmx -> mmx register moves.
+// { dg-do compile }
+// { dg-options "-O2" }
+// { dg-options "-fno-exceptions -O2 -mmmx -fPIC" { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+
+struct A {
+ unsigned a0;
+ bool a1 () { return !--a0; }
+ void a2 ();
+};
+
+struct B
+{
+ B ();
+ B (const B &);
+ ~B();
+ B &operator= (const B &);
+ B b0 (unsigned long x, int y = 0, int z = 10) const;
+
+private:
+ A *b1;
+ static A *b2;
+};
+
+inline B::~B()
+{
+ if (b1->a1 () && b1 == b2)
+ b1->a2();
+}
+
+struct C
+{
+ C *c0;
+};
+
+struct D
+{
+ C *d0;
+ D ();
+ D (const D &c0) {}
+ D &operator++ () {
+ C *x = d0; C *y = x->c0;
+ while (x == y->c0)
+ x = y;
+ d0 = x;
+ return *this;
+ }
+};
+
+B foo (const char *x, const B &y);
+
+void bar (void)
+{
+ B *y = 0;
+ B z;
+ for (unsigned long l = 0; l < 2147483647L * 2UL + 1; l++)
+ {
+ z = y->b0 (l);
+ *y = foo ("data", z);
+ }
+ D d;
+ ++d;
+}
mmx1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: switch3.C
===================================================================
--- switch3.C (nonexistent)
+++ switch3.C (revision 154)
@@ -0,0 +1,16 @@
+// PR c++/20023
+// { dg-do compile }
+// { dg-options "-O2" }
+
+void f (void);
+typedef __SIZE_TYPE__ size_t;
+void g (void *a)
+{
+ size_t b = (size_t) a;
+ switch (b)
+ {
+ case 1:
+ f ();
+ break;
+ }
+}
switch3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: stack1.C
===================================================================
--- stack1.C (nonexistent)
+++ stack1.C (revision 154)
@@ -0,0 +1,135 @@
+// PR optimization/11198
+// Origin: Joerg Walter
+// Reduced testcase by: Volker Reichelt
+// Wolfgang Bangerth
+
+// The compiler used to allocate the same stack slot for two aggregates,
+// overlooking that assignments to members given the same address on the
+// stack may not alias and thus may be reordered by the scheduling passes.
+
+// { dg-do run }
+// { dg-options "-O2 -frename-registers" }
+
+
+double zero_;
+
+inline const int&
+min(const int& a, const int& b) {
+ if (b < a) return b; return a;
+}
+
+struct barrier { barrier () {} };
+
+template struct unbounded_array {
+ inline unbounded_array (): data_ (new double [9]) {}
+ inline double& operator [] (int i) { return data_ [i]; }
+ double* data_;
+};
+
+inline int element (int i, int j) {
+ return i + j;
+}
+
+template
+struct matrix {
+ inline matrix () : size2_ (3) {}
+
+ inline unbounded_array<> &data () { return data_; }
+
+ inline double& el (int i, int j) {
+ int dead1 = j;
+ int dead2 = 1 + i - j;
+ if (j < size2_ && i-j < 2)
+ return data () [element (j,i-j+1)];
+ barrier ();
+ return zero_;
+ }
+
+ struct iterator2;
+
+ inline iterator2 find () {
+ return iterator2 (*this);
+ }
+
+ struct iterator1 {
+ inline iterator1 (matrix *m):
+ dead1 (m), i (0) {}
+ void *dead1;
+ int i;
+ int dead2;
+ };
+
+ const int size2_;
+ unbounded_array<> data_;
+};
+
+
+template
+struct adaptor {
+ adaptor (matrix<> &m) : m(&m), upper_ (1) {}
+
+ int size1 () const;
+ int size2 () const { return 3; }
+ int lower () const { return 1; }
+ int upper () const { return upper_; }
+ matrix<> &data () { return *m; }
+
+ double& el (int i, int j) {
+ int dead1, dead2;
+ if (j < size2 () && i-j < 1)
+ return data ().el (i, j);
+
+ barrier ();
+ return zero_;
+ }
+
+ struct a_iterator2;
+
+ struct a_iterator1 {
+ a_iterator1 (adaptor &a, const matrix<>::iterator1 &it1):
+ a (&a), dead1 (it1) {}
+
+ a_iterator2 begin () const {
+ return a_iterator2(*a);
+ }
+ adaptor *a;
+ matrix<>::iterator1 dead1;
+ };
+
+ struct a_iterator2 {
+ a_iterator2 (adaptor &a) : a (&a) {}
+
+ double& f () const {
+ int i = 0;
+ int l = a->upper () + i;
+ int q = a->size2 ();
+ if (0 < q &&
+ l < a->lower () + 1 + a->upper ())
+ return a->m->el(0,0);
+
+ return a->el (i, 0);
+ }
+
+ adaptor *a;
+ };
+
+ matrix<> *m;
+ int upper_;
+};
+
+void matrix_swap (adaptor<> &bam1, adaptor<> &bam2)
+{
+ adaptor<>::a_iterator1 it1 (bam1,matrix<>::iterator1(bam1.m)),
+ it2 (bam2,matrix<>::iterator1(bam2.m));
+ int dead;
+ double x = it1.begin().f();
+ it2.begin().f() = x;
+}
+
+int main ()
+{
+ matrix<> m1,m2;
+ adaptor<> bam1 (m1), bam2 (m2);
+ matrix_swap (bam1, bam2);
+ return 0;
+}
stack1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr19317-3.C
===================================================================
--- pr19317-3.C (nonexistent)
+++ pr19317-3.C (revision 154)
@@ -0,0 +1,37 @@
+// PR c++/19317
+// { dg-options "-O2" }
+// { dg-do run }
+
+extern "C" void abort (void);
+
+struct A { int c; int d; int e; int f; };
+
+A
+foo (const A *x, const A *r)
+{
+ A t;
+ t.c = -1;
+ t.c += x->c < r->c ? x->c : r->c;
+ t.d = 0;
+ t.e = 0;
+ t.f = 0;
+ return t;
+}
+
+int
+main ()
+{
+ A a;
+ a.c = 10;
+ a.d = 0;
+ a.e = 0;
+ a.f = 0;
+ A b;
+ b.c = 100;
+ b.d = 0;
+ b.e = 0;
+ b.f = 0;
+ a = foo (&b, &a);
+ if (a.c != 9)
+ abort ();
+}
pr19317-3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: complex2.C
===================================================================
--- complex2.C (nonexistent)
+++ complex2.C (revision 154)
@@ -0,0 +1,24 @@
+// PR 22022
+// { dg-do compile }
+// { dg-options "-O2" }
+
+_Complex float f();
+_Complex float g();
+_Complex float h()throw();
+void i(_Complex float)throw();
+
+void j(void)
+{
+ _Complex float x = h();
+ try
+ {
+ try
+ {
+ x = f();
+ }catch (...)
+ {
+ x = g();
+ }
+ }catch(...){}
+ i(x);
+}
complex2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: call1.C
===================================================================
--- call1.C (nonexistent)
+++ call1.C (revision 154)
@@ -0,0 +1,21 @@
+// { dg-options "-O2" }
+
+void a (void (*f)())
+{
+ f();
+}
+
+struct RunState
+{
+ static void runcallback() { }
+ static void wait()
+ {
+ a (runcallback);
+ }
+};
+
+int main()
+{
+ RunState::wait();
+ return 0;
+}
call1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: complex6.C
===================================================================
--- complex6.C (nonexistent)
+++ complex6.C (revision 154)
@@ -0,0 +1,14 @@
+// PR 30168
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct aaa
+{
+ aaa(_Complex float __z) ;
+ _Complex float _M_value;
+};
+aaa::aaa(_Complex float __z)
+{
+ __z*=2.0f;
+ _M_value = __z;
+}
complex6.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17697-1.C
===================================================================
--- pr17697-1.C (nonexistent)
+++ pr17697-1.C (revision 154)
@@ -0,0 +1,32 @@
+// PR tree-optimization/17697
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C"
+{
+ extern int strcmp (const char *s, const char *t) throw ()
+ __attribute__ ((pure));
+}
+
+namespace A
+{
+ extern int strcmp (const char *s, const char *t);
+}
+
+inline int
+A::strcmp (const char *s, const char *t)
+{
+ return ::strcmp (s, t);
+}
+
+int
+foo (const char *x) throw ()
+{
+ return A::strcmp ("", x);
+}
+
+int
+main ()
+{
+ return foo ("") != 0 || foo ("a") == 0;
+}
pr17697-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline4.C
===================================================================
--- inline4.C (nonexistent)
+++ inline4.C (revision 154)
@@ -0,0 +1,13 @@
+// { dg-options "-O2 -ftemplate-depth-20000" }
+
+template
+inline void g() { g(); return; }
+
+template <>
+inline void g<0>() { int i; return; }
+
+void h() {
+ g<250>();
+}
+
+// { dg-final { scan-assembler-not "\n_?_Z1gILi\[0-9\]+EEvv\[: \t\n\]" } }
inline4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: reg-stack4.C
===================================================================
--- reg-stack4.C (nonexistent)
+++ reg-stack4.C (revision 154)
@@ -0,0 +1,29 @@
+// PR target/12900
+// Origin:
+
+// This used to fail on x86 because the reg-stack pass
+// deleted a valid edge.
+
+// { dg-do compile }
+// { dg-options "-mtune=i586 -O2" { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+
+struct array {
+ double data;
+ virtual ~array();
+};
+
+double glob;
+double ext1(double);
+int nmuons;
+
+void track_match()
+{
+ array vecdca;
+ if (glob < 10) return;
+ double p = glob*5;
+ double phi = vecdca.data;
+ ext1 (vecdca.data-glob);
+ ext1 (phi*2);
+ if (1 < p)
+ ++nmuons;
+}
reg-stack4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: fold1.C
===================================================================
--- fold1.C (nonexistent)
+++ fold1.C (revision 154)
@@ -0,0 +1,17 @@
+// PR middle-end/13696
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern void x(unsigned long*);
+
+enum e { red, blue, green };
+
+struct s {
+ unsigned long l;
+};
+struct s map[1][256];
+
+void
+f(int i,e j) {
+ x(&(map[i][j].l));
+}
fold1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline8.C
===================================================================
--- inline8.C (nonexistent)
+++ inline8.C (revision 154)
@@ -0,0 +1,5 @@
+// PR c++/15871
+// { dg-options "-O2 -fkeep-inline-functions" }
+// { dg-final { scan-assembler "foo" } }
+
+inline void foo(void) { }
inline8.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: emptyunion.C
===================================================================
--- emptyunion.C (nonexistent)
+++ emptyunion.C (revision 154)
@@ -0,0 +1,13 @@
+// PR optimization/11059
+// This testcase ICEd because clear_by_pieces was called with zero length.
+// { dg-do compile }
+// { dg-options "-O2" }
+
+union uni {};
+
+int main() {
+ uni *h;
+
+ h = (uni *)new uni();
+}
+
emptyunion.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: covariant1.C
===================================================================
--- covariant1.C (nonexistent)
+++ covariant1.C (revision 154)
@@ -0,0 +1,47 @@
+// PR c++/20206
+// { dg-do run }
+// { dg-options "-O0" }
+
+void
+bar (int x)
+{
+ asm ("" : : "g" (x));
+}
+
+struct S { S () {}; virtual ~S () {}; };
+struct T { virtual T *foo (int) {}; };
+struct V : virtual S, virtual T {};
+struct V v;
+struct U : public S, public T
+{
+ bool a;
+ U () {}
+ virtual ~U () {}
+ virtual V *foo (int x)
+ {
+ switch (x)
+ {
+ case 12:
+ break;
+ case 9:
+ bar (7);
+ break;
+ case 10:
+ bar (12);
+ break;
+ case 4:
+ bar (18);
+ break;
+ case 2:
+ bar (26);
+ break;
+ }
+ return &v;
+ }
+};
+U u;
+
+int
+main ()
+{
+}
covariant1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: const2.C
===================================================================
--- const2.C (nonexistent)
+++ const2.C (revision 154)
@@ -0,0 +1,42 @@
+// PR optimization/6631
+
+// { dg-do run }
+// { dg-options "-O" }
+
+extern "C" void abort (void);
+
+struct QSize
+{
+ QSize();
+ QSize( int w, int h );
+ int wd, ht;
+ friend inline const QSize operator+( const QSize &, const QSize & );
+};
+
+inline QSize::QSize()
+{ wd = ht = -1; }
+
+inline QSize::QSize( int w, int h )
+{ wd = w; ht = h; }
+
+inline const QSize operator+( const QSize & s1, const QSize & s2 )
+{ return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
+
+QSize minimumSize()
+{
+ return QSize (100, 200);
+}
+
+QSize totalMinimumSize()
+{
+ QSize s = minimumSize();
+ return s + QSize( 0, 0 );
+}
+
+int main()
+{
+ QSize s = totalMinimumSize();
+ if (s.wd != 100 || s.ht != 200)
+ abort ();
+}
+
const2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: conj1.C
===================================================================
--- conj1.C (nonexistent)
+++ conj1.C (revision 154)
@@ -0,0 +1,18 @@
+// PR target/5740
+// This testcase ICEd on SPARC -m64 because emit_group_load tried
+// to move a DFmode register into DImode register directly.
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct C
+{
+ C (double y, double z) { __real__ x = y; __imag__ x = z; }
+ double r () const { return __real__ x; }
+ double i () const { return __imag__ x; }
+ __complex__ double x;
+};
+
+C conj (const C& z)
+{
+ return C (z.r (), -z.i ());
+}
conj1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr25005.C
===================================================================
--- pr25005.C (nonexistent)
+++ pr25005.C (revision 154)
@@ -0,0 +1,34 @@
+// PR target/25005
+// { dg-options "-O2 -funroll-loops" }
+// { dg-do compile }
+
+inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
+
+struct M { ~M() { } };
+
+struct P
+{
+ P () { v[0] = 0; v[1] = 0; v[2] = 0; }
+ P (const P &x) { for (int i = 0; i < 3; ++i) v[i] = x.v[i]; }
+ double v[3];
+};
+
+struct V : public M
+{
+ V (const P *x, const P *y)
+ {
+ P *b = this->a = ::new P[2];
+ for (; x != y; ++x, ++b)
+ ::new (b) P(*x);
+ }
+ P *a;
+};
+
+void bar (const V &);
+
+void
+foo ()
+{
+ const P d[2] = { P(), P() };
+ bar (V (&d[0], &d[2]));
+}
pr25005.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr16372-1.C
===================================================================
--- pr16372-1.C (nonexistent)
+++ pr16372-1.C (revision 154)
@@ -0,0 +1,17 @@
+// PR tree-optimization/16372
+// { dg-do run }
+// { dg-options "-O1" }
+
+extern "C" void abort();
+
+enum number {ZERO, ONE, TWO, THREE, FOUR, FIVE};
+
+int main() {
+ number n = FIVE;
+
+ if((n == ONE) || (n == TWO) || (n == THREE)) {
+ abort ();
+ }
+ return 0;
+}
+
pr16372-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr28116.C
===================================================================
--- pr28116.C (nonexistent)
+++ pr28116.C (revision 154)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+struct QDateTime
+{
+ QDateTime addSecs( int secs ) const;
+ int t;
+};
+QDateTime gridToDate(long x)
+{
+ QDateTime date;
+ date = date.addSecs(1);
+ return date;
+}
+void whatsOnAt(long x, long y)
+{
+ gridToDate(x);
+}
+
pr28116.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr19108.C
===================================================================
--- pr19108.C (nonexistent)
+++ pr19108.C (revision 154)
@@ -0,0 +1,19 @@
+// PR tree-optimization/19108
+// This used to abort due to not handing RANGE_EXPR in SRA.
+
+// { dg-do compile }
+// { dg-options "-O" }
+
+struct A
+{
+ int i[6];
+ A () : i() {}
+};
+
+struct B
+{
+ A a;
+ B(const A& x) : a(x) {}
+};
+
+B b=A();
pr19108.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17724-2.C
===================================================================
--- pr17724-2.C (nonexistent)
+++ pr17724-2.C (revision 154)
@@ -0,0 +1,23 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+namespace N { char *strcpy (char *, const char *); }
+extern "C" char *strcpy (char *, const char *);
+inline char *N::strcpy (char *s, const char *t) { return ::strcpy (s, t); }
+
+struct S { ~S (); };
+int foo ();
+
+int
+main ()
+{
+ S s;
+ int a;
+ char b[64];
+ N::strcpy (b, "ABCDEFGHIJKLM");
+ while ((a = foo ()) != -1)
+ if (a)
+ return -1;
+ return 0;
+}
pr17724-2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ptrmem1.C
===================================================================
--- ptrmem1.C (nonexistent)
+++ ptrmem1.C (revision 154)
@@ -0,0 +1,12 @@
+// { dg-options "-O2" }
+
+class QWidget
+{
+ public: void repaint( bool erase = 1 );
+};
+void f (void)
+{
+ typedef void (QWidget::*A)(bool);
+ A b = &QWidget::repaint;
+}
+
ptrmem1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17624.C
===================================================================
--- pr17624.C (nonexistent)
+++ pr17624.C (revision 154)
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern void foo (void);
+int c;
+void foo (int n)
+{
+ int j = 0;
+ try
+ {
+ for(;;)
+ {
+ foo ();
+ if (j ++ == n)
+ break;
+ foo ();
+ }
+ }
+ catch (...)
+ {
+ c = j;
+ }
+}
pr17624.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr20995-1.C
===================================================================
--- pr20995-1.C (nonexistent)
+++ pr20995-1.C (revision 154)
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+template void foo()
+{
+ double d = (N ? 0.0 : 0) + 1;
+}
+
pr20995-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr16693-1.C
===================================================================
--- pr16693-1.C (nonexistent)
+++ pr16693-1.C (revision 154)
@@ -0,0 +1,25 @@
+// PR middle-end/16693
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort();
+
+unsigned short ret6666(int) {
+ return 0x66;
+}
+
+typedef enum {
+ a = 0x0, b = 0x1, c = 0x2, d = 0x3, e = 0x4, f = 0x5,
+ g = 0x6, h = 0x7, i = 0x8, j = 0x9, k = 0xa, l = 0xb,
+ m = 0xc, n = 0xd, o = 0xe, p = 0xf
+} Test_Enum;
+
+int main(void) {
+ unsigned char r1;
+ r1 = static_cast(0xf & ret6666(44));
+
+ if(r1 != 0x6)
+ abort();
+ return 0;
+}
+
pr16693-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ptrmem5.C
===================================================================
--- ptrmem5.C (nonexistent)
+++ ptrmem5.C (revision 154)
@@ -0,0 +1,19 @@
+// PR tree-opt/18904
+// { dg-do compile }
+// { dg-options "-O3" }
+
+struct Data;
+struct Wrapper {
+ Data* D;
+};
+struct Data {
+ int X;
+ void init(Wrapper&);
+};
+void Data::init( Wrapper &w ) {
+ int Data::* res = &Data::X;
+ w.D = this;
+ for( int i = 0; i < 4; i++ )
+ (w.D->*res) = 0;
+}
+
ptrmem5.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv4.C
===================================================================
--- nrv4.C (nonexistent)
+++ nrv4.C (revision 154)
@@ -0,0 +1,23 @@
+// PR optimization/7145
+// Bug: The NRV optimization caused us to lose the initializer for 'ret'.
+// { dg-options -O }
+// { dg-do run }
+
+struct GdkColor {
+ long pixel;
+ short red;
+ short green;
+ short blue;
+};
+
+inline GdkColor mkcolor() {
+ GdkColor ret={0,1,2,3};
+ return ret;
+}
+
+int
+main()
+{
+ GdkColor col=mkcolor();
+ return (col.pixel != 0 || col.red != 1 || col.green != 2 || col.blue != 3);
+}
nrv4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: copysign-1.C
===================================================================
--- copysign-1.C (nonexistent)
+++ copysign-1.C (revision 154)
@@ -0,0 +1,10 @@
+// { dg-options "-O2" }
+// { dg-do compile }
+// PR rtl-opt/27883
+// MIPS used to ICE because local flow update
+// was not removing an invalid REG_DEAD.
+
+
+double copysign (double x, double y);
+double GetDouble();
+double a = copysign (1.0, GetDouble());
copysign-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17724-6.C
===================================================================
--- pr17724-6.C (nonexistent)
+++ pr17724-6.C (revision 154)
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern char *strcpy (char* d, const char* s);
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+ A a;
+ try
+ {
+ char z[22];
+ if (this->E) B (z, "");
+ return 0;
+ }
+ catch (int &f) { return -1; }
+}
pr17724-6.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr7503-1.C
===================================================================
--- pr7503-1.C (nonexistent)
+++ pr7503-1.C (revision 154)
@@ -0,0 +1,148 @@
+// PR c++/7503
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort();
+
+void test1a()
+{
+ int A = 4;
+ int B = 4;
+
+ (A > B ? A : B) = 1;
+ if (A != 4 || B != 1)
+ abort ();
+}
+
+void test1b()
+{
+ int A = 3;
+ int B = 5;
+
+ (A > B ? A : B) = 1;
+ if (A != 3 || B != 1)
+ abort ();
+}
+
+void test1c()
+{
+ int A = 5;
+ int B = 3;
+
+ (A > B ? A : B) = 1;
+ if (A != 1 || B != 3)
+ abort ();
+}
+
+void test2a()
+{
+ int A = 4;
+ int B = 4;
+
+ (A >= B ? A : B) = 1;
+ if (A != 1 || B != 4)
+ abort ();
+}
+
+void test2b()
+{
+ int A = 3;
+ int B = 5;
+
+ (A >= B ? A : B) = 1;
+ if (A != 3 || B != 1)
+ abort ();
+}
+
+void test2c()
+{
+ int A = 5;
+ int B = 3;
+
+ (A >= B ? A : B) = 1;
+ if (A != 1 || B != 3)
+ abort ();
+}
+
+void test3a()
+{
+ int A = 4;
+ int B = 4;
+
+ (A < B ? A : B) = 1;
+ if (A != 4 || B != 1)
+ abort ();
+}
+
+void test3b()
+{
+ int A = 3;
+ int B = 5;
+
+ (A < B ? A : B) = 1;
+ if (A != 1 || B != 5)
+ abort ();
+}
+
+void test3c()
+{
+ int A = 5;
+ int B = 3;
+
+ (A < B ? A : B) = 1;
+ if (A != 5 || B != 1)
+ abort ();
+}
+
+void test4a()
+{
+ int A = 4;
+ int B = 4;
+
+ (A <= B ? A : B) = 1;
+ if (A != 1 || B != 4)
+ abort ();
+}
+
+void test4b()
+{
+ int A = 3;
+ int B = 5;
+
+ (A <= B ? A : B) = 1;
+ if (A != 1 || B != 5)
+ abort ();
+}
+
+void test4c()
+{
+ int A = 5;
+ int B = 3;
+
+ (A <= B ? A : B) = 1;
+ if (A != 5 || B != 1)
+ abort ();
+}
+
+
+int main()
+{
+ test1a();
+ test1b();
+ test1c();
+
+ test2a();
+ test2b();
+ test2c();
+
+ test3a();
+ test3b();
+ test3c();
+
+ test4a();
+ test4b();
+ test4c();
+
+ return 0;
+}
+
pr7503-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: longbranch2.C
===================================================================
--- longbranch2.C (nonexistent)
+++ longbranch2.C (revision 154)
@@ -0,0 +1,63 @@
+// PR target/11689
+// Originator: thor@math.tu-berlin.de
+
+// { dg-do compile }
+// { dg-options "-O3 -funroll-loops -mtune=k6 -fomit-frame-pointer" { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+
+
+// This used to fail to assemble because of an out-of-range 'loop' instructions.
+
+
+class JKeeper {
+public:
+ unsigned long a0;
+};
+
+class EBCOTLut : public JKeeper {
+ unsigned char a1[1<<8];
+ unsigned char a2[1<<8];
+ unsigned char a3[1<<8];
+ long a4[1<<9];
+public:
+ EBCOTLut(void);
+};
+
+EBCOTLut::EBCOTLut(void)
+{
+ unsigned char inter[36]; // intermediate lookup table;
+ unsigned long i;
+ for(i=0;i<36;i++) {
+ inter[i] = 0;
+ }
+ for(i=1;i<16;i++) {
+ a1[i | (1<<7)] = 8<<1;
+ a1[i | (1<<6)] = 8<<1;
+ }
+ for(i=0;i < ((1<<9)-1);i++) {
+ int ds = (i>>0) & 0x01; // significance of DOWN
+ int us = (i>>1) & 0x01; // significance of UP
+ int rs = (i>>2) & 0x01; // significance of RIGHT
+ int ls = (i>>3) & 0x01; // significance of LEFT
+ int dn = (i>>5) & 0x01; // sign of DOWN
+ int un = (i>>6) & 0x01; // sign of UP
+ int rn = (i>>7) & 0x01; // sign of RIGHT
+ int ln = (i>>8) & 0x01; // sign of LEFT
+ int h,v; // h and v as in the VM description
+
+ h = ls*(1-ln*2) + rs*(1-2*rn);
+ v = us*(1-un*2) + ds*(1-2*dn);
+ h = (h >= -1)?(h):(-1);
+ v = (v >= -1)?(v):(-1);
+ h = (h <= 1)?(h):(1);
+ v = (v <= 1)?(v):(1);
+ a2[i] = inter[((h+1)<<3) | (v+1)];
+ a3[i] = inter[((h+1)<<3) | (v+1)] & (unsigned char)(~1);
+ }
+ for(i=0;i< 1<<9; i++) {
+ a4[i] = 2*(i-(1<<(9-1)))*(i-(1<<(9-1))) -
+ ((i< (1<<(9-1)))?
+ (2*(i-(1<<(9-2)))*(i-(1<<(9-2)))):
+ (2*(i-(3<<(9-2)))*(i-(3<<(9-2)))));
+
+ }
+}
longbranch2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: life1.C
===================================================================
--- life1.C (nonexistent)
+++ life1.C (revision 154)
@@ -0,0 +1,18 @@
+// This testcase did not set up the pic register on IA-32 due
+// to bug in calculate_global_regs_live EH edge handling.
+// { dg-do compile { target i?86-*-linux* x86_64-*-linux* } }
+// { dg-require-effective-target ilp32 }
+// { dg-require-effective-target fpic }
+// { dg-options "-O2 -fPIC" }
+
+struct A { };
+
+void foo (A (*fn)())
+{
+ try {
+ A a = fn ();
+ } catch (...) {
+ }
+}
+
+// { dg-final { scan-assembler "GLOBAL_OFFSET_TABLE" } }
life1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: interface1-a.cc
===================================================================
--- interface1-a.cc (nonexistent)
+++ interface1-a.cc (revision 154)
@@ -0,0 +1,9 @@
+struct Test {
+ void f();
+};
+
+Test t;
+
+void g() {
+ t.f();
+}
Index: pr6713.C
===================================================================
--- pr6713.C (nonexistent)
+++ pr6713.C (revision 154)
@@ -0,0 +1,117 @@
+// PR optimization/6713
+// This testcase segfaulted on x86 because a dangling REG_EQUAL note
+// resulted in incorrect substitutions later.
+// { dg-do run }
+// { dg-options "-O2" }
+
+template class basic_iterator
+{
+ public:
+ basic_iterator(_CharT* _p) : _M_current(_p) {}
+ basic_iterator& operator++() { ++_M_current; return *this; }
+ _CharT& operator*() const { return *_M_current; }
+ bool operator!=(basic_iterator &_rhs) { return _M_current != _rhs._M_current; }
+
+ private:
+ _CharT* _M_current;
+};
+
+template class basic_string
+{
+ public:
+ typedef unsigned int size_type;
+ typedef basic_iterator<_CharT> iterator;
+
+ private:
+ struct _Rep
+ {
+ size_type _M_length;
+ size_type _M_capacity;
+ int _M_references;
+
+ bool _M_is_leaked() const { return _M_references < 0; }
+ bool _M_is_shared() const { return _M_references > 0; }
+ void _M_set_leaked() { _M_references = -1; }
+ void _M_set_sharable() { _M_references = 0; }
+ };
+
+ struct _Rep _M_rep;
+
+ struct _Alloc_hider
+ {
+ _CharT _raw[16];
+ _CharT* _M_p;
+ };
+
+ mutable _Alloc_hider _M_dataplus;
+
+ _CharT* _M_data() const { return _M_dataplus._M_p; }
+
+ void _M_leak() { if (!_M_rep._M_is_leaked()) _M_leak_hard(); }
+
+ static int count;
+
+ static void _M_leak_hard();
+
+ public:
+ explicit basic_string(const _CharT* __s);
+
+ iterator begin() { _M_leak(); return iterator(_M_data()); }
+
+ iterator end() { _M_leak(); return iterator(_M_data() + this->size()); }
+
+ size_type size() const { return _M_rep._M_length; }
+};
+
+template basic_string<_CharT>::
+basic_string(const _CharT* __s)
+{
+ int i;
+
+ for (i=0; i<15; i++) {
+ if (!__s[i])
+ break;
+
+ _M_dataplus._raw[i] = __s[i];
+ }
+
+ _M_dataplus._raw[i] = 0;
+ _M_dataplus._M_p = _M_dataplus._raw;
+
+ _M_rep._M_length = i;
+ _M_rep._M_capacity = i;
+ _M_rep._M_references = 1;
+}
+
+template int basic_string<_CharT>::count = 0;
+
+template void basic_string<_CharT>::
+_M_leak_hard()
+{
+ count++;
+}
+
+typedef basic_string string;
+
+template int basic_string::count;
+
+int isspa(int ch)
+{
+ return 0;
+}
+
+void foo(string& str)
+{
+ string::iterator it = str.begin();
+ string::iterator stop = str.end();
+
+ for (; it != stop; ++it)
+ if (isspa(*it))
+ break;
+}
+
+int main()
+{
+ string str("test");
+ foo(str);
+}
pr6713.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: rtti1.C
===================================================================
--- rtti1.C (nonexistent)
+++ rtti1.C (revision 154)
@@ -0,0 +1,20 @@
+// Test that typeid sees through references even when optimizing.
+// { dg-do run }
+// { dg-options "-O2" }
+
+#include
+
+struct A
+{
+ virtual ~A() { }
+};
+
+class B : public A { };
+
+int main ()
+{
+ B b;
+ A &aref = b;
+
+ return typeid (aref) != typeid (b);
+}
rtti1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: placeholder1.C
===================================================================
--- placeholder1.C (nonexistent)
+++ placeholder1.C (revision 154)
@@ -0,0 +1,10 @@
+// PR rtl-optimization/15159
+// { dg-options "-O2" }
+struct S { S (); };
+struct P { P (S *); };
+void foo (const P &);
+void bar ()
+{
+ P p = new S;
+ foo (p);
+}
placeholder1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: crossjump1.C
===================================================================
--- crossjump1.C (nonexistent)
+++ crossjump1.C (revision 154)
@@ -0,0 +1,34 @@
+// PR middle-end/21492
+// { dg-do compile }
+// { dg-options "-Os" }
+// { dg-options "-Os -fPIC" { target fpic } }
+
+extern char *bar (const char *, const char *);
+extern char *baz (char *, const char *);
+extern unsigned int fn (const char *);
+static const struct C { int i; } k = { 0};
+
+struct A
+{
+ ~A ();
+};
+
+char *
+foo (char *x, const char *y)
+{
+ A a;
+ char *c = x;
+
+ if (bar (y, "foo"))
+ {
+ baz (c, "foo");
+ c += fn ("foo");
+ }
+ else if (bar (y, "bar"))
+ {
+ baz (c, "bar");
+ c += fn ("bar");
+ }
+
+ return x;
+}
crossjump1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: static2.C
===================================================================
--- static2.C (nonexistent)
+++ static2.C (revision 154)
@@ -0,0 +1,13 @@
+// Origin: reichelt@igpm.rwth-aachen.de
+// PR 5571
+// { dg-options "-O2" }
+
+template struct A {};
+
+struct B
+{
+ static A a;
+ void f() { a; }
+};
+
+A B::a = A();
static2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv13.C
===================================================================
--- nrv13.C (nonexistent)
+++ nrv13.C (revision 154)
@@ -0,0 +1,42 @@
+// PR tree-optimization/32353
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+struct A
+{
+ int f;
+ A (int x) : f (x) {}
+};
+
+A
+foo (const A &x, const A &y)
+{
+ A r (0);
+ r = x.f == -111 ? y : (y.f == -111 || x.f > y.f) ? x : y;
+ A s (0);
+ r = r.f == -111 ? s : (r.f > s.f) ? r : s;
+ return r;
+}
+
+int
+main ()
+{
+ if (foo (A (0), A (1)).f != 1)
+ abort ();
+ if (foo (A (1), A (9)).f != 9)
+ abort ();
+ if (foo (A (9), A (1)).f != 9)
+ abort ();
+ if (foo (A (-4), A (-5)).f != 0)
+ abort ();
+ if (foo (A (-111), A (-111)).f != 0)
+ abort ();
+ if (foo (A (2), A (-111)).f != 2)
+ abort ();
+ if (foo (A (-111), A (6)).f != 6)
+ abort ();
+ if (foo (A (-111), A (-4)).f != 0)
+ abort ();
+}
nrv13.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: alias1.C
===================================================================
--- alias1.C (nonexistent)
+++ alias1.C (revision 154)
@@ -0,0 +1,25 @@
+// Test that type punning using an anonymous union works with strict aliasing.
+// { dg-do run }
+// { dg-options "-O2 -fstrict-aliasing" }
+
+extern "C" void abort ();
+
+void f (long i)
+{
+ union
+ {
+ long ui;
+ float uf[20];
+ };
+
+ ui = i;
+ if (uf[0] != 42.0)
+ abort ();
+}
+
+int main ()
+{
+ union U { long i; float f[20]; } u;
+ u.f[0] = 42.0;
+ f (u.i);
+}
alias1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: thunk2.C
===================================================================
--- thunk2.C (nonexistent)
+++ thunk2.C (revision 154)
@@ -0,0 +1,44 @@
+// PR c++/20206
+// { dg-do run }
+// { dg-options "-O0" }
+
+void
+bar (int x)
+{
+ asm ("" : : "g" (x));
+}
+
+struct S { S () {}; virtual ~S () {}; };
+struct T { virtual void foo (int) = 0; };
+struct U : public S, public T
+{
+ bool a;
+ U () {}
+ virtual ~U () {}
+ virtual void foo (int x)
+ {
+ switch (x)
+ {
+ case 12:
+ break;
+ case 9:
+ bar (7);
+ break;
+ case 10:
+ bar (12);
+ break;
+ case 4:
+ bar (18);
+ break;
+ case 2:
+ bar (26);
+ break;
+ }
+ }
+};
+U u;
+
+int
+main ()
+{
+}
thunk2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr23454-2.C
===================================================================
--- pr23454-2.C (nonexistent)
+++ pr23454-2.C (revision 154)
@@ -0,0 +1,106 @@
+/* PR rtl-optimization/23454 */
+/* Submitted by Matthias Klose */
+
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef unsigned long long int ulonglong;
+typedef long long int longlong;
+typedef unsigned int uint32;
+typedef unsigned int uint;
+typedef unsigned long int ulong;
+
+class Item {
+public:
+ bool null_value;
+ virtual longlong val_int()=0;
+};
+
+typedef struct st_tree_element {
+ struct st_tree_element *left,*right;
+ uint32 count;
+} TREE_ELEMENT;
+
+typedef struct st_tree {
+ uint offset_to_key,elements_in_tree,size_of_element,memory_limit,allocated;
+ void *custom_arg;
+ bool with_delete;
+ uint flag;
+} TREE;
+
+class field_info
+{
+public:
+ ulong treemem, tree_elements, empty, nulls, min_length, max_length;
+ uint room_in_tree;
+ bool found;
+ TREE tree;
+ Item *item;
+};
+
+class field_ulonglong: public field_info
+{
+ ulonglong min_arg, max_arg;
+ ulonglong sum, sum_sqr;
+ void add();
+};
+
+extern char *longlong10_to_str(longlong val,char *dst,int radix);
+extern void delete_tree(TREE*);
+extern TREE_ELEMENT *tree_insert(TREE *tree,void *custom_arg);
+
+static int compare_ulonglong(const ulonglong *s, const ulonglong *t)
+{
+ return ((*s < *t) ? -1 : *s > *t ? 1 : 0);
+}
+
+void field_ulonglong::add()
+{
+ char buff[(255*3 +1)];
+ longlong num = item->val_int();
+ uint length = (uint) (longlong10_to_str(num, buff, 10) - buff);
+ TREE_ELEMENT *element;
+
+ if (item->null_value)
+ {
+ nulls++;
+ return;
+ }
+ if (num == 0)
+ empty++;
+
+ if (room_in_tree)
+ {
+ if (!(element = tree_insert(&tree, tree.custom_arg)))
+ {
+ room_in_tree = 0;
+ delete_tree(&tree);
+ }
+ else if (element->count == 1)
+ {
+ room_in_tree = 0;
+ delete_tree(&tree);
+ }
+ }
+
+ if (!found)
+ {
+ found = 1;
+ min_arg = max_arg = sum = num;
+ sum_sqr = num * num;
+ min_length = max_length = length;
+ }
+ else if (num != 0)
+ {
+ sum += num;
+ sum_sqr += num * num;
+ if (length < min_length)
+ min_length = length;
+ if (length > max_length)
+ max_length = length;
+ if (compare_ulonglong((ulonglong*) &num, &min_arg) < 0)
+ min_arg = num;
+ if (compare_ulonglong((ulonglong*) &num, &max_arg) > 0)
+ max_arg = num;
+ }
+}
pr23454-2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: cfg3.C
===================================================================
--- cfg3.C (nonexistent)
+++ cfg3.C (revision 154)
@@ -0,0 +1,61 @@
+// PR optimization/11646
+// Origin:
+
+// This used to fail because the compiler inadvertently cleared
+// the EDGE_ABNORMAL flag on a EDGE_EH edge and didn't delete
+// unreachable blocks after CSE.
+
+// { dg-do compile }
+// { dg-options "-O -fgcse -fnon-call-exceptions" }
+
+struct C
+{
+ int i;
+};
+
+struct allocator
+{
+ ~allocator() throw() {}
+};
+
+struct _Vector_alloc_base
+{
+ _Vector_alloc_base(const allocator& __a) {}
+ allocator _M_data_allocator;
+ struct C *_M_start, *_M_end_of_storage;
+ void _M_deallocate(struct C* __p, unsigned int __n) {}
+};
+
+struct _Vector_base : _Vector_alloc_base
+{
+ _Vector_base(const allocator& __a) : _Vector_alloc_base(__a) { }
+ ~_Vector_base() { _M_deallocate(0, _M_end_of_storage - _M_start); }
+};
+
+struct vector : _Vector_base
+{
+ vector(const allocator& __a = allocator()) : _Vector_base(__a) {}
+ struct C& operator[](unsigned int __n) { return *_M_start; }
+};
+
+struct A
+{
+ float l() const;
+ A operator-(const A &) const;
+ const A& operator=(float) const;
+};
+
+struct B
+{
+ float d();
+};
+
+float f(const A& a, B& b)
+{
+ vector vc;
+ int index = vc[0].i;
+ A aa;
+ float d = (aa - a).l();
+ if (d > b.d()) aa = 0;
+ return b.d();
+}
cfg3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mmx2.C
===================================================================
--- mmx2.C (nonexistent)
+++ mmx2.C (revision 154)
@@ -0,0 +1,23 @@
+// { dg-do link { target i?86-*-* x86_64-*-* } }
+// { dg-options "-O2 -mmmx" }
+
+#include
+
+static union u { __m64 m; long long l; } u;
+extern "C" void abort (void);
+
+__attribute__((noinline))
+void bar (__m64 x)
+{
+ u.m = x;
+}
+
+int
+main ()
+{
+ bar (_mm_set_pi32 (0x000000FF,0xFFFF00FF));
+ _mm_empty ();
+ if (u.l != 0xffffff00ffLL)
+ abort ();
+ return 0;
+}
mmx2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr18084-1.C
===================================================================
--- pr18084-1.C (nonexistent)
+++ pr18084-1.C (revision 154)
@@ -0,0 +1,32 @@
+// { dg-do run }
+// { dg-options "-O3" }
+
+extern "C" void abort (void);
+
+struct X {
+ bool init;
+ void foo() { if (!init) init = true; }
+ void bar() { foo(); }
+
+};
+
+typedef unsigned long long int uint64_t;
+uint64_t mask1, mask2;
+
+uint64_t calc() {
+ return mask1 & mask2;
+}
+
+int main()
+{
+ mask1 = 0x00000000FFFFFFFFull;
+ mask2 = 0x000000000000FFFFull;
+ uint64_t value = calc();
+
+ X().bar();
+
+ if(value != calc())
+ abort ();
+ return 0;
+}
+
pr18084-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: init1.C
===================================================================
--- init1.C (nonexistent)
+++ init1.C (revision 154)
@@ -0,0 +1,4 @@
+// PR c++/23171
+// { dg-options "-O" }
+
+int *p = (int*)(int[1]){0};
init1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: switch4.C
===================================================================
--- switch4.C (nonexistent)
+++ switch4.C (revision 154)
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+// PR c++/20008
+
+// We failed to compile this because CFG cleanup left the switch
+// statement intact, whereas expand_case expected at least one
+// in-range case to remain.
+
+typedef enum _SECStatus {
+ SECWouldBlock = -2,
+ SECFailure = -1,
+ SECSuccess = 0
+} SECStatus;
+
+typedef enum {
+ SEC_ERROR_BAD_SIGNATURE = (-0x2000) + 10
+} SECErrorCodes;
+
+void g(void);
+void f(SECStatus status)
+{
+ switch( status )
+ {
+ case SEC_ERROR_BAD_SIGNATURE :
+ // This case can be optimized away in C++ (but apparently not in
+ // C), because the enum type is defined with a narrow range.
+ g();
+ break ;
+ }
+}
switch4.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: reload1.C
===================================================================
--- reload1.C (nonexistent)
+++ reload1.C (revision 154)
@@ -0,0 +1,43 @@
+// PR 7944
+// { dg-do compile }
+// { dg-options -O2 }
+
+struct B
+{
+ B & operator << (short s)
+ {
+ int j;
+ if (j)
+ return operator << (s);
+ else
+ return operator << (s);
+ }
+};
+
+struct A
+{
+ int i;
+ static void bar ();
+ static int quux ()
+ {
+ bar ();
+ return 0;
+ }
+
+ A ():i (quux ())
+ {
+ }
+ ~A ()
+ {
+ }
+};
+
+void
+foo ()
+{
+ short s[4] = { 0, 0, 0, 1 };
+ A a[2] = { A (), A () };
+
+ B b;
+ b << s[0] << s[2];
+}
reload1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr18683-1.C
===================================================================
--- pr18683-1.C (nonexistent)
+++ pr18683-1.C (revision 154)
@@ -0,0 +1,29 @@
+// PR middle-end/18683
+// { dg-do compile }
+// { dg-options "-O0" }
+
+template
+struct basic_ostream
+{
+ basic_ostream& operator<<(int __n);
+};
+
+extern basic_ostream cout;
+
+template struct linear_congruential
+{
+ template
+ friend basic_ostream&
+ operator<<(basic_ostream& os,
+ const linear_congruential& lcg)
+ {
+ return os << 1;
+ }
+};
+
+void instantiate_all()
+{
+ linear_congruential<0> lcf;
+ cout << lcf;
+}
+
pr18683-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr23478.C
===================================================================
--- pr23478.C (nonexistent)
+++ pr23478.C (revision 154)
@@ -0,0 +1,211 @@
+// PR rtl-optimization/23478
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+bool tthrow;
+struct C3 { int i; };
+class C14 {};
+struct C7
+{
+ virtual ~C7 ();
+};
+
+C7::~C7 ()
+{
+ asm volatile ("" : : : "memory");
+}
+class C2 : public C7 {};
+
+template class C13
+{
+ bool ma;
+ X *mb;
+public:
+ explicit C13 (X *p = 0) throw () : ma (p != 0), mb (p) {}
+ ~C13 ();
+};
+
+template
+C13::~C13 ()
+{
+ asm volatile ("" : : "r" (ma), "r" (mb) : "memory");
+}
+
+struct C1
+{
+ C1 (const C3 &, const C3 &, const C3 &, const C3 *&);
+};
+
+C1::C1 (const C3 &, const C3 &, const C3 &, const C3 *&)
+{
+ if (!tthrow)
+ throw 24;
+}
+
+struct C8
+{
+ struct C15 {};
+ typedef C15 *C9;
+ virtual void f1 (C2 &, long *, void *, C3 &, void *, bool) = 0;
+ virtual C13 f3 () const = 0;
+ virtual ~C8 () {}
+};
+
+bool
+xx14 ()
+{
+ bool b = false;
+ if (tthrow)
+ throw 6;
+ asm volatile ("" : : "r" (&b) : "memory");
+ return b;
+}
+
+bool
+xx2 ()
+{
+ bool b = false;
+ if (tthrow)
+ throw 6;
+ asm volatile ("" : : "r" (&b) : "memory");
+ return b;
+}
+
+C13
+xx9 ()
+{
+ return C13();
+}
+
+C2 &
+xx10 ()
+{
+ static C2 c2;
+ return c2;
+}
+
+C3 &
+xx12 ()
+{
+ static C3 c3 = { 1 };
+ return c3;
+}
+
+const C3 &
+xx5 ()
+{
+ static const C3 c3 = { 2 };
+ return c3;
+}
+
+const C3 *&
+xx4 ()
+{
+ static const C3 *p;
+ if (tthrow)
+ throw 6;
+ return p;
+}
+
+long ll13;
+
+long
+xx13 ()
+{
+ long ret;
+ asm volatile ("" : "=r" (ret) : "r" (ll13));
+ return ret;
+}
+
+void
+xx15 (C3 &x, C13 &y)
+{
+ asm volatile ("" : : "r" (&x), "r" (&y) : "memory");
+}
+
+long
+xx16 (const void *x)
+{
+ long ret;
+ asm volatile ("" : "=r" (ret) : "0" (1), "r" (x) : "memory");
+ return ret;
+}
+
+void
+xx1 (C13 x)
+{
+ asm volatile ("" : : "r" (&x) : "memory");
+ if (tthrow)
+ throw 6;
+}
+
+void
+xx3 (const C7 *x)
+{
+ if (x)
+ abort ();
+}
+
+void
+xx7 ()
+{
+ asm volatile ("" : : : "memory");
+}
+
+struct C5
+{
+ C13 f2 (C3 &v1, const void *v2, C8 *v6);
+ C7 *m2[2];
+ long m1[2];
+};
+
+C13
+C5::f2 (C3 &v1, const void *v2, C8 *v6)
+{
+ C13 v13 = xx9 ();
+ C2 &v9 = xx10 ();
+ for (long i = 1; i < 2; i++)
+ xx3 (m2[i]);
+ const C3 &ld = xx5 ();
+ xx7 ();
+ if (xx2 ())
+ throw "";
+ xx4 ();
+ C3 &si = xx12 ();
+ for (long i = 0; i < xx16 (v2); ++i)
+ {
+ C13 sk (new C1 (xx5 (), ld, xx5 (), xx4 ()));
+ xx15 (si, sk);
+ }
+ long v4 = xx13 ();
+ for (long i = v4 - 1; i >= 0; --i)
+ m1[i] = i;
+ bool v8 = xx2 ();
+ for (long i = 0; i < 2 && !xx14 (); i++)
+ {
+ v6[i].f1 (v9, 0, __null, v1, __null, v8);
+ if (v8)
+ xx1 (v6[i].f3 ());
+ }
+ return v13;
+}
+
+int
+main (void)
+{
+ C5 c5 = { { __null, __null }, { 0, 0 } };
+ bool seen = false;
+ try
+ {
+ c5.f2 (xx12 (), __null, __null);
+ }
+ catch (int n)
+ {
+ if (n != 24)
+ abort ();
+ seen = true;
+ }
+ if (!seen)
+ abort ();
+}
pr23478.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr23299.C
===================================================================
--- pr23299.C (nonexistent)
+++ pr23299.C (revision 154)
@@ -0,0 +1,63 @@
+// PR rtl-optimization/23299
+// { dg-do run }
+// { dg-options "-Os" }
+
+extern "C" void abort ();
+
+struct A
+{
+ virtual int a () {}
+};
+struct B : public A
+{
+ virtual int b () {}
+};
+struct C : public A
+{
+ virtual int c () {}
+};
+struct D
+{
+ D () { d = 64; }
+ ~D ();
+ int d;
+};
+
+int x;
+D::~D ()
+{
+ x |= 1;
+ if (d != 64)
+ abort ();
+}
+
+struct E : public B, public C
+{
+ E () {}
+ virtual int c ();
+ ~E ();
+ D dv;
+};
+
+E::~E ()
+{
+ int r = c ();
+}
+
+int
+E::c ()
+{
+ if (x > 10)
+ throw 1;
+ x |= 2;
+}
+
+int
+main (void)
+{
+ {
+ E e;
+ }
+ if (x != 3)
+ abort ();
+}
pr23299.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: complex3.C
===================================================================
--- complex3.C (nonexistent)
+++ complex3.C (revision 154)
@@ -0,0 +1,24 @@
+// PR 22022
+// { dg-do compile }
+// { dg-options "-O2" }
+
+_Complex float f();
+_Complex float g();
+_Complex float h()throw();
+void i(float)throw();
+
+float j(void)
+{
+ _Complex float x = h();
+ try
+ {
+ try
+ {
+ x = f();
+ }catch (...)
+ {
+ x += g();
+ }
+ }catch(...){}
+ i(__builtin_crealf(x)+__builtin_cimagf(x));
+}
complex3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: 20050511-1.C
===================================================================
--- 20050511-1.C (nonexistent)
+++ 20050511-1.C (revision 154)
@@ -0,0 +1,65 @@
+/* { dg-do run } */
+/* { dg-options "-w" } */
+/* { dg-options "-O3 -w" { target powerpc*-*-* } } */
+#include
+#include
+
+typedef signed short SINT16 ;
+typedef unsigned long UINT32 ;
+typedef unsigned int UINT ;
+
+class A
+{
+public:
+ union
+ {
+ SINT16 xy[2];
+ UINT32 abXY;
+ };
+ bool operator==(const A& other) const {return abXY == other.abXY;}
+ bool operator!=(const A& other) const {return abXY != other.abXY;}
+};
+
+template struct pArray { unsigned char u08[16*(((size*1)+15)/16)] __attribute__ ((aligned(16))); };
+
+struct B
+{
+ union {
+ A mvL[2];
+ pArray<1> xyz;
+ };
+} ;
+
+typedef struct
+{
+ UINT w;
+ B b;
+
+}C;
+
+
+UINT32 bar (const C * sPtr)
+{
+ UINT w = sPtr->w;
+ A a;
+
+ a.xy[0] = sPtr->b.mvL[w].xy[0]<<2;
+ a.xy[1] = sPtr->b.mvL[w].xy[1]<<2;
+
+ if (a.xy[0] != ((SINT16) 0xffff << 2))
+ abort ();
+}
+
+int main()
+{
+ A a;
+ C c;
+ a.xy[0] = 0xffff;
+ a.xy[1] = 0xffff;
+ c.w=0;
+ c.b.mvL[0].xy[0] = a.xy[0];
+ c.b.mvL[0].xy[1] = a.xy[1];
+
+ bar (&c);
+}
+
20050511-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: unroll1.C
===================================================================
--- unroll1.C (nonexistent)
+++ unroll1.C (revision 154)
@@ -0,0 +1,420 @@
+// PR optimization/12340
+// Origin: Richard Guenther
+// Testcase by Eric Botcazou
+
+// This used to segfault on x86 because the loop optimizer wrongly
+// interpreted a double assignment to a biv as a double increment,
+// which subsequently fooled the unroller.
+
+// { dg-do run }
+// { dg-options "-O2 -fno-exceptions -funroll-loops" }
+
+typedef __SIZE_TYPE__ size_t;
+
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+inline void operator delete (void*, void*) throw() { };
+
+class Loc;
+class Interval;
+
+template
+class DomainBase
+{
+public:
+ typedef typename DT::Domain_t Domain_t;
+ typedef typename DT::Storage_t Storage_t;
+
+ Domain_t &unwrap() { return *static_cast(this); }
+
+ const Domain_t &unwrap() const {
+ return *static_cast(const_cast *>(this));
+ }
+
+protected:
+ Storage_t domain_m;
+};
+
+template
+class Domain : public DomainBase
+{
+ typedef DomainBase Base_t;
+
+public:
+ typedef typename DT::Size_t Size_t;
+ typedef typename DT::Element_t Element_t;
+ typedef typename Base_t::Domain_t Domain_t;
+ typedef typename Base_t::Storage_t Storage_t;
+
+ Domain_t &operator[](int) { return this->unwrap(); }
+
+ const Domain_t &operator[](int) const { return this->unwrap(); }
+
+ template
+ void setDomain(const T &newdom) {
+ DT::setDomain(this->domain_m, newdom);
+ }
+
+ Element_t first() const { return DT::first(this->domain_m); }
+
+ Size_t length() const { return DT::length(this->domain_m); }
+
+ Size_t size() const { return length(); }
+};
+
+template
+struct DomainTraits;
+
+template<>
+struct DomainTraits
+{
+ typedef int Size_t;
+ typedef int Element_t;
+ typedef Interval Domain_t;
+ typedef Interval OneDomain_t;
+ typedef Loc AskDomain_t;
+ typedef int Storage_t[2];
+ enum { dimensions = 1 };
+ enum { wildcard = false };
+
+ static int first(const Storage_t &d) { return d[0]; }
+
+ static int length(const Storage_t &d) { return d[1]; }
+
+ static OneDomain_t &getDomain(Domain_t &d, int) { return d; }
+
+ static const OneDomain_t &getDomain(const Domain_t &d, int) { return d; }
+
+ template
+ static void setDomain(Storage_t &dom, const T &newdom) {
+ dom[0] = newdom.first();
+ dom[1] = newdom.length();
+ }
+
+ template
+ static void setDomain(Storage_t &dom, const T1 &begval, const T2 &endval) {
+ dom[0] = begval;
+ dom[1] = (endval - begval + 1);
+ }
+
+};
+
+class Interval : public Domain >
+{
+public:
+ Interval(const Interval &a) : Domain >() {
+ for (int i=0; i < DomainTraits::dimensions; ++i)
+ DomainTraits::getDomain(*this, i).setDomain(
+ DomainTraits::getDomain(a, i));
+ }
+
+ Interval(int a) : Domain >()
+ {
+ DomainTraits::setDomain(domain_m, 0, a - 1);
+ }
+};
+
+template<>
+struct DomainTraits
+{
+ typedef int Size_t;
+ typedef int Element_t;
+ typedef Loc Domain_t;
+ typedef Loc AskDomain_t;
+ typedef Loc MultResult_t;
+ typedef int Storage_t;
+
+ static int first(int d) { return d; }
+
+ template
+ static void setDomain(int &dom, const T &newdom) {
+ dom = DomainTraits::getFirst(newdom);
+ }
+};
+
+template<>
+struct DomainTraits
+ {
+ enum { dimensions = 1 };
+ enum { wildcard = false };
+
+ static int getPointDomain(int d, int) { return d; }
+
+ static int getFirst(const int &d) { return d; }
+};
+
+class Loc : public Domain >
+{
+public:
+ explicit Loc(const int &a) : Domain >() {
+ for (int i=0; i < 1; ++i)
+ (*this)[i].setDomain(DomainTraits::getPointDomain(a, 0));
+ }
+};
+
+struct ElementProperties
+{
+ enum { hasTrivialDefaultConstructor = false };
+ enum { hasTrivialDestructor = false };
+
+ static void construct(double* addr)
+ {
+ new (addr) double();
+ }
+
+ static void construct(double* addr, const double& model)
+ {
+ new (addr) double(model);
+ }
+
+ static void destruct(double *addr) {}
+};
+
+class RefCounted
+{
+public:
+ RefCounted() : count_m(0) {}
+
+ void addReference() { ++count_m; }
+ bool removeRefAndCheckGarbage()
+ {
+ return (--count_m == 0);
+ }
+
+private:
+ int count_m;
+};
+
+class RefBlockController : public RefCounted
+{
+public:
+ explicit RefBlockController(unsigned int size)
+ : pBegin_m(0), pEnd_m(0), pEndOfStorage_m(0), dealloc_m(false)
+ {
+ reallocateStorage(size, false);
+
+ if (!ElementProperties::hasTrivialDefaultConstructor)
+ {
+ for (double * pt = begin(); pt != end(); ++pt)
+ ElementProperties::construct(pt);
+ }
+ }
+
+ ~RefBlockController()
+ {
+ deleteStorage();
+ }
+
+ double *begin() const
+ {
+ return pBegin_m;
+ }
+
+ double *end() const
+ {
+ return pEnd_m;
+ }
+
+ bool isMine() const
+ {
+ return dealloc_m;
+ }
+
+private:
+ void deleteStorage()
+ {
+ if (isMine() && pBegin_m != 0)
+ {
+ if (!ElementProperties::hasTrivialDestructor)
+ for (double *pt = begin(); pt != end(); ++pt)
+ ElementProperties::destruct(pt);
+
+ char *tmp = reinterpret_cast(pBegin_m);
+ delete [] tmp;
+ }
+ }
+
+ void reallocateStorage(unsigned int newsize, bool copyold = false)
+ {
+ double *pBeginNew = 0;
+ double *pEndNew = 0;
+ double *pEndOfStorageNew = 0;
+
+ if (newsize > 0)
+ {
+ int nsize = newsize * sizeof(double);
+ char *tmp = new char[nsize];
+ pBeginNew = reinterpret_cast(tmp);
+ pEndNew = pBeginNew + newsize;
+ pEndOfStorageNew = pBeginNew + (nsize / sizeof(double));
+
+ if (copyold)
+ {
+ double * pOld = begin();
+ double * pNew = pBeginNew;
+ while (pOld != end() && pNew != pEndNew)
+ ElementProperties::construct(pNew++,*pOld++);
+ }
+ }
+
+ deleteStorage();
+
+ pBegin_m = pBeginNew;
+ pEnd_m = pEndNew;
+ pEndOfStorage_m = pEndOfStorageNew;
+ dealloc_m = true;
+ }
+
+ double *pBegin_m;
+ double *pEnd_m;
+ double *pEndOfStorage_m;
+ bool dealloc_m;
+};
+
+class DataBlockController : public RefBlockController
+{
+public:
+ explicit
+ DataBlockController(unsigned int size)
+ : RefBlockController(size), dataObjectPtr_m(new char), owned_m(true) {}
+
+ ~DataBlockController()
+ {
+ if (owned_m) delete dataObjectPtr_m;
+ }
+
+private:
+ mutable char *dataObjectPtr_m;
+ bool owned_m;
+};
+
+class RefCountedPtr
+{
+public:
+ RefCountedPtr(DataBlockController * const pT) : ptr_m(pT)
+ { if (isValid()) ptr_m->addReference(); }
+
+ ~RefCountedPtr() { invalidate(); }
+
+ DataBlockController* operator->() const { return ptr_m; }
+ void invalidate();
+ bool isValid() const { return ptr_m != 0; }
+
+private:
+ friend class RefCountedBlockPtr;
+ DataBlockController * ptr_m;
+};
+
+inline void RefCountedPtr::invalidate()
+{
+ if ( isValid() && ptr_m->removeRefAndCheckGarbage() )
+ delete ptr_m;
+ ptr_m = 0;
+}
+
+class RefCountedBlockPtr
+{
+public:
+ explicit RefCountedBlockPtr(unsigned int size)
+ : offset_m(0),
+ blockControllerPtr_m(new DataBlockController(size)) {}
+
+ int offset() const
+ {
+ return offset_m;
+ }
+
+ double *beginPointer() const
+ {
+ return blockControllerPtr_m->begin();
+ }
+
+ double *currentPointer() const
+ {
+ return beginPointer() + offset();
+ }
+
+protected:
+ int offset_m;
+ RefCountedPtr blockControllerPtr_m;
+};
+
+class DataBlockPtr : public RefCountedBlockPtr
+{
+public:
+ explicit DataBlockPtr(unsigned int size) : RefCountedBlockPtr(size) {}
+};
+
+class Node
+{
+public:
+ Node(const Interval &owned, const Interval &allocated)
+ : domain_m(owned), allocated_m(allocated) {}
+
+ const Interval &allocated() const { return allocated_m; }
+
+private:
+ Interval domain_m;
+ Interval allocated_m;
+};
+
+class DomainLayout
+{
+public:
+ explicit DomainLayout(const Interval &dom) : node_m(0, dom) {}
+
+ const Interval &domain() const
+ {
+ return node_m.allocated();
+ }
+
+private:
+ Node node_m;
+};
+
+class BrickBase
+{
+public:
+ explicit BrickBase(const Interval &domain);
+
+ int offset(const Loc &dom) const { return off_m + dom[0].first(); }
+
+protected:
+ DomainLayout layout_m;
+ int firsts_m;
+ int off_m;
+};
+
+BrickBase::BrickBase(const Interval &dom)
+ : layout_m(dom)
+{
+ firsts_m = layout_m.domain()[0].first();
+ off_m = -firsts_m;
+}
+
+class Engine : public BrickBase
+{
+public:
+ explicit Engine(const Interval &dom)
+ : BrickBase(dom), dataBlock_m(dom.size()), data_m(dataBlock_m.currentPointer()) {}
+
+ double& operator()(const Loc &loc) const
+ {
+ return data_m[this->offset(loc)];
+ }
+
+private:
+ DataBlockPtr dataBlock_m;
+ double *data_m;
+};
+
+
+int main()
+{
+ Interval I(10);
+ Engine A(I);
+
+ for (int i = 0; i < 10; i++)
+ A(Loc(i)) = 2.0 + i - i*i;
+
+ return 0;
+}
unroll1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17697-2.C
===================================================================
--- pr17697-2.C (nonexistent)
+++ pr17697-2.C (revision 154)
@@ -0,0 +1,32 @@
+// PR tree-optimization/17697
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C"
+{
+ extern int strcmp (const char *s, const char *t) throw ()
+ __attribute__ ((pure));
+}
+
+namespace A
+{
+ extern int strcmp (const char *s, const char *t) throw ();
+}
+
+inline int
+A::strcmp (const char *s, const char *t) throw ()
+{
+ return ::strcmp (s, t);
+}
+
+int
+foo (const char *x) throw ()
+{
+ return A::strcmp ("", x);
+}
+
+int
+main ()
+{
+ return foo ("") != 0 || foo ("a") == 0;
+}
pr17697-2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline1.C
===================================================================
--- inline1.C (nonexistent)
+++ inline1.C (revision 154)
@@ -0,0 +1,43 @@
+// PR c++/6316
+// This testcase ICEd because when deferred bar()::F::F() was being
+// expanded, containing bar() was still deferred and had DECL_EXTERNAL set
+// (and DECL_NOT_REALLY_EXTERN too).
+// { dg-do compile }
+// { dg-options "-O3" }
+
+struct A { ~A() throw() {} };
+template struct B { U a; B(const T *); };
+typedef B C;
+struct D { D(); };
+struct E { virtual ~E(); };
+
+E *bar ();
+
+void
+foo ()
+{
+ E *a = bar ();
+}
+
+extern char *z [];
+
+E *
+bar ()
+{
+ struct F : public E
+ {
+ F ()
+ {
+ for (int i = 0; i < 2; i++)
+ C e = z[i];
+ }
+ D x, y;
+ };
+ return new F ();
+}
+
+int
+main ()
+{
+ foo ();
+}
inline1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: asm1.C
===================================================================
--- asm1.C (nonexistent)
+++ asm1.C (revision 154)
@@ -0,0 +1,9 @@
+// PR c++/6747
+// { dg-do compile }
+// { dg-options "-O" }
+
+void foo()
+{
+ union { double d; char c[sizeof(double)]; } tmp;
+ __asm__ ("" : "=m" (tmp.d)); // { dg-bogus "not directly addressable" "double sized union element should be addressible" { xfail xstormy16-*-* } }
+}
asm1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline5.C
===================================================================
--- inline5.C (nonexistent)
+++ inline5.C (revision 154)
@@ -0,0 +1,20 @@
+// PR c++/12519
+
+// { dg-do compile }
+// { dg-options "-O" }
+
+struct A
+{
+ ~A();
+};
+
+inline const A foo()
+{
+ A a;
+ return a;
+}
+
+A bar()
+{
+ return foo();
+}
inline5.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: strength-reduce.C
===================================================================
--- strength-reduce.C (nonexistent)
+++ strength-reduce.C (revision 154)
@@ -0,0 +1,51 @@
+// This testcase was miscompiled on s390x, because strength-reduction
+// did not see biv in C::foo as used after loop, but it was used
+// in a REG_EQUAL note.
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+struct C
+{
+ int foo (char ch, int offset = __INT_MAX__) const;
+ int bar (int offset, char c) const;
+ const char *a;
+};
+
+int C::bar (int offset, char c) const
+{
+ char ch = a[offset];
+ if (ch < c)
+ return -1;
+ if (ch > c)
+ return 1;
+ return 0;
+}
+
+int C::foo (char ch, int offset) const
+{
+ int len = __builtin_strlen (a);
+ if (len == 0)
+ return __INT_MAX__;
+ if (offset >= len)
+ offset = len - 1;
+
+ while (bar (offset, ch) != 0)
+ {
+ if (offset == 0)
+ return __INT_MAX__;
+ offset--;
+ }
+
+ return offset;
+}
+
+int main (void)
+{
+ C c;
+ c.a = "/some/dir/file.ext";
+ if (c.foo ('/') != 9)
+ abort ();
+ return 0;
+}
strength-reduce.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: fold2.C
===================================================================
--- fold2.C (nonexistent)
+++ fold2.C (revision 154)
@@ -0,0 +1,19 @@
+// PR optimization/14669
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+extern "C" void exit (int);
+
+enum ActionType { EE=-1, E0=0, E1, E2 };
+
+int main(void)
+{
+ ActionType t = E0;
+
+ if (E1 <= t && t <= E2)
+ abort ();
+
+ exit (0);
+}
+
fold2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: inline9.C
===================================================================
--- inline9.C (nonexistent)
+++ inline9.C (revision 154)
@@ -0,0 +1,29 @@
+// PR c++/17972
+// Origin: Michal Ostrowski
+// Testcase by Alan Modra
+// { dg-do run }
+// { dg-options "-O" }
+// { dg-options "-O -mtune=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+
+struct thread_info
+{
+ short preempt_count;
+} x;
+
+static inline struct thread_info *cti (void) __attribute__ ((const));
+static inline struct thread_info *cti (void)
+{
+ return &x;
+}
+
+void fn (void) __attribute__ ((noinline));
+void fn (void)
+{
+ ++cti()->preempt_count;
+}
+
+int main (void)
+{
+ fn ();
+ return 0;
+}
inline9.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: const3.C
===================================================================
--- const3.C (nonexistent)
+++ const3.C (revision 154)
@@ -0,0 +1,44 @@
+// PR optimization/12926
+// This failed on SPARC64 because the assignments to the bit-fields
+// were wrongly swapped in the constructor.
+
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort(void);
+
+typedef __SIZE_TYPE__ size_t;
+
+void *my_out;
+
+struct A
+{
+ enum Type {P, U, S};
+
+ int foo1(void *, const char *);
+ int foo2(int, const Type);
+
+ A (const size_t size, const Type type): mSize(size), mType(type)
+ {
+ foo2(foo1(my_out, "type = "), type);
+ foo2(foo1(my_out, "mType = "), mType);
+ }
+
+ const size_t mSize : 8*sizeof(size_t) - 3;
+ Type mType : 2;
+};
+
+int i;
+
+int A::foo1(void *ios, const char *str) { }
+int A::foo2(int v, const Type t) { i=0; }
+
+int main()
+{
+ A testa(2, A::S);
+
+ if (testa.mType != A::S)
+ abort();
+
+ return 0;
+}
const3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: noreturn-1.C
===================================================================
--- noreturn-1.C (nonexistent)
+++ noreturn-1.C (revision 154)
@@ -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;
+}
noreturn-1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: conj2.C
===================================================================
--- conj2.C (nonexistent)
+++ conj2.C (revision 154)
@@ -0,0 +1,23 @@
+// PR target/6043
+// This testcase ICEd on IA-64 because emit_group_store
+// did not handle loading CONCAT from register group
+// { dg-do compile }
+
+struct C
+{
+ C (double y, double z) { __real__ x = y; __imag__ x = z; }
+ double r () const { return __real__ x; }
+ double i () const { return __imag__ x; }
+ __complex__ double x;
+};
+
+inline C conj (const C& x)
+{
+ return C (x.r (), - x.i ());
+}
+
+void foo (void)
+{
+ C x (1.0, 1.0);
+ conj (x);
+}
conj2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: eh1.C
===================================================================
--- eh1.C (nonexistent)
+++ eh1.C (revision 154)
@@ -0,0 +1,21 @@
+// PR middle-end/14477
+// { dg-do compile }
+// { dg-options "-O2 -fno-default-inline" }
+
+struct A
+{
+ A();
+};
+
+struct B
+{
+ B(const A*);
+};
+
+struct C
+{
+ B b;
+ C(int) : b(new A) {}
+};
+
+C c(0);
eh1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: interface1.C
===================================================================
--- interface1.C (nonexistent)
+++ interface1.C (revision 154)
@@ -0,0 +1,13 @@
+// { dg-do run }
+// { dg-options "-O2" }
+// { dg-additional-sources "interface1-a.cc" }
+
+#pragma implementation "interface1.h"
+
+#include "interface1.h"
+
+extern void g();
+
+int main () {
+ g();
+}
interface1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: crash1.C
===================================================================
--- crash1.C (nonexistent)
+++ crash1.C (revision 154)
@@ -0,0 +1,14 @@
+// PR opt/13681
+// Here we have an out-of-range array index. We should not abort
+// trying to resolve the indirection back to an object.
+
+struct X {
+ double values[1];
+ double & foo (const unsigned int index) { return values[index]; }
+};
+
+void foo() {
+ double d;
+ X h1;
+ h1.foo(1) = d;
+}
crash1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: tmp1.C
===================================================================
--- tmp1.C (nonexistent)
+++ tmp1.C (revision 154)
@@ -0,0 +1,48 @@
+// { dg-do run }
+
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 30 Jul 2003
+
+// compound exprs were causing additional temporaries.
+
+extern "C" int printf (char const *, ...);
+extern "C" void abort ();
+
+
+static unsigned order[] =
+{
+ 1, 2, 502, 102, 101,
+ 0
+};
+
+static unsigned point;
+
+static void Check (unsigned t, unsigned i, void const *ptr, char const *name)
+{
+ printf ("%d %d %p %s\n", t, i, ptr, name);
+
+ if (order[point++] != i + t)
+ abort ();
+
+}
+
+template struct A
+{
+ A () { Check (0, I, this, __PRETTY_FUNCTION__); }
+ ~A () { Check (100, I, this, __PRETTY_FUNCTION__); }
+ A (A const &) { Check (200, I, this, __PRETTY_FUNCTION__); }
+ A &operator= (A const &) { Check (300, I, this, __PRETTY_FUNCTION__); }
+ void Foo () const { Check (400, I, this, __PRETTY_FUNCTION__); }
+};
+
+template void Foo (A a)
+{
+ Check (500, I, &a, __PRETTY_FUNCTION__);
+}
+
+int main ()
+{
+ Foo ((A<1> (), A<2> ()));
+ Check (0, 0, 0, "end");
+}
tmp1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr30590.C
===================================================================
--- pr30590.C (nonexistent)
+++ pr30590.C (revision 154)
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+struct test
+{
+ int type;
+ char buffer[4242]; /* should trigger pass-by-reference */
+};
+
+int flag = 0;
+
+struct test
+reset (void)
+{
+ struct test retval;
+ retval.type = 1;
+ return retval;
+}
+
+struct test
+test (void)
+{
+ struct test result;
+ result.type = 0;
+
+ for (int i = 0; i < 2; ++i)
+ {
+ struct test candidate = reset ();
+ if (flag)
+ result = candidate;
+ }
+
+ return result;
+}
+
+int
+main (void)
+{
+ struct test result = test ();
+ return result.type;
+}
pr30590.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17902.C
===================================================================
--- pr17902.C (nonexistent)
+++ pr17902.C (revision 154)
@@ -0,0 +1,26 @@
+/* { dg-options "-O3" } */
+/* { dg-do compile } */
+
+void foo();
+struct A { ~A(){ foo(); } };
+struct B { A a; };
+void bar()
+{
+ A a;
+ bool b = false;
+ int i, j;
+
+
+ for (j=0; j
pr17902.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ptrmem2.C
===================================================================
--- ptrmem2.C (nonexistent)
+++ ptrmem2.C (revision 154)
@@ -0,0 +1,12 @@
+typedef unsigned int Mword;
+struct Thread
+{
+ Mword sys_ipc_log();
+ void hook_ipc_vector();
+ unsigned (Thread::*syscall_table)();
+};
+
+void Thread::hook_ipc_vector()
+{
+ syscall_table = &Thread::sys_ipc_log;
+}
ptrmem2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv1.C
===================================================================
--- nrv1.C (nonexistent)
+++ nrv1.C (revision 154)
@@ -0,0 +1,28 @@
+// Test for the named return value optimization.
+// { dg-do run }
+// { dg-options -fno-inline }
+
+int c;
+int d;
+
+struct A
+{
+ A() { ++c; }
+ A(const A&) { ++c; };
+ ~A() { ++d; }
+};
+
+inline A f ()
+{
+ A a;
+ return a;
+}
+
+int main ()
+{
+ {
+ A a = f ();
+ }
+
+ return !(c == 1 && c == d);
+}
nrv1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr17724-3.C
===================================================================
--- pr17724-3.C (nonexistent)
+++ pr17724-3.C (revision 154)
@@ -0,0 +1,24 @@
+// PR tree-optimization/17724
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern "C" char *strcpy (char* d, const char* s) throw ();
+
+class A { public: A (); ~A (); };
+
+inline char * B (char *s, const char *t)
+{ return ::strcpy (s, t); }
+
+class C { int D (void); int E; };
+
+int C::D (void)
+{
+ A a;
+ try
+ {
+ char z[22];
+ if (this->E) B (z, "");
+ return 0;
+ }
+ catch (int &f) { return -1; }
+}
pr17724-3.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: temp1.C
===================================================================
--- temp1.C (nonexistent)
+++ temp1.C (revision 154)
@@ -0,0 +1,45 @@
+// PR c++/16405
+// { dg-options "-O2" }
+// { dg-do run }
+
+// There should be exactly one temporary generated for the code in "f"
+// below when optimizing -- for the result of "b + c". We have no
+// easy way of checking that directly, so we count the number of calls
+// to "memcpy", which is used on (some?) targets to copy temporaries.
+// If there is more than two calls (one for coping "*this" to "t", and
+// one for copying the temporary to "a"), then there are too many
+// temporaries.
+
+int i;
+
+extern "C"
+void *memcpy (void *dest, const void *src, __SIZE_TYPE__ n)
+{
+ char *d = (char *) dest;
+ const char *s = (const char *) src;
+ while (n--)
+ d[n] = s[n];
+ ++i;
+ return dest;
+}
+
+struct T {
+ int a[128];
+ T &operator+=(T const &v) __attribute__((noinline));
+ T operator+(T const &v) const { T t = *this; t += v; return t; }
+};
+
+T &T::operator+=(T const &v) {
+ return *this;
+}
+
+T a, b, c;
+
+void f() { a = b + c; }
+
+int main () {
+ i = 0;
+ f();
+ if (i > 2)
+ return 1;
+}
temp1.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: vrp2.C
===================================================================
--- vrp2.C (nonexistent)
+++ vrp2.C (revision 154)
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+/* VRP was miscompiling the following as it thought &a->b was a dereference
+ and therfore a was non-null.
+ Reduced from Mozilla by Serge Belyshev . */
+
+extern "C" void abort (void);
+struct T { int i; } t;
+struct A : T { int j; } *p = __null;
+
+int main (void)
+{
+ if (p == &t)
+ return 0;
+ if (p)
+ abort ();
+ return 0;
+}
+
vrp2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr16693-2.C
===================================================================
--- pr16693-2.C (nonexistent)
+++ pr16693-2.C (revision 154)
@@ -0,0 +1,21 @@
+// PR middle-end/16693
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort();
+
+char foo()
+{
+ return 0x10;
+}
+
+enum E { e = 0x0f };
+
+int main()
+{
+ char c = (char)(E)(e & foo());
+ if (c != 0)
+ abort();
+ return 0;
+}
+
pr16693-2.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: ptrmem6.C
===================================================================
--- ptrmem6.C (nonexistent)
+++ ptrmem6.C (revision 154)
@@ -0,0 +1,28 @@
+// PR tree-opt/18040
+// { dg-do compile }
+// { dg-options "-O3" }
+
+int PyObject_IsTrue();
+struct object_base
+{
+ void ptr() const;
+ void ptr1() const;
+};
+struct object : public object_base
+{
+ typedef void (object::*bool_type)() const;
+ inline operator bool_type() const
+ { return PyObject_IsTrue()
+ ? &object_base::ptr : &object::ptr1; }
+};
+void f();
+void g (void)
+{
+ for (unsigned n = 0; n < 100; ++n)
+ {
+ object kv;
+ if (kv)
+ f();
+ }
+}
+
ptrmem6.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nrv5.C
===================================================================
--- nrv5.C (nonexistent)
+++ nrv5.C (revision 154)
@@ -0,0 +1,57 @@
+// PR c++/7279
+// Test for the named return value optimization with inlining.
+// Contributed by Jakub Jelinek .
+// { dg-do run }
+// { dg-options -O2 }
+
+enum E { E0, E1, E2, E3 };
+
+struct S
+{
+ E s0 : 2;
+ bool s1 : 1, s2 : 1, s3 : 1, s4 : 1, s5 : 1, s6 : 1;
+ S ();
+ void foo (E x);
+};
+
+S::S() : s1 (true), s2 (false), s0 (E1), s3 (true), s4 (false),
+ s5 (true), s6 (false) {}
+void S::foo (E x) { this->s0 = x; }
+
+inline S foo ()
+{
+ S s;
+ s.foo (E0);
+ return s;
+}
+
+inline S bar ()
+{
+ S s;
+ s.foo (E2);
+ return s;
+}
+
+void check (S &s, bool isfoo);
+
+void test (bool isfoo)
+{
+ S a = isfoo ? foo () : bar ();
+ check (a, isfoo);
+}
+
+extern "C" void abort ();
+
+void check (S &s, bool isfoo)
+{
+ if (! s.s1 || s.s2 || ! s.s3 || s.s4 || ! s.s5 || s.s6)
+ abort ();
+ if (s.s0 != (isfoo ? E0 : E2))
+ abort ();
+}
+
+int main ()
+{
+ test (true);
+ test (false);
+}
nrv5.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr27826.C
===================================================================
--- pr27826.C (nonexistent)
+++ pr27826.C (revision 154)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+struct Geometry
+{
+ int type:16;
+};
+struct Geometry get() {};
+int f()
+{
+ struct Geometry test;
+ return get().type == test.type;
+}
+
pr27826.C
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property