diff options
Diffstat (limited to 'gcc-4.8/gcc/testsuite/g++.dg/torture')
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/torture/pr57499.C | 14 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/torture/pr59163.C | 30 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/torture/pr60609.C | 252 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/torture/pr60750.C | 21 | ||||
-rw-r--r-- | gcc-4.8/gcc/testsuite/g++.dg/torture/pr60895.C | 32 |
5 files changed, 349 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/torture/pr57499.C b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr57499.C new file mode 100644 index 000000000..fd985a199 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr57499.C @@ -0,0 +1,14 @@ +// PR middle-end/57499 +// { dg-do compile } + +struct S +{ + ~S () __attribute__ ((noreturn)) {} // { dg-warning "function does return" } +}; + +void +foo () +{ + S s; + throw 1; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/torture/pr59163.C b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr59163.C new file mode 100644 index 000000000..2f9a99970 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr59163.C @@ -0,0 +1,30 @@ +// PR target/59163 +// { dg-do run } + +struct A { float a[4]; }; +struct B { int b; A a; }; + +__attribute__((noinline, noclone)) void +bar (A &a) +{ + if (a.a[0] != 36.0f || a.a[1] != 42.0f || a.a[2] != 48.0f || a.a[3] != 54.0f) + __builtin_abort (); +} + +__attribute__((noinline, noclone)) void +foo (A &a) +{ + int i; + A c = a; + for (i = 0; i < 4; i++) + c.a[i] *= 6.0f; + a = c; + bar (a); +} + +int +main () +{ + B b = { 5, { 6, 7, 8, 9 } }; + foo (b.a); +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60609.C b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60609.C new file mode 100644 index 000000000..9ddec0b60 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60609.C @@ -0,0 +1,252 @@ +/* { dg-do assemble } */ + +class exception +{ +}; +class bad_alloc:exception +{ +}; +class logic_error:exception +{ +}; +class domain_error:logic_error +{ +}; +class invalid_argument:logic_error +{ +}; +class length_error:logic_error +{ +}; +class overflow_error:exception +{ +}; +typedef int mpz_t[]; +template < class > class __gmp_expr; +template <> class __gmp_expr < mpz_t > +{ + ~__gmp_expr (); +}; + +class PIP_Solution_Node; +class internal_exception +{ + ~internal_exception (); +}; +class not_an_integer:internal_exception +{ +}; +class not_a_variable:internal_exception +{ +}; +class not_an_optimization_mode:internal_exception +{ +}; +class not_a_bounded_integer_type_width:internal_exception +{ +}; +class not_a_bounded_integer_type_representation:internal_exception +{ +}; +class not_a_bounded_integer_type_overflow:internal_exception +{ +}; +class not_a_complexity_class:internal_exception +{ +}; +class not_a_control_parameter_name:internal_exception +{ +}; +class not_a_control_parameter_value:internal_exception +{ +}; +class not_a_pip_problem_control_parameter_name:internal_exception +{ +}; +class not_a_pip_problem_control_parameter_value:internal_exception +{ +}; +class not_a_relation:internal_exception +{ +}; +class ppl_handle_mismatch:internal_exception +{ +}; +class timeout_exception +{ + ~timeout_exception (); +}; +class deterministic_timeout_exception:timeout_exception +{ +}; +void __assert_fail (const char *, const char *, int, int *) +__attribute__ ((__noreturn__)); +void PL_get_pointer (void *); +int Prolog_is_address (); +inline int +Prolog_get_address (void **p1) +{ + Prolog_is_address ()? static_cast < + void >(0) : __assert_fail ("Prolog_is_address", "./swi_cfli.hh", 0, 0); + PL_get_pointer (p1); + return 0; +} + +class non_linear:internal_exception +{ +}; +class not_unsigned_integer:internal_exception +{ +}; +class not_universe_or_empty:internal_exception +{ +}; +class not_a_nil_terminated_list:internal_exception +{ +}; +class PPL_integer_out_of_range +{ + __gmp_expr < mpz_t > n; +}; +void handle_exception (); +template < typename T > T * term_to_handle (int, const char *) +{ + if (Prolog_is_address ()) + { + void *p; + Prolog_get_address (&p); + return static_cast < T * >(0); + } + throw; +} + +void +ppl_new_MIP_Problem_from_MIP_Problem () +try +{ + term_to_handle < int >(0, "ppl_new_MIP_Problem_from_MIP_Problem/2"); +} + +catch (exception &) +{ +} + +int +ppl_PIP_Tree_Node_parametric_values () +{ + try + { + PIP_Solution_Node *a = term_to_handle < PIP_Solution_Node > (0, 0); + (void)a; + return 1; + } + catch (internal_exception &) + { + } + catch (not_unsigned_integer &) + { + handle_exception (); + } + catch (non_linear &) + { + handle_exception (); + } + catch (not_a_variable &) + { + handle_exception (); + } + catch (not_an_integer &) + { + handle_exception (); + } + catch (ppl_handle_mismatch &) + { + handle_exception (); + } + catch (not_an_optimization_mode &) + { + handle_exception (); + } + catch (not_a_complexity_class &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_width &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_representation &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_overflow &) + { + handle_exception (); + } + catch (not_a_control_parameter_name &) + { + handle_exception (); + } + catch (not_a_control_parameter_value &) + { + handle_exception (); + } + catch (not_a_pip_problem_control_parameter_name &) + { + handle_exception (); + } + catch (not_a_pip_problem_control_parameter_value &) + { + handle_exception (); + } + catch (not_universe_or_empty &) + { + handle_exception (); + } + catch (not_a_relation &) + { + handle_exception (); + } + catch (not_a_nil_terminated_list &) + { + handle_exception (); + } + catch (PPL_integer_out_of_range &) + { + handle_exception (); + } + catch (int &) + { + } catch (timeout_exception &) + { + handle_exception (); + } catch (deterministic_timeout_exception &) + { + handle_exception (); + } catch (overflow_error &) + { + handle_exception (); + } catch (domain_error &) + { + handle_exception (); + } catch (length_error &) + { + handle_exception (); + } catch (invalid_argument &) + { + handle_exception (); + } catch (logic_error &) + { + handle_exception (); + } catch (bad_alloc &) + { + handle_exception (); + } catch (exception &) + { + handle_exception (); + } catch ( ...) + { + handle_exception (); + } + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60750.C b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60750.C new file mode 100644 index 000000000..a344bd764 --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60750.C @@ -0,0 +1,21 @@ +// { dg-do run } +// { dg-options "-std=c++11" } + +#include <string> +#include <stdexcept> + +const std::string err_prefix = "Problem: "; +void thrower (std::string msg) +{ + throw std::runtime_error(err_prefix + std::move(msg)); +} + +int main(int argc, char **argv) +{ + try { + std::string base = "hello"; + thrower(std::move(base)); + } catch (const std::runtime_error &e) { + } + return 0; +} diff --git a/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60895.C b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60895.C new file mode 100644 index 000000000..0edd36ada --- /dev/null +++ b/gcc-4.8/gcc/testsuite/g++.dg/torture/pr60895.C @@ -0,0 +1,32 @@ +// { dg-do compile } + +struct C +{ + double elems[3]; +}; + +C +foo () +{ + C a; + double *f = a.elems; + int b; + for (; b;) + { + *f = 0; + ++f; + } + return a; +} + +struct J +{ + C c; + __attribute__((always_inline)) J () : c (foo ()) {} +}; + +void +bar () +{ + J (); +} |