diff options
Diffstat (limited to 'gcc/testsuite')
100 files changed, 1741 insertions, 124 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e949b90730..b4864a20dbb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,227 @@ +2009-04-06 Jason Merrill <jason@redhat.com> + + PR c++/35146 + * g++.dg/template/fnspec1.C: New. + +2009-04-06 Laurent GUERBY <laurent@guerby.net> + + * lib/gnat.exp: Handle multilib. + +2009-04-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/38863 + * gfortran.dg/dependency_23.f90: New test. + +2009-04-06 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/28868 + * gcc.dg/tree-ssa/ssa-fre-21.c: New testcase. + * gcc.dg/tree-ssa/ssa-sccvn-1.c: Adjust. + * gcc.dg/tree-ssa/ssa-sccvn-2.c: Likewise. + * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. + +2009-04-06 Andrew Stubbs <ams@codesourcery.com> + + * gcc.dg/pragma-isr-trapa2.c: Skip test for FPU-less architectures. + +2009-04-06 Andrew Stubbs <ams@codesourcery.com> + + * gcc.target/sh/sh4a-memmovua.c: Include string.h instead of stdlib.h. + +2009-04-06 Andrew Stubbs <ams@codesourcery.com> + + * gcc.target/sh/sh4a-bitmovua.c (y0): Rename to y_0 to avoid a clash + with the built-in y0, and the subsequent warning. + (y1): Likewise, rename to y_1. + +2009-04-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/39414 + * gfortran.dg/proc_decl_21.f90: New. + +2009-04-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/36091 + * gfortran.dg/forall_13.f90: Add -fbounds-check option. + +2009-04-06 Hans-Peter Nilsson <hp@axis.com> + + * gfortran.dg/namelist_51.f90, gfortran.dg/utf8_2.f03, + gfortran.dg/namelist_48.f90, gfortran.dg/read_repeat.f90, + gfortran.dg/streamio_9.f90, gfortran.dg/widechar_IO_1.f90, + gfortran.dg/namelist_50.f90, gfortran.dg/namelist_52.f90, + gfortran.dg/utf8_1.f03, gfortran.dg/namelist_56.f90, + gfortran.dg/namelist_49.f90: Gate test on effective_target + fd_truncate. + * gfortran.dg/widechar_IO_3.f90: Ditto. Fix typo in comment. + +2009-04-05 Daniel Kraft <d@domob.eu> + + PR fortran/38654 + * gfortran.dg/read_float_2.f03 + * gfortran.dg/read_float_3.f90 + +2009-04-05 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/39648 + * gcc.c-torture/compile/pr39648.c: New testcase. + +2009-04-05 Jason Merrill <jason@redhat.com> + + PR c++/14912 + * g++.dg/template/error39.C: New. + +2009-04-05 Daniel Franke <franke.daniel@gmail.com> + + PR fortran/29458 + * gfortran.dg/implied_do_1.f90: New. + +2009-04-04 Tobias Burnus <burnus@net-b.de> + + PR fortran/39577 + * gfortran.dg/recursive_check_8.f90: New. + * gfortran.dg/recursive_check_9.f90: New. + * gfortran.dg/recursive_check_10.f90: New. + * gfortran.dg/recursive_check_11.f90: New. + * gfortran.dg/recursive_check_12.f90: New. + * gfortran.dg/recursive_check_13.f90: New. + * gfortran.dg/recursive_check_14.f90: New. + +2009-04-04 Jason Merrill <jason@redhat.com> + + PR c++/25185 + * g++.dg/template/error38.C: Add more tests. + +2009-04-04 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/37614 + * gfortran.dg/common_align_2.f90: New test. + +2009-04-04 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/8781 + PR tree-optimization/37892 + * g++.dg/tree-ssa/pr8781.C: New testcase. + * gcc.dg/tree-ssa/ssa-pre-25.c: Likewise. + +2009-04-04 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/39636 + * gcc.c-torture/compile/pr39636.c: New testcase. + +2009-04-03 H.J. Lu <hongjiu.lu@intel.com> + + PR rtl-optimization/39607 + * g++.dg/opt/pr39607.C: New. + +2009-04-03 Tobias Burnus <burnus@net-b.de> + + PR fortran/39594 + * gfortran.dg/common_12.f90: New. + +2009-04-03 Jason Merrill <jason@redhat.com> + + PR c++/39608 + * g++.dg/template/const2.C: New test. + +2009-04-03 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/2480 + PR tree-optimization/23086 + * gcc.dg/tree-ssa/pr2480.c: New testcase. + * gcc.dg/tree-ssa/pr23086.c: Likewise. + +2009-04-03 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/34743 + * gcc.dg/pr38984.c: Remove XFAIL, adjust. + * gcc.dg/tree-ssa/20070302-1.c: Remove XFAIL. + * gcc.dg/tree-ssa/alias-18.c: Likewise. + * gcc.dg/tree-ssa/sra-3.c: Likewise. + * gcc.dg/vect/no-vfa-vect-49.c: Likewise. + * gcc.dg/vect/no-vfa-vect-53.c: Likewise. + * gcc.dg/vect/no-vfa-vect-57.c: Likewise. + * gcc.dg/vect/no-vfa-vect-61.c: Likewise. + +2009-04-03 Richard Guenther <rguenther@suse.de> + + PR middle-end/13146 + PR tree-optimization/23940 + PR tree-optimization/33237 + PR middle-end/33974 + PR middle-end/34093 + PR tree-optimization/36201 + PR tree-optimization/36230 + PR tree-optimization/38049 + PR tree-optimization/38207 + PR tree-optimization/38230 + PR tree-optimization/38301 + PR tree-optimization/38585 + PR middle-end/38895 + PR tree-optimization/38985 + PR tree-optimization/39299 + * gcc.dg/pr19633-1.c: Adjust. + * gcc.dg/torture/pta-callused-1.c: Likewise. + * gcc.dg/torture/pr39074-2.c: Likewise. + * gcc.dg/torture/pr39074.c: Likewise. + * gcc.dg/torture/pta-ptrarith-3.c: New testcase. + * gcc.dg/torture/pr30375.c: Adjust. + * gcc.dg/torture/pr33563.c: Likewise. + * gcc.dg/torture/pr33870.c: Likewise. + * gcc.dg/torture/pr33560.c: Likewise. + * gcc.dg/torture/pta-structcopy-1.c: New testcase. + * gcc.dg/torture/ssa-pta-fn-1.c: Likewise. + * gcc.dg/tree-ssa/alias-15.c: Remove. + * gcc.dg/tree-ssa/ssa-dce-4.c: New testcase. + * gcc.dg/tree-ssa/pr26421.c: Adjust. + * gcc.dg/tree-ssa/ssa-fre-10.c: XFAIL. + * gcc.dg/tree-ssa/ssa-dce-5.c: New testcase. + * gcc.dg/tree-ssa/pr23382.c: Adjust. + * gcc.dg/tree-ssa/ssa-fre-20.c: New testcase. + * gcc.dg/tree-ssa/alias-16.c: Adjust. + * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. + * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. + * gcc.dg/tree-ssa/alias-18.c: Likewise. + * gcc.dg/tree-ssa/ssa-fre-15.c: Likewise. + * gcc.dg/tree-ssa/ssa-lim-3.c: Likewise. + * gcc.dg/tree-ssa/alias-19.c: Likewise. + * gcc.dg/tree-ssa/pta-ptrarith-1.c: New testcase. + * gcc.dg/tree-ssa/pr13146.c: Likewise. + * gcc.dg/tree-ssa/ssa-pre-23.c: Likewise. + * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. + * gcc.dg/tree-ssa/ssa-fre-18.c: Likewise. + * gcc.dg/tree-ssa/ssa-pre-24.c: New XFAILed testcase. + * gcc.dg/tree-ssa/ssa-fre-19.c: New testcase. + * gcc.dg/tree-ssa/alias-20.c: Likewise. + * gcc.dg/tree-ssa/ssa-dse-12.c: Likewise. + * gcc.dg/tree-ssa/pr38895.c: Likewise. + * gcc.dg/uninit-B.c: XFAIL. + * gcc.dg/vect/no-vfa-vect-43.c: Adjust. + * gcc.dg/uninit-pr19430.c: XFAIL. + * g++.dg/tree-ssa/pr13146.C: New testcase. + * g++.dg/opt/pr36187.C: Adjust. + * g++.dg/torture/20090329-1.C: New testcase. + +2009-04-02 Chao-ying Fu <fu@mips.com> + + * gcc.target/mips/interrupt_handler.c: New test. + +2009-04-02 David Ayers <ayers@fsfe.org> + + PR objc/18456 + * objc.dg/bad-receiver-type-2.m: New test contributed by + Alexander Mamberg. + +2009-04-02 Jason Merrill <jason@redhat.com> + + PR c++/25185 + * g++.dg/template/error38.C: New test. + +2009-04-02 Janis Johnson <janis187@us.ibm.com> + + PR tree-optimization/31677 + * gcc.dg/memcpy-1.c: Add compiler option. + 2009-04-02 Ira Rosen <irar@il.ibm.com> PR tree-optimization/39595 diff --git a/gcc/testsuite/g++.dg/opt/pr36187.C b/gcc/testsuite/g++.dg/opt/pr36187.C index fdb468d5a0a..91166940d09 100644 --- a/gcc/testsuite/g++.dg/opt/pr36187.C +++ b/gcc/testsuite/g++.dg/opt/pr36187.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 --param max-aliased-vops=20" } */ +/* { dg-options "-O2" } */ extern "C" void abort (void); enum SbxDataType { SbxINTEGER, SbxDECIMAL, SbxBYREF = 0x4000 }; diff --git a/gcc/testsuite/g++.dg/opt/pr39607.C b/gcc/testsuite/g++.dg/opt/pr39607.C new file mode 100644 index 00000000000..c39260dc5ea --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr39607.C @@ -0,0 +1,65 @@ +// PR rtl-optimization/39607 +// { dg-do compile } +// { dg-options "-O2" } + +void abcErrorMessage(int error); +enum AbcSurfType { + SURF_U, + SURF_V +}; +class AbcVec2d +{ +public: + double x; + double y; +}; +class AbcIval1d +{ +protected: + double m_dMin; + double m_dMax; +public: + AbcIval1d(); + AbcIval1d(double dMin, double dMax); + double GetMax() const { return m_dMax; } + double GetMin() const { return m_dMin; } +}; +inline AbcIval1d::AbcIval1d(double dMin, double dMax) +{ + if (dMin > dMax) { + abcErrorMessage(1); + } + else { + m_dMin = dMin; + m_dMax = dMax; + } +} +class AbcIval2d +{ +protected: + AbcVec2d m_vMin; + AbcVec2d m_vMax; +public: + AbcVec2d GetMax() const { return m_vMax; } + AbcVec2d GetMin() const { return m_vMin; } +}; +class AbcCone +{ +protected: + int m_uv; +public: + AbcIval2d GetNaturalUVDomain() const; + AbcIval1d GetLinearParamIval(AbcSurfType * pSurfParam) const; +}; +AbcIval1d AbcCone::GetLinearParamIval(AbcSurfType * pSurfParam) const +{ + AbcIval1d sIval; + AbcIval2d sUVDomain = GetNaturalUVDomain(); + if (m_uv) { + sIval = AbcIval1d(sUVDomain.GetMin().x,sUVDomain.GetMax().x); + } + else { + sIval = AbcIval1d(sUVDomain.GetMin().y,sUVDomain.GetMax().y); + } + return sIval; +} diff --git a/gcc/testsuite/g++.dg/template/const2.C b/gcc/testsuite/g++.dg/template/const2.C new file mode 100644 index 00000000000..5188fe29d10 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/const2.C @@ -0,0 +1,16 @@ +// PR c++/39608 +// We were improperly considering dependent members of the current +// instantiation to be non-constant (and therefore invalid template +// non-type arguments). + +template <int I> +struct C {}; + +template <class T> +struct A +{ + static const T x = 1; + C<A<T>::x> c; // { dg-bogus "invalid" } +}; + +A<int> a; diff --git a/gcc/testsuite/g++.dg/template/error38.C b/gcc/testsuite/g++.dg/template/error38.C new file mode 100644 index 00000000000..e26345f29a3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error38.C @@ -0,0 +1,37 @@ +// Testcase for printing typename/typedef bindings as well as template args +// in diagnostics (PR c++/25185) + +template <class T> +struct A { + typename T::type f(); // { dg-message "typename T::type = void*" } + void f(int i = 0); // { dg-message "" } + + typedef typename T::type mytype; + mytype g(); // { dg-message "mytype = void*" } + void g(int i = 0); // { dg-message "" } +}; + +struct B +{ + typedef void* type; +}; + +// Also make sure that deduced template arguments get canonicalized. + +template <class T> +void f (T &t); // { dg-message "T = int" } + +template <class T> +void f (T &t, int = 0); // { dg-message "" } + +typedef int myint; +myint i; + +int main() +{ + A<B> a; + a.f(); // { dg-error "" } + a.g(); // { dg-error "" } + + f(i); // { dg-error "" } +} diff --git a/gcc/testsuite/g++.dg/template/error39.C b/gcc/testsuite/g++.dg/template/error39.C new file mode 100644 index 00000000000..49faa3654cb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/error39.C @@ -0,0 +1,11 @@ +// PR c++/14912 + +template <class T, int N=0, int X=1> +struct A +{ +}; + +void foo(void) +{ + A<void> a = 0; // { dg-error "A<void>" } +} diff --git a/gcc/testsuite/g++.dg/template/fnspec1.C b/gcc/testsuite/g++.dg/template/fnspec1.C new file mode 100644 index 00000000000..5d5324475a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/fnspec1.C @@ -0,0 +1,16 @@ +// PR c++/35146 + +template <typename T> struct S {}; + +template <typename R> struct ref; +template <> struct ref<double> { typedef double result; }; + +template <typename T> +void foo(typename ref<T>::result, S<T>*); +template <> +void foo(S<double>, S<double>*); // { dg-error "does not match" } +template <> +void foo(double alpha, S<double>* x) +{ + alpha; x; +} diff --git a/gcc/testsuite/g++.dg/torture/20090329-1.C b/gcc/testsuite/g++.dg/torture/20090329-1.C new file mode 100644 index 00000000000..0274a1944e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/20090329-1.C @@ -0,0 +1,59 @@ +/* { dg-do compile } */ + +struct input_iterator_tag { }; +template<typename _Category, typename _Tp, typename _Distance = long, typename _Pointer = _Tp*, typename _Reference = _Tp&> +struct iterator { + typedef _Category iterator_category; +}; +template<typename _Iterator> struct iterator_traits { + typedef typename _Iterator::iterator_category iterator_category; +}; +template<typename, typename> struct __lc_rai { + template<typename _II1, typename _II2> + static _II1 __newlast1(_II1, _II1 __last1, _II2, _II2) { + return __last1; + } + template<typename _II> + static bool __cnd2(_II __first, _II __last) { + return __first != __last; + } +}; +template<typename _II1, typename _II2, typename _Compare> +bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, + _II2 __last2, _Compare __comp) { + typedef typename iterator_traits<_II1>::iterator_category _Category1; + typedef typename iterator_traits<_II2>::iterator_category _Category2; + typedef __lc_rai<_Category1, _Category2> __rai_type; + __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); + for (; + __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); + ++__first1, ++__first2) { + if (__comp(*__first1, *__first2)) return true; + } +} +void __assert_fail () throw () __attribute__ ((__noreturn__)); +template<typename T> struct BoundsContainer { }; +template<class T> class input_iterator_wrapper : public iterator<input_iterator_tag, T, long, T*, T&> { +public: + typedef BoundsContainer<T> ContainerType; + T* ptr; + ContainerType* SharedInfo; + input_iterator_wrapper(const input_iterator_wrapper& in) : ptr(in.ptr), SharedInfo(in.SharedInfo) { } + bool operator==(const input_iterator_wrapper& in) const { + (static_cast<void> ((SharedInfo != __null + && SharedInfo == in.SharedInfo) + ? 0 : (__assert_fail (), 0))); + } + bool operator!=(const input_iterator_wrapper& in) const { + return !(*this == in); + } + T& operator*() const { } + input_iterator_wrapper& operator++() { } +}; +struct X { }; +bool predicate(const X&, const X&) { + return true; +} +bool test2(input_iterator_wrapper<X>& x) { + return lexicographical_compare(x, x, x, x, predicate); +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr13146.C b/gcc/testsuite/g++.dg/tree-ssa/pr13146.C new file mode 100644 index 00000000000..62447c1a272 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr13146.C @@ -0,0 +1,74 @@ +/* { dg-do link } */ +/* { dg-options "-O -fstrict-aliasing" } */ + +class first +{ +public: + double d; + int f1; +}; + +class middle : public first +{ +}; + +class second : public middle +{ +public: + int f2; + short a; +}; + +class third +{ +public: + char a; + char b; +}; + +class multi: public third, public second +{ +public: + short s; + char f3; +}; + +extern void link_error (); + +void +foo (first *s1, second *s2) +{ + s1->f1 = 0; + s2->f2 = 0; + s1->f1++; + s2->f2++; + s1->f1++; + s2->f2++; + if (s1->f1 != 2) + link_error (); +} + +void +bar (first *s1, multi *s3) +{ + s1->f1 = 0; + s3->f3 = 0; + s1->f1++; + s3->f3++; + s1->f1++; + s3->f3++; + if (s1->f1 != 2) + link_error (); +} + + +int +main() +{ + first a; + second b; + multi c; + foo (&a, &b); + bar (&a, &c); + return 0; +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr8781.C b/gcc/testsuite/g++.dg/tree-ssa/pr8781.C new file mode 100644 index 00000000000..a9d279af74e --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr8781.C @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre-details" } */ + +int f(); + +template<typename predicate> +class noop_t { + const predicate &pred; +public: + explicit noop_t(const predicate &p) : pred(p) {} + + int operator()() const { return pred(); } +}; + +template<typename predicate> +inline noop_t<predicate> noop(const predicate pred) { + return noop_t<predicate>(pred); +} + +int x() +{ + return (noop(noop(noop(noop(noop(noop(noop(noop(noop(f)))))))))()); +} + +/* We should optimize this to a direct call. */ + +/* { dg-final { scan-tree-dump "Replacing call target with f" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39636.c b/gcc/testsuite/gcc.c-torture/compile/pr39636.c new file mode 100644 index 00000000000..ceddbb3efed --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39636.c @@ -0,0 +1,11 @@ +typedef float real; +typedef real rvec[3]; +void calc_dx2dx(real *, real *); +void phi_sr(int nj,rvec x[],int k) +{ + int i,j; + for(i=0; (i<nj-1); i++) + for(j=i+1; (j<nj); j++) + if (k) + calc_dx2dx(x[i],x[j]); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39648.c b/gcc/testsuite/gcc.c-torture/compile/pr39648.c new file mode 100644 index 00000000000..bb901fee0d5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39648.c @@ -0,0 +1,12 @@ +void +yysyntax_error (char *yyp) +{ + char const *yyf; + char yyformat[5]; + + yyf = yyformat; + while ((*yyp = *yyf) != '\0') { + if (yyf[1] == 's') + yyf += 2; + } +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39501.c b/gcc/testsuite/gcc.c-torture/execute/pr39501.c new file mode 100644 index 00000000000..3749d6e7889 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39501.c @@ -0,0 +1,83 @@ +/* { dg-options "-ffast-math" } */ +#define min1(a,b) ((a) < (b) ? (a) : (b)) +#define max1(a,b) ((a) > (b) ? (a) : (b)) + +#define min2(a,b) ((a) <= (b) ? (a) : (b)) +#define max2(a,b) ((a) >= (b) ? (a) : (b)) + +#define F(type,n) \ + type __attribute__((noinline)) type##_##n(type a, type b) \ + { \ + return n(a, b); \ + } + +F(float,min1) +F(float,min2) +F(float,max1) +F(float,max2) + +F(double,min1) +F(double,min2) +F(double,max1) +F(double,max2) + +int main() +{ + if (float_min1(0.f, -1.f) != -1.f) abort(); + if (float_min1(-1.f, 0.f) != -1.f) abort(); + if (float_min1(0.f, 1.f) != 0.f) abort(); + if (float_min1(1.f, 0.f) != 0.f) abort(); + if (float_min1(-1.f, 1.f) != -1.f) abort(); + if (float_min1(1.f, -1.f) != -1.f) abort(); + + if (float_max1(0.f, -1.f) != 0.f) abort(); + if (float_max1(-1.f, 0.f) != 0.f) abort(); + if (float_max1(0.f, 1.f) != 1.f) abort(); + if (float_max1(1.f, 0.f) != 1.f) abort(); + if (float_max1(-1.f, 1.f) != 1.f) abort(); + if (float_max1(1.f, -1.f) != 1.f) abort(); + + if (float_min2(0.f, -1.f) != -1.f) abort(); + if (float_min2(-1.f, 0.f) != -1.f) abort(); + if (float_min2(0.f, 1.f) != 0.f) abort(); + if (float_min2(1.f, 0.f) != 0.f) abort(); + if (float_min2(-1.f, 1.f) != -1.f) abort(); + if (float_min2(1.f, -1.f) != -1.f) abort(); + + if (float_max2(0.f, -1.f) != 0.f) abort(); + if (float_max2(-1.f, 0.f) != 0.f) abort(); + if (float_max2(0.f, 1.f) != 1.f) abort(); + if (float_max2(1.f, 0.f) != 1.f) abort(); + if (float_max2(-1.f, 1.f) != 1.f) abort(); + if (float_max2(1.f, -1.f) != 1.f) abort(); + + if (double_min1(0., -1.) != -1.) abort(); + if (double_min1(-1., 0.) != -1.) abort(); + if (double_min1(0., 1.) != 0.) abort(); + if (double_min1(1., 0.) != 0.) abort(); + if (double_min1(-1., 1.) != -1.) abort(); + if (double_min1(1., -1.) != -1.) abort(); + + if (double_max1(0., -1.) != 0.) abort(); + if (double_max1(-1., 0.) != 0.) abort(); + if (double_max1(0., 1.) != 1.) abort(); + if (double_max1(1., 0.) != 1.) abort(); + if (double_max1(-1., 1.) != 1.) abort(); + if (double_max1(1., -1.) != 1.) abort(); + + if (double_min2(0., -1.) != -1.) abort(); + if (double_min2(-1., 0.) != -1.) abort(); + if (double_min2(0., 1.) != 0.) abort(); + if (double_min2(1., 0.) != 0.) abort(); + if (double_min2(-1., 1.) != -1.) abort(); + if (double_min2(1., -1.) != -1.) abort(); + + if (double_max2(0., -1.) != 0.) abort(); + if (double_max2(-1., 0.) != 0.) abort(); + if (double_max2(0., 1.) != 1.) abort(); + if (double_max2(1., 0.) != 1.) abort(); + if (double_max2(-1., 1.) != 1.) abort(); + if (double_max2(1., -1.) != 1.) abort(); + + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39501.x b/gcc/testsuite/gcc.c-torture/execute/pr39501.x new file mode 100644 index 00000000000..72527d7b4e9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39501.x @@ -0,0 +1,2 @@ +set additional_flags "-ffast-math" +return 0 diff --git a/gcc/testsuite/gcc.dg/memcpy-1.c b/gcc/testsuite/gcc.dg/memcpy-1.c index 2b11098b286..cc602423793 100644 --- a/gcc/testsuite/gcc.dg/memcpy-1.c +++ b/gcc/testsuite/gcc.dg/memcpy-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized --param sra-max-structure-size=32" } */ /* PR36598 AVR fail maybe due to cost metrics */ /* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" { xfail { "avr-*-*" } } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr19633-1.c b/gcc/testsuite/gcc.dg/pr19633-1.c index 6370ff59b23..c05e46aef64 100644 --- a/gcc/testsuite/gcc.dg/pr19633-1.c +++ b/gcc/testsuite/gcc.dg/pr19633-1.c @@ -1,9 +1,5 @@ /* { dg-do run } */ - -/* The max-aliased-vops setting is a temporary workaround to avoid the - random failures as described in PR 30194. This test case does not - need alias sets bigger than 13 elements. */ -/* { dg-options "-O2 --param max-aliased-vops=15" } */ +/* { dg-options "-O2" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/pr38984.c b/gcc/testsuite/gcc.dg/pr38984.c index 0ba72739942..11f1e7f211a 100644 --- a/gcc/testsuite/gcc.dg/pr38984.c +++ b/gcc/testsuite/gcc.dg/pr38984.c @@ -10,10 +10,8 @@ int f(int *p) return *p == a; } -/* Currently fails because of PR38985. */ - -/* { dg-final { scan-tree-dump-times " = \\\*p" 2 "optimized" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-not "return 1" "optimized" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "\\\*p" 2 "optimized" } } */ +/* { dg-final { scan-tree-dump-not "return 1" "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pragma-isr-trapa2.c b/gcc/testsuite/gcc.dg/pragma-isr-trapa2.c index 7b68185fc03..a1165893be5 100644 --- a/gcc/testsuite/gcc.dg/pragma-isr-trapa2.c +++ b/gcc/testsuite/gcc.dg/pragma-isr-trapa2.c @@ -1,4 +1,6 @@ /* { dg-do compile { target { { sh-*-* sh4*-*-* } && nonpic } } } */ +/* { dg-skip-if "FPU Required" { "sh*-*-*" } { "-m*nofpu*" } { "" } } */ +/* { dg-skip-if "FPU Required" { "sh*-*-*" } { "-m4al*" } { "" } } */ /* { dg-options "-O -m4" } */ extern void foo (); diff --git a/gcc/testsuite/gcc.dg/torture/pr30375.c b/gcc/testsuite/gcc.dg/torture/pr30375.c index ea63f97c98d..435c38f13b8 100644 --- a/gcc/testsuite/gcc.dg/torture/pr30375.c +++ b/gcc/testsuite/gcc.dg/torture/pr30375.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "--param max-aliased-vops=0" } */ typedef struct _s { int a; diff --git a/gcc/testsuite/gcc.dg/torture/pr33560.c b/gcc/testsuite/gcc.dg/torture/pr33560.c index 5b2359b3dc0..7eea1e3f601 100644 --- a/gcc/testsuite/gcc.dg/torture/pr33560.c +++ b/gcc/testsuite/gcc.dg/torture/pr33560.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "--param max-aliased-vops=0" } */ struct T { diff --git a/gcc/testsuite/gcc.dg/torture/pr33563.c b/gcc/testsuite/gcc.dg/torture/pr33563.c index 47907db7ea6..33e78521c50 100644 --- a/gcc/testsuite/gcc.dg/torture/pr33563.c +++ b/gcc/testsuite/gcc.dg/torture/pr33563.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "--param max-aliased-vops=0" } */ struct T { diff --git a/gcc/testsuite/gcc.dg/torture/pr33870.c b/gcc/testsuite/gcc.dg/torture/pr33870.c index 519efd3a592..9c0e30d94be 100644 --- a/gcc/testsuite/gcc.dg/torture/pr33870.c +++ b/gcc/testsuite/gcc.dg/torture/pr33870.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "--param max-aliased-vops=1" } */ struct X { int i; diff --git a/gcc/testsuite/gcc.dg/torture/pr39074-2.c b/gcc/testsuite/gcc.dg/torture/pr39074-2.c index 89f7ebf8cd8..a90c5643dca 100644 --- a/gcc/testsuite/gcc.dg/torture/pr39074-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr39074-2.c @@ -30,5 +30,5 @@ int main() return 0; } -/* { dg-final { scan-tree-dump "y.._., name memory tag: NMT..., is dereferenced, points-to vars: { i }" "alias" } } */ +/* { dg-final { scan-tree-dump "y.._., points-to vars: { i }" "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr39074.c b/gcc/testsuite/gcc.dg/torture/pr39074.c index cc37c8e08ec..7be7e227b25 100644 --- a/gcc/testsuite/gcc.dg/torture/pr39074.c +++ b/gcc/testsuite/gcc.dg/torture/pr39074.c @@ -27,5 +27,5 @@ int main() return 0; } -/* { dg-final { scan-tree-dump "y.._., name memory tag: NMT..., is dereferenced, points-to vars: { i }" "alias" } } */ +/* { dg-final { scan-tree-dump "y.._., points-to vars: { i }" "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pta-callused-1.c b/gcc/testsuite/gcc.dg/torture/pta-callused-1.c index dfe994b7a84..dfbde86c65b 100644 --- a/gcc/testsuite/gcc.dg/torture/pta-callused-1.c +++ b/gcc/testsuite/gcc.dg/torture/pta-callused-1.c @@ -21,5 +21,5 @@ int main() return 0; } -/* { dg-final { scan-tree-dump "p.._., name memory tag: NMT..., is dereferenced, points-to vars: { i j }" "alias" } } */ +/* { dg-final { scan-tree-dump "p.._., points-to vars: { i j }" "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c new file mode 100644 index 00000000000..6c08319d8c5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-3.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-fdump-tree-alias" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +extern void abort (void); +struct X { + int *p; + int *q; + int *r; +}; +int __attribute__((noinline)) +foo(int i, int j, int k, int off) +{ + struct X x; + int **p, *q; + x.p = &i; + x.q = &j; + x.r = &k; + p = &x.q; + p += off; + /* *p points to { i, j, k } */ + q = *p; + return *q; +} +int main() +{ + if (foo(1, 2, 3, -1) != 1) + abort (); + if (foo(1, 2, 3, 0) != 2) + abort (); + if (foo(1, 2, 3, 1) != 3) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "q_., points-to vars: { i j k }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c b/gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c new file mode 100644 index 00000000000..bdb2acb0464 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pta-structcopy-1.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-fno-tree-sra -fdump-tree-alias" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +struct X +{ + long l1; + struct Y + { + long l2; + int *p; + } y; +}; +int i; +static int +foo (struct X *x) +{ + struct Y y = x->y; + *y.p = 0; + i = 1; + return *y.p; +} +extern void abort (void); +int main() +{ + struct X x; + x.y.p = &i; + if (foo(&x) != 1) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "points-to vars: { i }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c b/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c new file mode 100644 index 00000000000..21d36dc60f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/ssa-pta-fn-1.c @@ -0,0 +1,61 @@ +/* { dg-do run } */ +/* { dg-options "-fdump-tree-alias" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +extern void abort (void); +int *glob; + +int * __attribute__((noinline,const)) +foo_const(int *p) { return p; } + +int * __attribute__((noinline,pure)) +foo_pure(int *p) { return glob; } + +int * __attribute__((noinline)) +foo_normal(int *p) { glob = p; return p; } + +void test_const(void) +{ + int i; + int *p = &i; + int *q_const = foo_const(p); + *p = 1; + *q_const = 2; + if (*p != 2) + abort (); +} + +void test(void) +{ + int i; + int *p = &i; + int *q_normal = foo_normal(p); + *p = 1; + *q_normal = 2; + if (*p != 2) + abort (); +} + +void test_pure(void) +{ + int i; + int *p = &i; + int *q_pure = foo_pure(p); + *p = 1; + *q_pure = 2; + if (*p != 2) + abort (); +} + +int main() +{ + test_const(); + test(); + test_pure(); + return 0; +} + +/* { dg-final { scan-tree-dump "q_const_., points-to non-local, points-to vars: { i }" "alias" } } */ +/* { dg-final { scan-tree-dump "q_pure_., points-to non-local, points-to escaped, points-to vars: { i }" "alias" } } */ +/* { dg-final { scan-tree-dump "q_normal_., points-to non-local, points-to escaped, points-to vars: { }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20070302-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20070302-1.c index ab8e38e1dd6..4b148f23df5 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20070302-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20070302-1.c @@ -1,5 +1,4 @@ /* { dg-do link } */ -/* { dg-xfail-if "" { *-*-* } { "*" } { "" } } See PR34743. */ /* { dg-options "-O2" } */ struct A diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-15.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-15.c deleted file mode 100644 index 617af0fd154..00000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-15.c +++ /dev/null @@ -1,19 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O -fno-early-inlining -fdump-tree-alias-vops-details" } */ - -struct foo { - int a; - struct X { - int b[4]; - } b; -} m; -static inline struct X *wrap(struct X *p) { return p; } -int test2(void) -{ - struct X *p = wrap(&m.b); - /* Both memory references need to alias the same tags. */ - return p->b[3] - m.b.b[3]; -} - -/* { dg-final { scan-tree-dump-times "VUSE <m_.\\\(D\\\)>" 2 "alias" } } */ -/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-16.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-16.c index cf10fa913ce..c71486c26c2 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-16.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-16.c @@ -1,9 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O --param max-aliased-vops=1" } */ -/* Compile with -O --param max-aliased-vops=1. This partitions all - the initial SFTs for 'm' which was causing the operand scanner to - miss adding the right SFTs to p->b[2]. */ extern void abort (void); struct X { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-18.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-18.c index 84d884effb5..e86acbc1900 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-18.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-18.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-fre-details -fdump-tree-optimized --param max-aliased-vops=0" } */ +/* { dg-options "-O2 -fdump-tree-fre-details -fdump-tree-optimized" } */ struct A { int i; @@ -77,11 +77,11 @@ int test8 (struct A *p, int *q) } /* { dg-final { scan-tree-dump "with 0" "fre" } } */ -/* { dg-final { scan-tree-dump "with 1" "fre" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump "with 3" "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "with 1" "fre" } } */ +/* { dg-final { scan-tree-dump "with 3" "fre" } } */ /* { dg-final { scan-tree-dump "with 4" "fre" } } */ /* { dg-final { scan-tree-dump "with 5" "fre" } } */ -/* { dg-final { scan-tree-dump "with 8" "fre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "with 8" "fre" } } */ /* { dg-final { scan-tree-dump-not "return 2;" "optimized" } } */ /* { dg-final { scan-tree-dump-not "return 6;" "optimized" } } */ /* { dg-final { scan-tree-dump-not "return 7;" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c index b92df4343c2..7b3689049ac 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-19.c @@ -26,6 +26,5 @@ int main() } /* { dg-final { scan-tree-dump "q_. = { a b }" "alias" } } */ -/* { dg-final { scan-tree-dump "q_., name memory tag: NMT..., is dereferenced, points-to vars: { a b }" "alias" } } */ -/* { dg-final { scan-tree-dump "# VUSE <a_.\\\(D\\\), b_.>" "alias" } } */ +/* { dg-final { scan-tree-dump "q_., points-to vars: { a b }" "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-20.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-20.c new file mode 100644 index 00000000000..7991c52fd0a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-20.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fstrict-aliasing -fdump-tree-optimized" } */ + +struct S { float f; int i; }; +struct R { int x; int i; }; + +/* Strict-aliasing rules say that int and float do not alias. */ +int bar(struct S *s, int *i) +{ + *i = 0; + s->f = 1.0; + return *i; +} + +/* Strict-aliasing rules say that S and R do not alias. */ +int foo(struct S *s, struct R *r) +{ + r->i = 0; + s->i = 1; + return r->i; +} + +/* { dg-final { scan-tree-dump-times "return 0;" 2 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr13146.c b/gcc/testsuite/gcc.dg/tree-ssa/pr13146.c new file mode 100644 index 00000000000..b556457678c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr13146.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fstrict-aliasing -fdump-tree-optimized" } */ + +struct A +{ + int i; +}; +struct B +{ + struct A a; + int j; +}; + +int foo (struct A *p, struct B *q) +{ + p->i = 0; + q->j = 1; + return p->i; +} + +/* { dg-final { scan-tree-dump "return 0;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c new file mode 100644 index 00000000000..206b92de147 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23086.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +extern void link_error (void); +extern void abort (void); + +int *t; +int __attribute__((noinline)) g(int *a) +{ + t = a; + *a = 2; +} + +void __attribute__((noinline)) f(int *a) +{ + int b; + b = 1; + g(&b); + b = 2; + *a = 1; + if (b != 2) + link_error(); +} + +int main(void) +{ + int t; + f(&t); + if (t != 1) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23382.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23382.c index 331e01b5ae3..fd74af8d6a1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr23382.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23382.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-alias-vops" } */ +/* { dg-options "-O2 -fdump-tree-pre-details" } */ struct a { int length; @@ -13,5 +13,5 @@ int f(void) struct a *a = malloc(sizeof(struct a)); return a->length; } -/* { dg-final { scan-tree-dump-times "VDEF <HEAP" 1 "alias"} } */ -/* { dg-final { cleanup-tree-dump "alias" } } */ +/* { dg-final { scan-tree-dump-times "Variable: HEAP" 1 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr2480.c b/gcc/testsuite/gcc.dg/tree-ssa/pr2480.c new file mode 100644 index 00000000000..d7f7af4d295 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr2480.c @@ -0,0 +1,53 @@ +/* { dg-do link } */ +/* { dg-options "-O2" } */ + +/* We have enough cascading at -O2 to cover the missed control-dependence + in SCCVN (which considers the link_error calls to clobber the structs). */ + +struct example +{ + char a; + int b; + char c; +} *ex1; + +extern void link_error(void); + +void +bar (void) +{ + ex1->a = 1; + ex1->b = 2; + ex1->c = 3; + + if (ex1->a != 1) + link_error (); + if (ex1->b != 2) + link_error (); + if (ex1->c != 3) + link_error (); + +} + +void +foo (struct example *ex2) +{ + ex2->a = 1; + ex2->b = 2; + ex2->c = 3; + + if (ex2->a != 1) + link_error (); + if (ex2->b != 2) + link_error (); + if (ex2->c != 3) + link_error (); + +} + +int main (void) +{ + bar (); + foo (ex1); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c b/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c index 73db85c17da..70f123158af 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-alias-vops" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ typedef struct { int i; @@ -18,5 +18,5 @@ int foo(void) /* Verify the call clobbers all of a. */ -/* { dg-final { scan-tree-dump-times "VDEF <a_" 2 "alias" } } */ -/* { dg-final { cleanup-tree-dump "alias" } } */ +/* { dg-final { scan-tree-dump-not "return 1;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr38895.c b/gcc/testsuite/gcc.dg/tree-ssa/pr38895.c new file mode 100644 index 00000000000..0a96e53348a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr38895.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fstrict-aliasing -fdump-tree-optimized" } */ + +struct A { + int i; + int j; +}; +struct B { + struct A a1; + struct A a2; +}; +struct C { + struct A a1; + struct B b; +}; +int foo(struct C *c, struct B *b) +{ + c->a1.i = 1; + b->a1.i = 0; + return c->a1.i; +} + +/* { dg-final { scan-tree-dump "return 1;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c new file mode 100644 index 00000000000..b61674dff3a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */ + +extern void abort (void); +struct X { + int *p; + int *q; + int *r; +}; +int __attribute__((noinline)) +foo(int i, int j, int k, int off) +{ + struct X x; + int **p, *q; + x.p = &i; + x.q = &j; + x.r = &k; + p = &x.q; + p += 1; + /* *p points to { k } */ + q = *p; + return *q; +} + +/* { dg-final { scan-tree-dump "q_., points-to vars: { k }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c new file mode 100644 index 00000000000..adb01b23165 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-alias" } */ + +extern void abort (void); +struct X { + int *p; + int *q; + int *r; +}; +int __attribute__((noinline)) +foo(int i, int j, int k, int off) +{ + struct X x; + int **p, *q; + x.p = &i; + x.q = &j; + x.r = &k; + p = &x.q; + p -= 1; + /* *p points to { i } */ + q = *p; + return *q; +} + +/* { dg-final { scan-tree-dump "q_., points-to vars: { i }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sra-3.c b/gcc/testsuite/gcc.dg/tree-ssa/sra-3.c index 732dc302deb..661dc58ff09 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/sra-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/sra-3.c @@ -24,5 +24,5 @@ copystruct1 (void) } /* There should be no reference to link_error. */ -/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-4.c new file mode 100644 index 00000000000..89118a62621 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-cddce1" } */ + +int foo(int b) +{ + int a[128]; + a[b] = 1; + if (b) + { + b = 2; + a[2] = 0; + } + a[2] = 3; + return a[2] + b; +} + +/* { dg-final { scan-tree-dump-times "a\\\[\[^\n\]\\\]" 2 "cddce1" } } */ +/* { dg-final { cleanup-tree-dump "cddce1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-5.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-5.c new file mode 100644 index 00000000000..11c9e666b3c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-5.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-cddce1" } */ + +struct X { int i; }; +struct X foo(int b) +{ + struct X x; + if (b) + x.i = 0; + x.i = 1; + return x; +} + +/* { dg-final { scan-tree-dump-times "x.i =" 1 "cddce1" } } */ +/* { dg-final { cleanup-tree-dump "cddce1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-12.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-12.c new file mode 100644 index 00000000000..dd8f69c8aea --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-12.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-dse1" } */ + +void foo (int *p, int b) +{ + if (b) + *p = 1; + *p = 0; +} + +/* { dg-final { scan-tree-dump-times "\\\*p" 1 "dse1" } } */ +/* { dg-final { cleanup-tree-dump "dse1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-10.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-10.c index a27f2d6c023..34217a0298a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-10.c @@ -18,5 +18,9 @@ void __frame_state_for (volatile char *state_in, int x) } } -/* { dg-final { scan-tree-dump "Insertions: 2" "pre" } } */ +/* This is a weird testcase. It should need PPRE to hoist the loop + invariants and the volatileness of state_in prevents DSE of the + first store. Thus, this is XFAILed. */ + +/* { dg-final { scan-tree-dump "Insertions: 2" "pre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c index 3253afe2927..ae9eb5a2002 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-13.c @@ -1,9 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O -fstrict-aliasing -fno-tree-sra --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0 -fdump-tree-fre-details" } */ +/* { dg-options "-O -fstrict-aliasing -fno-tree-sra -fdump-tree-fre-details" } */ -/* Should be optimized, propagating &a into (*p)[i] with parameters - --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0 - which means max 1 VOP per stmt and no SFTs. */ +/* Should be optimized, propagating &a into (*p)[i]. */ /* For this testcase we need TBAA to work. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c index d2d5e01bcc4..24b58ee941a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c @@ -1,9 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O -fno-tree-sra --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0 -fdump-tree-fre-details" } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */ -/* Should be optimized, propagating &a into (*p)[i] with parameters - --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0 - which means max 1 VOP per stmt and no SFTs. */ +/* Should be optimized, propagating &a into (*p)[i]. */ struct Foo { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c index 1a286f1e1cb..a557f27f319 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c @@ -1,9 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O -fno-tree-sra --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0 -fdump-tree-fre-details" } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */ -/* Should be optimized, propagating &a into (*p)[i] with parameters - --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0 - which means max 1 VOP per stmt and no SFTs. */ +/* Should be optimized, propagating &a into (*p)[i]. */ struct Foo { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-18.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-18.c new file mode 100644 index 00000000000..392b1f6cf7d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-18.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre" } */ + +struct a +{ + union + { + int a; + int b; + }; + union + { + int c; + int d; + }; +}; + +int f(struct a *c) +{ + int d = c->a; + c->c = 1; + return c->a + d; +} + +/* We should have CSEd the load from c->a. */ + +/* { dg-final { scan-tree-dump-times "c_.*\\\.a" 1 "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-19.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-19.c new file mode 100644 index 00000000000..688fe86403e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-19.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre" } */ + +struct a +{ + union + { + int a; + int b; + }; + union + { + int c; + int d; + }; + int e; +}; + +int f(struct a *c) +{ + int d; + c->e = 2; + d = c->a; + c->c = 1; + return c->a + d; +} + +/* We should have CSEd the load from c->a. */ + +/* { dg-final { scan-tree-dump-times "c_.*\\\.a" 1 "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-20.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-20.c new file mode 100644 index 00000000000..f73ad36c5b7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-20.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +int i, j; +int foo(int b) +{ + j = 0; + if (b) + goto L2; +L1: + i = i + 1; +L2: + i = i + 1; + if (i == 1) + goto L1; + return j; +} + +/* { dg-final { scan-tree-dump "return 0;" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-23.c new file mode 100644 index 00000000000..491836d28ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-23.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre" } */ + +int f(int t, int a, int b) +{ + int c, d; + if (t) + { + c = a; + d = a; + } + else + { + c = b; + d = b; + } + return c+d; +} + +/* { dg-final { scan-tree-dump-times "PHI" 1 "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c index b88a1e58af6..91956017898 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-lim-details" } */ +/* { dg-options "-O -fdump-tree-lim-details" } */ struct { int x; int y; } global; void foo(int n) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-23.c new file mode 100644 index 00000000000..88c8bb71eb9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-23.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ + +struct { int x; int y; } global; +void foo(int n) +{ + int i; + for ( i=0; i<n; i++) + global.y += global.x*global.x; +} + +/* { dg-final { scan-tree-dump "Eliminated: 2" "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-24.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-24.c new file mode 100644 index 00000000000..6729e2a297e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-24.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre" } */ + +void foo(int *p, double *x, int n) +{ + int i; + for (i = 0; i < n; ++i) + *(x + *p * i) = 0.0; +} + +/* We should remove the unnecessary insertion of a phi-node and + _not_ end up using the phi result for replacement *p. + The issue here is that when PHI-translating the virtual operands + we assign different value-numbers to the load. Re-running VN + after insertion or trying to be clever and doing this on the + fly during PHI translation would solve this. The next copyprop + fixes this anyway. */ + +/* { dg-final { scan-tree-dump-not "= prephitmp" "pre" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-25.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-25.c new file mode 100644 index 00000000000..32b068275c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-25.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ + +struct X { int i; }; + +int foo (int x) +{ + struct X a; + struct X b; + struct X *p; + a.i = 1; + b.i = 2; + if (x) + p = &a; + else + p = &b; + return p->i; +} + +/* We should eliminate the load from p for a PHI node with values 1 and 2. */ + +/* { dg-final { scan-tree-dump "Eliminated: 1" "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-1.c index 263124b646e..65cd83d7cde 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-1.c @@ -17,5 +17,5 @@ void vnum_test8(int *data) } } /* We should eliminate m - n, and set n = n + k into n = m. */ -/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "fre"} } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "fre"} } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-2.c index 2c73a678b78..cc3661cc6d7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-2.c @@ -21,5 +21,5 @@ int vnum_test8(int *data) } /* We should eliminate m - n, and set n = n + k into n = m, and set p to 0 */ -/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "fre"} } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "fre"} } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c index 7caf4eec6f8..27ccda5264a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sccvn-4.c @@ -23,5 +23,5 @@ int vnum_test8(int *data) } /* We should eliminate m - n, n + k, set data[5] = 0, eliminate the address arithmetic for data[5], and set p = 0. -/* { dg-final { scan-tree-dump-times "Eliminated: 5" 1 "fre"} } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 6" 1 "fre"} } */ /* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/uninit-B.c b/gcc/testsuite/gcc.dg/uninit-B.c index adb1461d951..f03dd701853 100644 --- a/gcc/testsuite/gcc.dg/uninit-B.c +++ b/gcc/testsuite/gcc.dg/uninit-B.c @@ -9,7 +9,7 @@ void baz (void) { int i; - if (i) /* { dg-warning "is used uninitialized" "uninit i warning" } */ + if (i) /* { dg-warning "is used uninitialized" "uninit i warning" { xfail *-*-* } } */ bar (i); foo (&i); } diff --git a/gcc/testsuite/gcc.dg/uninit-pr19430.c b/gcc/testsuite/gcc.dg/uninit-pr19430.c index ecf9c009627..53810c553e1 100644 --- a/gcc/testsuite/gcc.dg/uninit-pr19430.c +++ b/gcc/testsuite/gcc.dg/uninit-pr19430.c @@ -29,7 +29,7 @@ void frob(int *pi); int main(void) { int i; - printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" } */ + printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" "" { xfail *-*-* } } */ frob(&i); return 0; @@ -38,6 +38,6 @@ int main(void) void foo3(int*); void bar3(void) { int x; - if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" } */ + if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" { xfail *-*-* } } */ foo3(&x); } diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c index b64427f6d0b..d9bb114d416 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c @@ -28,7 +28,8 @@ main1 (float *pa) float pb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float pc[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; - /* Not vectorizable: pa may alias pb and/or pc, since their addresses escape. */ + /* Vectorizable: pa may not alias pb and/or pc, even though their + addresses escape. &pa would need to escape to point to escaped memory. */ for (i = 0; i < N; i++) { pa[i] = pb[i] * pc[i]; @@ -74,6 +75,6 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c index 6c336754159..f61dff6e341 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c @@ -58,5 +58,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c index 02926b0f577..fe04694f657 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c @@ -59,5 +59,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c index 8d630b89a02..b7ef4b43017 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c @@ -59,5 +59,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c index 61cfec2bc80..39491a882e5 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c @@ -61,5 +61,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.target/mips/interrupt_handler.c b/gcc/testsuite/gcc.target/mips/interrupt_handler.c new file mode 100644 index 00000000000..1cf891829f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/interrupt_handler.c @@ -0,0 +1,23 @@ +/* Test attributes for interrupt handlers */ +/* { dg-do compile } */ +/* { dg-options "-mips32r2 -msoft-float" } */ + +void f () { } + +void __attribute__ ((interrupt)) v0 () { } +void __attribute__ ((interrupt, use_shadow_register_set)) v1 () { } +void __attribute__ ((interrupt, keep_interrupts_masked)) v2 () { } +void __attribute__ ((interrupt, use_debug_exception_return)) v3 () { } +void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked)) v4 () { } +void __attribute__ ((interrupt, use_shadow_register_set, use_debug_exception_return)) v5 () { } +void __attribute__ ((interrupt, keep_interrupts_masked, use_debug_exception_return)) v6 () { } +void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked, use_debug_exception_return)) v7 () { } + +void __attribute__ ((interrupt)) w0 () { t(); } +void __attribute__ ((interrupt, use_shadow_register_set)) w1 () { t(); } +void __attribute__ ((interrupt, keep_interrupts_masked)) w2 () { t(); } +void __attribute__ ((interrupt, use_debug_exception_return)) w3 () { t(); } +void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked)) w4 () { t(); } +void __attribute__ ((interrupt, use_shadow_register_set, use_debug_exception_return)) w5 () { t(); } +void __attribute__ ((interrupt, keep_interrupts_masked, use_debug_exception_return)) w6 () { t(); } +void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked, use_debug_exception_return)) w7 () { t(); } diff --git a/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c b/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c index b7081bf7186..761c7b0b5df 100644 --- a/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c +++ b/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c @@ -35,15 +35,15 @@ long long f4() { } /* Aligned. */ -struct u0 { unsigned long long d : 32; } y0; +struct u0 { unsigned long long d : 32; } y_0; unsigned long long g0() { - return y0.d; + return y_0.d; } /* Unaligned load. */ -struct u1 { long long c : 8; unsigned long long d : 32; } y1; +struct u1 { long long c : 8; unsigned long long d : 32; } y_1; unsigned long long g1() { - return y1.d; + return y_1.d; } /* Unaligned load. */ diff --git a/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c b/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c index 68927929854..ec5c0bdab59 100644 --- a/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c +++ b/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c @@ -5,7 +5,7 @@ /* { dg-final { scan-assembler-times "\tmovua\\.l\t(.*)+" 2 } } */ #ifdef __SH4A__ -#include <stdlib.h> +#include <string.h> struct s { int i; char a[10], b[10]; } x; int f() { diff --git a/gcc/testsuite/gfortran.dg/common_12.f90 b/gcc/testsuite/gfortran.dg/common_12.f90 new file mode 100644 index 00000000000..0eea80f03b8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/common_12.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! PR fortran/39594 +! +! Contributed by Peter Knowles and reduced by Jakub Jelinek. +! +module pr39594 + implicit double precision(z) + common /z/ z0,z1,z2,z3,z4,z5,z6,z7 +contains + subroutine foo + implicit double precision(z) + common /z/ z0,z1,z2,z3,z4,z5,z6,z7 + call bar(z0) + end subroutine foo +end module + +! { dg-final { cleanup-modules "pr39594" } } diff --git a/gcc/testsuite/gfortran.dg/common_align_2.f90 b/gcc/testsuite/gfortran.dg/common_align_2.f90 new file mode 100644 index 00000000000..e3b70d76edb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/common_align_2.f90 @@ -0,0 +1,30 @@ +! { dg-do run } +! Tests the fix for PR37614, in which the alignement of commons followed +! g77 rather than the standard or other compilers. +! +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> +! +subroutine foo (z) + real(8) x, y, z + common i(8) + equivalence (x, i(3)),(y,i(7)) + if ((i(1) .ne. 42) .or. (i(5) .ne. 43)) call abort + if ((i(2) .ne. 0) .or. (i(2) .ne. 0)) call abort + if ((x .ne. z) .or. (y .ne. z)) call abort +end subroutine + +subroutine bar + common i(8) + i = 0 +end subroutine + + real(8) x, y + common i, x, j, y ! { dg-warning "Padding" } + call bar + i = 42 + j = 43 + x = atan (1.0)*4.0 + y = x + call foo (x) +end + diff --git a/gcc/testsuite/gfortran.dg/dependency_23.f90 b/gcc/testsuite/gfortran.dg/dependency_23.f90 new file mode 100644 index 00000000000..bdb17115a11 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_23.f90 @@ -0,0 +1,56 @@ +! { dg-do run } +! Test the fix for PR38863, in which an unnecessary temporary +! generated results that are not consistent with other compilers. +! +! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com> +! +module rg0045_stuff + type unseq + integer :: i + logical :: l + end type unseq + interface assignment(=) + module procedure l_to_t, i_to_t + end interface +contains + elemental subroutine l_to_t (arg1, arg2) + type(unseq), intent(inout) :: arg1 + logical, intent(in) :: arg2 + arg1%l = arg2 + end subroutine l_to_t + elemental subroutine i_to_t (arg1, arg2) + type(unseq), intent(inout) :: arg1 + integer, intent(in) :: arg2 + arg1%i = arg2 + end subroutine i_to_t + subroutine rg0045(nf1, nf2, nf3) + type(unseq) :: tla2l(nf3, nf2) + type(unseq) :: tda2l(3,2) + logical :: lda(nf3,nf2) + tda2l%l = reshape ([.true.,.false.,.true.,.false.,.true.,.false.],[3,2]) + tda2l%i = reshape ([1, -1, 3, -1, 5, -1],[3,2]) + lda = tda2l%l + tla2l%l = lda + tla2l%i = reshape ([1, 2, 3, 4, 5, 6], [3,2]) +! +! The problem occurred here: gfortran was producing a temporary for these +! assignments because the dependency checking was too restrictive. Since +! a temporary was used, the integer component was reset in the first assignment +! rather than being carried over. +! + where(lda) + tla2l = tla2l(1:3, 1:2)%l + tla2l = tla2l(1:3, 1:2)%i + elsewhere + tla2l = -1 + endwhere + if (any (tla2l%i .ne. tda2l%i)) call abort + if (any (tla2l%l .neqv. tda2l%l)) call abort + end subroutine +end module rg0045_stuff + + use rg0045_stuff + call rg0045(1, 2, 3) +end + + diff --git a/gcc/testsuite/gfortran.dg/forall_13.f90 b/gcc/testsuite/gfortran.dg/forall_13.f90 index 97f6062bd55..c7819f10183 100644 --- a/gcc/testsuite/gfortran.dg/forall_13.f90 +++ b/gcc/testsuite/gfortran.dg/forall_13.f90 @@ -5,6 +5,9 @@ ! Contributed by Dick Hendrickson on comp.lang.fortran, ! " Most elegant syntax for inverting a permutation?" 20071006 ! +! Test the fix for PR36091 as well... +! { dg-options "-fbounds-check" } +! integer :: p(4) = (/2,4,1,3/) forall (i = 1:4) p(p(i)) = i ! This was the original if (any (p .ne. (/3,1,4,2/))) call abort () diff --git a/gcc/testsuite/gfortran.dg/implied_do_1.f90 b/gcc/testsuite/gfortran.dg/implied_do_1.f90 new file mode 100644 index 00000000000..7f1266c5dc2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/implied_do_1.f90 @@ -0,0 +1,11 @@ +! { dg-do "run" } +! PR fortran/29458 - spurious warning for implied do-loop counter + + integer :: n, i + i = 10 + n = 5 + n = SUM((/(i,i=1,n)/)) + + ! 'i' must not be changed + IF (i /= 10) CALL abort() +END diff --git a/gcc/testsuite/gfortran.dg/namelist_48.f90 b/gcc/testsuite/gfortran.dg/namelist_48.f90 index e9a29285b17..0d1570bf304 100644 --- a/gcc/testsuite/gfortran.dg/namelist_48.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_48.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! { dg-options "-fbackslash" } ! PR36538 namelist failure with tabs preceding object name program check1 diff --git a/gcc/testsuite/gfortran.dg/namelist_49.f90 b/gcc/testsuite/gfortran.dg/namelist_49.f90 index aec83eea965..e8efab33f3d 100644 --- a/gcc/testsuite/gfortran.dg/namelist_49.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_49.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! { dg-options "-fbackslash" } ! PR36546 Namelist error with tab following a comma and newline program check1 diff --git a/gcc/testsuite/gfortran.dg/namelist_50.f90 b/gcc/testsuite/gfortran.dg/namelist_50.f90 index 57e93fcbf25..678161b56d1 100644 --- a/gcc/testsuite/gfortran.dg/namelist_50.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_50.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! PR36657 Namelist string constant immediately followed by comment program gfcbug79 implicit none diff --git a/gcc/testsuite/gfortran.dg/namelist_51.f90 b/gcc/testsuite/gfortran.dg/namelist_51.f90 index 9663bd68d9f..152f9f8d8df 100644 --- a/gcc/testsuite/gfortran.dg/namelist_51.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_51.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! PR36676 Namelist comment problems ! test case from PR, reduced by Jerry DeLisle <jvdelisle@gcc.gnu.org> program mem_nml diff --git a/gcc/testsuite/gfortran.dg/namelist_52.f90 b/gcc/testsuite/gfortran.dg/namelist_52.f90 index 6e31382927f..e0975cf3ee8 100644 --- a/gcc/testsuite/gfortran.dg/namelist_52.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_52.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! PR36582 Namelist I/O error: Bogus "Cannot match namelist object" ! Test case derived from PR. module mod1 diff --git a/gcc/testsuite/gfortran.dg/namelist_56.f90 b/gcc/testsuite/gfortran.dg/namelist_56.f90 index 03fda759f5c..8d879fc910b 100644 --- a/gcc/testsuite/gfortran.dg/namelist_56.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_56.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! PR37707 Namelist read of array of derived type incorrect ! Test case from Tobias Burnus IMPLICIT NONE diff --git a/gcc/testsuite/gfortran.dg/proc_decl_21.f90 b/gcc/testsuite/gfortran.dg/proc_decl_21.f90 new file mode 100644 index 00000000000..4fd4020cb80 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_decl_21.f90 @@ -0,0 +1,32 @@ +! { dg-do compile } +! +! PR fortran/39414: PROCEDURE statement double declaration bug +! +! Discovered by Paul Thomas <pault@gcc.gnu.org> +! Modified by Janus Weil <janus@gcc.gnu.org> + + +! forbidden + +procedure(integer) :: a +integer :: a ! { dg-error "already has basic type of" } + +integer :: b +procedure(integer) :: b ! { dg-error "already has basic type of" } + +procedure(iabs) :: c +integer :: c ! { dg-error "may not have basic type of" } + +integer :: d +procedure(iabs) :: d ! { dg-error "already has basic type of" } + +! allowed + +integer :: e +procedure() :: e + +procedure() :: f +integer :: f + +end + diff --git a/gcc/testsuite/gfortran.dg/read_float_2.f03 b/gcc/testsuite/gfortran.dg/read_float_2.f03 new file mode 100644 index 00000000000..29344bcb555 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/read_float_2.f03 @@ -0,0 +1,18 @@ +! { dg-do run } +! Contributed by Dominique Dhumieres <dominiq@lps.ens.fr> + +character(15) :: str="+ .339 567+2" +real, parameter :: should_be = .339567e2 +real, parameter :: eps = 10 * epsilon (should_be) +real :: x, y + +read(str,'(BN,F15.6)') x +print *, x +read(str,'(G15.7)') y +print *, y + +if (abs (x - should_be) > eps .or. abs (y - should_be) > eps) then + call abort () +end if + +end diff --git a/gcc/testsuite/gfortran.dg/read_float_3.f90 b/gcc/testsuite/gfortran.dg/read_float_3.f90 new file mode 100644 index 00000000000..0fa2f5c4e7b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/read_float_3.f90 @@ -0,0 +1,21 @@ +! { dg-do run } +! Contributed by Dominique Dhumieres <dominiq@lps.ens.fr> + +character(100) :: str1 = & + "123.00456.88 0.123E+01 +0.987+1 -0.2345+02 -0.6879E+2+0.7E+03 0.4E+03" +character(100), parameter :: should_be = & + "123.00456.88 0.123E+01 0.987E+01-0.2345E+02-0.6879E+02 0.7E+03 0.4E+03" +character(100) :: output +complex :: c1, c2, c3, c4 + +100 format ( 2F6.2, 2E10.3, 2E11.4, 2E8.1) +read (str1,100) c1, c2, c3, c4 +write (output, 100) c1, c2, c3, c4 + +print *, output +if (output /= should_be) then + print *, should_be + call abort () +end if + +end diff --git a/gcc/testsuite/gfortran.dg/read_repeat.f90 b/gcc/testsuite/gfortran.dg/read_repeat.f90 index 192ebe81ffb..ab7a6a4c7d5 100644 --- a/gcc/testsuite/gfortran.dg/read_repeat.f90 +++ b/gcc/testsuite/gfortran.dg/read_repeat.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! PR39528 repeated entries not read when using list-directed input. ! Test case derived from reporters example. program rread diff --git a/gcc/testsuite/gfortran.dg/recursive_check_10.f90 b/gcc/testsuite/gfortran.dg/recursive_check_10.f90 new file mode 100644 index 00000000000..a30b82caaf2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_10.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! { dg-options "-fcheck=recursion" } +! +! PR fortran/39577 +! +! OK - no recursion +program test + integer :: i + i = f(.false.) + print *,i + i = f(.false.) + print *,i +contains + integer function f(rec) + logical :: rec + if(rec) then + f = g() + else + f = 42 + end if + end function f + integer function g() + g = f(.false.) + end function g +end program test diff --git a/gcc/testsuite/gfortran.dg/recursive_check_11.f90 b/gcc/testsuite/gfortran.dg/recursive_check_11.f90 new file mode 100644 index 00000000000..870c1127d01 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_11.f90 @@ -0,0 +1,28 @@ +! { dg-do run } +! { dg-options "-fcheck=recursion" } +! { dg-shouldfail "Recursion check" } +! +! { dg-output "Fortran runtime error: Recursive call to nonrecursive procedure 'f'" } +! +! PR fortran/39577 +! +! wrong - recursion +program test + integer :: i + i = f(.false.) + print *,i + i = f(.true.) + print *,i +contains + integer function f(rec) + logical :: rec + if(rec) then + f = g() + else + f = 42 + end if + end function f + integer function g() + g = f(.false.) + end function g +end program test diff --git a/gcc/testsuite/gfortran.dg/recursive_check_12.f90 b/gcc/testsuite/gfortran.dg/recursive_check_12.f90 new file mode 100644 index 00000000000..22eaf7d0f28 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_12.f90 @@ -0,0 +1,29 @@ +! { dg-do run } +! { dg-options "-fcheck=recursion" } +! +! PR fortran/39577 +! +! OK - no recursion +module m + implicit none +contains + subroutine f(rec) + logical :: rec + if(rec) then + call h() + end if + return + entry g() + end subroutine f + subroutine h() + call f(.false.) + end subroutine h +end module m + +program test + use m + implicit none + call f(.false.) + call f(.false.) +end program test +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/recursive_check_13.f90 b/gcc/testsuite/gfortran.dg/recursive_check_13.f90 new file mode 100644 index 00000000000..ed222a322ec --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_13.f90 @@ -0,0 +1,32 @@ +! { dg-do run } +! { dg-options "-fcheck=recursion" } +! { dg-shouldfail "Recursion check" } +! +! { dg-output "Fortran runtime error: Recursive call to nonrecursive procedure 'master.0.f'" } +! +! PR fortran/39577 +! +! invalid - recursion +module m + implicit none +contains + subroutine f(rec) + logical :: rec + if(rec) then + call h() + end if + return + entry g() + end subroutine f + subroutine h() + call f(.false.) + end subroutine h +end module m + +program test + use m + implicit none + call f(.false.) + call f(.true.) +end program test +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/recursive_check_14.f90 b/gcc/testsuite/gfortran.dg/recursive_check_14.f90 new file mode 100644 index 00000000000..e68e5fc566b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_14.f90 @@ -0,0 +1,40 @@ +! { dg-do run } +! { dg-options "-fcheck=recursion" } +! +! PR fortran/39577 +! +! Recursive but valid program +! Contributed by Dominique Dhumieres +! +recursive function fac(i) result (res) + integer :: i, j, k, res + k = 1 + goto 100 +entry bifac(i,j) result (res) + k = j +100 continue + if (i < k) then + res = 1 + else + res = i * bifac(i-k,k) + end if +end function + +program test +interface + recursive function fac(n) result (res) + integer :: res + integer :: n + end function fac + recursive function bifac(m,n) result (res) + integer :: m, n, res + end function bifac +end interface + + print *, fac(5) + print *, bifac(5,2) + print*, fac(6) + print *, bifac(6,2) + print*, fac(0) + print *, bifac(1,2) +end program test diff --git a/gcc/testsuite/gfortran.dg/recursive_check_8.f90 b/gcc/testsuite/gfortran.dg/recursive_check_8.f90 new file mode 100644 index 00000000000..4d83498c7e2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_8.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! { dg-options "-fcheck=recursion" } +! +! PR fortran/39577 +! +! OK - no recursion +program test + call f(.false.) + call f(.false.) +contains + subroutine f(rec) + logical :: rec + if(rec) then + call g() + end if + return + end subroutine f + subroutine g() + call f(.false.) + return + end subroutine g +end program test diff --git a/gcc/testsuite/gfortran.dg/recursive_check_9.f90 b/gcc/testsuite/gfortran.dg/recursive_check_9.f90 new file mode 100644 index 00000000000..50af06787fc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_9.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! { dg-options "-fcheck=recursion" } +! { dg-shouldfail "Recursion check" } +! +! { dg-output "Fortran runtime error: Recursive call to nonrecursive procedure 'f'" } +! +! PR fortran/39577 +! +! Invalid - recursion +program test + call f(.false.) + call f(.true.) +contains + subroutine f(rec) + logical :: rec + if(rec) then + call g() + end if + return + end subroutine f + subroutine g() + call f(.false.) + return + end subroutine g +end program test diff --git a/gcc/testsuite/gfortran.dg/streamio_9.f90 b/gcc/testsuite/gfortran.dg/streamio_9.f90 index 150c1c6c393..a134d549e1f 100644 --- a/gcc/testsuite/gfortran.dg/streamio_9.f90 +++ b/gcc/testsuite/gfortran.dg/streamio_9.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! PR29053 Stream IO test 9. ! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>. ! Test case derived from that given in PR by Steve Kargl. diff --git a/gcc/testsuite/gfortran.dg/utf8_1.f03 b/gcc/testsuite/gfortran.dg/utf8_1.f03 index 6c30885cce5..f2d62f65b0b 100644 --- a/gcc/testsuite/gfortran.dg/utf8_1.f03 +++ b/gcc/testsuite/gfortran.dg/utf8_1.f03 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! { dg-options "-fbackslash" } ! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org> program test1 diff --git a/gcc/testsuite/gfortran.dg/utf8_2.f03 b/gcc/testsuite/gfortran.dg/utf8_2.f03 index 0146a2e281b..3e409970bed 100644 --- a/gcc/testsuite/gfortran.dg/utf8_2.f03 +++ b/gcc/testsuite/gfortran.dg/utf8_2.f03 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! { dg-options "-fbackslash" } ! Contributed by Tobias Burnus program test2 diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_1.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90 index 0fe479cda64..0c7c5f3f807 100644 --- a/gcc/testsuite/gfortran.dg/widechar_IO_1.f90 +++ b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! Wide chracter I/O test 1, formatted and mixed kind ! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org> program test1 diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_3.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_3.f90 index 6f4a10c857e..c09205e2d7d 100644 --- a/gcc/testsuite/gfortran.dg/widechar_IO_3.f90 +++ b/gcc/testsuite/gfortran.dg/widechar_IO_3.f90 @@ -1,5 +1,5 @@ -! { dg-do run } -! Wide chracter I/O test 3, unformatted arrays +! { dg-do run { target fd_truncate } } +! Wide character I/O test 3, unformatted arrays ! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org> program test1 integer, parameter :: k4 = 4 diff --git a/gcc/testsuite/lib/gnat.exp b/gcc/testsuite/lib/gnat.exp index d37a4aa1e06..c14899fe914 100644 --- a/gcc/testsuite/lib/gnat.exp +++ b/gcc/testsuite/lib/gnat.exp @@ -83,17 +83,22 @@ proc gnat_init { args } { global gluefile wrap_flags global gnat_initialized global GNAT_UNDER_TEST + global GNAT_UNDER_TEST_ORIG global TOOL_EXECUTABLE global gnat_libgcc_s_path + global gnat_target_current + + set gnat_target_current "" if { $gnat_initialized == 1 } { return } if ![info exists GNAT_UNDER_TEST] then { if [info exists TOOL_EXECUTABLE] { - set GNAT_UNDER_TEST $TOOL_EXECUTABLE + set GNAT_UNDER_TEST "$TOOL_EXECUTABLE" } else { - set GNAT_UNDER_TEST [find_gnatmake] + set GNAT_UNDER_TEST "[local_find_gnatmake]" } + set GNAT_UNDER_TEST_ORIG "$GNAT_UNDER_TEST" } if ![info exists tmpdir] then { @@ -124,14 +129,26 @@ proc gnat_target_compile { source dest type options } { global gluefile wrap_flags global srcdir global GNAT_UNDER_TEST + global GNAT_UNDER_TEST_ORIG global TOOL_OPTIONS global ld_library_path global gnat_libgcc_s_path + global gnat_target_current + + # If we detect a change of target we need to recompute + # the appropriate RTS by calling get_multilibs. + if { $gnat_target_current!="[current_target_name]" } { + set gnat_target_current "[current_target_name]" + if [info exists TOOL_OPTIONS] { + set gnat_rts_opt "--RTS=[get_multilibs ${TOOL_OPTIONS}]/libada" + } else { + set gnat_rts_opt "--RTS=[get_multilibs]/libada" + } + set GNAT_UNDER_TEST "$GNAT_UNDER_TEST_ORIG $gnat_rts_opt" + } - setenv ADA_INCLUDE_PATH "${rootme}/ada/rts" set ld_library_path ".:${gnat_libgcc_s_path}" lappend options "compiler=$GNAT_UNDER_TEST -q -f" - lappend options "incdir=${rootme}/ada/rts" lappend options "timeout=[timeout_value]" if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { @@ -150,6 +167,7 @@ proc gnat_target_compile { source dest type options } { # set sourcename [string range $source 0 [expr [string length $source] - 5]] # set dest "" + return [target_compile $source $dest $type $options] } @@ -232,29 +250,27 @@ proc prune_gnat_output { text } { return $text } -# If this is an older version of DejaGnu (without find_gnatmake), provide one. -# This can be deleted after next DejaGnu release. - -if { [info procs find_gnatmake] == "" } { - proc find_gnatmake {} { - global tool_root_dir +# find_gnatmake for some version of DejaGnu will hardcode a -I...rts/ada flag +# which prevent multilib from working, so define a new one. - if ![is_remote host] { - set file [lookfor_file $tool_root_dir gnatmake] - if { $file == "" } { - set file [lookfor_file $tool_root_dir gcc/gnatmake] - } - if { $file != "" } { - set root [file dirname $file] - set CC "$file -I$root/ada/rts --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs --GCC=$root/xgcc -B$root -margs"; - } else { - set CC [transform gnatmake] - } - } else { - set CC [transform gnatmake] - } - return $CC +proc local_find_gnatmake {} { + global tool_root_dir + + if ![is_remote host] { + set file [lookfor_file $tool_root_dir gnatmake] + if { $file == "" } { + set file [lookfor_file $tool_root_dir gcc/gnatmake] + } + if { $file != "" } { + set root [file dirname $file] + set CC "$file --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs -B$root -margs -B$root"; + } else { + set CC [transform gnatmake] + } + } else { + set CC [transform gnatmake] } + return $CC } # If this is an older version of DejaGnu (without runtest_file_p), diff --git a/gcc/testsuite/objc.dg/bad-receiver-type-2.m b/gcc/testsuite/objc.dg/bad-receiver-type-2.m new file mode 100644 index 00000000000..eca8400d503 --- /dev/null +++ b/gcc/testsuite/objc.dg/bad-receiver-type-2.m @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* Contributed by Alexander Malmberg: PR18456 */ + +@interface Foo +-(void) foo; +@end + +void *ip; + +void (*func1)(void); + +struct +{ + int a:2; +} struct1,struct2[2]; + +union +{ + int a:2; +} union1,union2[2]; + +Foo **f; + +int main(int argc,char **argv) +{ + [(struct {int a;} *)ip foo]; /* { dg-warning "invalid receiver type" } */ + [func1 foo]; /* { dg-warning "invalid receiver type" } */ + [struct1.a foo]; /* { dg-warning "invalid receiver type" } */ + /* { dg-warning "cast to pointer from integer" "" { target *-*-* } 28 } */ + [union1.a foo]; /* { dg-warning "invalid receiver type" } */ + /* { dg-warning "cast to pointer from integer" "" { target *-*-* } 30 } */ + [struct1 foo]; /* { dg-warning "invalid receiver type" } */ + /* { dg-error "cannot convert" "" { target *-*-* } 32 } */ + [union1 foo]; /* { dg-warning "invalid receiver type" } */ + /* { dg-error "cannot convert" "" { target *-*-* } 34 } */ + [struct2 foo]; /* { dg-warning "invalid receiver type" } */ + /* { dg-error "cannot convert" "" { target *-*-* } 36 } */ + [union2 foo]; /* { dg-warning "invalid receiver type" } */ + /* { dg-error "cannot convert" "" { target *-*-* } 38 } */ + [f foo]; /* { dg-warning "invalid receiver type" } */ +} |