aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.6/gcc/testsuite/g++.dg/torture
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.6/gcc/testsuite/g++.dg/torture')
-rw-r--r--gcc-4.6/gcc/testsuite/g++.dg/torture/pr49309.C15
-rw-r--r--gcc-4.6/gcc/testsuite/g++.dg/torture/pr49628.C37
-rw-r--r--gcc-4.6/gcc/testsuite/g++.dg/torture/pr49720.C8
-rw-r--r--gcc-4.6/gcc/testsuite/g++.dg/torture/pr50189.C121
4 files changed, 181 insertions, 0 deletions
diff --git a/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49309.C b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49309.C
new file mode 100644
index 0000000..a345377
--- /dev/null
+++ b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49309.C
@@ -0,0 +1,15 @@
+// PR tree-optimization/49309
+// { dg-do compile }
+// { dg-options "-fpreprocessed -fmudflap" }
+
+struct A
+{
+ int i;
+
+ A();
+ A(const A&);
+};
+
+inline void foo(A a) { a = A(); }
+
+void bar() { foo(A()); }
diff --git a/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49628.C b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49628.C
new file mode 100644
index 0000000..4bc6543
--- /dev/null
+++ b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49628.C
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+
+#include <vector>
+
+template <int rank, int dim> class Tensor;
+template <int dim> class Tensor<1,dim> {
+public:
+ explicit Tensor (const bool initialize = true);
+ Tensor (const Tensor<1,dim> &);
+ Tensor<1,dim> & operator = (const Tensor<1,dim> &);
+ double values[(dim!=0) ? (dim) : 1];
+};
+template <int dim>
+inline Tensor<1,dim> & Tensor<1,dim>::operator = (const Tensor<1,dim> &p)
+{
+ for (unsigned int i=0; i<dim; ++i)
+ values[i] = p.values[i];
+};
+template <int dim> class Quadrature {
+public:
+ const unsigned int n_quadrature_points;
+};
+class MappingQ1
+{
+ class InternalData {
+ public:
+ std::vector<Tensor<1,3> > shape_derivatives;
+ unsigned int n_shape_functions;
+ };
+ void compute_data (const Quadrature<3> &quadrature, InternalData &data)
+ const;
+};
+void MappingQ1::compute_data (const Quadrature<3> &q, InternalData &data) const
+{
+ const unsigned int n_q_points = q.n_quadrature_points;
+ data.shape_derivatives.resize(data.n_shape_functions * n_q_points);
+}
diff --git a/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49720.C b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49720.C
new file mode 100644
index 0000000..c5da7ba
--- /dev/null
+++ b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr49720.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+extern char t_start[], t_end[], t_size[];
+bool foo (void)
+{
+ long size = reinterpret_cast<long>(t_size);
+ return (size == t_end - t_start);
+}
diff --git a/gcc-4.6/gcc/testsuite/g++.dg/torture/pr50189.C b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr50189.C
new file mode 100644
index 0000000..06f1d36
--- /dev/null
+++ b/gcc-4.6/gcc/testsuite/g++.dg/torture/pr50189.C
@@ -0,0 +1,121 @@
+// { dg-do run }
+// { dg-options "-fstrict-enums" }
+
+extern "C" void abort (void);
+class CCUTILS_KeyedScalarLevelPosition
+{
+public:
+
+ typedef enum
+ {
+ UNINITED = 0,
+ AT_BEGIN = 1,
+ AT_END = 2,
+ AT_KEY = 3
+
+ } position_t;
+
+ bool is_init() const
+ { return(m_timestamp != UNINITED); }
+
+ bool is_at_begin() const
+ { return(m_timestamp == AT_BEGIN); }
+
+ position_t get_state() const
+ {
+ return((m_timestamp >= AT_KEY)
+ ? AT_KEY
+ : ((position_t)m_timestamp));
+ }
+
+ void set_at_begin()
+ { m_timestamp = AT_BEGIN; }
+
+ unsigned int get_index() const
+ { return(m_index); }
+
+ void set_pos(unsigned int a_index, unsigned int a_timestmap)
+ {
+ m_index = a_index;
+ m_timestamp = a_timestmap;
+ }
+
+ bool check_pos(unsigned int a_num_entries, unsigned int a_timestamp) const
+ {
+ if (get_state() != AT_KEY)
+ return(false);
+
+ if (m_timestamp != a_timestamp)
+ return(false);
+
+ return(m_index < a_num_entries);
+ }
+
+ void set_not_init()
+ { m_timestamp = 0; }
+
+private:
+
+ unsigned int m_timestamp;
+ unsigned int m_index;
+
+};
+
+class CCUTILS_KeyedScalarPosition
+{
+public:
+
+ CCUTILS_KeyedScalarLevelPosition m_L1;
+ CCUTILS_KeyedScalarLevelPosition m_L2;
+};
+
+class baz
+{
+public:
+ int *n[20];
+ unsigned int m_cur_array_len;
+ unsigned int m_timestamp;
+
+ unsigned int _get_timestamp() const
+ { return(m_timestamp); }
+
+ bool _check_L1_pos(const CCUTILS_KeyedScalarPosition &a_position) const
+ {
+ return(a_position.m_L1.check_pos(
+ m_cur_array_len, _get_timestamp()));
+ }
+
+ void *next (CCUTILS_KeyedScalarPosition &);
+};
+
+void * baz::next (CCUTILS_KeyedScalarPosition &a_position)
+{
+ if (a_position.m_L1.is_at_begin() || (!a_position.m_L1.is_init()))
+ {
+ a_position.m_L1.set_pos(0, _get_timestamp());
+ a_position.m_L2.set_at_begin();
+ }
+ else if (!_check_L1_pos(a_position))
+ return(0);
+
+ return n[a_position.m_L1.get_index ()];
+}
+
+int main (int, char **)
+{
+ baz obj;
+ CCUTILS_KeyedScalarPosition a_pos;
+ void *ret;
+ int n[5];
+
+ obj.n[0] = n;
+ obj.m_cur_array_len = 1;
+ obj.m_timestamp = 42;
+
+ a_pos.m_L1.set_pos (0, 42);
+
+ ret = obj.next (a_pos);
+ if (ret == 0)
+ abort ();
+ return 0;
+}