diff options
Diffstat (limited to 'gcc/testsuite')
123 files changed, 1999 insertions, 118 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e8175a12083..f73e0443f8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,264 @@ +2008-07-07 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.dg/compat/struct-layout-1_generate.c (vector_types): Add + v32qi, v16hi, v8si, v4di, v8sf, v4df, u32qi, u16hi, u8si, u4di, + u8sf and u4df. + + * gcc.dg/compat/union-m128-1_main.c: Run only on x86. Remove + __x86_64__ check. Include "cpuid.h". + (main): Check SSE2 at runtime. + + * gcc.dg/compat/union-m128-1_x.c: Compile with -msse2. Remove + __x86_64__ check. + * gcc.dg/compat/union-m128-1_y.c: Likewise. + + * gcc.dg/compat/vector-1_x.c: Add 32byte vector tests. + * gcc.dg/compat/vector-1_y.c: Likewise. + * gcc.dg/compat/vector-2_x.c: Likewise. + * gcc.dg/compat/vector-2_y.c: Likewise. + + * gcc.dg/compat/vector-1a_main.c: New. + * gcc.dg/compat/vector-1a_x.c: Likewise. + * gcc.dg/compat/vector-1a_y.c: Likewise. + * gcc.dg/compat/vector-2a_main.c: Likewise. + * gcc.dg/compat/vector-2a_x.c: Likewise. + * gcc.dg/compat/vector-2a_y.c: Likewise. + + * gcc.dg/compat/vector-defs.h (v32qi): New. + (v16hi): Likewise. + (v8si): Likewise. + (v4di): Likewise. + (v8sf): Likewise. + (v4df): Likewise. + (u32qi): Likewise. + (u16hi): Likewise. + (u8si): Likewise. + (u4di): Likewise. + (u8sf): Likewise. + (u4df): Likewise. + + * lib/compat.exp (compat-get-options-main): Support dg-skip-if. + +2008-07-07 Andy Hutchinson <hutchinsonandy@aim.com> + + * gcc.c-torture/compile/20080625-1.c: Skip for AVR target. + * gcc.dg/torture/pr36373-10.c: Correct test where target pointer + is not same size as unsigned long. + +2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/36670 + * gfortran.dg/product_sum_bounds_1.f90: New test case. + +2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/36341 + PR fortran/34670 + * gfortran.dg/matmul_bounds_2.f90: New test. + * gfortran.dg/matmul_bounds_3.f90: New test. + * gfortran.dg/matmul_bounds_4.f90: New test. + * gfortran.dg/matmul_bounds_5.f90: New test. + +2008-07-07 Richard Guenther <rguenther@suse.de> + + * gcc.dg/torture/pta-ptrarith-1.c: New testcase. + * gcc.dg/torture/pta-ptrarith-2.c: Likewise. + * gcc.dg/torture/ipa-pta-1.c: Likewise. + +2008-07-07 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/36726 + * gfortran.dg/gomp/pr36726.f90: New test. + +2008-07-06 Richard Sandiford <rdsandiford@googlemail.com> + + * gcc.target/mips/gcc-have-sync-compare-and-swap-1.c: Expect the + macros to be defined for MIPS16 too. + * gcc.target/mips/gcc-have-sync-compare-and-swap-2.c: Likewise. + * gcc.target/mips/gcc-have-sync-compare-and-swap-3.c: New test. + * gcc.target/mips/gcc-have-sync-compare-and-swap-4.c: Likewise. + +2008-07-06 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/pta-callused.c: Adjust testcase. + +2008-07-06 Kai Tietz <kai.tietz@onevision.com> + + * gcc.dg/callabi/callabi.h: New. + * gcc.dg/callabi/vaarg-1.c: New. + * gcc.dg/callabi/vaarg-2.c: New. + * gcc.dg/callabi/vaarg-3.c: New. + * gcc.dg/callabi/func-1.c: New. + +2008-07-05 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * g++.dg/tree-ssa/ptrmemfield.C: New testcase. + +2008-07-05 Joseph Myers <joseph@codesourcery.com> + + * lib/gcc-dg.exp (remove-build-file): Remove files on remote host + as well as on build. + +2008-07-04 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/pta-callused.c: New testcase. + +2008-07-04 Richard Sandiford <richard@codesourcery.com> + + * gcc.target/m68k/interrupt-2.c: New file. + * gcc.dg/tree-ssa/20040204-1.c: Don't XFAIL for m68k*-*-*. + +2008-07-03 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.dg/compat/struct-by-value-17a_x.c: Remove duplicated code. + * gcc.dg/compat/struct-by-value-17a_y.c: Likewise. + +2008-07-03 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/loop_optimization3.adb: New test. + * gnat.dg/loop_optimization3_pkg.ad[sb]: New helper. + +2008-07-03 Uros Bizjak <ubizjak@gmail.com> + + PR target/36710 + * gcc.target/i386/float128-2.c: New test. + +2008-07-03 Michael Meissner <gnu@the-meissners.org> + + PR middle-end/35736 + * gcc.dg/pr35736.c: New file. + +2008-07-03 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * gcc.dg/pr28243.c: Skip on SPU. + * gcc.dg/torture/pr25947-1.c: Likewise. + * gcc.dg/20030702-1.c: Likewise. + * g++.old-deja/g++.other/comdat5.C: Likewise. + * g++.old-deja/g++.other/local-alloc1.C: Likewise. + * g++.dg/opt/vt1.C: Likewise. + +2008-07-03 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.dg/compat/struct-by-value-17a_main.c: Remove duplicated code. + +2008-07-03 H.J. Lu <hongjiu.lu@intel.com> + Uros Bizjak <ubizjak@gmail.com> + + * gcc.target/i386/float128-1.c: New. + +2008-07-03 Andrew Haley <aph@redhat.com> + + PR preprocessor/33305 + * gcc.dg/cpp/avoidpaste1.c: Use dg-options "-ansi" to avoid + "-pedantic". + * gcc.dg/cpp/avoidpaste2.c: Likewise + * gcc.dg/cpp/20000519-1.c: Likewise. + * g++.dg/ext/gnu-inline-global-reject.C: Likewise. + * gcc.dg/cpp/c99-empty-macro-args.c: New test. + * gcc.dg/cpp/c90-empty-macro-args.c: New test. + +2008-07-03 Richard Guenther <rguenther@suse.de> + + PR c++/36128 + * g++.dg/other/builtin1.C: New testcase. + +2008-07-02 Joseph Myers <joseph@codesourcery.com> + + * g++.dg/compat/struct-layout-1.exp: Compile generator on build system. + * gcc.dg/compat/struct-layout-1.exp: Likewise. + * objc.dg/gnu-encoding/gnu-encoding.exp: Likewise. + +2008-07-02 Andy Hutchinson <hutchinsonandy@aim.com> + + PR testsuite/36285 + * gcc.dg/compat/struct-by-value-16_x.c: Move some tests to new file + to reduce code size. + * gcc.dg/compat/struct-by-value-16_y.c: Ditto. + * gcc.dg/compat/struct-by-value-16a_main.c: New file. + * gcc.dg/compat/struct-by-value-16a_x.c: Ditto. + * gcc.dg/compat/struct-by-value-16a_y.c: Ditto. + * gcc.dg/compat/struct-by-value-17_x.c: Move some tests to new file + to reduce code size. + * gcc.dg/compat/struct-by-value-17_y.c: Ditto. + * gcc.dg/compat/struct-by-value-17a_main.c: New file. + * gcc.dg/compat/struct-by-value-17a_x.c: Ditto. + * gcc.dg/compat/struct-by-value-17a_y.c: Ditto. + * gcc.dg/compat/struct-by-value-18_x.c: Move some tests to new file + to reduce code size. + * gcc.dg/compat/struct-by-value-18_y.c: Ditto. + * gcc.dg/compat/struct-by-value-18a_main.c: New file. + * gcc.dg/compat/struct-by-value-18a_x.c: Ditto. + * gcc.dg/compat/struct-by-value-18a_y.c: Ditto. + + +2008-07-02 Andy Hutchinson <hutchinsonandy@aim.com> + + * gcc.dg/pr36227.c: Correct test for targets where long is + not the same size as pointer. + +2008-07-02 Kaz Kojima <kkojima@gcc.gnu.org> + + * g++.dg/cdce3.C: Test long double math functions for + large_long_double target only. Skip pow10 and exp10 + functions for *-*-darwin*. + +2008-07-02 Janus Weil <janus@gcc.gnu.org> + Tobias Burnus <burnus@net-b.de> + + PR fortran/32580 + * gfortran.dg/c_f_pointer_tests_3.f90: Updated. + * gfortran.dg/proc_decl_1.f90: Updated. + * gfortran.dg/proc_ptr_1.f90: New. + * gfortran.dg/proc_ptr_2.f90: New. + * gfortran.dg/proc_ptr_3.f90: New. + * gfortran.dg/proc_ptr_4.f90: New. + * gfortran.dg/proc_ptr_5.f90: New. + * gfortran.dg/proc_ptr_6.f90: New. + * gfortran.dg/proc_ptr_7.f90: New. + * gfortran.dg/proc_ptr_8.f90: New. + +2008-07-02 Joseph Myers <joseph@codesourcery.com> + + * gcc.target/arm/neon/polytypes.c: Use dg-message separately from + dg-error to match separate messages. + +2008-07-02 H.J. Lu <hongjiu.lu@intel.com> + + * g++.dg/abi/mangle24.C: Remove -mmmx. + * gcc.dg/const-float80-ped.c: Likewise. + * gcc.dg/const-float80.c: Likewise. + * gcc.dg/torture/fp-int-convert-float80.c: Likewise. + + * g++.dg/abi/mangle25.C: Enable x86. + * gcc.dg/const-float128-ped.c: Likewise. + * gcc.dg/const-float128.c: Likewise. + * gcc.dg/torture/fp-int-convert-float128.c: Likewise. + * gcc.target/i386/pr32191.c: Likewise. + * gcc.target/i386/pr32268.c: Likewise. + +2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + PR target/36698 + * gcc.c-torture/compile/20001226-1.c: XFAIL -O0 case on SPU. + + * gcc.dg/pr27095.c: Provide target-specific regexp for SPU. + +2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * lib/compat.exp (compat-execute): Add -ffunction-sections + and -Wl,--auto-overlay when building for spu-*-elf*. + +2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * gcc.dg/nrv3.c (S): Increase size of padding for SPU. + * g++.dg/opt/temp1.C (struct T): Likewise. + +2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * gcc.c-torture/execute/20030222-1.x: New file. + * gcc.dg/tree-ssa/ssa-fre-3.c: Disable test on SPU. + * gcc.dg/lower-subreg-1.c: Likewise. + 2008-07-02 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> SPU single-precision FP does not support subnormals: diff --git a/gcc/testsuite/g++.dg/abi/mangle24.C b/gcc/testsuite/g++.dg/abi/mangle24.C index 16aa2ea8e59..3a9f629d5bf 100644 --- a/gcc/testsuite/g++.dg/abi/mangle24.C +++ b/gcc/testsuite/g++.dg/abi/mangle24.C @@ -5,7 +5,6 @@ // Origin: Joseph Myers <joseph@codesourcery.com> // { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */ // { dg-options "" } */ -// { dg-options "-mmmx" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ // { dg-final { scan-assembler "_Z1fe" { target i?86-*-* x86_64-*-* } } } */ // { dg-final { scan-assembler "_Z1fe" { target { ia64-*-* && { ! "ia64-*-hpux*" } } } } } */ // { dg-final { scan-assembler "_Z1fu9__float80" { target ia64-*-hpux* } } } */ diff --git a/gcc/testsuite/g++.dg/abi/mangle25.C b/gcc/testsuite/g++.dg/abi/mangle25.C index 75819a7bfaf..e00ba5c692d 100644 --- a/gcc/testsuite/g++.dg/abi/mangle25.C +++ b/gcc/testsuite/g++.dg/abi/mangle25.C @@ -4,7 +4,7 @@ // ia64-hpux where "long double" is "e" and __float128 is synonymous with // "long double". // Origin: Joseph Myers <joseph@codesourcery.com> -// { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-*} && lp64 } } } } +// { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } } // { dg-options "" } */ // { dg-final { scan-assembler "_Z1fg" { target i?86-*-* x86_64-*-* } } } */ // { dg-final { scan-assembler "_Z1fg" { target { ia64-*-* && { ! "ia64-*-hpux*" } } } } } */ diff --git a/gcc/testsuite/g++.dg/cdce3.C b/gcc/testsuite/g++.dg/cdce3.C index 6c6afc89027..19f7f0b295a 100644 --- a/gcc/testsuite/g++.dg/cdce3.C +++ b/gcc/testsuite/g++.dg/cdce3.C @@ -1,21 +1,23 @@ -/* { dg-do run { target { ! "*-*-darwin*" } } } */ -/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */ -/* { dg-final { scan-tree-dump "cdce3.C:68: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:69: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:70: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:71: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:72: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:73: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:74: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:75: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:76: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:77: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:78: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:79: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:80: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:81: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:82: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ -/* { dg-final { scan-tree-dump "cdce3.C:83: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-do run } */ +/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DNO_GNU_EXTENSION -lm" { target "*-*-darwin*" } } */ +/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! "*-*-darwin*" } && large_long_double } } }*/ +/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DNO_LONG_DOUBLE -lm" { target {! large_long_double } } } */ +/* { dg-final { scan-tree-dump "cdce3.C:89: note: function call is shrink-wrapped into error conditions\." "cdce" { target {! "*-*-darwin*" } } } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:90: note: function call is shrink-wrapped into error conditions\." "cdce" { target {! "*-*-darwin*" } } } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:92: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:95: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:98: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:99: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:100: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:101: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:102: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:103: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:104: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ +/* { dg-final { scan-tree-dump "cdce3.C:105: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/ /* { dg-final { cleanup-tree-dump "cdce" } } */ #include <stdlib.h> #include <math.h> @@ -23,9 +25,24 @@ #include <stdio.h> #endif #include <errno.h> -typedef long double ldouble; typedef void (*FP) (int xp); #define NI __attribute__((noinline)) + +#if defined(NO_LONG_DOUBLE) +double result; + +#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \ +{ \ + float yy = name##f ((float) x); \ + STORE_RESULT; \ +} \ +NI void prefix##name (int x) \ +{ \ + double yy = name ((double)x); \ + STORE_RESULT; \ +} +#else +typedef long double ldouble; ldouble result; #define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \ @@ -42,12 +59,15 @@ NI void prefix##name##l (int x) \ { \ ldouble yy = name##l ((ldouble)x); \ STORE_RESULT; \ -} +} +#endif #undef STORE_RESULT #define STORE_RESULT result = yy +#if !defined(NO_GNU_EXTENSION) DEF_MATH_FUNC (m,pow10) DEF_MATH_FUNC (m,exp10) +#endif DEF_MATH_FUNC (m,exp2) DEF_MATH_FUNC (m,exp) DEF_MATH_FUNC (m,expm1) @@ -65,8 +85,10 @@ DEF_MATH_FUNC (m,sqrt) #undef STORE_RESULT #define STORE_RESULT +#if !defined(NO_GNU_EXTENSION) DEF_MATH_FUNC (o,pow10) DEF_MATH_FUNC (o,exp10) +#endif DEF_MATH_FUNC (o,exp2) DEF_MATH_FUNC (o,exp) DEF_MATH_FUNC (o,expm1) @@ -82,9 +104,14 @@ DEF_MATH_FUNC (o,log10) DEF_MATH_FUNC (o,log1p) DEF_MATH_FUNC (o,sqrt) +#if defined(NO_LONG_DOUBLE) +#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \ +{ prefix##name, #name, 0, 0, lb, ub }, +#else #define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \ { prefix##name, #name, 0, 0, lb, ub }, \ { prefix##name##l, #name "l" , 0, 0, lb, ub }, +#endif struct MathFuncInfo { @@ -95,8 +122,10 @@ struct MathFuncInfo bool has_lb; bool has_ub; } math_func_arr[] = { +#if !defined(NO_GNU_EXTENSION) INIT_MATH_FUNC (m,pow10, false, true) INIT_MATH_FUNC (m,exp10, false, true) +#endif INIT_MATH_FUNC (m,exp2, false, true) INIT_MATH_FUNC (m,expm1, false, true) INIT_MATH_FUNC (m,exp, false, true) @@ -114,8 +143,11 @@ struct MathFuncInfo { 0, 0, 0, 0, 0, 0} }; MathFuncInfo opt_math_func_arr[] = -{ INIT_MATH_FUNC (o,pow10, false, true) +{ +#if !defined(NO_GNU_EXTENSION) + INIT_MATH_FUNC (o,pow10, false, true) INIT_MATH_FUNC (o,exp10, false, true) +#endif INIT_MATH_FUNC (o,exp2, false, true) INIT_MATH_FUNC (o,expm1, false, true) INIT_MATH_FUNC (o,exp, false, true) diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp index 14473486aeb..cd58e7302a2 100644 --- a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp +++ b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp @@ -136,7 +136,7 @@ if [info exists env(GCC_EXEC_PREFIX)] { set orig_gcc_exec_prefix_saved 1 unsetenv GCC_EXEC_PREFIX } -set status [remote_exec host "$HOSTCC $HOSTCFLAGS $generator_cmd"] +set status [remote_exec build "$HOSTCC $HOSTCFLAGS $generator_cmd"] set status [lindex $status 0] if { $orig_gcc_exec_prefix_saved } { set orig_gcc_exec_prefix_saved 0 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist1.C b/gcc/testsuite/g++.dg/cpp0x/initlist1.C new file mode 100644 index 00000000000..b7583da7829 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist1.C @@ -0,0 +1,69 @@ +// Basic uses of initializer lists +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include <initializer_list> + +extern "C" void abort(); + +using namespace std; + +struct A { int i,j; A(int _i,int _j): i(_i), j(_j) {} }; +struct B { A a; B(A _a): a(_a) {} }; +struct C { B b; C(B _b): b(_b) {} }; + +struct D +{ + int ia[3]; + D (initializer_list<int> l) + { + const int *p = l.begin(); + for (int i = 0; i < 3; ++i) + ia[i] = *p++; + } +}; + +void f(C c) +{ + if (c.b.a.i != 1) abort(); + if (c.b.a.j != 2) abort(); +} +void f(int); + +void g(D d) +{ + if (d.ia[0] != 1 || d.ia[1] != 2 || d.ia[2] != 3) + abort(); +} + +struct E +{ + int i, j, k; +}; + +void h(E e) +{ + if (e.i != 1 || e.j != 2 || e.k != 3) + abort(); +} + +void i(initializer_list<int> l) +{ + const int *p = l.begin(); + if (*p++ != 1) abort(); + if (*p++ != 2) abort(); + if (*p++ != 3) abort(); + if (p != l.end()) abort(); +} + +int main() +{ + g({1,2,3}); + + h({1,2,3}); + + f({{{1,2}}}); + f({{A{1,2}}}); + + i({1,2,3}); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist2.C b/gcc/testsuite/g++.dg/cpp0x/initlist2.C new file mode 100644 index 00000000000..2fe4770560d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist2.C @@ -0,0 +1,32 @@ +// Test that conversion to std::initializer_list takes priority over other +// user-defined conversions. + +// { dg-do link } +// { dg-options "-std=c++0x" } + +#include <initializer_list> + +struct string +{ + string (const char *) {} + template <class Iter> string (Iter, Iter); +}; + +template <class T, class U> +struct pair +{ + pair (T t, U u) {} +}; + +template<class T, class U> +struct map +{ + void insert (pair<T,U>); + void insert (std::initializer_list<pair<T,U> >) {} +}; + +int main() +{ + map<string,string> m; + m.insert({ {"this","that"}, {"me","you"} }); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist3.C b/gcc/testsuite/g++.dg/cpp0x/initlist3.C new file mode 100644 index 00000000000..412deb51129 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist3.C @@ -0,0 +1,11 @@ +// { dg-options "-std=c++0x" } + +#include <initializer_list> + +template <class T> void f(std::initializer_list<T>); + +void g() +{ + f({1,2,3}); +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist4.C b/gcc/testsuite/g++.dg/cpp0x/initlist4.C new file mode 100644 index 00000000000..d1ffab8546c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist4.C @@ -0,0 +1,32 @@ +// Test for initializer-list 'explicit' rule +// { dg-options "-std=c++0x" } + +struct A +{ + explicit A(int,int); + operator bool(); +}; + +A f(A) +{ + A{1,2}; + A a1{1,2}; + new A{1,2}; + if (A a5{1,2}); + + A({1,2}); // { dg-error "explicit" } + A a2({1,2}); // { dg-error "explicit" } + A a3 = {1,2}; // { dg-error "explicit" } + new A({1,2}); // { dg-error "explicit" } + f({1,2}); // { dg-error "explicit" } + a1 = {1,2}; // { dg-error "explicit" } + if (A a4 = {1,2}); // { dg-error "explicit" } + return {1,2}; // { dg-error "explicit" } +} + +struct B +{ + A a; + B(): a{1,2} {} + B(const B&): a({1,2}) {} // { dg-error "explicit" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist5.C b/gcc/testsuite/g++.dg/cpp0x/initlist5.C new file mode 100644 index 00000000000..0d02fd42d7f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist5.C @@ -0,0 +1,21 @@ +// Test for narrowing diagnostics +// { dg-options "-std=c++0x" } + +#include <initializer_list> + +struct A { int i; int j; }; +A a2 { 1.2 }; // { dg-error "narrowing" } +A a1 { 1, 2 }; // aggregate initialization +struct B { + B(std::initializer_list<int>); +}; +B b1 { 1, 2 }; // creates initializer_list<int> and calls constructor +B b2 { 1, 2.0 }; // { dg-error "narrowing" } +struct C { + C(int i, double j); +}; +C c1 = { 1, 2.2 }; // calls constructor with arguments (1, 2.2) +C c2 = { 1.1, 2 }; // { dg-error "narrowing" } + +int j { 1 }; // initialize to 1 +int k {}; // initialize to 0 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist6.C b/gcc/testsuite/g++.dg/cpp0x/initlist6.C new file mode 100644 index 00000000000..523570315eb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist6.C @@ -0,0 +1,30 @@ +// Test for initlist lifetime +// { dg-options "-std=c++0x" } +// { dg-do run } + +#include <initializer_list> + +int c; + +struct A +{ + A(int,int) { ++c; } + ~A() { --c; } +}; + +void f (std::initializer_list<A> l) { } + +int main() +{ + f({ {1,2}, {3,4} }); + if (c != 0) + return 1; + + { + std::initializer_list<A> l { {1,2}, {3,4} }; + if (c != 2) + return 2; + } + if (c != 0) + return 3; +} diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C b/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C index 2f2b8f29a08..d9e26609550 100644 --- a/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C +++ b/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C @@ -4,6 +4,7 @@ */ /* { dg-do compile } */ +/* { dg-options " -ansi -Wno-long-long" } */ #include "gnu-inline-common.h" diff --git a/gcc/testsuite/g++.dg/inherit/error4.C b/gcc/testsuite/g++.dg/inherit/error4.C index 77fa75d1994..d56d67f7556 100644 --- a/gcc/testsuite/g++.dg/inherit/error4.C +++ b/gcc/testsuite/g++.dg/inherit/error4.C @@ -2,9 +2,9 @@ struct A { virtual ~A(); }; -struct B : A A {}; // { dg-error "'A'|function definition|extra" } +struct B : A A {}; // { dg-error "" } -A foo(const B &b) +A foo(const B &b) // { dg-error "" } { - return b; // { dg-error "conversion" } + return b; } diff --git a/gcc/testsuite/g++.dg/init/brace2.C b/gcc/testsuite/g++.dg/init/brace2.C index 2af063d5f56..619a20f3c70 100644 --- a/gcc/testsuite/g++.dg/init/brace2.C +++ b/gcc/testsuite/g++.dg/init/brace2.C @@ -5,4 +5,4 @@ const char * y = { "hello" }; int a = 2; int b = { 2,3 }; // { dg-error "requires one element in initializer" } int c = { { 2 } } ; // { dg-error "braces around scalar initializer" } -int d = {}; // { dg-error "requires one element in initializer" } +int d = {}; // { dg-error "initializer" } diff --git a/gcc/testsuite/g++.dg/init/brace6.C b/gcc/testsuite/g++.dg/init/brace6.C index ffb70118f9e..066d1ba65ff 100644 --- a/gcc/testsuite/g++.dg/init/brace6.C +++ b/gcc/testsuite/g++.dg/init/brace6.C @@ -6,7 +6,7 @@ struct A { }; struct B { - B(const B&); + B(const B&); // { dg-error "candidate" } int b; }; @@ -18,8 +18,8 @@ int main() { int i = { 1 }; int j = { 1, 2 }; /* { dg-error "requires one element" } */ - A a = { 6 }; /* { dg-error "initializer for non" } */ - B b = { 6 }; /* { dg-error "initializer for non" } */ + A a = { 6 }; /* { dg-error "initialize" } */ + B b = { 6 }; /* { dg-error "initialize" } */ C c = { 6 }; /* { dg-error "too many initializers" } */ D d = { 6 }; } diff --git a/gcc/testsuite/g++.dg/opt/temp1.C b/gcc/testsuite/g++.dg/opt/temp1.C index b822dc464fe..dc13f516246 100644 --- a/gcc/testsuite/g++.dg/opt/temp1.C +++ b/gcc/testsuite/g++.dg/opt/temp1.C @@ -24,7 +24,12 @@ void *memcpy (void *dest, const void *src, __SIZE_TYPE__ n) } struct T { +#ifdef __SPU__ + /* SPU returns aggregates up to 1172 bytes in registers. */ + int a[300]; +#else int a[128]; +#endif T &operator+=(T const &v) __attribute__((noinline)); T operator+(T const &v) const { T t = *this; t += v; return t; } }; diff --git a/gcc/testsuite/g++.dg/opt/vt1.C b/gcc/testsuite/g++.dg/opt/vt1.C index b3abb5d57a2..ea74f52126f 100644 --- a/gcc/testsuite/g++.dg/opt/vt1.C +++ b/gcc/testsuite/g++.dg/opt/vt1.C @@ -1,6 +1,7 @@ // Test whether vtable for S is not put into read-only section. // { dg-do compile { target fpic } } // { dg-options "-O2 -fpic -fno-rtti" } +// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } // Origin: Jakub Jelinek <jakub@redhat.com> struct S diff --git a/gcc/testsuite/g++.dg/other/builtin1.C b/gcc/testsuite/g++.dg/other/builtin1.C new file mode 100644 index 00000000000..88665819987 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/builtin1.C @@ -0,0 +1,6 @@ +/* { dg-do compile } */ + +void foo() +{ + __builtin_isless (foo, 0); /* { dg-error "non-floating-point arguments" } */ +} diff --git a/gcc/testsuite/g++.dg/parse/crash36.C b/gcc/testsuite/g++.dg/parse/crash36.C index bcd96e4ec1f..1397e87d256 100644 --- a/gcc/testsuite/g++.dg/parse/crash36.C +++ b/gcc/testsuite/g++.dg/parse/crash36.C @@ -2,7 +2,7 @@ // { dg-do compile } // { dg-options "-std=c++98" } -template <typename... T> struct A // { dg-error "does not include variadic templates" } +template <typename... T> struct A // { dg-error "variadic templates" } { static T &t; // { dg-error "not expanded with|T" } static const int i = sizeof (++t); // { dg-error "was not declared in this scope" } diff --git a/gcc/testsuite/g++.dg/parse/ctor3.C b/gcc/testsuite/g++.dg/parse/ctor3.C index 193ffae24fe..e597d926f40 100644 --- a/gcc/testsuite/g++.dg/parse/ctor3.C +++ b/gcc/testsuite/g++.dg/parse/ctor3.C @@ -4,5 +4,5 @@ struct A {}; struct B : A { - B() : A {} // { dg-error "expected" } + B() : A {} // { dg-error "initializer|expected" } }; diff --git a/gcc/testsuite/g++.dg/tree-ssa/ptrmemfield.C b/gcc/testsuite/g++.dg/tree-ssa/ptrmemfield.C new file mode 100644 index 00000000000..38189eb43af --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/ptrmemfield.C @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +// { dg-options "-O2 -fdump-tree-final_cleanup" } + + +struct f +{ + char m; + char m1; +}; + +static inline char f:: *g(int a) +{ + return a?0:&f::m; +} + +int h(void) +{ + char f:: *a = g(0); + return a == 0; +} + +/* We should have no cast to offset_type. */ +/* { dg-final { scan-tree-dump-times "offset_type" 0 "final_cleanup"} } */ +// And we should optimized this code to just return 0 +/* { dg-final { scan-tree-dump-times "return 0" 1 "final_cleanup"} } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ + diff --git a/gcc/testsuite/g++.old-deja/g++.other/comdat5.C b/gcc/testsuite/g++.old-deja/g++.other/comdat5.C index 5c2baa389e2..ad707f57247 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/comdat5.C +++ b/gcc/testsuite/g++.old-deja/g++.other/comdat5.C @@ -2,5 +2,6 @@ // { dg-do link { target fpic } } // { dg-additional-sources " comdat5-aux.cc" } // { dg-options "-O2 -fPIC" } +// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } #include "comdat4.C" diff --git a/gcc/testsuite/g++.old-deja/g++.other/local-alloc1.C b/gcc/testsuite/g++.old-deja/g++.other/local-alloc1.C index fe9d24fccf7..7488f1971c4 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/local-alloc1.C +++ b/gcc/testsuite/g++.old-deja/g++.other/local-alloc1.C @@ -1,5 +1,6 @@ // { dg-do assemble { target fpic } } // { dg-options "-O0 -fpic" } +// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } // Origin: Jakub Jelinek <jakub@redhat.com> struct bar { diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c index cfcf546e157..19701ab3877 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c @@ -4,6 +4,7 @@ /* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */ /* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */ /* { dg-xfail-if "jump beyond 128K not supported" { xtensa-*-* } { "-O0" } { "" } } */ +/* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */ /* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */ /* This testcase exposed two branch shortening bugs on powerpc. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c index f0900fd9693..226bea1ffae 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "too much data" { "avr-*-*" } { "*" } { "" } } */ struct peakbufStruct { unsigned int lnum [5000]; int lscan [5000][4000]; diff --git a/gcc/testsuite/gcc.c-torture/execute/20030222-1.x b/gcc/testsuite/gcc.c-torture/execute/20030222-1.x new file mode 100644 index 00000000000..e195563ddd0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030222-1.x @@ -0,0 +1,6 @@ +if [istarget "spu-*-*"] { + # Using inline assembly to convert long long to int is not working quite + # right # on the SPU. An extra shift-left-4-byte is needed. + return 1 +} +return 0 diff --git a/gcc/testsuite/gcc.dg/20030702-1.c b/gcc/testsuite/gcc.dg/20030702-1.c index 892f7d50539..4dbb4c50fc5 100644 --- a/gcc/testsuite/gcc.dg/20030702-1.c +++ b/gcc/testsuite/gcc.dg/20030702-1.c @@ -2,6 +2,7 @@ correctly in combine. */ /* { dg-do compile { target fpic } } */ /* { dg-options "-O2 -fpic -fprofile-arcs" } */ +/* { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } */ void test (void) { diff --git a/gcc/testsuite/gcc.dg/callabi/callabi.h b/gcc/testsuite/gcc.dg/callabi/callabi.h new file mode 100644 index 00000000000..d008ad659cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/callabi/callabi.h @@ -0,0 +1,50 @@ +/* First the default target definition. */ +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + typedef __builtin_va_list __gnuc_va_list; +#endif + +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED + typedef __gnuc_va_list va_list; +#endif + +#define __va_copy(d,s) __builtin_va_copy(d,s) +#define __va_start(v,l) __builtin_va_start(v,l) +#define __va_arg(v,l) __builtin_va_arg(v,l) +#define __va_end(v) __builtin_va_end(v) + +#define __ms_va_copy(d,s) __builtin_ms_va_copy(d,s) +#define __ms_va_start(v,l) __builtin_ms_va_start(v,l) +#define __ms_va_arg(v,l) __builtin_va_arg(v,l) +#define __ms_va_end(v) __builtin_ms_va_end(v) + +#define __sysv_va_copy(d,s) __builtin_sysv_va_copy(d,s) +#define __sysv_va_start(v,l) __builtin_sysv_va_start(v,l) +#define __sysv_va_arg(v,l) __builtin_va_arg(v,l) +#define __sysv_va_end(v) __builtin_sysv_va_end(v) + +#define CALLABI_NATIVE + +#ifdef _WIN64 +#define CALLABI_CROSS __attribute__ ((sysv_abi)) + +#define CROSS_VA_LIST __builtin_sysv_va_list + +#define CROSS_VA_COPY(d,s) __sysv_va_copy(d,s) +#define CROSS_VA_START(v,l) __sysv_va_start(v,l) +#define CROSS_VA_ARG(v,l) __sysv_va_arg(v,l) +#define CROSS_VA_END(v) __sysv_va_end(v) + +#else + +#define CALLABI_CROSS __attribute__ ((ms_abi)) + +#define CROSS_VA_LIST __builtin_ms_va_list + +#define CROSS_VA_COPY(d,s) __ms_va_copy(d,s) +#define CROSS_VA_START(v,l) __ms_va_start(v,l) +#define CROSS_VA_ARG(v,l) __ms_va_arg(v,l) +#define CROSS_VA_END(v) __ms_va_end(v) + +#endif
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/callabi/func-1.c b/gcc/testsuite/gcc.dg/callabi/func-1.c new file mode 100644 index 00000000000..c727dbe6e53 --- /dev/null +++ b/gcc/testsuite/gcc.dg/callabi/func-1.c @@ -0,0 +1,40 @@ +/* Test for cross x86_64<->w64 abi standard calls. +*/ +/* Origin: Kai Tietz <kai.tietz@onevision.com> */ +/* { dg-do run { target { x86_64-*-* } } } */ +/* { dg-options "-std=gnu99 -ffast-math" } */ +#include "callabi.h" + +extern void abort (void); + +long double +CALLABI_CROSS func_cross (long double a, double b, float c, long d, int e, + char f) +{ + long double ret; + ret = a + (long double) b + (long double) c; + ret *= (long double) (d + (long) e); + if (f>0) + ret += func_cross (a,b,c,d,e,-f); + return ret; +} + +long double +CALLABI_NATIVE func_native (long double a, double b, float c, long d, int e, + char f) +{ + long double ret; + ret = a + (long double) b + (long double) c; + ret *= (long double) (d + (long) e); + if (f>0) + ret += func_native (a,b,c,d,e,-f); + return ret; +} + +int main () +{ + if (func_cross (1.0,2.0,3.0,1,2,3) + != func_native (1.0,2.0,3.0,1,2,3)) + abort (); + return 0; +}
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/callabi/vaarg-1.c b/gcc/testsuite/gcc.dg/callabi/vaarg-1.c new file mode 100644 index 00000000000..1e745e56085 --- /dev/null +++ b/gcc/testsuite/gcc.dg/callabi/vaarg-1.c @@ -0,0 +1,47 @@ +/* Test for cross x86_64<->w64 abi va_list calls. +*/ +/* Origin: Kai Tietz <kai.tietz@onevision.com> */ +/* { dg-do run { target { x86_64-*-* } } } */ +/* { dg-options "-std=gnu99" } */ +#include "callabi.h" + +extern __SIZE_TYPE__ strlen (const char *); +extern int sprintf (char *,const char *, ...); +extern void abort (void); + +static +void CALLABI_CROSS vdo_cpy (char *s, CROSS_VA_LIST argp) +{ + __SIZE_TYPE__ len; + char *r = s; + char *e; + *r = 0; + for (;;) { + e = CROSS_VA_ARG (argp,char *); + if (*e == 0) break; + sprintf (r,"%s", e); + r += strlen (r); + } +} + +static +void CALLABI_CROSS do_cpy (char *s, ...) +{ + CROSS_VA_LIST argp; + CROSS_VA_START (argp, s); + vdo_cpy (s, argp); + CROSS_VA_END (argp); +} + +int main () +{ + char s[256]; + + do_cpy (s, "1","2","3","4", "5", "6", "7", ""); + + if (s[0] != '1' || s[1] !='2' || s[2] != '3' || s[3] != '4' + || s[4] != '5' || s[5] != '6' || s[6] != '7' || s[7] != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/callabi/vaarg-2.c b/gcc/testsuite/gcc.dg/callabi/vaarg-2.c new file mode 100644 index 00000000000..c9b716194a6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/callabi/vaarg-2.c @@ -0,0 +1,47 @@ +/* Test for cross x86_64<->w64 abi va_list calls. +*/ +/* Origin: Kai Tietz <kai.tietz@onevision.com> */ +/* { dg-do run { target { x86_64-*-* } } } */ +/* { dg-options "-std=gnu99" } */ +#include "callabi.h" + +extern void abort (void); + +#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll + +static +int CALLABI_CROSS fct1 (va_list argp, ...) +{ + long long p1,p2; + int ret = 1; + CROSS_VA_LIST argp_2; + CROSS_VA_START (argp_2,argp); + + do { + p1 = CROSS_VA_ARG (argp_2, long long); + p2 = __va_arg (argp, long long); + if (p1 != p2) + ret = 0; + } while (ret && p1 != 0); + CROSS_VA_END (argp_2); + return ret; +} + +static +int fct2 (int dummy, ...) +{ + va_list argp; + int ret = dummy; + + __va_start (argp, dummy); + ret += fct1 (argp, SZ_ARGS); + __va_end (argp); + return ret; +} + +int main() +{ + if (fct2 (-1, SZ_ARGS) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/callabi/vaarg-3.c b/gcc/testsuite/gcc.dg/callabi/vaarg-3.c new file mode 100644 index 00000000000..d0d068754e1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/callabi/vaarg-3.c @@ -0,0 +1,47 @@ +/* Test for cross x86_64<->w64 abi va_list calls. +*/ +/* Origin: Kai Tietz <kai.tietz@onevision.com> */ +/* { dg-do run { target { x86_64-*-* } } } */ +/* { dg-options "-std=gnu99" } */ +#include "callabi.h" + +extern void abort (void); + +#define SZ_ARGS 1ll,2ll,3ll,4ll,5ll,6ll,7ll,0ll + +static +int fct1 (CROSS_VA_LIST argp, ...) +{ + long long p1,p2; + int ret = 1; + va_list argp_2; + + __va_start (argp_2,argp); + do { + p1 = __va_arg (argp_2, long long); + p2 = CROSS_VA_ARG (argp, long long); + if (p1 != p2) + ret = 0; + } while (ret && p1 != 0); + __va_end (argp_2); + return ret; +} + +static +int CALLABI_CROSS fct2 (int dummy, ...) +{ + CROSS_VA_LIST argp; + int ret = dummy; + + CROSS_VA_START (argp, dummy); + ret += fct1 (argp, SZ_ARGS); + CROSS_VA_END (argp); + return ret; +} + +int main() +{ + if (fct2 (-1, SZ_ARGS) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-16_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-16_x.c index 6b7331833ae..eb995921467 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-by-value-16_x.c +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-16_x.c @@ -19,10 +19,7 @@ TEST(Scf9, _Complex float) TEST(Scf10, _Complex float) TEST(Scf11, _Complex float) TEST(Scf12, _Complex float) -TEST(Scf13, _Complex float) -TEST(Scf14, _Complex float) -TEST(Scf15, _Complex float) -TEST(Scf16, _Complex float) + #undef T @@ -45,10 +42,7 @@ T(Scf9, _Complex float) T(Scf10, _Complex float) T(Scf11, _Complex float) T(Scf12, _Complex float) -T(Scf13, _Complex float) -T(Scf14, _Complex float) -T(Scf15, _Complex float) -T(Scf16, _Complex float) + DEBUG_FINI diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-16_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-16_y.c index 273d7cc4f3e..9450815e74c 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-by-value-16_y.c +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-16_y.c @@ -27,7 +27,4 @@ TEST(Scf9, _Complex float) TEST(Scf10, _Complex float) TEST(Scf11, _Complex float) TEST(Scf12, _Complex float) -TEST(Scf13, _Complex float) -TEST(Scf14, _Complex float) -TEST(Scf15, _Complex float) -TEST(Scf16, _Complex float) + diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_main.c new file mode 100644 index 00000000000..6a71d15b8ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_main.c @@ -0,0 +1,14 @@ +/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are of type
+ _Complex float. */
+
+extern void struct_by_value_16_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_16a_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_x.c new file mode 100644 index 00000000000..0aa45249590 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_x.c @@ -0,0 +1,37 @@ +#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(cf, _Complex float)
+CHECKS(cf, _Complex float)
+
+
+TEST(Scf13, _Complex float)
+TEST(Scf14, _Complex float)
+TEST(Scf15, _Complex float)
+TEST(Scf16, _Complex float)
+
+#undef T
+
+void
+struct_by_value_16a_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+
+T(Scf13, _Complex float)
+T(Scf14, _Complex float)
+T(Scf15, _Complex float)
+T(Scf16, _Complex float)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_y.c new file mode 100644 index 00000000000..2fd561ef044 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-16a_y.c @@ -0,0 +1,22 @@ +#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(cf,_Complex float)
+INITS(cf, _Complex float)
+
+
+TEST(Scf13, _Complex float)
+TEST(Scf14, _Complex float)
+TEST(Scf15, _Complex float)
+TEST(Scf16, _Complex float)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-17_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-17_x.c index cba628bcb5b..93fd788ea45 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-by-value-17_x.c +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-17_x.c @@ -19,10 +19,7 @@ TEST(Scd9, _Complex double) TEST(Scd10, _Complex double) TEST(Scd11, _Complex double) TEST(Scd12, _Complex double) -TEST(Scd13, _Complex double) -TEST(Scd14, _Complex double) -TEST(Scd15, _Complex double) -TEST(Scd16, _Complex double) + #undef T @@ -45,10 +42,7 @@ T(Scd9, _Complex double) T(Scd10, _Complex double) T(Scd11, _Complex double) T(Scd12, _Complex double) -T(Scd13, _Complex double) -T(Scd14, _Complex double) -T(Scd15, _Complex double) -T(Scd16, _Complex double) + DEBUG_FINI diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-17_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-17_y.c index a0342a37c0c..f8ac0a7c15e 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-by-value-17_y.c +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-17_y.c @@ -27,7 +27,4 @@ TEST(Scd9, _Complex double) TEST(Scd10, _Complex double) TEST(Scd11, _Complex double) TEST(Scd12, _Complex double) -TEST(Scd13, _Complex double) -TEST(Scd14, _Complex double) -TEST(Scd15, _Complex double) -TEST(Scd16, _Complex double) + diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_main.c new file mode 100644 index 00000000000..1db00215f2c --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_main.c @@ -0,0 +1,14 @@ +/* Test structures passed by value, including to a function with a + variable-length argument lists. All struct members are of type + _Complex double. */ + +extern void struct_by_value_17_x (void); +extern void exit (int); +int fails; + +int +main () +{ + struct_by_value_17a_x (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_x.c new file mode 100644 index 00000000000..5b2f1d1d920 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_x.c @@ -0,0 +1,37 @@ +#include "compat-common.h" + +#include "fp-struct-defs.h" +#include "fp-struct-check.h" +#include "fp-struct-test-by-value-x.h" + +DEFS(cd, _Complex double) +CHECKS(cd, _Complex double) + + +TEST(Scd13, _Complex double) +TEST(Scd14, _Complex double) +TEST(Scd15, _Complex double) +TEST(Scd16, _Complex double) + +#undef T + +void +struct_by_value_17a_x () +{ +DEBUG_INIT + +#define T(TYPE, MTYPE) testit##TYPE (); + + +T(Scd13, _Complex double) +T(Scd14, _Complex double) +T(Scd15, _Complex double) +T(Scd16, _Complex double) + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_y.c new file mode 100644 index 00000000000..d785a999d58 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-17a_y.c @@ -0,0 +1,22 @@ +#include <stdarg.h> + +#include "compat-common.h" + +#ifdef SKIP_VA +const int test_va = 0; +#else +const int test_va = 1; +#endif + +#include "fp-struct-defs.h" +#include "fp-struct-init.h" +#include "fp-struct-test-by-value-y.h" + +DEFS(cd,_Complex double) +INITS(cd, _Complex double) + + +TEST(Scd13, _Complex double) +TEST(Scd14, _Complex double) +TEST(Scd15, _Complex double) +TEST(Scd16, _Complex double) diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-18_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-18_x.c index e040ecc79a7..f9dd6aa0b72 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-by-value-18_x.c +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-18_x.c @@ -19,10 +19,7 @@ TEST(Scld9, _Complex long double) TEST(Scld10, _Complex long double) TEST(Scld11, _Complex long double) TEST(Scld12, _Complex long double) -TEST(Scld13, _Complex long double) -TEST(Scld14, _Complex long double) -TEST(Scld15, _Complex long double) -TEST(Scld16, _Complex long double) + #undef T @@ -45,10 +42,7 @@ T(Scld9, _Complex long double) T(Scld10, _Complex long double) T(Scld11, _Complex long double) T(Scld12, _Complex long double) -T(Scld13, _Complex long double) -T(Scld14, _Complex long double) -T(Scld15, _Complex long double) -T(Scld16, _Complex long double) + DEBUG_FINI diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-18_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-18_y.c index b69425a5f4e..8c732d58273 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-by-value-18_y.c +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-18_y.c @@ -27,7 +27,4 @@ TEST(Scld9, _Complex long double) TEST(Scld10, _Complex long double) TEST(Scld11, _Complex long double) TEST(Scld12, _Complex long double) -TEST(Scld13, _Complex long double) -TEST(Scld14, _Complex long double) -TEST(Scld15, _Complex long double) -TEST(Scld16, _Complex long double) + diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_main.c new file mode 100644 index 00000000000..5b9dfd983b4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_main.c @@ -0,0 +1,14 @@ +/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are of type
+ _Complex long double. */
+
+extern void struct_by_value_18_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_18a_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_x.c new file mode 100644 index 00000000000..72f5bbf5d44 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_x.c @@ -0,0 +1,37 @@ +#include "compat-common.h"
+
+#include "fp-struct-defs.h"
+#include "fp-struct-check.h"
+#include "fp-struct-test-by-value-x.h"
+
+DEFS(cld, _Complex long double)
+CHECKS(cld, _Complex long double)
+
+
+TEST(Scld13, _Complex long double)
+TEST(Scld14, _Complex long double)
+TEST(Scld15, _Complex long double)
+TEST(Scld16, _Complex long double)
+
+#undef T
+
+void
+struct_by_value_18a_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+
+T(Scld13, _Complex long double)
+T(Scld14, _Complex long double)
+T(Scld15, _Complex long double)
+T(Scld16, _Complex long double)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_y.c new file mode 100644 index 00000000000..545dcf8970f --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-18a_y.c @@ -0,0 +1,22 @@ +#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "fp-struct-defs.h"
+#include "fp-struct-init.h"
+#include "fp-struct-test-by-value-y.h"
+
+DEFS(cld,_Complex long double)
+INITS(cld, _Complex long double)
+
+
+TEST(Scld13, _Complex long double)
+TEST(Scld14, _Complex long double)
+TEST(Scld15, _Complex long double)
+TEST(Scld16, _Complex long double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp b/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp index 5de2c1e2618..992b62cdc09 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp @@ -98,7 +98,7 @@ if [info exists env(GCC_EXEC_PREFIX)] { set orig_gcc_exec_prefix_saved 1 unsetenv GCC_EXEC_PREFIX } -set status [remote_exec host "$HOSTCC $HOSTCFLAGS $generator_cmd"] +set status [remote_exec build "$HOSTCC $HOSTCFLAGS $generator_cmd"] set status [lindex $status 0] if { $orig_gcc_exec_prefix_saved } { set orig_gcc_exec_prefix_saved 0 diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c index c53c3e8c2bd..f6a217e6f56 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c @@ -186,30 +186,42 @@ struct types vector_types[] = { /* vector-defs.h typedefs */ { "v8qi", TYPE_OTHER, 0, 0 }, { "v16qi", TYPE_OTHER, 0, 0 }, +{ "v32qi", TYPE_OTHER, 0, 0 }, { "v2hi", TYPE_OTHER, 0, 0 }, { "v4hi", TYPE_OTHER, 0, 0 }, { "v8hi", TYPE_OTHER, 0, 0 }, +{ "v16hi", TYPE_OTHER, 0, 0 }, { "v2si", TYPE_OTHER, 0, 0 }, { "v4si", TYPE_OTHER, 0, 0 }, +{ "v8si", TYPE_OTHER, 0, 0 }, { "v1di", TYPE_OTHER, 0, 0 }, { "v2di", TYPE_OTHER, 0, 0 }, +{ "v4di", TYPE_OTHER, 0, 0 }, { "v2sf", TYPE_OTHER, 0, 0 }, { "v4sf", TYPE_OTHER, 0, 0 }, +{ "v8sf", TYPE_OTHER, 0, 0 }, { "v16sf", TYPE_OTHER, 0, 0 }, { "v2df", TYPE_OTHER, 0, 0 }, +{ "v4df", TYPE_OTHER, 0, 0 }, { "u8qi", TYPE_OTHER, 0, 0 }, { "u16qi", TYPE_OTHER, 0, 0 }, +{ "u32qi", TYPE_OTHER, 0, 0 }, { "u2hi", TYPE_OTHER, 0, 0 }, { "u4hi", TYPE_OTHER, 0, 0 }, { "u8hi", TYPE_OTHER, 0, 0 }, +{ "u16hi", TYPE_OTHER, 0, 0 }, { "u2si", TYPE_OTHER, 0, 0 }, { "u4si", TYPE_OTHER, 0, 0 }, +{ "u8si", TYPE_OTHER, 0, 0 }, { "u1di", TYPE_OTHER, 0, 0 }, { "u2di", TYPE_OTHER, 0, 0 }, +{ "u4di", TYPE_OTHER, 0, 0 }, { "u2sf", TYPE_OTHER, 0, 0 }, { "u4sf", TYPE_OTHER, 0, 0 }, +{ "u8sf", TYPE_OTHER, 0, 0 }, { "u16sf", TYPE_OTHER, 0, 0 }, { "u2df", TYPE_OTHER, 0, 0 }, +{ "u4df", TYPE_OTHER, 0, 0 }, { "__m64", TYPE_OTHER, 0, 0 }, { "__m128", TYPE_OTHER, 0, 0 } #define NVTYPES2 (sizeof (vector_types) / sizeof (vector_types[0])) diff --git a/gcc/testsuite/gcc.dg/compat/union-m128-1_main.c b/gcc/testsuite/gcc.dg/compat/union-m128-1_main.c index 69dd34dce57..11f872154eb 100644 --- a/gcc/testsuite/gcc.dg/compat/union-m128-1_main.c +++ b/gcc/testsuite/gcc.dg/compat/union-m128-1_main.c @@ -1,6 +1,8 @@ +/* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */ /* { dg-options "-O" } */ -#ifdef __x86_64__ +#include "cpuid.h" + /* Test function argument passing. PR target/15301. */ extern void union_m128_1_x (void); @@ -9,13 +11,14 @@ extern void exit (int); int main () { - union_m128_1_x (); + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + /* Run SSE vector test only if host has SSE2 support. */ + if (edx & bit_SSE2) + union_m128_1_x (); + exit (0); } -#else -int -main () -{ - return 0; -} -#endif diff --git a/gcc/testsuite/gcc.dg/compat/union-m128-1_x.c b/gcc/testsuite/gcc.dg/compat/union-m128-1_x.c index 06a4ef5ffdb..1f92303d95b 100644 --- a/gcc/testsuite/gcc.dg/compat/union-m128-1_x.c +++ b/gcc/testsuite/gcc.dg/compat/union-m128-1_x.c @@ -1,6 +1,5 @@ -/* { dg-options "-O" } */ +/* { dg-options "-O -msse2" } */ -#ifdef __x86_64__ #include "union-m128-1.h" SS_union_mi128 un; @@ -23,7 +22,3 @@ union_m128_1_x () foo(un); foo(st); } -#else -int dummy_x; -#endif - diff --git a/gcc/testsuite/gcc.dg/compat/union-m128-1_y.c b/gcc/testsuite/gcc.dg/compat/union-m128-1_y.c index 2b6eb0a6ee8..be9d6e8f3d5 100644 --- a/gcc/testsuite/gcc.dg/compat/union-m128-1_y.c +++ b/gcc/testsuite/gcc.dg/compat/union-m128-1_y.c @@ -1,6 +1,5 @@ -/* { dg-options "-O" } */ +/* { dg-options "-O -msse2" } */ -#ifdef __x86_64__ #include <stdlib.h> #include "union-m128-1.h" @@ -26,7 +25,3 @@ foo (SS_struct_mi128 st) || x.u [1] != 0xfedcba9876543210LL) abort (); } -#else -int dummy_y; -#endif - diff --git a/gcc/testsuite/gcc.dg/compat/vector-1_x.c b/gcc/testsuite/gcc.dg/compat/vector-1_x.c index 11995b496e5..ab4f88bf48b 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1_x.c @@ -8,13 +8,17 @@ SETUP (8, qi); SETUP (16, qi); +SETUP (32, qi); SETUP (2, hi); SETUP (4, hi); SETUP (8, hi); +SETUP (16, hi); SETUP (2, si); SETUP (4, si); +SETUP (8, si); SETUP (1, di); SETUP (2, di); +SETUP (4, di); #endif @@ -26,13 +30,17 @@ vector_1_x (void) CHECK (8, qi); CHECK (16, qi); + CHECK (32, qi); CHECK (2, hi); CHECK (4, hi); CHECK (8, hi); + CHECK (16, hi); CHECK (2, si); CHECK (4, si); + CHECK (8, si); CHECK (1, di); CHECK (2, di); + CHECK (4, di); DEBUG_FINI diff --git a/gcc/testsuite/gcc.dg/compat/vector-1_y.c b/gcc/testsuite/gcc.dg/compat/vector-1_y.c index 1cec61734b4..5a09c0eadb6 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1_y.c @@ -8,12 +8,16 @@ TEST (8, qi, 101) TEST (16, qi, 101) +TEST (32, qi, 90) TEST (2, hi, 201) TEST (4, hi, 202) TEST (8, hi, 203) +TEST (16, hi, 203) TEST (2, si, 301) TEST (4, si, 302) +TEST (8, si, 303) TEST (1, di, 401) TEST (2, di, 402) +TEST (4, di, 403) #endif diff --git a/gcc/testsuite/gcc.dg/compat/vector-1a_main.c b/gcc/testsuite/gcc.dg/compat/vector-1a_main.c new file mode 100644 index 00000000000..76fb2915e1d --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-1a_main.c @@ -0,0 +1,26 @@ +/* { dg-skip-if "test SSE2 vector" { ! { i?86-*-* x86_64-*-* } } } */ + +/* Test compatibility of vector types: layout between separately-compiled + modules, parameter passing, and function return. This test uses + vectors of integer values. */ + +#include "cpuid.h" + +extern void vector_1_x (void); +extern void exit (int); +int fails; + +int +main () +{ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + /* Run SSE vector test only if host has SSE2 support. */ + if (edx & bit_SSE2) + vector_1_x (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/compat/vector-1a_x.c b/gcc/testsuite/gcc.dg/compat/vector-1a_x.c new file mode 100644 index 00000000000..aa0fa7f208c --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-1a_x.c @@ -0,0 +1,3 @@ +/* { dg-options "-w -mno-mmx -msse2" } */ + +#include "vector-1_x.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-1a_y.c b/gcc/testsuite/gcc.dg/compat/vector-1a_y.c new file mode 100644 index 00000000000..2c88e198845 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-1a_y.c @@ -0,0 +1,3 @@ +/* { dg-options "-w -mno-mmx -msse2" } */ + +#include "vector-1_y.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-2_x.c b/gcc/testsuite/gcc.dg/compat/vector-2_x.c index de5f29c2688..d08c77fe3a0 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2_x.c @@ -10,7 +10,9 @@ SETUP (2, sf); SETUP (4, sf); SETUP (16, sf); +SETUP (8, sf); SETUP (2, df); +SETUP (4, df); #endif @@ -22,7 +24,9 @@ vector_2_x (void) CHECK (2, sf); CHECK (4, sf); + CHECK (8, sf); CHECK (16, sf); + CHECK (4, df); CHECK (2, df); DEBUG_FINI diff --git a/gcc/testsuite/gcc.dg/compat/vector-2_y.c b/gcc/testsuite/gcc.dg/compat/vector-2_y.c index 10d7a064532..fd5830c35b3 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2_y.c @@ -9,7 +9,9 @@ TEST (2, sf, 301.0) TEST (4, sf, 302.0) +TEST (8, sf, 303.0) TEST (16, sf, 304.0) TEST (2, df, 402.0) +TEST (4, df, 402.0) #endif diff --git a/gcc/testsuite/gcc.dg/compat/vector-2a_main.c b/gcc/testsuite/gcc.dg/compat/vector-2a_main.c new file mode 100644 index 00000000000..96c1111fddc --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-2a_main.c @@ -0,0 +1,26 @@ +/* { dg-skip-if "test SSE2 support" { ! { i?86-*-* x86_64-*-* } } } */ + +/* Test compatibility of vector types: layout between separately-compiled + modules, parameter passing, and function return. This test uses + vectors of floating points values. */ + +#include "cpuid.h" + +extern void vector_2_x (void); +extern void exit (int); +int fails; + +int +main () +{ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + /* Run SSE vector test only if host has SSE2 support. */ + if (edx & bit_SSE2) + vector_2_x (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/compat/vector-2a_x.c b/gcc/testsuite/gcc.dg/compat/vector-2a_x.c new file mode 100644 index 00000000000..fcfacec04e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-2a_x.c @@ -0,0 +1,3 @@ +/* { dg-options "-w -mno-mmx -msse2" } */ + +#include "vector-2_x.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-2a_y.c b/gcc/testsuite/gcc.dg/compat/vector-2a_y.c new file mode 100644 index 00000000000..3797acb6a57 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/vector-2a_y.c @@ -0,0 +1,3 @@ +/* { dg-options "-w -mno-mmx -msse2" } */ + +#include "vector-2_y.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-defs.h b/gcc/testsuite/gcc.dg/compat/vector-defs.h index 7574e28c53d..f2f050527ec 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-defs.h +++ b/gcc/testsuite/gcc.dg/compat/vector-defs.h @@ -56,6 +56,20 @@ typedef float __attribute__((mode(V2DF))) v2df; #endif +typedef qi __attribute__((vector_size (32))) v32qi; +typedef hi __attribute__((vector_size (32))) v16hi; +typedef si __attribute__((vector_size (32))) v8si; +typedef di __attribute__((vector_size (32))) v4di; +typedef sf __attribute__((vector_size (32))) v8sf; +typedef df __attribute__((vector_size (32))) v4df; + +typedef union U32QI { v32qi v; qi a[32]; } u32qi; +typedef union U16HI { v16hi v; hi a[16]; } u16hi; +typedef union U8SI { v8si v; si a[8]; } u8si; +typedef union U4DI { v4di v; di a[4]; } u4di; +typedef union U8SF { v8sf v; sf a[8]; } u8sf; +typedef union U4DF { v4df v; df a[4]; } u4df; + typedef union U8QI { v8qi v; qi a[8]; } u8qi; typedef union U16QI { v16qi v; qi a[16]; } u16qi; diff --git a/gcc/testsuite/gcc.dg/const-float128-ped.c b/gcc/testsuite/gcc.dg/const-float128-ped.c index 86a630cf951..6a6b6223ce2 100644 --- a/gcc/testsuite/gcc.dg/const-float128-ped.c +++ b/gcc/testsuite/gcc.dg/const-float128-ped.c @@ -1,5 +1,5 @@ /* Test 'q' suffix with -pedantic on __float128 type constants. */ -/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } } */ /* { dg-options "-pedantic" } */ __float128 a = 123.456789q; /* { dg-warning "non-standard suffix on floating constant" } */ diff --git a/gcc/testsuite/gcc.dg/const-float128.c b/gcc/testsuite/gcc.dg/const-float128.c index 146e0c9c986..116e4597b44 100644 --- a/gcc/testsuite/gcc.dg/const-float128.c +++ b/gcc/testsuite/gcc.dg/const-float128.c @@ -1,5 +1,5 @@ /* Test 'q' and 'Q' suffixes on __float128 type constants. */ -/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-* } && lp64 } } } } */ +/* { dg-do compile { target ia64-*-* i?86-*-* x86_64-*-* } } */ /* { dg-options "" } */ __float128 a = 123.456789q; diff --git a/gcc/testsuite/gcc.dg/const-float80-ped.c b/gcc/testsuite/gcc.dg/const-float80-ped.c index 9cf047804a4..d1cf316dcad 100644 --- a/gcc/testsuite/gcc.dg/const-float80-ped.c +++ b/gcc/testsuite/gcc.dg/const-float80-ped.c @@ -1,6 +1,5 @@ /* Test 'w' suffix with -pedantic on __float80 type constants. */ /* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */ /* { dg-options "-pedantic" } */ -/* { dg-options "-mmmx -pedantic" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ __float80 a = 123.456789w; /* { dg-warning "non-standard suffix on floating constant" } */ diff --git a/gcc/testsuite/gcc.dg/const-float80.c b/gcc/testsuite/gcc.dg/const-float80.c index f2a836d3e64..8ec771f8f9c 100644 --- a/gcc/testsuite/gcc.dg/const-float80.c +++ b/gcc/testsuite/gcc.dg/const-float80.c @@ -1,7 +1,6 @@ /* Test 'w' and 'W' suffixes on __float80 type constants. */ /* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */ /* { dg-options "" } */ -/* { dg-options "-mmmx" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ __float80 a = 123.456789W; __float80 b = 123.456789w; diff --git a/gcc/testsuite/gcc.dg/cpp/20000519-1.c b/gcc/testsuite/gcc.dg/cpp/20000519-1.c index 82ab3a26861..7cd7daa3ad2 100644 --- a/gcc/testsuite/gcc.dg/cpp/20000519-1.c +++ b/gcc/testsuite/gcc.dg/cpp/20000519-1.c @@ -1,6 +1,7 @@ /* Regression test for preprocessor crash. Reported by Mathias Froehlich <frohlich@na.uni-tuebingen.de>. */ /* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ #define foo #define __CAT__(a,b,c,d) a##b##c##d diff --git a/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c index d304a744155..3591f9c08ae 100644 --- a/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c +++ b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c @@ -1,6 +1,7 @@ /* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ /* This tests that we avoid accidental pasting only before and after macros and arguments, and not when the tokens are already pasted diff --git a/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c b/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c index 42b549c8d6c..dc5bbc7f270 100644 --- a/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c +++ b/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c @@ -1,6 +1,7 @@ /* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ /* This tests that we avoid accidental pasting, as well as gratuitous space insertion, in various nasty places _inside_ a macro's diff --git a/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c b/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c new file mode 100644 index 00000000000..e90f8e6cb69 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c89 -pedantic" } */ + +#define f(a,b) f2(a,,b) +#define f2(a,b,c) a; b; c; +#define f3(a) a + +#define g() p() + +void p(void) {} + + +void foo(void) +{ + f(p(),p()); /* { dg-warning "macro f2 argument 2: empty macro arguments are undefined" } */ + f2(p(),,p()); /* { dg-warning "macro f2 argument 2: empty macro arguments are undefined" } */ + f3(); /* { dg-warning "macro f3 argument 1: empty macro arguments are undefined" } */ + g(); +} diff --git a/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c b/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c new file mode 100644 index 00000000000..e1e0c61ec29 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic" } */ + +#define f(a,b) f2(a,,b) +#define f2(a,b,c) a; b; c; +#define f3(a) a + +#define g() p() + +void p(void) {} + + +void foo(void) +{ + f(p(),p()); + f2(p(),,p()); + f3(); + g(); +} diff --git a/gcc/testsuite/gcc.dg/lower-subreg-1.c b/gcc/testsuite/gcc.dg/lower-subreg-1.c index 01851268c11..bb35d21bb50 100644 --- a/gcc/testsuite/gcc.dg/lower-subreg-1.c +++ b/gcc/testsuite/gcc.dg/lower-subreg-1.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { { ! mips64 } && { ! ia64-*-* } } } } */ +/* { dg-do compile { target { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } } } */ /* { dg-options "-O -fdump-rtl-subreg" } */ /* { dg-require-effective-target ilp32 } */ diff --git a/gcc/testsuite/gcc.dg/nrv3.c b/gcc/testsuite/gcc.dg/nrv3.c index 2b582c3ebe8..c28b8ec570d 100644 --- a/gcc/testsuite/gcc.dg/nrv3.c +++ b/gcc/testsuite/gcc.dg/nrv3.c @@ -3,7 +3,12 @@ /* { dg-do compile } */ /* { dg-options "-O -fdump-tree-optimized" } */ +#ifdef __SPU__ +/* SPU returns aggregates up to 1172 bytes in registers. */ +typedef struct { int x[300]; void *y; } S; +#else typedef struct { int x[20]; void *y; } S; +#endif typedef struct { int a; S b; } T; S nrv_candidate (void); void use_result (S, int); diff --git a/gcc/testsuite/gcc.dg/pr27095.c b/gcc/testsuite/gcc.dg/pr27095.c index 5ec39687a06..d274f4e8445 100644 --- a/gcc/testsuite/gcc.dg/pr27095.c +++ b/gcc/testsuite/gcc.dg/pr27095.c @@ -11,7 +11,7 @@ main (int argc, char **argv) memset (x, argc, strlen (x)); return 0; } -/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen" { target { ! { powerpc*-*-darwin* hppa*-*-hpux* ia64-*-hpux* alpha*-*-* } } } } } */ +/* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen" { target { ! { powerpc*-*-darwin* hppa*-*-hpux* ia64-*-hpux* alpha*-*-* spu-*-* } } } } } */ /* hppa*-*-hpux* has an IMPORT statement for strlen (plus the branch). */ /* *-*-darwin* has something similar. */ /* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen" { target hppa*-*-hpux* } } } */ @@ -20,3 +20,5 @@ main (int argc, char **argv) /* { dg-final { scan-assembler-not "(?n)strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen\(.*\n\)+.*strlen" { target ia64-*-hpux* } } } */ /* alpha-*-* has a GOT load and the call. */ /* { dg-final { scan-assembler-not "(?n)jsr .*,strlen\(.*\n\)+.*jsr .*,strlen" { target alpha*-*-* } } } */ +/* spu-*-* has a branch hint and the call. */ +/* { dg-final { scan-assembler-not "(?n)brsl.*,strlen\(.*\n\)+.*brsl.*,strlen" { target spu-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/pr28243.c b/gcc/testsuite/gcc.dg/pr28243.c index c2797c0fb3f..12447a1c3d3 100644 --- a/gcc/testsuite/gcc.dg/pr28243.c +++ b/gcc/testsuite/gcc.dg/pr28243.c @@ -4,6 +4,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target fpic } */ /* { dg-options "-O2 -ftracer -fPIC" } */ +/* { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } */ struct displayfuncs { void (*init) (); diff --git a/gcc/testsuite/gcc.dg/pr35736.c b/gcc/testsuite/gcc.dg/pr35736.c new file mode 100644 index 00000000000..f411bb8a92f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr35736.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O -Wall" } */ + +void foo() +{ + while (1) + for (;;({ continue; })) + ; +} diff --git a/gcc/testsuite/gcc.dg/pr36227.c b/gcc/testsuite/gcc.dg/pr36227.c index d6657632b91..27fe0015505 100644 --- a/gcc/testsuite/gcc.dg/pr36227.c +++ b/gcc/testsuite/gcc.dg/pr36227.c @@ -1,12 +1,22 @@ /* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-overflow=3" } */ +#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__) +typedef unsigned long long ptrcast; +#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__) +typedef unsigned long ptrcast; +#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__) +typedef unsigned int ptrcast; +#else +#error Add target support here +#endif volatile unsigned long * sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end) { - if ((unsigned long)ptr + i * sizeof(*ptr) > (unsigned long)ptr) /* { dg-bogus "pointer wraparound" } */ + if ((ptrcast)ptr + i * sizeof(*ptr) > (ptrcast)ptr) /* { dg-bogus "pointer wraparound" } */ return ptr + i; else return end; } + diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c index 24decb86fdf..a4b73e9cf5d 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128.c @@ -1,6 +1,6 @@ /* Test floating-point conversions. __float128 type. */ /* Origin: Joseph Myers <joseph@codesourcery.com> */ -/* { dg-do run { target { ia64-*-* || { { i?86-*-* x86_64-*-*} && lp64 } } } } */ +/* { dg-do run { target ia64-*-* i?86-*-* x86_64-*-* } } */ /* { dg-options "" } */ #include "fp-int-convert.h" diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c index e2b587c0cba..3e25f904dbe 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float80.c @@ -2,7 +2,6 @@ /* Origin: Joseph Myers <joseph@codesourcery.com> */ /* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */ /* { dg-options "" } */ -/* { dg-options "-mmmx" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ #include "fp-int-convert.h" diff --git a/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c b/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c new file mode 100644 index 00000000000..c5adb259d26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/ipa-pta-1.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-fipa-pta -fdump-ipa-pta" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +struct X { char x; char y; }; + +void bar (char *p); + +void test1 (char a, char b, char c, char d, char e, char f, char g, char h) +{ + char *p = &a; + p++; + bar (p); +} + +void test2 (struct X a, char b, char c, char d, char e, char f, char g, char h) +{ + char *p = &a.x; + p++; + bar (p); +} + +void test3 (struct X a, char b, char c, char d, char e, char f, char g, char h) +{ + char *p = &a.y; + bar (p); +} + +void test4 (int a, char b, char c, char d, char e, char f, char g, char h) +{ + char *p = (char *)&a; + p++; + p++; + p++; + p++; + bar (p); +} + +/* { dg-final { scan-ipa-dump "bar.arg0 = { test4.arg0 test3.arg0 test2.arg0 test1.arg0 }" "pta" } } */ +/* { dg-final { cleanup-ipa-dump "pta" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr25947-1.c b/gcc/testsuite/gcc.dg/torture/pr25947-1.c index d52ef8c8e3f..8af6f8d4624 100644 --- a/gcc/testsuite/gcc.dg/torture/pr25947-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr25947-1.c @@ -1,5 +1,6 @@ /* PR target/25947: define_split in cris.md caused unrecognized insn. */ /* { dg-options "-fpic" { target fpic } } */ +/* { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "-O0" } { "" } } */ extern char *rl_line_buffer; extern int rl_point; diff --git a/gcc/testsuite/gcc.dg/torture/pr35842.c b/gcc/testsuite/gcc.dg/torture/pr35842.c index 05b26d84c11..05b26d84c11 100755..100644 --- a/gcc/testsuite/gcc.dg/torture/pr35842.c +++ b/gcc/testsuite/gcc.dg/torture/pr35842.c diff --git a/gcc/testsuite/gcc.dg/torture/pr36373-10.c b/gcc/testsuite/gcc.dg/torture/pr36373-10.c index b84e2544152..ed701772828 100644 --- a/gcc/testsuite/gcc.dg/torture/pr36373-10.c +++ b/gcc/testsuite/gcc.dg/torture/pr36373-10.c @@ -1,6 +1,14 @@ /* { dg-do run } */ +#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__) +typedef unsigned long long uintptr_t; +#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__) typedef unsigned long uintptr_t; +#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__) +typedef unsigned int uintptr_t; +#else +#error Add target support here +#endif void __attribute__((noinline)) foo(uintptr_t l) diff --git a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c new file mode 100644 index 00000000000..2a8dc9e3037 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-1.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-fdump-tree-alias" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +struct Foo { + int *p; +}; + +void __attribute__((noinline)) +foo (void *p) +{ + struct Foo *f = (struct Foo *)p - 1; + *f->p = 0; +} + +int bar (void) +{ + struct Foo f; + int i = 1; + f.p = &i; + foo (&f + 1); + return i; +} +extern void abort (void); +int main() +{ + if (bar () != 0) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "ESCAPED = { ESCAPED NONLOCAL f .* i }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c new file mode 100644 index 00000000000..fb5b2e15ede --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pta-ptrarith-2.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-fdump-tree-alias" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +struct Foo { + int **p; + int **q; +}; + +int __attribute__((noinline)) +bar (void) +{ + struct Foo f; + int j, i = 1; + char *p; + int *x = &i; + int *y = &j; + f.p = &y; + f.q = &x; + p = (char *)&f; + for (j = 0; j < sizeof (int *); ++j) + p++; + return ***(int ***)p; +} +extern void abort (void); +int main() +{ + if (bar () != 1) + abort (); + return 0; +} + +/* In theory = { i } is the correct solution. But it's not easy to scan + for that reliably, so just use what we create now. */ +/* { dg-final { scan-tree-dump "= { i j }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c index 28cdfd23181..d7aea1b8430 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c @@ -33,5 +33,5 @@ void test55 (int x, int y) that the && should be emitted (based on BRANCH_COST). Fix this by teaching dom to look through && and register all components as true. */ -/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "powerpc*-*-* cris-*-* crisv32-*-* mmix-*-* mips*-*-*" } } } } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "powerpc*-*-* cris-*-* crisv32-*-* mmix-*-* mips*-*-* m68k*-*-*" } } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c new file mode 100644 index 00000000000..c2b512a12e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-callused.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 --param max-fields-for-field-sensitive=2 -fdump-tree-alias" } */ + +struct Foo { + int *p, *q; +}; + +int foo (int ***x) __attribute__((pure)); + +int bar (int b) +{ + int i; + struct Foo f; + int *p, **q; + p = &i; + f.p = &i; + f.q = f.p; + if (b) + q = &f.p; + else + q = &f.q; + return foo (&q); +} + +/* { dg-final { scan-tree-dump "CALLUSED = { f.* i q }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c index 3b7a547a6e7..85e444886d0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c @@ -5,7 +5,7 @@ When the condition is true, we distribute "(int) (a + b)" as "(int) a + (int) b", otherwise we keep the original. */ -/* { dg-do compile { target { ! mips64 } } } */ +/* { dg-do compile { target { { ! mips64 } && { ! spu-*-* } } } } */ /* { dg-options "-O -fwrapv -fdump-tree-fre-details" } */ /* From PR14844. */ diff --git a/gcc/testsuite/gcc.target/arm/neon/polytypes.c b/gcc/testsuite/gcc.target/arm/neon/polytypes.c index 9aca6671ae0..12e9b0a7f6a 100644 --- a/gcc/testsuite/gcc.target/arm/neon/polytypes.c +++ b/gcc/testsuite/gcc.target/arm/neon/polytypes.c @@ -28,7 +28,8 @@ void foo () poly8x16_t v128_8; poly16x8_t v128_16; - s64_8 (v64_8); /* { dg-error "use -flax-vector-conversions.*incompatible type for argument 1 of 's64_8'" } */ + s64_8 (v64_8); /* { dg-message "use -flax-vector-conversions" } */ + /* { dg-error "incompatible type for argument 1 of 's64_8'" "" { target *-*-* } 31 } */ u64_8 (v64_8); /* { dg-error "incompatible type for argument 1 of 'u64_8'" } */ p64_8 (v64_8); diff --git a/gcc/testsuite/gcc.target/i386/float128-1.c b/gcc/testsuite/gcc.target/i386/float128-1.c new file mode 100644 index 00000000000..9c6d22745f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/float128-1.c @@ -0,0 +1,24 @@ +/* { dg-do run { target *-*-linux* } } */ +/* { dg-options "-O2 -msse2" } */ + +#include "sse2-check.h" + +extern void abort (void); + +typedef _Complex float __attribute__((mode(TC))) _Complex128; + +_Complex128 __attribute__ ((noinline)) +foo (_Complex128 x, _Complex128 y) +{ + return x * y; +} + +static void +sse2_test (void) +{ + _Complex128 a = 1.3q + 3.4qi, b = 5.6q + 7.8qi, c; + + c = foo (a, b); + if (__real__(c) == 0.0q || __imag__ (c) == 0.0q) + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/float128-2.c b/gcc/testsuite/gcc.target/i386/float128-2.c new file mode 100644 index 00000000000..94408d2ef35 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/float128-2.c @@ -0,0 +1,17 @@ +/* PR target/36710 */ + +/* { dg-do run { target *-*-linux* *-*-darwin* } } */ +/* { dg-options "-Os -msse2" } */ + +#include "sse2-check.h" + +extern void abort (void); + +static void +sse2_test (void) +{ + static volatile __float128 a = 123.0q; + + if ((int) a != 123) + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/pr32191.c b/gcc/testsuite/gcc.target/i386/pr32191.c index 0da5d5c5aae..f5238b01dee 100644 --- a/gcc/testsuite/gcc.target/i386/pr32191.c +++ b/gcc/testsuite/gcc.target/i386/pr32191.c @@ -1,5 +1,4 @@ /* { dg-do compile } */ -/* { dg-require-effective-target lp64 } */ /* { dg-options "-std=c99" } */ typedef _Complex float __attribute__((mode(TC))) _Complex128; diff --git a/gcc/testsuite/gcc.target/i386/pr32268.c b/gcc/testsuite/gcc.target/i386/pr32268.c index 472259c1eba..a5d673ad94f 100644 --- a/gcc/testsuite/gcc.target/i386/pr32268.c +++ b/gcc/testsuite/gcc.target/i386/pr32268.c @@ -1,5 +1,4 @@ /* { dg-do run { target *-*-linux* } } */ -/* { dg-require-effective-target lp64 } */ /* { dg-options "-O2" } */ extern void abort(void); diff --git a/gcc/testsuite/gcc.target/m68k/interrupt-2.c b/gcc/testsuite/gcc.target/m68k/interrupt-2.c new file mode 100644 index 00000000000..7d4cb68c121 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/interrupt-2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +int x; +volatile unsigned int y; + +#define REPEAT10(X, Y) \ + X(Y##0); X(Y##1); X(Y##2); X(Y##3); X(Y##4); \ + X(Y##5); X(Y##6); X(Y##7); X(Y##8); X(Y##9) + +#define REPEAT30(X) REPEAT10 (X, 0); REPEAT10 (X, 1); REPEAT10 (X, 2) +#define IN(X) unsigned int x##X = y +#define OUT(X) y = x##X + +void __attribute__ ((interrupt_handler)) f1 (void) +{ + x = y + 11; +} + +void __attribute__ ((interrupt_handler)) f2 (void) +{ + REPEAT30 (IN); + REPEAT30 (OUT); +} diff --git a/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-1.c b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-1.c index 4c642258f7b..c12d08e0521 100644 --- a/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-1.c +++ b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-1.c @@ -1,15 +1,15 @@ /* { dg-do preprocess } */ /* { dg-mips-options "-mips2" } */ -#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) == defined (__mips16) +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 #error nonono #endif -#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) == defined (__mips16) +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 #error nonono #endif -#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) == defined (__mips16) +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 #error nonono #endif diff --git a/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-2.c b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-2.c index 4265e4167ba..eaae7801754 100644 --- a/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-2.c +++ b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-2.c @@ -1,19 +1,19 @@ /* { dg-do preprocess } */ /* { dg-mips-options "-mgp64" } */ -#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) == defined (__mips16) +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 #error nonono #endif -#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) == defined (__mips16) +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 #error nonono #endif -#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) == defined (__mips16) +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 #error nonono #endif -#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) == defined (__mips16) +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 #error nonono #endif diff --git a/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-3.c b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-3.c new file mode 100644 index 00000000000..faf50fc69ca --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-3.c @@ -0,0 +1,23 @@ +/* { dg-do preprocess { target mips16_attribute } } */ +/* { dg-mips-options "-mips2 -mips16" } */ +/* { dg-add-options mips16_attribute } */ + +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 +#error nonono +#endif + +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 +#error nonono +#endif + +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#error nonono +#endif + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +#error nonono +#endif + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +#error nonono +#endif diff --git a/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-4.c b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-4.c new file mode 100644 index 00000000000..b53f4b05b61 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/gcc-have-sync-compare-and-swap-4.c @@ -0,0 +1,23 @@ +/* { dg-do preprocess { target mips16_attribute } } */ +/* { dg-mips-options "-mgp64 -mips16" } */ +/* { dg-add-options mips16_attribute } */ + +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 +#error nonono +#endif + +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 +#error nonono +#endif + +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#error nonono +#endif + +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +#error nonono +#endif + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +#error nonono +#endif diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_3.f90 b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_3.f90 index 525af506428..3b28f52b4e7 100644 --- a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_3.f90 +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_3.f90 @@ -14,11 +14,11 @@ program test type(c_funptr) :: cfunptr integer(4), pointer :: fptr integer(4), pointer :: fptr_array(:) -! procedure(integer(4)), pointer :: fprocptr ! TODO + procedure(integer(4)), pointer :: fprocptr call c_f_pointer(cptr, fptr) call c_f_pointer(cptr, fptr_array, [ 1 ]) -! call c_f_procpointer(cfunptr, fprocptr) ! TODO + call c_f_procpointer(cfunptr, fprocptr) end program test ! Make sure there is only a single function call: @@ -30,6 +30,6 @@ end program test ! { dg-final { scan-tree-dump-times " fptr = .integer.kind=4. .. cptr" 1 "original" } } ! ! Check c_f_procpointer -! TODO { scan-tree-dump-times " fprocptr = .integer.kind=4. .\\*<.*>. .void.. cfunptr;" 1 "original" } } TODO +! { dg-final { scan-tree-dump-times " fprocptr = .integer.kind=4. .\\*<.*>. .void.. cfunptr;" 1 "original" } } ! ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/pr36726.f90 b/gcc/testsuite/gfortran.dg/gomp/pr36726.f90 new file mode 100644 index 00000000000..99e170ad798 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr36726.f90 @@ -0,0 +1,20 @@ +! PR middle-end/36726 +! { dg-do compile } +! { dg-options "-fopenmp" } + +subroutine foo + integer, allocatable :: vs(:) + !$omp parallel private (vs) + allocate (vs(10)) + vs = 2 + deallocate (vs) + !$omp end parallel +end subroutine foo +subroutine bar + integer, allocatable :: vs(:) + !$omp parallel private (vs) + allocate (vs(10)) + vs = 2 + deallocate (vs) + !$omp end parallel +end subroutine bar diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 new file mode 100644 index 00000000000..429b28c3016 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 2: is 2, should be 3" } +program main + real, dimension(3,2) :: a + real, dimension(2,3) :: b + real, dimension(:,:), allocatable :: ret + allocate (ret(2,2)) + a = 1.0 + b = 2.3 + ret = matmul(b,a) ! This is OK + deallocate(ret) + allocate(ret(3,2)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 2: is 2, should be 3" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 new file mode 100644 index 00000000000..c5830ded729 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 1: is 2, should be 3" } +program main + real, dimension(3,2) :: a + real, dimension(2,3) :: b + real, dimension(:,:), allocatable :: ret + allocate (ret(3,3)) + a = 1.0 + b = 2.3 + ret = matmul(a,b) ! This is OK + deallocate(ret) + allocate(ret(2,3)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic for dimension 1: is 2, should be 3" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 new file mode 100644 index 00000000000..a61bacc1d2b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } +program main + real, dimension(3) :: a + real, dimension(3,2) :: b + real, dimension(:), allocatable :: ret + allocate (ret(2)) + a = 1.0 + b = 2.3 + ret = matmul(a,b) ! This is OK + deallocate(ret) + allocate(ret(3)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 new file mode 100644 index 00000000000..4b20098f50f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } +program main + real, dimension(2,3) :: a + real, dimension(3) :: b + real, dimension(:), allocatable :: ret + allocate (ret(2)) + a = 1.0 + b = 2.3 + ret = matmul(a,b) ! This is OK + deallocate(ret) + allocate(ret(3)) + ret = matmul(a,b) ! This should throw an error. +end program main +! { dg-output "Fortran runtime error: Incorrect extent in return array in MATMUL intrinsic: is 3, should be 2" } diff --git a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 b/gcc/testsuite/gfortran.dg/proc_decl_1.f90 index c01f7c6101e..3e7a3d18fb7 100644 --- a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 +++ b/gcc/testsuite/gfortran.dg/proc_decl_1.f90 @@ -40,8 +40,6 @@ program prog procedure(dcos) :: my1 procedure(amax0) :: my2 ! { dg-error "not allowed in PROCEDURE statement" } - procedure(),pointer:: ptr ! { dg-error "not yet implemented" } - type t procedure(),pointer:: p ! { dg-error "not yet implemented" } end type diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_1.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_1.f90 new file mode 100644 index 00000000000..fe8e201000e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_1.f90 @@ -0,0 +1,73 @@ +! { dg-do run } +! +! basic tests of PROCEDURE POINTERS +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +module m +contains + subroutine proc1(arg) + character (5) :: arg + arg = "proc1" + end subroutine + integer function proc2(arg) + integer, intent(in) :: arg + proc2 = arg**2 + end function + complex function proc3(re, im) + real, intent(in) :: re, im + proc3 = complex (re, im) + end function +end module + +subroutine foo1 +end subroutine + +real function foo2() + foo2=6.3 +end function + +program procPtrTest + use m, only: proc1, proc2, proc3 + character (5) :: str + PROCEDURE(proc1), POINTER :: ptr1 + PROCEDURE(proc2), POINTER :: ptr2 + PROCEDURE(proc3), POINTER :: ptr3 => NULL() + PROCEDURE(REAL), SAVE, POINTER :: ptr4 + PROCEDURE(), POINTER :: ptr5,ptr6 + + EXTERNAL :: foo1,foo2 + real :: foo2 + + if(ASSOCIATED(ptr3)) call abort() + + NULLIFY(ptr1) + if (ASSOCIATED(ptr1)) call abort() + ptr1 => proc1 + if (.not. ASSOCIATED(ptr1)) call abort() + call ptr1 (str) + if (str .ne. "proc1") call abort () + + ptr2 => NULL() + if (ASSOCIATED(ptr2)) call abort() + ptr2 => proc2 + if (.not. ASSOCIATED(ptr2,proc2)) call abort() + if (10*ptr2 (10) .ne. 1000) call abort () + + ptr3 => NULL (ptr3) + if (ASSOCIATED(ptr3)) call abort() + ptr3 => proc3 + if (ptr3 (1.0, 2.0) .ne. (1.0, 2.0)) call abort () + + ptr4 => cos + if (ptr4(0.0)/=1.0) call abort() + + ptr5 => foo1 + call ptr5() + + ptr6 => foo2 + if (ptr6()/=6.3) call abort() + +end program + +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_2.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_2.f90 new file mode 100644 index 00000000000..d19b81d6e47 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_2.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! +! checking invalid code for PROCEDURE POINTERS +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +PROCEDURE(REAL), POINTER :: ptr +PROCEDURE(REAL), SAVE :: noptr ! { dg-error "attribute conflicts with" } + +ptr => cos(4.0) ! { dg-error "Invalid character" } + +ALLOCATE(ptr) ! { dg-error "must be ALLOCATABLE" } + +end diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_3.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_3.f90 new file mode 100644 index 00000000000..34d4f1625fb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_3.f90 @@ -0,0 +1,45 @@ +! { dg-do run } +! +! PROCEDURE POINTERS without the PROCEDURE statement +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +real function e1(x) + real :: x + print *,'e1!',x + e1 = x * 3.0 +end function + +subroutine e2(a,b) + real, intent(inout) :: a + real, intent(in) :: b + print *,'e2!',a,b + a = a + b +end subroutine + +program proc_ptr_3 + +real, external, pointer :: fp + +pointer :: sp +interface + subroutine sp(a,b) + real, intent(inout) :: a + real, intent(in) :: b + end subroutine sp +end interface + +external :: e1,e2 +real :: c = 1.2 + +fp => e1 + +if (abs(fp(2.5)-7.5)>0.01) call abort() + +sp => e2 + +call sp(c,3.4) + +if (abs(c-4.6)>0.01) call abort() + +end diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_4.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_4.f90 new file mode 100644 index 00000000000..60b9e73af82 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_4.f90 @@ -0,0 +1,57 @@ +! { dg-do compile } +! +! PROCEDURE POINTERS & pointer-valued functions +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +interface + integer function f1() + end function +end interface + +interface + function f2() + integer, pointer :: f2 + end function +end interface + +interface + function pp1() + integer :: pp1 + end function +end interface +pointer :: pp1 + +pointer :: pp2 +interface + function pp2() + integer :: pp2 + end function +end interface + +pointer :: pp3 +interface + function pp3() + integer, pointer :: pp3 + end function +end interface + +interface + function pp4() + integer, pointer :: pp4 + end function +end interface +pointer :: pp4 + + +pp1 => f1 + +pp2 => pp1 + +f2 => f1 ! { dg-error "is not a variable" } + +pp3 => f2 + +pp4 => pp3 + +end
\ No newline at end of file diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_5.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_5.f90 new file mode 100644 index 00000000000..61cf8a35d10 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_5.f90 @@ -0,0 +1,33 @@ +! { dg-do run } +! +! NULL() initialization for PROCEDURE POINTERS +! +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> + +program main +implicit none +call test(.true.) +call test(.false.) + +contains + +integer function hello() + hello = 42 +end function hello + +subroutine test(first) + logical :: first + integer :: i + procedure(integer), pointer :: x => null() + + if(first) then + if(associated(x)) call abort() + x => hello + else + if(.not. associated(x)) call abort() + i = x() + if(i /= 42) call abort() + end if + end subroutine test + +end program main diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_6.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_6.f90 new file mode 100644 index 00000000000..6a5c7e5f462 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_6.f90 @@ -0,0 +1,39 @@ +! { dg-do run } +! +! PROCEDURE POINTERS as actual/formal arguments +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +subroutine foo(j) + INTEGER, INTENT(OUT) :: j + j = 6 +end subroutine + +program proc_ptr_6 + +PROCEDURE(),POINTER :: ptr1 +PROCEDURE(REAL),POINTER :: ptr2 +EXTERNAL foo +INTEGER :: k = 0 + +ptr1 => foo +call s_in(ptr1,k) +if (k /= 6) call abort() + +call s_out(ptr2) +if (ptr2(-3.0) /= 3.0) call abort() + +contains + +subroutine s_in(p,i) + PROCEDURE(),POINTER,INTENT(IN) :: p + INTEGER, INTENT(OUT) :: i + call p(i) +end subroutine + +subroutine s_out(p) + PROCEDURE(REAL),POINTER,INTENT(OUT) :: p + p => abs +end subroutine + +end program diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_7.c b/gcc/testsuite/gfortran.dg/proc_ptr_7.c new file mode 100644 index 00000000000..7e9542fd86e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_7.c @@ -0,0 +1,10 @@ +/* Procedure pointer test. Used by proc_ptr_7.f90. + PR fortran/32580. */ + +int f(void) { + return 42; +} + +void assignf_(int(**ptr)(void)) { + *ptr = f; +} diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_7.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_7.f90 new file mode 100644 index 00000000000..8b1ea0a44b3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_7.f90 @@ -0,0 +1,47 @@ +! { dg-do run } +! { dg-additional-sources proc_ptr_7.c } +! +! PR fortran/32580 +! Procedure pointer test +! +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> + +program proc_pointer_test + use iso_c_binding, only: c_int + implicit none + + interface + subroutine assignF(f) + import c_int + procedure(Integer(c_int)), pointer :: f + end subroutine + end interface + + procedure(Integer(c_int)), pointer :: ptr + + call assignF(ptr) + if(ptr() /= 42) call abort() + + ptr => f55 + if(ptr() /= 55) call abort() + + call foo(ptr) + if(ptr() /= 65) call abort() + +contains + + subroutine foo(a) + procedure(integer(c_int)), pointer :: a + if(a() /= 55) call abort() + a => f65 + if(a() /= 65) call abort() + end subroutine foo + + integer(c_int) function f55() + f55 = 55 + end function f55 + + integer(c_int) function f65() + f65 = 65 + end function f65 +end program proc_pointer_test diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_8.c b/gcc/testsuite/gfortran.dg/proc_ptr_8.c new file mode 100644 index 00000000000..c732ff6667c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_8.c @@ -0,0 +1,14 @@ +/* Used by proc_ptr_8.f90. + PR fortran/32580. */ + +int (*funpointer)(int); + +int f(int t) +{ + return t*3; +} + +void init() +{ + funpointer=f; +} diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 new file mode 100644 index 00000000000..80d26619bc0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 @@ -0,0 +1,34 @@ +! { dg-do run } +! { dg-additional-sources proc_ptr_8.c } +! +! PR fortran/32580 +! Original test case +! +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> + +MODULE X + + USE ISO_C_BINDING + INTERFACE + INTEGER(KIND=C_INT) FUNCTION mytype( a ) BIND(C) + USE ISO_C_BINDING + INTEGER(KIND=C_INT), VALUE :: a + END FUNCTION + SUBROUTINE init() BIND(C,name="init") + END SUBROUTINE + END INTERFACE + + TYPE(C_FUNPTR), BIND(C,name="funpointer") :: funpointer + +END MODULE X + +USE X +PROCEDURE(mytype), POINTER :: ptype + +CALL init() +CALL C_F_PROCPOINTER(funpointer,ptype) +if (ptype(3) /= 9) call abort() + +END + +! { dg-final { cleanup-modules "X" } } diff --git a/gcc/testsuite/gfortran.dg/product_sum_bounds_1.f90 b/gcc/testsuite/gfortran.dg/product_sum_bounds_1.f90 new file mode 100644 index 00000000000..c6390896c17 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/product_sum_bounds_1.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +program main + real, dimension(4,3) :: a + real, dimension(2) :: b + a = 21. + b = product(a,dim=1) ! { dg-error "Different shape" } + b = sum(a,dim=2) ! { dg-error "Different shape" } +end program main diff --git a/gcc/testsuite/gnat.dg/loop_optimization3.adb b/gcc/testsuite/gnat.dg/loop_optimization3.adb new file mode 100644 index 00000000000..e69f535fb05 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization3.adb @@ -0,0 +1,15 @@ +-- { dg-do run } +-- { dg-options "-O" } + +with Loop_Optimization3_Pkg; use Loop_Optimization3_Pkg; + +procedure Loop_Optimization3 is + + type Arr is array (Integer range -3 .. 3) of Integer; + C : constant Arr := (1, others => F(2)); + +begin + if C /= (1, 2, 2, 2, 2, 2, 2) then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/loop_optimization3_pkg.adb b/gcc/testsuite/gnat.dg/loop_optimization3_pkg.adb new file mode 100644 index 00000000000..7a64815033d --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization3_pkg.adb @@ -0,0 +1,8 @@ +package body Loop_Optimization3_Pkg is + + function F (n : Integer) return Integer is + begin + return n; + end; + +end Loop_Optimization3_Pkg; diff --git a/gcc/testsuite/gnat.dg/loop_optimization3_pkg.ads b/gcc/testsuite/gnat.dg/loop_optimization3_pkg.ads new file mode 100644 index 00000000000..90f4fc32bad --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization3_pkg.ads @@ -0,0 +1,5 @@ +package Loop_Optimization3_Pkg is + + function F (n : Integer) return Integer; + +end Loop_Optimization3_Pkg; diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp index 474af620d16..ee7cff56fbe 100644 --- a/gcc/testsuite/lib/compat.exp +++ b/gcc/testsuite/lib/compat.exp @@ -156,6 +156,8 @@ proc compat-run { testname objlist dest optall optfile optstr } { proc compat-get-options-main { src } { # dg-options sets a variable called dg-extra-tool-flags. set dg-extra-tool-flags "" + # dg-options sets a variable called tool_flags. + set tool_flags "" # dg-require-* sets dg-do-what. upvar dg-do-what dg-do-what @@ -164,6 +166,7 @@ proc compat-get-options-main { src } { foreach op $tmp { set cmd [lindex $op 0] if { ![string compare "dg-options" $cmd] \ + || [string match "dg-skip-if" $cmd] \ || [string match "dg-require-*" $cmd] } { set status [catch "$op" errmsg] if { $status != 0 } { @@ -275,6 +278,15 @@ proc compat-execute { src1 sid use_alt } { set extra_flags_3 [compat-get-options $src3] set compile_xfail_3 $compiler_conditional_xfail_data + # On the SPU, most of the compat test cases exceed local store size. + # Use automatic overlay support to make them fit. + if { [istarget spu-*-elf*] } { + set extra_flags_1 "$extra_flags_1 -Wl,--auto-overlay" + set extra_flags_1 "$extra_flags_1 -ffunction-sections" + set extra_flags_2 "$extra_flags_2 -ffunction-sections" + set extra_flags_3 "$extra_flags_3 -ffunction-sections" + } + # Define the names of the object files. regsub "sid" "sid_main_tst.o" $sid obj1 regsub "sid" "sid_x_tst.o" $sid obj2_tst diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 9a3f12b5131..8d308d42461 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -354,6 +354,11 @@ proc remove-build-file { pat } { set file_list "[glob -nocomplain $pat]" verbose "remove-build-file `$file_list'" 2 foreach output_file $file_list { + if [is_remote host] { + # Ensure the host knows the file is gone by deleting there + # first. + remote_file host delete $output_file + } remote_file build delete $output_file } } diff --git a/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp b/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp index 7a0bdf3196c..dc4d9245a32 100644 --- a/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp +++ b/gcc/testsuite/objc.dg/gnu-encoding/gnu-encoding.exp @@ -37,7 +37,7 @@ set generator_src "$srcdir/$subdir/struct-layout-encoding-1_generate.c" set generator_src "$generator_src $srcdir/$subdir/generate-random.c" set generator_src "$generator_src $srcdir/$subdir/generate-random_r.c" set generator_cmd "-o $generator $generator_src" -set status [remote_exec host "$HOSTCC $HOSTCFLAGS $generator_cmd"] +set status [remote_exec build "$HOSTCC $HOSTCFLAGS $generator_cmd"] set status [lindex $status 0] if { $status == 0 } then { file delete -force $tstobjdir |