diff options
author | Ian Lance Taylor <iant@google.com> | 2009-05-29 00:44:55 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2009-05-29 00:44:55 +0000 |
commit | 7f794ff8cdee91ebc42cdd0a8bb9fae084f40102 (patch) | |
tree | e8b21472b24b249a2ca4c86c80e6075a3882c580 /gcc/testsuite | |
parent | f04406d03a367f3075c1ca521c7b32392f913105 (diff) |
Merge from trunk revision 147962.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-in-cxx@147966 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
193 files changed, 4291 insertions, 152 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b82f4721256..b0706c50a87 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,427 @@ +2009-05-28 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/ssa-fre-26.c: New testcase. + * gcc.c-torture/execute/20090527-1.c: Likewise. + +2009-05-28 Dodji Seketeli <dodji@redhat.com> + + PR c++/39754 + * g++.dg/template/canon-type-1.C: New test. + * g++.dg/template/canon-type-2.C: Likewise. + * g++.dg/template/canon-type-3.C: Likewise. + * g++.dg/template/canon-type-4.C: Likewise. + * g++.dg/template/canon-type-5.C: Likewise. + * g++.dg/template/canon-type-6.C: Likewise. + * g++.dg/template/canon-type-7.C: Likewise. + + +2009-05-28 Dave Korn <dave.korn.cygwin@gmail.com> + Uros Bizjak <ubizjak@gmail.com> + Danny Smith <dansmister@gmail.com> + + PR target/37216 + + * lib/target-supports.exp (check_effective_target_pe_aligned_commons): + New function. + * gcc.target/i386/pr37216.c: New test source file. + * gcc.dg/compat/struct-layout-1_generate.c (dg_options[]): No longer + use -fno-common for testing Cygwin and MinGW targets. + +2009-05-28 Kai Tietz <kai.tietz@onevision.com> + + * g++.dg/ext/packed6.C (size_t): Use __extension__ and + __SIZE_TYPE__. + * g++.dg/opt/memcpy1.C (size_t): Likewise. + * g++.dg/pr37742.C (size_t): Likewise. + * g++.dg/torture/pr34850.C (size_t): Likewise. + * g++.dg/torture/20070621-1.C (ptrdiff_t): Use __extension__ and + _PTRDIFF_TYPE__. + * g++.dg/torture/pr34222.C (ptrdiff_t): Likewise. + * g++.dg/tree-ssa/pr22444.C (ptrdiff_t): Likewise. + (size_t): Use __extension__ and __SIZE_TYPE__. + * gcc.c-torture/compile/20000211-1.c (size_t): Typedef size_t via + __SIZE_TYPE__. + * gcc.c-torture/compile/20010328-1.c (size_t): Likewise, + * gcc.c-torture/compile/20030320-1.c (size_t): Likewise, + * gcc.c-torture/compile/20030405-1.c (size_t): Likewise, + * gcc.c-torture/compile/20030902-1.c (size_t): Likewise, + * gcc.c-torture/compile/20060202-1.c (size_t): Likewise, + * gcc.c-torture/compile/20080613-1.c (size_t): Likewise, + * gcc.c-torture/compile/920428-2.c (size_t): Likewise, + * gcc.c-torture/compile/980329-1.c (size_t): Likewise, + * gcc.c-torture/compile/980816-1.c (size_t): Likewise, + * gcc.c-torture/compile/pr32584.c (size_t): Likewise, + * (__ssize_t): Likewise. + * gcc.c-torture/compile/pr33173.c (size_t): Likewise, + * gcc.c-torture/compile/pr33382.c (size_t): Likewise, + * gcc.c-torture/compile/pr34334.c (size_t): Likewise, + * gcc.c-torture/compile/pr34688.c (size_t): Likewise, + * gcc.c-torture/compile/pr35043.c (size_t): Likewise, + * gcc.c-torture/compile/pr37669.c (size_t): Likewise, + * gcc.dg/20050629-1.c (size_t): Typedef size_t via __SIZE_TYPE__. + * gcc.dg/pr33667.c (size_t): Likewise. + * gcc.dg/prefetch-loop-arrays-1.c (size_t): Likewise. + * gcc.dg/torture/pr39204.c (size_t): Likewise. + * gcc.dg/tree-ssa/20041122-1.c (size_t): Likewise. + * gcc.dg/tree-ssa/pr36908.c (size_t): Likewise. + * gcc.dg/tree-ssa/pr38250.c (size_t): Likewise. + * gcc.dg/tree-ssa/ssa-dse-10.c (size_t): Likewise. + +2009-05-28 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/40254 + * gcc.dg/vect/pr40254.c: New test. + +2009-05-28 Adam Nemet <anemet@caviumnetworks.com> + + PR middle-end/33699 + * gcc.target/mips/const-anchor-1.c: New test. + * gcc.target/mips/const-anchor-2.c: New test. + +2009-05-27 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/initlist15.C: New. + * g++.dg/cpp0x/initlist16.C: New. + * g++.dg/cpp0x/initlist17.C: New. + +2009-05-27 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/39178 + * gfortran.dg/elemental_dependency_1.f90: Fix scan-tree-dump-times + patterns to reflect frontend changes. + * gfortran.dg/vector_subscript_4.f90: Likewise. + +2009-05-27 Olivier Hainque <hainque@adacore.com> + Eric Botcazou <botcazou@adacore.com> + + * gcc.c-torture/execute/align-nest.c: New testcase. + * gnat.dg/misaligned_nest.adb: New testcase. + +2009-05-27 Rafael Avila de Espindola <espindola@google.com> + + * g++.dg/plugin/attribute_plugin.c: Include gcc-plugin.h first. + * g++.dg/plugin/dumb_plugin.c: Include gcc-plugin.h first. + * g++.dg/plugin/selfassign.c: Include gcc-plugin.h first. + * gcc.dg/plugin/selfassign.c: Include gcc-plugin.h first. + +2009-05-27 Kai TIetz <kai.tietz@onevision.com> + + * g++.old-deja/g++.brendan/array1.C (array): Use __SIZE_TYPE__ + cast instead of assuming 0ul. + * g++.old-deja/g++.brendan/crash64.C (size_t): Define it via + __SIZE_TYPE__. + (_type_desc): Make first argument const. + * g++.old-deja/g++.jason/new3.C (dg-options): Add -Wno-long-long. + +2009-05-27 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/40187 + * gfortran.dg/c_f_pointer_shape_tests_4.f03: New file. + * gfortran.dg/c_f_pointer_shape_tests_4_driver.c: New file. + +2009-05-26 Tobias Burnus <burnus@net-b.de> + + PR fortran/40246 + * gfortran.dg/nullify_4.f90: New test. + +2009-05-26 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/inline-3.c: Remove dump file. + +2009-05-26 Richard Guenther <rguenther@suse.de> + + PR middle-end/40252 + * gcc.c-torture/compile/pr40252.c: New testcase. + +2009-05-26 Dodji Seketeli <dodji@redhat.com> + + PR c++/40007 + * g++.dg/template/typedef18.C: New test. + * g++.dg/template/typedef19.C: Likewise. + * g++.dg/template/typedef20.C: Likewise. + * g++.dg/template/access11.C: Adjust. + +2009-05-26 Richard Guenther <rguenther@suse.de> + + PR testsuite/40247 + * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Obfuscate. + +2009-05-25 Jason Merrill <jason@redhat.com> + + PR c++/38064 + * g++.dg/cpp0x/enum3.C: New test. + +2009-05-25 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/36327 + * gcc.dg/tree-ssa/ssa-fre-24.c: New testcase. + * gcc.dg/tree-ssa/ssa-fre-25.c: Likewise. + * gcc.dg/tree-ssa/sra-2.c: Disable FRE. + * gcc.dg/vect/no-vfa-vect-43.c: Adjust. + * gcc.dg/vect/vect-40.c: Likewise. + * gcc.dg/vect/vect-42.c: Likewise. + * gcc.dg/vect/vect-46.c: Likewise. + * gcc.dg/vect/vect-76.c: Likewise. + +2009-05-25 Janus Weil <janus@gcc.gnu.org> + + PR fortran/40176 + * gfortran.dg/proc_ptr_18.f90: New. + * gfortran.dg/proc_ptr_19.f90: New. + * gfortran.dg/proc_ptr_comp_9.f90: New. + * gfortran.dg/proc_ptr_comp_10.f90: New. + +2009-05-25 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/ssa-fre-14.c: Adjust. + * gcc.dg/tree-ssa/ssa-fre-15.c: Likewise. + +2009-05-25 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/40238 + * gcc.dg/vect/pr40238.c: New test. + +2009-05-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> + Dominique Dhumieres + + PR fortran/35732 + PR fortran/39872 + * gfortran.dg/bounds_check_fail_3.f90: New test. + * gfortran.dg/bounds_check_fail_4.f90: New test. + * gfortran.dg/bounds_check_14.f90: Update test. + * gfortran.dg/bound_4.f90: Update test. + +2009-05-24 Richard Guenther <rguenther@suse.de> + + PR middle-end/40233 + * gcc.c-torture/compile/pr40233.c: New testcase. + +2009-05-24 Uros Bizjak <ubizjak@gmail.com> + + * gfortran.dg/erf_2.F90 (dg-options): Add -mieee + for alpha*-*-* targets. + +2009-05-24 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/bb-slp-1.c: New test. + * gcc.dg/vect/bb-slp-2.c, gcc.dg/vect/bb-slp-3.c, + gcc.dg/vect/bb-slp-4.c, gcc.dg/vect/bb-slp-5.c, + gcc.dg/vect/bb-slp-6.c, gcc.dg/vect/bb-slp-7.c, + gcc.dg/vect/bb-slp-8.c, gcc.dg/vect/bb-slp-9.c, + gcc.dg/vect/bb-slp-10.c, gcc.dg/vect/bb-slp-11.c, + gcc.dg/vect/no-tree-reassoc-bb-slp-12.c, gcc.dg/vect/bb-slp-13.c, + gcc.dg/vect/bb-slp-14.c, gcc.dg/vect/bb-slp-15.c, + gcc.dg/vect/bb-slp-16.c, gcc.dg/vect/bb-slp-17.c, + gcc.dg/vect/bb-slp-18.c, gcc.dg/vect/bb-slp-19.c, + gcc.dg/vect/bb-slp-20.c, gcc.dg/vect/bb-slp-21.c, + gcc.dg/vect/bb-slp-22.c: Likewise. + * gcc.dg/vect/vect.exp: Run basic block SLP tests. + +2009-05-23 Mark Mitchell <mark@codesourcery.com> + Maxim Kuvyrkov <maxim@codesourcery.com> + + * gcc.dg/falign-labels-1.c: New test. + +2009-05-23 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/rep_clause3.ads: New test. + +2009-05-23 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/addr6.adb: New test. + +2009-05-22 Mark Mitchell <mark@codesourcery.com> + + * lib/target-supports.exp (check_effective_target_arm_thumb2_ok): + New function. + * gcc.target/arm/thumb2-mul-space.c: New file. + * gcc.target/arm/thumb2-mul-space-2.c: New file. + * gcc.target/arm/thumb2-mul-space-3.c: New file. + * gcc.target/arm/thumb2-mul-speed.c: New file. + +2009-05-22 Richard Guenther <rguenther@suse.de> + + PR middle-end/38964 + * g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: XFAIL. + * gcc.dg/Wstrict-aliasing-converted-assigned.c: Likewise. + * gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c: Likewise. + +2009-05-22 Mark Mitchell <mark@codesourcery.com> + + * gcc.dg/dll-6.c: New test. + * gcc.dg/dll-6a.c: Likewise. + * gcc.dg/dll-7.c: Likewise. + * gcc.dg/dll-7a.c: Likewise. + * g++.dg/ext/dllexport2.C: Likewise. + * g++.dg/ext/dllexport2a.cc: Likewise. + +2009-05-21 Steve Ellcey <sje@cup.hp.com> + + PR target/37846 + * gcc.target/ia64/mfused-madd-vect.c: New test. + * gcc.target/ia64/mfused-madd.c: New test. + * gcc.target/ia64/mno-fused-madd-vect.c: New test. + * gcc.target/ia64/mno-fused-madd.c: New test. + +2009-05-21 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.target/i386/movbe-1.c: New. + * gcc.target/i386/movbe-2.c: Likewise. + +2009-05-21 Taras Glek <tglek@mozilla.com> + + * gcc.dg/plugin/selfassign.c (plugin_init): Updated to new + plugin_init signature. + * g++.dg/plugin/selfassign.c (plugin_init): Likewise. + * g++.dg/plugin/dumb_plugin.c (plugin_init): Likewise. + * g++.dg/plugin/attribute_plugin.c (plugin_init): Likewise. + +2009-05-21 Mark Mitchell <mark@codesourcery.com> + + * gcc.dg/target/arm/neon-vmla-1.c: New. + * gcc.dg/target/arm/neon-vmls-1.c: Likewise. + +2009-05-20 Adam Nemet <anemet@caviumnetworks.com> + + * gcc.target/mips/octeon-exts-6.c: New test. + * gcc.target/mips/extend-1.c: New test. + * gcc.target/mips/octeon-exts-2.c: Adjust to not match sign-extension + EXTS. + * gcc.target/mips/octeon-exts-5.c: Likewise. + +2009-05-20 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/40204 + * gcc.c-torture/compile/pr40204.c: New test. + +2009-05-20 Richard Guenther <rguenther@suse.de> + + * gcc.c-torture/compile/20090518-1.c: New testcase. + +2009-05-19 Zdenek Dvorak <ook@ucw.cz> + + PR tree-optimization/40087 + * gcc.dg/tree-ssa/pr40087.c: New test. + +2009-05-19 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * gcc.dg/vector-4.c: New testcase. + * gcc.dg/simd-1b.c: % is now allowed for integer vectors. + * g++.dg/ext/vector16.C: New testcase. + +2009-05-19 H.J. Lu <hongjiu.lu@intel.com> + + PR c/40172 + * gcc.dg/pr40172.c: Renamed to ... + * gcc.dg/pr40172-1.c: This. + + * gcc.dg/pr40172-2.c: New. + * gcc.dg/pr40172-3.c: Likewise. + +2009-05-19 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR c/40172 + * gcc.dg/pr40172.c: Add -Wlogical-op to dg-options. + +2009-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/loop_optimization6.ad[sb]: New test. + +2009-05-19 Richard Guenther <rguenther@suse.de> + + * gcc.c-torture/compile/20090519-1.c: New testcase. + +2009-05-18 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/explicit1.C: New. + * g++.dg/cpp0x/explicit2.C: New. + +2009-05-18 Dodji Seketeli <dodji@redhat.com> + + PR debug/40109 + * g++.dg/debug/dwarf2/nested-1.C: New test. + +2009-05-18 H.J. Lu <hongjiu.lu@intel.com> + + PR testsuite/39907 + * gcc.target/x86_64/abi/asm-support.S (snapshot_ret): Preserve + stack alignment. + +2009-05-18 Janus Weil <janus@gcc.gnu.org> + + PR fortran/40164 + * gfortran.dg/proc_ptr_comp_8.f90: New. + +2009-05-18 Richard Guenther <rguenther@suse.de> + + PR fortran/40168 + * gfortran.dg/array_memset_2.f90: Adjust. + +2009-05-18 Janus Weil <janus@gcc.gnu.org> + + PR fortran/36947 + PR fortran/40039 + * gfortran.dg/interface_27.f90: New. + * gfortran.dg/interface_28.f90: New. + * gfortran.dg/proc_ptr_11.f90: Fixing invalid test case. + * gfortran.dg/proc_ptr_result_1.f90: Ditto. + +2009-05-18 Maxim Kuvyrkov <maxim@codesourcery.com> + + * gcc.target/m68k/tls-ie.c: New test. + * gcc.target/m68k/tls-le.c: New test. + * gcc.target/m68k/tls-gd.c: New test. + * gcc.target/m68k/tls-ld.c: New test. + * gcc.target/m68k/tls-ie-xgot.c: New test. + * gcc.target/m68k/tls-le-xtls.c: New test. + * gcc.target/m68k/tls-gd-xgot.c: New test. + * gcc.target/m68k/tls-ld-xgot.c: New test. + * gcc.target/m68k/tls-ld-xtls.c: New test. + * gcc.target/m68k/tls-ld-xgot-xtls.c: New test. + +2009-05-18 Martin Jambor <mjambor@suse.cz> + + * gcc.dg/ipa/modif-1.c: Do not check for unmodified int parameter. + +2009-05-17 H.J. Lu <hongjiu.lu@intel.com> + + PR c/40172 + * gcc.dg/pr40172.c: New. + +2009-05-17 Jason Merrill <jason@redhat.com> + + PR c++/40139 + * g++.dg/template/dtor6.C: New. + +2009-05-17 Joseph Myers <joseph@codesourcery.com> + + * g++.dg/warn/translate-ice-1.C: New test. + +2009-05-17 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * gfortran.dg/c_kind_int128_test1.f03: Also test C_INT_FAST128_T. + * gfortran.dg/c_kind_int128_test2.f03: Update comment. + * gfortran.dg/c_kind_params.f90: Also test int_fast*_t. + * gfortran.dg/c_kinds.c: Add int_fast*_t arguments. + +2009-05-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR fortran/33197 + * gfortran.dg/erf_2.F90: New test. + * gfortran.dg/erfc_scaled_2.f90: New test. + +2009-05-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR fortran/31243 + * gcc/testsuite/gfortran.dg/string_1.f90: New test. + * gcc/testsuite/gfortran.dg/string_2.f90: New test. + * gcc/testsuite/gfortran.dg/string_3.f90: New test. + +2009-05-16 David Billinghurst <billingd@gcc.gnu.org> + + * gfortran.dg/default_format_denormal_1.f90: XFAIL on cygwin. + * gfortran.dg/default_format_1.f90: Revert change of 2009-05-12 + 2009-05-15 Ian Lance Taylor <iant@google.com> * gcc.dg/Wcxx-compat-10.c: New testcase. @@ -68,15 +492,17 @@ 2009-05-14 Laurent GUERBY <laurent@guerby.net> - * ada/acats/tests/c3/c38202a.ada: Use Impdef. - * ada/acats/tests/c5/c59002c.ada: Likewise. + * ada/acats/tests/c3/c38202a.ada: Use Impdef. + * ada/acats/tests/c5/c59002c.ada: Likewise. 2009-05-13 Taras Glek <tglek@mozilla.com> - * g++.dg/plugin/attribute_plugin-test-1.C Testcase input for custom attributes and decl smashing - * g++.dg/plugin/attribute_plugin.c Testcase plugin to test user attributes - * g++.dg/plugin/dumb_plugin.c Fixed typo - * g++.dg/plugin/plugin.exp Added attribute_plugin test + * g++.dg/plugin/attribute_plugin-test-1.C: Testcase input for custom + attributes and decl smashing. + * g++.dg/plugin/attribute_plugin.c: Testcase plugin to test user + attributes. + * g++.dg/plugin/dumb_plugin.c: Fixed typo. + * g++.dg/plugin/plugin.exp: Added attribute_plugin test . 2009-05-14 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/g++.dg/cpp0x/enum3.C b/gcc/testsuite/g++.dg/cpp0x/enum3.C new file mode 100644 index 00000000000..5555ab2aac8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum3.C @@ -0,0 +1,17 @@ +// PR c++/38064 +// { dg-options "-std=c++0x" } +// { dg-do run } + +enum class E { elem }; + +template <class T> +void f (T t); + +bool f (bool b) { return b; } + +int main() +{ + E e = E::elem; + if (!f (e == E::elem)) + return 1; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit1.C b/gcc/testsuite/g++.dg/cpp0x/explicit1.C new file mode 100644 index 00000000000..fe164fc8cb1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit1.C @@ -0,0 +1,58 @@ +// Test for explicit conversion ops from N2437. +// { dg-options "-std=c++0x" } + +class U; class V; +class T +{ +public: + T( U const & ); + //implicit converting ctor + explicit T( V const & ); + // explicit ctor +}; +class U +{ +}; +class V +{ +}; +class W +{ +public: + operator T() const; +}; +class X +{ +public: + explicit operator T() const; // theoretical +}; +int main() +{ + U u; V v; W w; X x; + // Direct initialization: + T t1( u ); + T t2( v ); + T t3( w ); + T t4( x ); + // Copy initialization: + T t5 = u; + T t6 = v; // { dg-error "" } + T t7 = w; + T t8 = x; // { dg-error "" } + // Cast notation: + T t9 = (T) u; + T t10 = (T) v; + T t11 = (T) w; + T t12 = (T) x; + // Static cast: + T t13 = static_cast<T>( u ); + T t14 = static_cast<T>( v ); + T t15 = static_cast<T>( w ); + T t16 = static_cast<T>( x ); + // Function-style cast: + T t17 = T( u ); + T t18 = T( v ); + T t19 = T( w ); + T t20 = T( x ); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit2.C b/gcc/testsuite/g++.dg/cpp0x/explicit2.C new file mode 100644 index 00000000000..c2327c140d8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit2.C @@ -0,0 +1,29 @@ +// Test for explicit conversion ops in various conversion situations. +// { dg-options "-std=c++0x" } + +typedef void (*pfn)(); + +struct A +{ + explicit operator int() const; + explicit operator pfn() const; +}; + +int main() +{ + A a; + int i = a; // { dg-error "" } + const int &ir = a; // { dg-error "" } + a(); // { dg-error "" } + a + 1; // { dg-message "" } (error and note on same line) + + int j (a); + (int)a; + static_cast<int>(a); +} + +struct B +{ + int i; + B(const A& a): i(a) { } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist15.C b/gcc/testsuite/g++.dg/cpp0x/initlist15.C new file mode 100644 index 00000000000..d59e5af640b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist15.C @@ -0,0 +1,17 @@ +// { dg-options "-std=c++0x" } + +#include <vector> +#include <typeinfo> + +using namespace std; + +template< typename ... ArgTypes > +void test( ArgTypes ... args ) { + vector<type_info*> x = { &typeid(ArgTypes)... }; // { dg-error "" } +} + +int main() +{ + test( 1, 3.14f, 2.78 ); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist16.C b/gcc/testsuite/g++.dg/cpp0x/initlist16.C new file mode 100644 index 00000000000..86a00396051 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist16.C @@ -0,0 +1,12 @@ +// { dg-options "-std=c++0x" } +// { dg-do run } + +extern "C" void abort(); + +void f(int i) { if (i != 42) abort(); } + +int main() +{ + f({42}); + return {0}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist17.C b/gcc/testsuite/g++.dg/cpp0x/initlist17.C new file mode 100644 index 00000000000..86371e81969 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist17.C @@ -0,0 +1,9 @@ +// { dg-options "-std=c++0x" } + +void f(int i); + +int main() +{ + f({42.0}); // { dg-error "narrowing" } + return {1.0}; // { dg-error "narrowing" } +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/nested-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/nested-1.C new file mode 100644 index 00000000000..336582c112a --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/nested-1.C @@ -0,0 +1,29 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR debug/40109 +// { dg-do compile } +// { dg-options "-g -dA -O0" } + +namespace A +{ + + class B + { + }; + typedef A::B AB; +}; + +int +main() +{ + A::AB ab; + return 0; +} + +// { dg-final { scan-assembler "DW_TAG_typedef" } } +// +// What we want to do here is to be sure that the DIE of A::AB is generated +// as a child of the DIE of the namespace A declaration. +// So this test won't catch a regression on this fix yet. To write a proper +// test for this fix, we would need a dwarf reader written in tcl, +// or something along those lines. + diff --git a/gcc/testsuite/g++.dg/ext/dllexport2.C b/gcc/testsuite/g++.dg/ext/dllexport2.C new file mode 100644 index 00000000000..71ccf670b4b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/dllexport2.C @@ -0,0 +1,52 @@ +// { dg-do link } +// { dg-require-dll "" } +// { dg-additional-sources "dllexport2a.cc" } +// { dg-options "-O2" } + +/* Test that inline functions declared "dllexport" appear in object + files, even if they are not called. + + This behavior is required by the ARM C++ ABI: + + Exporting a function that can be inlined should force the + creation and export of an out-of-line copy of it. + + and should presumably also apply. + + Visual Studio 2005 also honors that rule. */ + +__declspec(dllexport) inline void i1() {} + +__declspec(dllexport) extern inline void e1() {} + +/* It is invalid to declare the function inline after its definition. */ +#if 0 +__declspec(dllexport) void i2() {} +inline void i2(); + +__declspec(dllexport) extern void e2() {} +inline void e2(); +#endif + +__declspec(dllexport) inline void i3() {} +void i3(); + +__declspec(dllexport) inline void e3() {} +extern void e3(); + +__declspec(dllexport) void i4(); +inline void i4() {}; + +__declspec(dllexport) extern void e4(); +inline void e4() {}; + +__declspec(dllexport) inline void i5(); +void i5() {}; + +__declspec(dllexport) inline void e5(); +extern void e5() {}; + +/* Make sure that just declaring the function -- without defining it + -- does not cause errors. */ +__declspec(dllexport) inline void i6(); +__declspec(dllexport) extern inline void e6(); diff --git a/gcc/testsuite/g++.dg/ext/dllexport2a.cc b/gcc/testsuite/g++.dg/ext/dllexport2a.cc new file mode 100644 index 00000000000..80caf321742 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/dllexport2a.cc @@ -0,0 +1,21 @@ +extern void i1(); +extern void i3(); +extern void i4(); +extern void i5(); + +extern void e1(); +extern void e3(); +extern void e4(); +extern void e5(); + +int main () { + i1(); + i3(); + i4(); + i5(); + + e1(); + e3(); + e4(); + e5(); +} diff --git a/gcc/testsuite/g++.dg/ext/packed6.C b/gcc/testsuite/g++.dg/ext/packed6.C index f89aafec163..6a176b62442 100644 --- a/gcc/testsuite/g++.dg/ext/packed6.C +++ b/gcc/testsuite/g++.dg/ext/packed6.C @@ -1,7 +1,7 @@ // PR c++/15209 // { dg-options "-w" } -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; typedef unsigned char uint8_t; typedef unsigned short int uint16_t; diff --git a/gcc/testsuite/g++.dg/ext/vector16.C b/gcc/testsuite/g++.dg/ext/vector16.C new file mode 100644 index 00000000000..7964a881f4a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/vector16.C @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +#define vector __attribute__((vector_size(4*sizeof(int)) )) + +vector int a, b, c; + + +/* Test that remainder works for vectors. */ +void f(void) +{ + a = b % c; +} diff --git a/gcc/testsuite/g++.dg/opt/memcpy1.C b/gcc/testsuite/g++.dg/opt/memcpy1.C index f9887ee2314..f2913459973 100644 --- a/gcc/testsuite/g++.dg/opt/memcpy1.C +++ b/gcc/testsuite/g++.dg/opt/memcpy1.C @@ -6,7 +6,7 @@ typedef unsigned char uint8_t; typedef uint8_t uint8; -typedef long unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; class csVector2 { public:float x; diff --git a/gcc/testsuite/g++.dg/plugin/attribute_plugin.c b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c index d071762102b..16b34964350 100644 --- a/gcc/testsuite/g++.dg/plugin/attribute_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c @@ -1,5 +1,6 @@ /* Demonstrates how to add custom attributes */ +#include "gcc-plugin.h" #include <stdlib.h> #include "config.h" #include "system.h" @@ -7,7 +8,6 @@ #include "tree.h" #include "tree-pass.h" #include "intl.h" -#include "gcc-plugin.h" /* Attribute handler callback */ @@ -54,10 +54,10 @@ handle_pre_generic (void *event_data, void *data) } int -plugin_init (const char *plugin_name, - struct plugin_gcc_version *version, - int argc, struct plugin_argument *argv) +plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) { + const char *plugin_name = plugin_info->base_name; register_callback (plugin_name, PLUGIN_CXX_CP_PRE_GENERICIZE, handle_pre_generic, NULL); diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c index 839dc2b1c8a..24da5440391 100644 --- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c @@ -1,6 +1,7 @@ /* A trivial (dumb) plugin example that shows how to use the GCC plugin mechanism. */ +#include "gcc-plugin.h" #include <stdlib.h> #include "config.h" #include "system.h" @@ -8,7 +9,6 @@ #include "tree.h" #include "tree-pass.h" #include "intl.h" -#include "gcc-plugin.h" /* Callback function to invoke after GCC finishes parsing a struct. */ @@ -78,11 +78,13 @@ static struct gimple_opt_pass pass_dumb_plugin_example = both of which determine where the plugin pass should be inserted. */ int -plugin_init (const char *plugin_name, - struct plugin_gcc_version *version __attribute__((unused)), - int argc, struct plugin_argument *argv) +plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) { struct plugin_pass pass_info; + const char *plugin_name = plugin_info->base_name; + int argc = plugin_info->argc; + struct plugin_argument *argv = plugin_info->argv; char *ref_pass_name = NULL; int ref_instance_number = 0; int i; diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c index 6fbce83c01d..2bc1d861358 100644 --- a/gcc/testsuite/g++.dg/plugin/selfassign.c +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c @@ -2,6 +2,7 @@ self-assignment statements. */ /* { dg-options "-O" } */ +#include "gcc-plugin.h" #include "config.h" #include "system.h" #include "coretypes.h" @@ -12,7 +13,6 @@ #include "tree.h" #include "tree-pass.h" #include "intl.h" -#include "gcc-plugin.h" /* Indicate whether to check overloaded operator '=', which is performed by @@ -294,10 +294,13 @@ static struct gimple_opt_pass pass_warn_self_assign = Note that this function needs to be named exactly "plugin_init". */ int -plugin_init (const char *plugin_name, struct plugin_gcc_version *version, - int argc, struct plugin_argument *argv) +plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) { struct plugin_pass pass_info; + const char *plugin_name = plugin_info->base_name; + int argc = plugin_info->argc; + struct plugin_argument *argv = plugin_info->argv; bool enabled = true; int i; diff --git a/gcc/testsuite/g++.dg/pr37742.C b/gcc/testsuite/g++.dg/pr37742.C index 784eb498487..2bbb01723fb 100644 --- a/gcc/testsuite/g++.dg/pr37742.C +++ b/gcc/testsuite/g++.dg/pr37742.C @@ -1,6 +1,6 @@ /* { dg-do compile } */ -typedef long unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; void* __valarray_get_memory(size_t __n); int*__restrict__ __valarray_get_storage(size_t __n) diff --git a/gcc/testsuite/g++.dg/template/access11.C b/gcc/testsuite/g++.dg/template/access11.C index 38bd5155f65..c9364a82399 100644 --- a/gcc/testsuite/g++.dg/template/access11.C +++ b/gcc/testsuite/g++.dg/template/access11.C @@ -17,7 +17,7 @@ template <> struct X::Y<int> { A::X x; // { dg-error "this context" } }; -template <typename T> struct X::Y { // { dg-error "this context" } +template <typename T> struct X::Y { typename T::X x; // { dg-error "this context" } }; diff --git a/gcc/testsuite/g++.dg/template/canon-type-1.C b/gcc/testsuite/g++.dg/template/canon-type-1.C new file mode 100644 index 00000000000..2a36dc09951 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-1.C @@ -0,0 +1,18 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/39754 +// { dg-do "compile" } + +template < typename > struct A ; +template < typename T , typename = A < T > > struct B { } ; +template < class W , class > struct D +{ + typedef W X ; + A<X*> a ; +}; + +template < class Y > struct E +{ + B<Y*> b ; +} ; +E<int> e ; + diff --git a/gcc/testsuite/g++.dg/template/canon-type-2.C b/gcc/testsuite/g++.dg/template/canon-type-2.C new file mode 100644 index 00000000000..dd23ec5ea6d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-2.C @@ -0,0 +1,18 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/39754 +// { dg-do "compile" } + +template < typename > struct A ; +template < typename T , typename = A < T > > struct B { } ; +template < class W , class > struct D +{ + typedef W X ; + A< X()> a ; +}; + +template < class Y > struct E +{ + B< Y()> b ; +}; +E<int> e ; + diff --git a/gcc/testsuite/g++.dg/template/canon-type-3.C b/gcc/testsuite/g++.dg/template/canon-type-3.C new file mode 100644 index 00000000000..a43169addc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-3.C @@ -0,0 +1,20 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/39754 +// { dg-do "compile" } + +template<typename> struct A ; +template<typename T , typename = A<T> > struct B { } ; +template<class W , class > struct D +{ + typedef W X ; + typedef X (FP) (); + A<FP&> a ; +} ; + +template < class Y > struct E +{ + typedef Y (FP) (); + B<FP&> b ; +} ; +E < int > e ; + diff --git a/gcc/testsuite/g++.dg/template/canon-type-4.C b/gcc/testsuite/g++.dg/template/canon-type-4.C new file mode 100644 index 00000000000..ec5e1e6a200 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-4.C @@ -0,0 +1,22 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/39754 +// { dg-do "compile" } + +template<typename> struct A ; +template<typename T ,typename = A<T> > struct B { } ; + +template<class W, class> +struct D +{ + typedef W X; + A<X[2]> a; +} ; + +template<class Y> +struct E +{ + B<Y[2]> b; +}; + +E < int > e; + diff --git a/gcc/testsuite/g++.dg/template/canon-type-5.C b/gcc/testsuite/g++.dg/template/canon-type-5.C new file mode 100644 index 00000000000..7331c3086fb --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-5.C @@ -0,0 +1,22 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/39754 +// { dg-do "compile" } + +struct Foo {}; +template<typename> struct A ; +template<typename T ,typename = A<T> > struct B { } ; + +template<class W, class> +struct D +{ + typedef W X ; + A<X Foo::*> a ; +} ; + +template<class Y> +struct E +{ + B<Y Foo::*> b ; +} ; +E < int > e ; + diff --git a/gcc/testsuite/g++.dg/template/canon-type-6.C b/gcc/testsuite/g++.dg/template/canon-type-6.C new file mode 100644 index 00000000000..5065c395dc4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-6.C @@ -0,0 +1,22 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/39754 +// { dg-do "compile" } + +struct Foo {}; +template<typename> struct A ; +template<typename T ,typename = A<T> > struct B { } ; + +template<class W, class> +struct D +{ + typedef W X; + A<void (Foo::*) (X)> a; +} ; + +template<class Y> +struct E +{ + B<void (Foo::*) (Y)> b; +}; +E < int > e ; + diff --git a/gcc/testsuite/g++.dg/template/canon-type-7.C b/gcc/testsuite/g++.dg/template/canon-type-7.C new file mode 100644 index 00000000000..80e8f87e834 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-7.C @@ -0,0 +1,21 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/39754 +// { dg-do "compile" } + +struct Foo {}; +template<typename> struct A ; +template<typename T ,typename = A<T> > struct B { } ; + +template<class W, class> +struct D +{ + typedef W X; + A<X (Foo::*) (X)> a ; +}; + +template<class Y> +struct E +{ + B<Y (Foo::*) (Y)> b ; +}; +E<int> e ; diff --git a/gcc/testsuite/g++.dg/template/dtor6.C b/gcc/testsuite/g++.dg/template/dtor6.C new file mode 100644 index 00000000000..c44b780294c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dtor6.C @@ -0,0 +1,16 @@ +// PR c++/40139 + +template<int> struct A +{ + static int i; +}; + +template<int N> int A<N>::i = { A::~A }; // { dg-error "non-static member function" } + +template class A<0>; + +struct X { }; + +int i1 = X::~X; // { dg-error "non-static member function" } +int i2 = &X::~X; // { dg-error "address of destructor" } +int i3 = &A<0>::~A; // { dg-error "address of destructor" } diff --git a/gcc/testsuite/g++.dg/template/typedef18.C b/gcc/testsuite/g++.dg/template/typedef18.C new file mode 100644 index 00000000000..8ea3c736a0a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef18.C @@ -0,0 +1,24 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/40007 +// { dg-do compile } + +template<typename T> +struct x +{ + protected: + typedef int type; +}; + +template<typename T> +struct y : public x<T> +{ + typename x<T>::type z; +}; + +template<> +struct y<void> : public x<void> +{ + typedef x<void>::type z; +}; + +template class y<int>; diff --git a/gcc/testsuite/g++.dg/template/typedef19.C b/gcc/testsuite/g++.dg/template/typedef19.C new file mode 100644 index 00000000000..f576d4828e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef19.C @@ -0,0 +1,21 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/40007 +// { dg-do compile } + +class A +{ + typedef int mytype; // { dg-error "'typedef int A::mytype' is private" } +}; + +template <class T> +class B : public A +{ +}; + +template<class T> +class B<T*> : public A +{ // { dg-error "within this context" } + mytype mem; +}; + +B<int*> b; diff --git a/gcc/testsuite/g++.dg/template/typedef20.C b/gcc/testsuite/g++.dg/template/typedef20.C new file mode 100644 index 00000000000..a5cbdeb236b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef20.C @@ -0,0 +1,27 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/40007 +// { dg-do compile } + +class x +{ + typedef int privtype; // { dg-error "is private" } + +protected: + typedef int type; +}; + +template<typename T> +struct y : public x +{ + typename x::type z; +}; + +template<typename T> +struct y<T*> : public x +{ // { dg-error "within this context" } + typedef x::type good; + typedef x::privtype bad; +}; + +template class y<int>; +template class y<int*>; diff --git a/gcc/testsuite/g++.dg/torture/20070621-1.C b/gcc/testsuite/g++.dg/torture/20070621-1.C index d17db9763ae..185314a47ca 100644 --- a/gcc/testsuite/g++.dg/torture/20070621-1.C +++ b/gcc/testsuite/g++.dg/torture/20070621-1.C @@ -6,7 +6,7 @@ */ -typedef long int ptrdiff_t; +__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t; namespace std __attribute__ ((__visibility__ ("default"))) { template<typename, typename> struct __are_same { enum { diff --git a/gcc/testsuite/g++.dg/torture/pr34222.C b/gcc/testsuite/g++.dg/torture/pr34222.C index 1939b5015b1..130896dc9da 100644 --- a/gcc/testsuite/g++.dg/torture/pr34222.C +++ b/gcc/testsuite/g++.dg/torture/pr34222.C @@ -3,7 +3,7 @@ namespace std __attribute__ ((__visibility__ ("default"))) { template<class _CharT> struct char_traits; } -typedef long int ptrdiff_t; +__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t; namespace std __attribute__ ((__visibility__ ("default"))) { typedef ptrdiff_t streamsize; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ifstream; diff --git a/gcc/testsuite/g++.dg/torture/pr34850.C b/gcc/testsuite/g++.dg/torture/pr34850.C index e7caa7b6638..88df5a3382b 100644 --- a/gcc/testsuite/g++.dg/torture/pr34850.C +++ b/gcc/testsuite/g++.dg/torture/pr34850.C @@ -5,7 +5,7 @@ typedef unsigned char uint8_t; typedef unsigned int uint32_t; typedef uint8_t byte; typedef uint32_t u32bit; -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; extern "C" { extern void __warn_memset_zero_len (void) __attribute__((__warning__ (""))); extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__)) diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr22444.C b/gcc/testsuite/g++.dg/tree-ssa/pr22444.C index 2cc84bb9d1e..7df4b9cce15 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr22444.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr22444.C @@ -4,8 +4,8 @@ // with the subvars leading to the subvars not being renamed when they should // { dg-do compile } // { dg-options "-O2" } -typedef int ptrdiff_t; -typedef unsigned int size_t; +__extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t; +__extension__ typedef __SIZE_TYPE__ size_t; namespace std { template<class _T1, class _T2> struct pair diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C index d88ed4314b3..8b82874f51d 100644 --- a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C @@ -4,8 +4,8 @@ int foo() { int x; - float& q = reinterpret_cast<float&> (x); /* { dg-message "initialized" } */ - q = 1.0; /* { dg-warning "does break strict-aliasing" } */ + float& q = reinterpret_cast<float&> (x); /* { dg-message "initialized" "" { xfail *-*-* } } */ + q = 1.0; /* { dg-warning "does break strict-aliasing" "" { xfail *-*-* } } */ return x; } diff --git a/gcc/testsuite/g++.dg/warn/translate-ice-1.C b/gcc/testsuite/g++.dg/warn/translate-ice-1.C new file mode 100644 index 00000000000..22e103c2980 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/translate-ice-1.C @@ -0,0 +1,45 @@ +// Test ICE in caching printable names for a function. +// { dg-options "-std=c++98 -pedantic -O2" } + +void g (int a) __attribute__((warning("g"))); +void g2 (int a, int *p); +static inline __attribute__((__always_inline__)) void +gg (int a) +{ + if (a == 0) + return g(a); // { dg-warning "attribute" } + __extension__ int v[a]; + return g2(a, v); +} + +void h (int a) __attribute__((warning("h"))); +void h2 (int a, int *p); +static inline __attribute__((__always_inline__)) void +hh (int a) +{ + if (a == 0) + return h(a); // { dg-warning "attribute" } + __extension__ int v[a]; + return h2(a, v); +} + +void i (int a) __attribute__((warning("i"))); +void i2 (int a, int *p); +static inline __attribute__((__always_inline__)) void +ii (int a) +{ + if (a == 0) + return i(a); // { dg-warning "attribute" } + __extension__ int v[a]; + return i2(a, v); +} + +void +f (void) +{ + long long l; // { dg-warning "long long" } + const char *p = __PRETTY_FUNCTION__; + gg(0); + hh(0); + ii(0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/array1.C b/gcc/testsuite/g++.old-deja/g++.brendan/array1.C index df132ea9024..a58d3363bcd 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/array1.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/array1.C @@ -3,5 +3,5 @@ // GROUPS passed array-bindings extern "C" int printf (const char *, ...); -char array[~(~0ul>>1)|~(0ul>>3)]; // { dg-error "" } overflow in array dimension.* +char array[~(~((__SIZE_TYPE__)0ul)>>1)|~(((__SIZE_TYPE__)0ul)>>3)]; // { dg-error "" } overflow in array dimension.* int main () { printf ("PASS\n"); return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C index b3717a5d999..6046cb1c9ee 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash64.C @@ -1,6 +1,6 @@ // { dg-do assemble } // GROUPS passed old-abort -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef void (*RF_Ptr)(void *); struct _im_pers_mem_spec { @@ -9,7 +9,7 @@ struct _im_pers_mem_spec { }; struct _type_desc { - _type_desc(char *, int , RF_Ptr , int , int ,...); + _type_desc(const char *, int , RF_Ptr , int , int ,...); }; struct metatype { int base_list; }; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new3.C b/gcc/testsuite/g++.old-deja/g++.jason/new3.C index 62e9b7dd1b6..d950259e72a 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/new3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/new3.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-options "-fcheck-new -pedantic" } +// { dg-options "-fcheck-new -pedantic -Wno-long-long" } // PRMS Id: 6037 extern "C" void * malloc (__SIZE_TYPE__); diff --git a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c index 8d8a4074e0f..7a7c8c0cb20 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20000211-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20000211-1.c @@ -1,4 +1,4 @@ -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef unsigned char Bufbyte; typedef int Bytecount; typedef int Charcount; diff --git a/gcc/testsuite/gcc.c-torture/compile/20010328-1.c b/gcc/testsuite/gcc.c-torture/compile/20010328-1.c index d92c6dae113..951ae78b950 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20010328-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20010328-1.c @@ -1,4 +1,4 @@ -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef unsigned int __u_int; typedef unsigned long __u_long; diff --git a/gcc/testsuite/gcc.c-torture/compile/20030320-1.c b/gcc/testsuite/gcc.c-torture/compile/20030320-1.c index 40243f28f93..72d0d0966c6 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20030320-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20030320-1.c @@ -2,7 +2,7 @@ conditional returns without updating dominance info. Extracted from glibc's dl-load.c. */ -typedef unsigned long size_t; +typedef __SIZE_TYPE__ size_t; static size_t is_dst (const char *start, const char *name, const char *str, diff --git a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c index f84e606c045..0bdafb9239f 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20030405-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20030405-1.c @@ -6,7 +6,7 @@ and when the PHI node at the end of the while() is visited the first time, CCP will try to assign it a value of UNDEFINED, but the default value for *str is a constant. */ -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; size_t strlength (const char * const); char foo(); diff --git a/gcc/testsuite/gcc.c-torture/compile/20030902-1.c b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c index 443b43921b8..56c2650b86b 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20030902-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20030902-1.c @@ -1,4 +1,4 @@ -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef unsigned long int reg_syntax_t; struct re_pattern_buffer { diff --git a/gcc/testsuite/gcc.c-torture/compile/20060202-1.c b/gcc/testsuite/gcc.c-torture/compile/20060202-1.c index 9d440741c6b..d16e7b7c5ad 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20060202-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20060202-1.c @@ -1,4 +1,4 @@ -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef const struct objc_selector { void *sel_id; diff --git a/gcc/testsuite/gcc.c-torture/compile/20080613-1.c b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c index f64964e7740..20e3878420e 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20080613-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c @@ -1,7 +1,7 @@ /* PR middle-end/36520 */ /* Testcase by Richard Guenther <rguenth@gcc.gnu.org> */ -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef unsigned short int sa_family_t; struct cmsghdr { size_t cmsg_len; diff --git a/gcc/testsuite/gcc.c-torture/compile/20090518-1.c b/gcc/testsuite/gcc.c-torture/compile/20090518-1.c new file mode 100644 index 00000000000..709504c405a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090518-1.c @@ -0,0 +1,6 @@ +float +foo(int i) +{ + int j = i == 42; + return *(float *)&j; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20090519-1.c b/gcc/testsuite/gcc.c-torture/compile/20090519-1.c new file mode 100644 index 00000000000..54add6b2e1a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20090519-1.c @@ -0,0 +1,11 @@ +typedef struct { int licensed; } __pmPDUInfo; +void __pmDecodeXtendError (int *); +void do_handshake(void) +{ + __pmPDUInfo *pduinfo; + int challenge; + __pmDecodeXtendError(&challenge); + pduinfo = (__pmPDUInfo *)&challenge; + *pduinfo = *pduinfo; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/920428-2.c b/gcc/testsuite/gcc.c-torture/compile/920428-2.c index 23f32a83a9d..f313b32986b 100644 --- a/gcc/testsuite/gcc.c-torture/compile/920428-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/920428-2.c @@ -41,7 +41,7 @@ extern struct _iobuf { short _flag; char _file; } _iob[]; -typedef unsigned long size_t; +typedef __SIZE_TYPE__ size_t; typedef char *va_list; struct _iobuf *fopen(const char *filename, const char *type); struct _iobuf *freopen(const char *filename, const char *type, struct _iobuf *stream); diff --git a/gcc/testsuite/gcc.c-torture/compile/980329-1.c b/gcc/testsuite/gcc.c-torture/compile/980329-1.c index d11b49b01c7..3b3fe27cf71 100644 --- a/gcc/testsuite/gcc.c-torture/compile/980329-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/980329-1.c @@ -1,4 +1,4 @@ -typedef unsigned long int size_t; +typedef __SIZE_TYPE__ size_t; struct re_pattern_buffer { unsigned char *buffer; diff --git a/gcc/testsuite/gcc.c-torture/compile/980816-1.c b/gcc/testsuite/gcc.c-torture/compile/980816-1.c index c56b6c9b92c..a79100fab57 100644 --- a/gcc/testsuite/gcc.c-torture/compile/980816-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/980816-1.c @@ -1,4 +1,4 @@ -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef void *XtPointer; typedef struct _WidgetRec *Widget; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32584.c b/gcc/testsuite/gcc.c-torture/compile/pr32584.c index 02799fc7449..403ea9b12fa 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr32584.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr32584.c @@ -1,5 +1,8 @@ -typedef long unsigned int size_t; -typedef long int __ssize_t; +typedef __SIZE_TYPE__ size_t; +/* Kludge */ +#define unsigned +typedef __SIZE_TYPE__ __ssize_t; +#undef unsigned typedef struct { } __mbstate_t; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33173.c b/gcc/testsuite/gcc.c-torture/compile/pr33173.c index 503c7afbdac..f599297e79a 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr33173.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr33173.c @@ -1,4 +1,4 @@ -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef struct { } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33382.c b/gcc/testsuite/gcc.c-torture/compile/pr33382.c index d83f74e42cc..c939cf7b772 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr33382.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr33382.c @@ -1,4 +1,4 @@ -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef struct { int disable; char *searchconfig[]; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34334.c b/gcc/testsuite/gcc.c-torture/compile/pr34334.c index 15f895f1cba..30bb782626f 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr34334.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr34334.c @@ -1,4 +1,4 @@ -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; __extension__ typedef long long int __quad_t; __extension__ typedef unsigned int __mode_t; __extension__ typedef __quad_t __off64_t; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34688.c b/gcc/testsuite/gcc.c-torture/compile/pr34688.c index 9891c72d93d..60e0f3c9f15 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr34688.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr34688.c @@ -1,4 +1,4 @@ -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef struct { } HashTable; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr35043.c b/gcc/testsuite/gcc.c-torture/compile/pr35043.c index 29c685207b9..a14379dc148 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr35043.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr35043.c @@ -1,4 +1,4 @@ -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; typedef struct { long double dat[2]; } gsl_complex_long_double; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37669.c b/gcc/testsuite/gcc.c-torture/compile/pr37669.c index 9b003cdf099..68e96c621cf 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr37669.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr37669.c @@ -1,6 +1,6 @@ /* This testcase used to fail because a miscompiled execute_fold_all_builtins. */ -typedef long unsigned int size_t; +typedef __SIZE_TYPE__ size_t; extern __inline __attribute__ ((__always_inline__)) int __attribute__ ((__nothrow__)) snprintf (char *__restrict __s, size_t __n, __const char *__restrict __fmt, ...) { diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40204.c b/gcc/testsuite/gcc.c-torture/compile/pr40204.c new file mode 100644 index 00000000000..3193284ff7a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40204.c @@ -0,0 +1,14 @@ +/* PR middle-end/40204 */ + +struct S +{ + unsigned int a : 4; + unsigned int b : 28; +} s; +char c; + +void +f (void) +{ + s.a = (c >> 4) & ~(1 << 4); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40233.c b/gcc/testsuite/gcc.c-torture/compile/pr40233.c new file mode 100644 index 00000000000..b3487edde74 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40233.c @@ -0,0 +1,10 @@ +typedef int aligned __attribute__((aligned(64))); +struct Frame { + aligned i; +}; + +void foo(struct Frame *p) +{ + aligned *q = &p->i; + *q = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40252.c b/gcc/testsuite/gcc.c-torture/compile/pr40252.c new file mode 100644 index 00000000000..f58e799b01f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40252.c @@ -0,0 +1,6 @@ +typedef unsigned int uint32_t; +static void IP(uint32_t v[2]) +{ + v[0] = ((v[0] << 1) | ((v[0] >> 31) & 1L)) & 0xffffffffL; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/20090527-1.c b/gcc/testsuite/gcc.c-torture/execute/20090527-1.c new file mode 100644 index 00000000000..d8e3711cdf6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20090527-1.c @@ -0,0 +1,38 @@ +typedef enum { POSITION_ASIS, POSITION_UNSPECIFIED } unit_position; + +typedef enum { STATUS_UNKNOWN, STATUS_UNSPECIFIED } unit_status; + +typedef struct +{ + unit_position position; + unit_status status; +} unit_flags; + +extern void abort (void); + +void +new_unit (unit_flags * flags) +{ + if (flags->status == STATUS_UNSPECIFIED) + flags->status = STATUS_UNKNOWN; + + if (flags->position == POSITION_UNSPECIFIED) + flags->position = POSITION_ASIS; + + switch (flags->status) + { + case STATUS_UNKNOWN: + break; + + default: + abort (); + } +} + +int main() +{ + unit_flags f; + f.status = STATUS_UNSPECIFIED; + new_unit (&f); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/align-nest.c b/gcc/testsuite/gcc.c-torture/execute/align-nest.c new file mode 100644 index 00000000000..2ff2952c70c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/align-nest.c @@ -0,0 +1,28 @@ + +void foo(int n) +{ + typedef struct + { + int value; + } myint; + + struct S + { + int i[n]; + unsigned int b:1; + myint mi; + } __attribute__ ((packed)) __attribute__ ((aligned (4))); + + struct S s[2]; + int k; + + for (k = 0; k < 2; k ++) + s[k].mi.value = 0; +} + +int main () +{ + foo (2); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/20050629-1.c b/gcc/testsuite/gcc.dg/20050629-1.c index 67d73f0eb66..0dd47f7024b 100644 --- a/gcc/testsuite/gcc.dg/20050629-1.c +++ b/gcc/testsuite/gcc.dg/20050629-1.c @@ -5,7 +5,7 @@ contains many warnings, but it exposes a copy propagation bug that is somewhat difficult to reproduce otherwise. */ -typedef long unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; extern void fancy_abort (const char *, int, const char *) __attribute__ ((__noreturn__)); typedef union tree_node *tree; enum tree_code { diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c index 1fef7947c9b..b77373d56bd 100644 --- a/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c +++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-converted-assigned.c @@ -9,5 +9,5 @@ int foo() return i; } -/* { dg-message "does break strict-aliasing" "" { target { *-*-* && lp64 } } 8 } */ -/* { dg-message "initialized" "" { target { *-*-* && lp64 } } 8 } */ +/* { dg-message "does break strict-aliasing" "" { target { *-*-* && lp64 } xfail *-*-* } 8 } */ +/* { dg-message "initialized" "" { target { *-*-* && lp64 } xfail *-*-* } 8 } */ diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c index fccc178d224..b90fb76c28b 100644 --- a/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c +++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c @@ -11,12 +11,12 @@ int foo() { float* r; if (flag) { - q = (float*) &x; /* { dg-message "initialized" } */ + q = (float*) &x; /* { dg-message "initialized" "" { xfail *-*-* } } */ } else { - q = (float*) &y; /* { dg-message "initialized" } */ + q = (float*) &y; /* { dg-message "initialized" "" { xfail *-*-* } } */ } - *q = 1.0; /* { dg-warning "does break strict-aliasing" } */ + *q = 1.0; /* { dg-warning "does break strict-aliasing" "" { xfail *-*-* } } */ return x; 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 f563c2774bd..4f5315df2c2 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c @@ -46,7 +46,7 @@ const char *dg_options[] = { "/* { dg-options \"%s-I%s\" } */\n", "/* { dg-options \"%s-I%s -Wno-abi\" } */\n", "/* { dg-options \"%s-I%s -mno-mmx -Wno-abi\" { target i?86-*-* x86_64-*-* } } */\n", -"/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n", +"/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* } } */\n", "/* { dg-options \"%s-I%s -mno-mmx -fno-common -Wno-abi\" { target i?86-*-darwin* x86_64-*-darwin* } } */\n", "/* { dg-options \"%s-I%s -mno-base-addresses\" { target mmix-*-* } } */\n", "/* { dg-options \"%s-I%s -mlongcalls -mtext-section-literals\" { target xtensa*-*-* } } */\n" diff --git a/gcc/testsuite/gcc.dg/dll-6.c b/gcc/testsuite/gcc.dg/dll-6.c new file mode 100644 index 00000000000..7907f40d1bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/dll-6.c @@ -0,0 +1,52 @@ +/* { dg-do link } */ +/* { dg-require-dll "" } */ +/* { dg-additional-sources "dll-6a.c" } */ +/* { dg-options "-w -O2 -std=gnu89" } */ + +/* Test that inline functions declared "dllexport" appear in object + files, even if they are not called. + + This behavior is required by the ARM C++ ABI: + + Exporting a function that can be inlined should force the + creation and export of an out-of-line copy of it. + + and should presumably also apply. + + Visual Studio 2005 also honors that rule. */ + +__declspec(dllexport) inline void i1() {} + +__declspec(dllexport) extern inline void e1() {} + +/* It is invalid to declare the function inline after its definition. */ +#if 0 +__declspec(dllexport) void i2() {} +inline void i2(); + +__declspec(dllexport) extern void e2() {} +inline void e2(); +#endif + +__declspec(dllexport) inline void i3() {} +void i3(); + +__declspec(dllexport) inline void e3() {} +extern void e3(); + +__declspec(dllexport) void i4(); +inline void i4() {}; + +__declspec(dllexport) extern void e4(); +inline void e4() {}; + +__declspec(dllexport) inline void i5(); +void i5() {}; + +__declspec(dllexport) inline void e5(); +extern void e5() {}; + +/* Make sure that just declaring the function -- without defining it + -- does not cause errors. */ +__declspec(dllexport) inline void i6(); +__declspec(dllexport) extern inline void e6(); diff --git a/gcc/testsuite/gcc.dg/dll-6a.c b/gcc/testsuite/gcc.dg/dll-6a.c new file mode 100644 index 00000000000..80caf321742 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dll-6a.c @@ -0,0 +1,21 @@ +extern void i1(); +extern void i3(); +extern void i4(); +extern void i5(); + +extern void e1(); +extern void e3(); +extern void e4(); +extern void e5(); + +int main () { + i1(); + i3(); + i4(); + i5(); + + e1(); + e3(); + e4(); + e5(); +} diff --git a/gcc/testsuite/gcc.dg/dll-7.c b/gcc/testsuite/gcc.dg/dll-7.c new file mode 100644 index 00000000000..c3a5957ae6b --- /dev/null +++ b/gcc/testsuite/gcc.dg/dll-7.c @@ -0,0 +1,52 @@ +/* { dg-do link } */ +/* { dg-require-dll "" } */ +/* { dg-additional-sources "dll-7a.c" } */ +/* { dg-options "-w -O2 -std=gnu99" } */ + +/* Test that inline functions declared "dllexport" appear in object + files, even if they are not called. + + This behavior is required by the ARM C++ ABI: + + Exporting a function that can be inlined should force the + creation and export of an out-of-line copy of it. + + and should presumably also apply. + + Visual Studio 2005 also honors that rule. */ + +__declspec(dllexport) inline void i1() {} + +__declspec(dllexport) extern inline void e1() {} + +/* It is invalid to declare the function inline after its definition. */ +#if 0 +__declspec(dllexport) void i2() {} +inline void i2(); + +__declspec(dllexport) extern void e2() {} +inline void e2(); +#endif + +__declspec(dllexport) inline void i3() {} +void i3(); + +__declspec(dllexport) inline void e3() {} +extern void e3(); + +__declspec(dllexport) void i4(); +inline void i4() {}; + +__declspec(dllexport) extern void e4(); +inline void e4() {}; + +__declspec(dllexport) inline void i5(); +void i5() {}; + +__declspec(dllexport) inline void e5(); +extern void e5() {}; + +/* Make sure that just declaring the function -- without defining it + -- does not cause errors. */ +__declspec(dllexport) inline void i6(); +__declspec(dllexport) extern inline void e6(); diff --git a/gcc/testsuite/gcc.dg/dll-7a.c b/gcc/testsuite/gcc.dg/dll-7a.c new file mode 100644 index 00000000000..80caf321742 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dll-7a.c @@ -0,0 +1,21 @@ +extern void i1(); +extern void i3(); +extern void i4(); +extern void i5(); + +extern void e1(); +extern void e3(); +extern void e4(); +extern void e5(); + +int main () { + i1(); + i3(); + i4(); + i5(); + + e1(); + e3(); + e4(); + e5(); +} diff --git a/gcc/testsuite/gcc.dg/falign-labels-1.c b/gcc/testsuite/gcc.dg/falign-labels-1.c new file mode 100644 index 00000000000..1e9661790e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/falign-labels-1.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-falign-labels=8" { target { ! { m68k*-*-* || fido*-*-* } } } } */ + +/* On ARMv7-A CPUs, this test resulted in incorrect code generation. + The code generated for the switch statement expected the jump table + to immediately follow the jump instruction, but -falign-labels + caused the label preceding the table to be aligned. */ +/* M68K and fido only support -falign-labels argument <= 2. */ + +volatile int x; + +int main(void) +{ + int y; + + x = 0; + + switch(x) + { + case 0: + y = 2 * x; + break; + case 1: + y = -3 * x; + break; + case 2: + y = x + 5; + break; + case 3: + y = x - 7; + break; + default: + break; + } + + x = y; + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ipa/modif-1.c b/gcc/testsuite/gcc.dg/ipa/modif-1.c index bc1706c5650..db6915a9d9e 100644 --- a/gcc/testsuite/gcc.dg/ipa/modif-1.c +++ b/gcc/testsuite/gcc.dg/ipa/modif-1.c @@ -15,12 +15,11 @@ void func4 (int *pi); void the_test (struct whatever u, struct whatever v, struct whatever w, struct whatever x, - int i, int j, int k, int l) + int i, int k, int l) { struct whatever *pw = &w; int *pk = &k; - j = l+3; v.first = 9; func1 (u); @@ -28,7 +27,6 @@ void the_test (struct whatever u, struct whatever v, func2 (pw); func2 (&x); func3 (i); - func3 (j); func4 (pk); func4 (&l); } @@ -40,5 +38,4 @@ void the_test (struct whatever u, struct whatever v, /* { dg-final { scan-ipa-dump-not "param 4\[^\\n\]*modified" "inline" } } */ /* { dg-final { scan-ipa-dump "param 5\[^\\n\]*modified" "inline" } } */ /* { dg-final { scan-ipa-dump "param 6\[^\\n\]*modified" "inline" } } */ -/* { dg-final { scan-ipa-dump "param 7\[^\\n\]*modified" "inline" } } */ /* { dg-final { cleanup-ipa-dump "inline" } } */ diff --git a/gcc/testsuite/gcc.dg/plugin/ggcplug-test-1.c b/gcc/testsuite/gcc.dg/plugin/ggcplug-test-1.c new file mode 100644 index 00000000000..74e68bb82ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/ggcplug-test-1.c @@ -0,0 +1,12 @@ +/* Test the ggcplug plugin. */ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +int main() +{ + int i=0, j=0; + for (i= 0; i<1000; i++) + if (i%8 == 0) + j++; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/plugin/ggcplug.c b/gcc/testsuite/gcc.dg/plugin/ggcplug.c new file mode 100644 index 00000000000..136404ae65f --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/ggcplug.c @@ -0,0 +1,109 @@ +/* This plugin tests the GGC related plugin events. */ +/* { dg-options "-O" } */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "basic-block.h" +#include "gimple.h" +#include "tree.h" +#include "tree-pass.h" +#include "intl.h" +#include "gcc-plugin.h" + + +/* The initialization routine exposed to and called by GCC. The spec of this + function is defined in gcc/gcc-plugin.h. + + Note that this function needs to be named exactly "plugin_init". */ + + +/* our callback is the same for all PLUGIN_GGC_START, + PLUGIN_GGC_MARKING, PLUGIN_GGC_END events; it just increments the + user_data which is an int */ +static void increment_callback (void *gcc_data, void *user_data); + +/* our counters are user_data */ +static int our_ggc_start_counter; +static int our_ggc_end_counter; +static int our_ggc_marking_counter; + +/* our empty GGC extra root table */ +static const struct ggc_root_tab our_xtratab[] = { + LAST_GGC_ROOT_TAB +}; + +int +plugin_init ((struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + const char *plugin_name = plugin_info->base_name; + int argc = plugin_info->argc; + struct plugin_argument *argv = plugin_info->argv; + if (!plugin_default_version_check (version, version)) + return 1; + /* Process the plugin arguments. This plugin takes the following arguments: + count-ggc-start count-ggc-end count-ggc-mark */ + for (i = 0; i < argc; ++i) + { + if (!strcmp (argv[i].key, "count-ggc-start")) + { + if (argv[i].value) + warning (0, G_ ("option '-fplugin-arg-%s-count-ggc-start=%s'" + " ignored (superfluous '=%s')"), + plugin_name, argv[i].value, argv[i].value); + else + register_callback ("ggcplug", + PLUGIN_GGC_START, + increment_callback, + (void *) &our_ggc_start_counter); + } + else if (!strcmp (argv[i].key, "count-ggc-end")) + { + if (argv[i].value) + warning (0, G_ ("option '-fplugin-arg-%s-count-ggc-end=%s'" + " ignored (superfluous '=%s')"), + plugin_name, argv[i].value, argv[i].value); + else + register_callback ("ggcplug", + PLUGIN_GGC_END, + increment_callback, + (void *) &our_ggc_end_counter); + } + else if (!strcmp (argv[i].key, "count-ggc-mark")) + { + if (argv[i].value) + warning (0, G_ ("option '-fplugin-arg-%s-count-ggc-mark=%s'" + " ignored (superfluous '=%s')"), + plugin_name, argv[i].value, argv[i].value); + else + register_callback ("ggcplug", + PLUGIN_GGC_MARKING, + increment_callback, + (void *) &our_ggc_marking_counter); + } + else if (!strcmp (argv[i].key, "test-extra-root")) + { + if (argv[i].value) + warning (0, G_ ("option '-fplugin-arg-%s-test-extra-root=%s'" + " ignored (superfluous '=%s')"), + plugin_name, argv[i].value, argv[i].value); + else + register_callback ("ggcplug", + PLUGIN_REGISTER_GGC_ROOTS, + NULL, + (void *) our_xtratab); + } + } +} + +static void +increment_callback (void *gcc_data, void *user_data) +{ + int *usercountptr = (int *) user_data; + gcc_assert (!gcc_data); + gcc_assert (user_data); + (*usercountptr)++; +} diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp index 93c0c5cb848..63ee74427f6 100644 --- a/gcc/testsuite/gcc.dg/plugin/plugin.exp +++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp @@ -47,7 +47,9 @@ load_lib plugin-support.exp # Specify the plugin source file and the associated test files in a list. # plugin_test_list={ {plugin1 test1 test2 ...} {plugin2 test1 ...} ... } set plugin_test_list [list \ - { selfassign.c self-assign-test-1.c self-assign-test-2.c } ] + { selfassign.c self-assign-test-1.c self-assign-test-2.c } \ + { ggcplug.c ggcplug-test-1.c } \ +] foreach plugin_test $plugin_test_list { # Replace each source file with its full-path name diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c index 6fbce83c01d..2bc1d861358 100644 --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c @@ -2,6 +2,7 @@ self-assignment statements. */ /* { dg-options "-O" } */ +#include "gcc-plugin.h" #include "config.h" #include "system.h" #include "coretypes.h" @@ -12,7 +13,6 @@ #include "tree.h" #include "tree-pass.h" #include "intl.h" -#include "gcc-plugin.h" /* Indicate whether to check overloaded operator '=', which is performed by @@ -294,10 +294,13 @@ static struct gimple_opt_pass pass_warn_self_assign = Note that this function needs to be named exactly "plugin_init". */ int -plugin_init (const char *plugin_name, struct plugin_gcc_version *version, - int argc, struct plugin_argument *argv) +plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) { struct plugin_pass pass_info; + const char *plugin_name = plugin_info->base_name; + int argc = plugin_info->argc; + struct plugin_argument *argv = plugin_info->argv; bool enabled = true; int i; diff --git a/gcc/testsuite/gcc.dg/pr33667.c b/gcc/testsuite/gcc.dg/pr33667.c index d3c039b51df..676c4a46dac 100644 --- a/gcc/testsuite/gcc.dg/pr33667.c +++ b/gcc/testsuite/gcc.dg/pr33667.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned long long int uint64_t; diff --git a/gcc/testsuite/gcc.dg/pr40172-1.c b/gcc/testsuite/gcc.dg/pr40172-1.c new file mode 100644 index 00000000000..a834a8a998e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr40172-1.c @@ -0,0 +1,31 @@ +/* PR middle-end/40172 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -W -Werror -Wlogical-op" } */ + +struct rtx_def; +typedef struct rtx_def *rtx; + +extern int foo; +extern int bar; +extern int xxx; + +int +test (void) +{ + if (((rtx) 0 != (rtx) 0) && xxx ? foo : bar) + return 1; + else if ((foo & 0) && xxx) + return 2; + else if (foo & 0) + return 3; + else if (0 && xxx) + return 4; + else if (0) + return 5; + if (((int) 0 != (int) 0) && bar ? foo : xxx) + return 6; + else if (0 != 0 && foo ? xxx : bar) + return 7; + else + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr40172-2.c b/gcc/testsuite/gcc.dg/pr40172-2.c new file mode 100644 index 00000000000..17aabb8b5f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr40172-2.c @@ -0,0 +1,16 @@ +/* PR middle-end/40172 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -W -Werror" } */ + +extern int xxx; + +#define XXX xxx + +int +test (void) +{ + if (!XXX && xxx) + return 4; + else + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr40172-3.c b/gcc/testsuite/gcc.dg/pr40172-3.c new file mode 100644 index 00000000000..ea74fce37c6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr40172-3.c @@ -0,0 +1,17 @@ +/* PR middle-end/40172 */ +/* { dg-do compile */ +/* { dg-xfail-if "" { "*-*-*" } { "*" } { "" } } */ +/* { dg-options "-Wall -W -Werror -Wlogical-op" } */ + +extern int xxx; + +#define XXX xxx + +int +test (void) +{ + if (!XXX && xxx) + return 4; + else + return 0; +} diff --git a/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c b/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c index ba91d69650d..59cebc52e96 100644 --- a/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c +++ b/gcc/testsuite/gcc.dg/prefetch-loop-arrays-1.c @@ -3,7 +3,7 @@ /* { dg-options "-O2 -fprefetch-loop-arrays -w" } */ /* { dg-options "-O2 -fprefetch-loop-arrays -march=i686 -msse -w" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ -typedef unsigned long size_t; +__extension__ typedef __SIZE_TYPE__ size_t; struct re_pattern_buffer { diff --git a/gcc/testsuite/gcc.dg/simd-1b.c b/gcc/testsuite/gcc.dg/simd-1b.c index 56d94b91c68..1e2b597b565 100644 --- a/gcc/testsuite/gcc.dg/simd-1b.c +++ b/gcc/testsuite/gcc.dg/simd-1b.c @@ -14,7 +14,7 @@ void hanneke () { /* Operators on compatible SIMD types. */ - a %= b; /* { dg-error "invalid operands to binary %" } */ + a %= b; c &= d; a |= b; c ^= d; diff --git a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c index 8e54632454e..4cb94afc5df 100644 --- a/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c +++ b/gcc/testsuite/gcc.dg/struct/wo_prof_escape_substr_pointer.c @@ -24,6 +24,8 @@ typedef struct int c; }str_with_substr_t; +int foo; + int main (void) { @@ -37,6 +39,8 @@ main (void) for (i=0; i < N; i++) A[i].sub_str->a = 5; + foo = A[56].sub_str->a; + return 0; } diff --git a/gcc/testsuite/gcc.dg/torture/pr39204.c b/gcc/testsuite/gcc.dg/torture/pr39204.c index 4604b7079d1..1389a52ec58 100644 --- a/gcc/testsuite/gcc.dg/torture/pr39204.c +++ b/gcc/testsuite/gcc.dg/torture/pr39204.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-w" } */ -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c index d5cabb0bd37..d72d133e154 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20041122-1.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -fdump-tree-dom2" } */ -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; extern void *xmalloc (size_t) __attribute__ ((__malloc__)); struct edge_def { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c index 5132aa3d69e..f7ebb33d2a5 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c @@ -27,3 +27,4 @@ inline_me_too (void) } /* { dg-final { scan-tree-dump-times "Inlining inline_me " 1 "einline2"} } */ /* { dg-final { scan-tree-dump-times "Inlining inline_me_too " 1 "einline2"} } */ +/* { dg-final { cleanup-tree-dump "einline2" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c b/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c index a135bcff238..8fa2ed2ca1f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c @@ -2,7 +2,7 @@ /* { dg-options "-O2 -ftree-loop-distribution" } */ #define NULL ((void *)0) -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; extern void *foo(size_t nelem, size_t elsize); extern void bar (char*, ...); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c b/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c index 79039066808..fac6cd3b806 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr38250.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -ftree-loop-distribution" } */ -typedef long unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; typedef struct { long dat[2]; } gsl_complex_long_double; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr40087.c b/gcc/testsuite/gcc.dg/tree-ssa/pr40087.c new file mode 100644 index 00000000000..22e2b629ed7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr40087.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-options "-O1 " } */ + +extern void abort (void); + +static void __attribute__((always_inline)) +reverse(int *first, int *last) +{ + if (first == last--) + return; + while (first != last) + { + int t = *first; + *first = *last; + *last = t; + if (++first == last--) + break; + } +} + +int main() +{ + int seq[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + + reverse(seq, seq + 8); + if (seq[3] != 5 || seq[4] != 4) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sra-2.c b/gcc/testsuite/gcc.dg/tree-ssa/sra-2.c index ec30bc904d7..177c4bcace4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/sra-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/sra-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-optimized --param sra-max-structure-size=32" } */ +/* { dg-options "-O1 -fno-tree-fre -fdump-tree-optimized --param sra-max-structure-size=32" } */ /* Test for SRA. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c index dd0da7913dc..bce2c315a66 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-10.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O -w -fdump-tree-dse-vops" } */ -typedef unsigned int size_t; +__extension__ typedef __SIZE_TYPE__ size_t; typedef struct _IO_FILE FILE; typedef struct { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c index 24b58ee941a..81b82fe4880 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-14.c @@ -8,6 +8,7 @@ struct Foo void *data; double size; }; +void bar(double *); void foo(double (*q)[4]) { struct Foo tmp1; @@ -23,6 +24,7 @@ void foo(double (*q)[4]) this store to tmp1 here. */ tmp1.size -= 1.0; } + bar(a); } /* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c index a557f27f319..d24cd1e4c38 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-15.c @@ -8,6 +8,7 @@ struct Foo void *data; double size; }; +void bar(double *); void foo(double (*q)[4]) { struct Foo tmp1; @@ -22,6 +23,7 @@ void foo(double (*q)[4]) this store to tmp1 here. */ tmp1.size -= 1.0; } + bar(a); } /* { dg-final { scan-tree-dump "Replaced" "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-24.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-24.c new file mode 100644 index 00000000000..705993a4fb3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-24.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-fre" } */ + +int foo(void) +{ + int a[16] = {}; + return a[3]; +} + +int bar(void) +{ + int a[16]; + __builtin_memset (a, 0, sizeof(a)); + return a[3]; +} + +struct X { int i; }; +int baz(void) +{ + struct X a,b; + a.i = 0; + b = a; + return b.i; +} + +int bazzoo (void) +{ + struct X b, a = {}; + b = a; + return b.i; +} + +/* { dg-final { scan-tree-dump-times "= 0;" 5 "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-25.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-25.c new file mode 100644 index 00000000000..f7f99bf74f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-25.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-fre" } */ + +struct X { int i; int j; }; +void bar (struct X *); +int foo (struct X *p) +{ + struct X x; + p->i = 1; + x = *p; + x.j = 2; + return p->i - x.i; +} + +/* We should optimize this to return 0. */ + +/* { dg-final { scan-tree-dump "= 0;" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-26.c new file mode 100644 index 00000000000..144d146b935 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-26.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-fre-details" } */ + +union U { + float f; + int i; +}; + +int foo (union U *p) +{ + union U u; + p->f = 0.0; + u = *p; + return u.i; +} + +/* { dg-final { scan-tree-dump "Replaced u.i with 0 in" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-1.c new file mode 100644 index 00000000000..57e5665247d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-1.c @@ -0,0 +1,62 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 32 + +unsigned int out[N*8]; +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + +__attribute__ ((noinline)) int +main1 (int dummy) +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[0]; + + for (i = 0; i < N; i++) + { + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + /* Avoid loop vectorization. */ + if (dummy == 32) + abort (); + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*8] != in[i*8] + || out[i*8 + 1] != in[i*8 + 1] + || out[i*8 + 2] != in[i*8 + 2] + || out[i*8 + 3] != in[i*8 + 3] + || out[i*8 + 4] != in[i*8 + 4] + || out[i*8 + 5] != in[i*8 + 5] + || out[i*8 + 6] != in[i*8 + 6] + || out[i*8 + 7] != in[i*8 + 7]) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (33); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-10.c b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c new file mode 100644 index 00000000000..abac3c31a40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c @@ -0,0 +1,53 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[2]; + unsigned int a0, a1, a2, a3; + + /* Misaligned store. */ + a0 = *pin++ + 23; + a1 = *pin++ + 142; + a2 = *pin++ + 2; + a3 = *pin++ + 31; + + *pout++ = a0 * x; + *pout++ = a1 * y; + *pout++ = a2 * x; + *pout++ = a3 * y; + + /* Check results. */ + if (out[2] != (in[0] + 23) * x + || out[3] != (in[1] + 142) * y + || out[4] != (in[2] + 2) * x + || out[5] != (in[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { scan-tree-dump-times "unsupported alignment in basic block." 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-11.c b/gcc/testsuite/gcc.dg/vect/bb-slp-11.c new file mode 100644 index 00000000000..456f9618139 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-11.c @@ -0,0 +1,52 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[0]; + short a0, a1, a2, a3; + + a0 = *pin++ + 23; + a1 = *pin++ + 142; + a2 = *pin++ + 2; + a3 = *pin++ + 31; + + *pout++ = a0 * x; + *pout++ = a1 * y; + *pout++ = a2 * x; + *pout++ = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { scan-tree-dump-times "SLP with multiple types" 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-13.c b/gcc/testsuite/gcc.dg/vect/bb-slp-13.c new file mode 100644 index 00000000000..5005ae5019f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-13.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[2] + 2; + a3 = in[3] + 31; + + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-14.c b/gcc/testsuite/gcc.dg/vect/bb-slp-14.c new file mode 100644 index 00000000000..673a163c92f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-14.c @@ -0,0 +1,50 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + /* Not consecutive load with permutation - not supported. */ + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[1] + 2; + a3 = in[3] + 31; + + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[1] + 2) * x + || out[3] != (in[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-15.c b/gcc/testsuite/gcc.dg/vect/bb-slp-15.c new file mode 100644 index 00000000000..ba8bc757e86 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-15.c @@ -0,0 +1,54 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + if (x > y) + x = x + y; + else + y = x; + + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[2] + 2; + a3 = in[3] + 31; + + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-16.c b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c new file mode 100644 index 00000000000..16cd7a18d67 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c @@ -0,0 +1,71 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 32 + +unsigned int out[N*8]; +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned int arr[N] = {0,1,2,3,4,5,6,7}; + +__attribute__ ((noinline)) int +main1 (int dummy) +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[0]; + unsigned int a = 0; + + for (i = 0; i < N; i++) + { + *pout++ = *pin++ + a; + *pout++ = *pin++ + a; + *pout++ = *pin++ + a; + *pout++ = *pin++ + a; + *pout++ = *pin++ + a; + *pout++ = *pin++ + a; + *pout++ = *pin++ + a; + *pout++ = *pin++ + a; + if (arr[i] = i) + a = i; + else + a = 2; + } + + a = 0; + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*8] != in[i*8] + a + || out[i*8 + 1] != in[i*8 + 1] + a + || out[i*8 + 2] != in[i*8 + 2] + a + || out[i*8 + 3] != in[i*8 + 3] + a + || out[i*8 + 4] != in[i*8 + 4] + a + || out[i*8 + 5] != in[i*8 + 5] + a + || out[i*8 + 6] != in[i*8 + 6] + a + || out[i*8 + 7] != in[i*8 + 7] + a) + abort (); + + if (arr[i] = i) + a = i; + else + a = 2; + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (33); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-17.c b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c new file mode 100644 index 00000000000..36227391d2e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c @@ -0,0 +1,60 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int b[N]; +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + if (x > y) + x = x + y; + else + y = x; + + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[2] + 2; + a3 = in[3] + 31; + + b[0] = a0; + b[1] = a1; + + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y + || b[0] != in[0] + 23 + || b[1] != in[1] + 142) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-18.c b/gcc/testsuite/gcc.dg/vect/bb-slp-18.c new file mode 100644 index 00000000000..ab99f822aff --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-18.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[2] + 2; + a3 = in[3] + 31; + + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + + /* Check results. */ + if (out[0] != a0 * x + || out[1] != a1 * y + || out[2] != a2 * x + || out[3] != a3 * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-19.c b/gcc/testsuite/gcc.dg/vect/bb-slp-19.c new file mode 100644 index 00000000000..5ee83a1945e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-19.c @@ -0,0 +1,56 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned short out[N]; +unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned short *pin = &in[0]; + unsigned short *pout = &out[0]; + + /* A group of 9 shorts - unsupported for now. */ + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + + /* Check results. */ + if (out[0] != in[0] + || out[1] != in[1] + || out[2] != in[2] + || out[3] != in[3] + || out[4] != in[4] + || out[5] != in[5] + || out[6] != in[6] + || out[7] != in[7] + || out[8] != in[8]) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-2.c new file mode 100644 index 00000000000..1de31986829 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-2.c @@ -0,0 +1,59 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N*8]; +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + +__attribute__ ((noinline)) int +main1 (int dummy) +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[0]; + + for (i = 0; i < N*2; i++) + { + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + + /* Avoid loop vectorization. */ + if (dummy == 32) + abort (); + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*8] != in[i*8] + || out[i*8 + 1] != in[i*8 + 1] + || out[i*8 + 2] != in[i*8 + 2] + || out[i*8 + 3] != in[i*8 + 3] + || out[i*8 + 4] != in[i*8 + 4] + || out[i*8 + 5] != in[i*8 + 5] + || out[i*8 + 6] != in[i*8 + 6] + || out[i*8 + 7] != in[i*8 + 7]) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (33); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-20.c b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c new file mode 100644 index 00000000000..a40a629d1e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c @@ -0,0 +1,68 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +int b[N]; +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + if (x > y) + x = x + y; + else + y = x; + + /* Two SLP instances in the basic block, only one is supported for now, + the second one contains type conversion. */ + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[2] + 2; + a3 = in[3] + 31; + + b[0] = -a0; + b[1] = -a1; + b[2] = -a2; + b[3] = -a3; + + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y + || b[0] != -(in[0] + 23) + || b[1] != -(in[1] + 142) + || b[2] != -(in[2] + 2) + || b[3] != -(in[3] + 31)) + + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-21.c b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c new file mode 100644 index 00000000000..f0b4f6b1ac8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c @@ -0,0 +1,68 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int b[N]; +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + /* Two SLP instances in one basic block. */ + if (x > y) + x = x + y; + else + y = x; + + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[2] + 2; + a3 = in[3] + 31; + + b[0] = a0; + b[1] = a1; + b[2] = a2; + b[3] = a3; + + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y + || b[0] != (in[0] + 23) + || b[1] != (in[1] + 142) + || b[2] != (in[2] + 2) + || b[3] != (in[3] + 31)) + + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "slp" { target { ! {vect_int_mult } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-22.c b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c new file mode 100644 index 00000000000..3e6e685f118 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c @@ -0,0 +1,67 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int b[N]; +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int a0, a1, a2, a3; + + a0 = in[0] + 23; + a1 = in[1] + 142; + a2 = in[2] + 2; + a3 = in[3] + 31; + + if (x > y) + { + b[0] = a0; + b[1] = a1; + b[2] = a2; + b[3] = a3; + } + else + { + out[0] = a0 * x; + out[1] = a1 * y; + out[2] = a2 * x; + out[3] = a3 * y; + } + + /* Check results. */ + if ((x <= y + && (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y)) + || (x > y + && (b[0] != (in[0] + 23) + || b[1] != (in[1] + 142) + || b[2] != (in[2] + 2) + || b[3] != (in[3] + 31)))) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target { ! {vect_int_mult } } } } } */ +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 2 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-3.c b/gcc/testsuite/gcc.dg/vect/bb-slp-3.c new file mode 100644 index 00000000000..07ad7129ad7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-3.c @@ -0,0 +1,45 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[0]; + + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + + /* Check results. */ + if (out[0] != in[0] + || out[1] != in[1] + || out[2] != in[2] + || out[3] != in[3]) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-4.c b/gcc/testsuite/gcc.dg/vect/bb-slp-4.c new file mode 100644 index 00000000000..3e74fff29b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-4.c @@ -0,0 +1,45 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned short out[N]; +unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned short *pin = &in[0]; + unsigned short *pout = &out[0]; + + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + + /* Check results. */ + if (out[0] != in[0] + || out[1] != in[1] + || out[2] != in[2] + || out[3] != in[3]) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-5.c b/gcc/testsuite/gcc.dg/vect/bb-slp-5.c new file mode 100644 index 00000000000..0775d998c8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-5.c @@ -0,0 +1,53 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned short out[N]; +unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned short *pin = &in[0]; + unsigned short *pout = &out[0]; + + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + + /* Check results. */ + if (out[0] != in[0] + || out[1] != in[1] + || out[2] != in[2] + || out[3] != in[3] + || out[4] != in[4] + || out[5] != in[5] + || out[6] != in[6] + || out[7] != in[7]) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-6.c b/gcc/testsuite/gcc.dg/vect/bb-slp-6.c new file mode 100644 index 00000000000..d351691c2fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-6.c @@ -0,0 +1,51 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[0]; + unsigned int a0, a1, a2, a3; + + a0 = *pin++ + 23; + a1 = *pin++ + 142; + a2 = *pin++ + 2; + a3 = *pin++ + 31; + + *pout++ = a0 * x; + *pout++ = a1 * y; + *pout++ = a2 * x; + *pout++ = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-7.c b/gcc/testsuite/gcc.dg/vect/bb-slp-7.c new file mode 100644 index 00000000000..e3fac8d5dbe --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-7.c @@ -0,0 +1,52 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int *pin = &in[0]; + unsigned int *pout = &out[0]; + unsigned int a0, a1, a2, a3; + + /* Non isomorphic. */ + a0 = *pin++ + 23; + a1 = *pin++ + 142; + a2 = *pin++ + 2; + a3 = *pin++ * 31; + + *pout++ = a0 * x; + *pout++ = a1 * y; + *pout++ = a2 * x; + *pout++ = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] * 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-8.c b/gcc/testsuite/gcc.dg/vect/bb-slp-8.c new file mode 100644 index 00000000000..b0c1be77a3e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-8.c @@ -0,0 +1,50 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y, unsigned int *pin, unsigned int *pout) +{ + int i; + unsigned int a0, a1, a2, a3; + + /* pin and pout may alias. */ + a0 = *pin++ + 23; + a1 = *pin++ + 142; + a2 = *pin++ + 2; + a3 = *pin++ + 31; + + *pout++ = a0 * x; + *pout++ = a1 * y; + *pout++ = a2 * x; + *pout++ = a3 * y; + + /* Check results. */ + if (out[0] != (in[0] + 23) * x + || out[1] != (in[1] + 142) * y + || out[2] != (in[2] + 2) * x + || out[3] != (in[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3, &in[0], &out[0]); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-9.c b/gcc/testsuite/gcc.dg/vect/bb-slp-9.c new file mode 100644 index 00000000000..e8fe1507365 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-9.c @@ -0,0 +1,53 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int *pin = &in[1]; + unsigned int *pout = &out[0]; + unsigned int a0, a1, a2, a3; + + /* Misaligned load. */ + a0 = *pin++ + 23; + a1 = *pin++ + 142; + a2 = *pin++ + 2; + a3 = *pin++ + 31; + + *pout++ = a0 * x; + *pout++ = a1 * y; + *pout++ = a2 * x; + *pout++ = a3 * y; + + /* Check results. */ + if (out[0] != (in[1] + 23) * x + || out[1] != (in[2] + 142) * y + || out[2] != (in[3] + 2) * x + || out[3] != (in[4] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { scan-tree-dump-times "unsupported alignment in basic block." 1 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c b/gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c new file mode 100644 index 00000000000..d0b2ed4fff7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c @@ -0,0 +1,53 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 16 + +unsigned int out[N]; +unsigned int in1[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; +unsigned int in2[N] = {10,11,12,13,14,15,16,17,18,19,110,111,112,113,114,115}; + +__attribute__ ((noinline)) int +main1 (unsigned int x, unsigned int y) +{ + int i; + unsigned int *pin1 = &in1[0]; + unsigned int *pin2 = &in2[0]; + unsigned int *pout = &out[0]; + unsigned int a0, a1, a2, a3; + + a0 = *pin2++ - *pin1++ + 23; + a1 = *pin2++ - *pin1++ + 142; + a2 = *pin2++ - *pin1++ + 2; + a3 = *pin2++ - *pin1++ + 31; + + *pout++ = a0 * x; + *pout++ = a1 * y; + *pout++ = a2 * x; + *pout++ = a3 * y; + + /* Check results. */ + if (out[0] != (in2[0] - in1[0] + 23) * x + || out[1] != (in2[1] - in1[1] + 142) * y + || out[2] != (in2[2] - in1[2] + 2) * x + || out[3] != (in2[3] - in1[3] + 31) * y) + abort(); + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (2, 3); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect_int_mult } } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c index 13fbc82a42f..65e36fe8015 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c @@ -22,41 +22,53 @@ void bar (float *pa, float *pb, float *pc) __attribute__ ((noinline)) int -main1 (float *pa) +main1 (float *pa, float *pb, float *pc) { int i; - float pb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float pc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + + for (i = 0; i < N; i++) + { + b[i] = pb[i]; + c[i] = pc[i]; + } /* Vectorizable: pa may not alias pb and/or pc, even though their addresses escape. &pa would need to escape to point to escaped memory. */ for (i = 0; i < N; i++) { - pa[i] = pb[i] * pc[i]; + pa[i] = b[i] * c[i]; } - bar (pa,pb,pc); + bar (pa,b,c); return 0; } __attribute__ ((noinline)) int -main2 (float * pa) +main2 (float *pa, float *pb, float *pc) { int i; - float pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + + for (i = 0; i < N; i++) + { + b[i] = pb[i]; + c[i] = pc[i]; + } /* Vectorizable: pb and pc addresses do not escape. */ for (i = 0; i < N; i++) { - pa[i] = pb[i] * pc[i]; + pa[i] = b[i] * c[i]; } /* check results: */ for (i = 0; i < N; i++) { - if (pa[i] != (pb[i] * pc[i])) + if (pa[i] != (b[i] * c[i])) abort (); } @@ -67,14 +79,16 @@ int main (void) { int i; float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; + float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; check_vect (); - main1 (a); - main2 (a); + main1 (a,b,c); + main2 (a,b,c); return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr40238.c b/gcc/testsuite/gcc.dg/vect/pr40238.c new file mode 100644 index 00000000000..91cf0982439 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr40238.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ + +extern int xdo_rb_ctr_row( int *pos_code); + +int xgp_ahd_interpolate (int tile) +{ + int p[4]; + + switch (tile) { + default: + case 0: + case 1: + p[0] = 0; p[1] = 1; p[2] = 2; p[3] = 3; + break; + case 2: + case 3: + p[0] = 1; p[1] = 0; p[2] = 3; p[3] = 2; + break; + case 4: + case 5: + p[0] = 3; p[1] = 2; p[2] = 1; p[3] = 0; + break; + case 6: + case 7: + p[0] = 2; p[1] = 3; p[2] = 0; p[3] = 1; + break; + } + + xdo_rb_ctr_row(p); + xdo_rb_ctr_row(p); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/pr40254.c b/gcc/testsuite/gcc.dg/vect/pr40254.c new file mode 100644 index 00000000000..b890a449312 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr40254.c @@ -0,0 +1,39 @@ +#include <stdlib.h> +#include <stdarg.h> +#include "tree-vect.h" + +struct s +{ + int *x; + int x1; + int x2; + int x3; + int *y; +}; + +struct s arr[64] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + +__attribute__ ((noinline)) void +foo (int i, int *in_x, int *in_y) +{ + arr[i].x = in_x; + arr[i].y = in_y; +} + +int +main (void) +{ + int a, b; + + check_vect (); + + foo (5, &a, &b); + + if (arr[5].x != &a || arr[5].y != &b) + abort (); + + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-40.c b/gcc/testsuite/gcc.dg/vect/vect-40.c index a73d1551643..d2c17d1d97d 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-40.c +++ b/gcc/testsuite/gcc.dg/vect/vect-40.c @@ -26,13 +26,16 @@ void bar (float *pa, float *pb, float *pc) vect-46.c is similar to this one with one difference: the loop bound is unknown. */ +float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) + = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; +float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) + = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + __attribute__ ((noinline)) int main1 () { int i; float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); - float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; float *pa = a; float *pb = b; float *pc = c; diff --git a/gcc/testsuite/gcc.dg/vect/vect-42.c b/gcc/testsuite/gcc.dg/vect/vect-42.c index f1764e13ecf..29688638603 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-42.c +++ b/gcc/testsuite/gcc.dg/vect/vect-42.c @@ -27,15 +27,22 @@ void bar (float *pa, float *pb, float *pc) No aliasing problems. */ __attribute__ ((noinline)) int -main1 (float * __restrict__ pa) +main1 (float * __restrict__ pa, float *pb, float *pc) { + float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); int i; - float pb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float pc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + /* We also vectorize this loop. */ for (i = 0; i < N; i++) { - pa[i] = pb[i] * pc[i]; + b[i] = pb[i]; + c[i] = pc[i]; + } + + for (i = 0; i < N; i++) + { + pa[i] = b[i] * c[i]; } return 0; @@ -45,18 +52,18 @@ int main (void) { int i; float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); - float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; - float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; + float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; check_vect (); - main1 (a); + main1 (a,b,c); bar (a,b,c); return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_no_align || { ! vector_alignment_reachable } } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || { ! vector_alignment_reachable } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { vect_no_align || { ! vector_alignment_reachable } } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail {vect_no_align || { ! vector_alignment_reachable } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-46.c b/gcc/testsuite/gcc.dg/vect/vect-46.c index 2588a7b291e..d506d4329c0 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-46.c +++ b/gcc/testsuite/gcc.dg/vect/vect-46.c @@ -26,11 +26,16 @@ void bar (float *pa, float *pb, float *pc) vect-40.c is similar to this one with one difference: the loop bound is known. */ +float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) + = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; +float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) + = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + __attribute__ ((noinline)) int main1 (int n) { int i; - float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); float *pa = a; float *pb = b; float *pc = c; diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c index 7097e7a821e..d7713024224 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-76.c +++ b/gcc/testsuite/gcc.dg/vect/vect-76.c @@ -11,13 +11,13 @@ more involved than just an ssa_name. */ int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; +int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; __attribute__ ((noinline)) int main1 (int *pib) { int i; int ia[N+OFF]; - int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; for (i = OFF; i < N; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index d9c47f6c1c0..42435eb3130 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -122,6 +122,8 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \ "" $DEFAULT_VECTCFLAGS lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details" +set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS +lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details" # Main loop. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \ @@ -130,10 +132,14 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \ "" $DEFAULT_VECTCFLAGS dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \ "" $DEFAULT_VECTCFLAGS +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \ + "" $VECT_SLP_CFLAGS + #### Tests with special options global SAVED_DEFAULT_VECTCFLAGS set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS +set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS # --param vect-max-version-for-alias-checks=0 tests set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS @@ -262,6 +268,11 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \ "" $O1_VECTCFLAGS +# -fno-tree-reassoc +set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS +lappend VECT_SLP_CFLAGS "-fno-tree-reassoc" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \ + "" $VECT_SLP_CFLAGS # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/gcc.dg/vector-4.c b/gcc/testsuite/gcc.dg/vector-4.c new file mode 100644 index 00000000000..7964a881f4a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vector-4.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +#define vector __attribute__((vector_size(4*sizeof(int)) )) + +vector int a, b, c; + + +/* Test that remainder works for vectors. */ +void f(void) +{ + a = b % c; +} diff --git a/gcc/testsuite/gcc.target/arm/neon-vmla-1.c b/gcc/testsuite/gcc.target/arm/neon-vmla-1.c new file mode 100644 index 00000000000..3592ab979ac --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/neon-vmla-1.c @@ -0,0 +1,10 @@ +/* { dg-require-effective-target arm_neon_hw } */ +/* { dg-options "-O2 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize" } */ +/* { dg-final { scan-assembler "vmla\\.f32" } } */ + +/* Verify that VMLA is used. */ +void f1(int n, float a, float x[], float y[]) { + int i; + for (i = 0; i < n; ++i) + y[i] = a * x[i] + y[i]; +} diff --git a/gcc/testsuite/gcc.target/arm/neon-vmls-1.c b/gcc/testsuite/gcc.target/arm/neon-vmls-1.c new file mode 100644 index 00000000000..1b3fcbbbbc9 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/neon-vmls-1.c @@ -0,0 +1,10 @@ +/* { dg-require-effective-target arm_neon_hw } */ +/* { dg-options "-O2 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize" } */ +/* { dg-final { scan-assembler "vmls\\.f32" } } */ + +/* Verify that VMLS is used. */ +void f1(int n, float a, float x[], float y[]) { + int i; + for (i = 0; i < n; ++i) + y[i] = y[i] - a * x[i]; +} diff --git a/gcc/testsuite/gcc.target/arm/thumb2-mul-space-2.c b/gcc/testsuite/gcc.target/arm/thumb2-mul-space-2.c new file mode 100644 index 00000000000..b53df2fa12a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb2-mul-space-2.c @@ -0,0 +1,15 @@ +/* In Thumb-2 mode, when optimizing for size, generate a "muls" + instruction and use the resulting condition flags rather than a + separate compare instruction. */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "muls" } } */ +/* { dg-final { scan-assembler-not "cmp" } } */ + +int x; + +void f(int i, int j) +{ + if (i * j < 0) + x = 1; +} diff --git a/gcc/testsuite/gcc.target/arm/thumb2-mul-space-3.c b/gcc/testsuite/gcc.target/arm/thumb2-mul-space-3.c new file mode 100644 index 00000000000..143a6deee79 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb2-mul-space-3.c @@ -0,0 +1,17 @@ +/* In Thumb-2 mode, when optimizing for size, generate a "muls" + instruction and use the resulting condition flags rather than a + separate compare instruction. */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "muls" } } */ +/* { dg-final { scan-assembler-not "cmp" } } */ + +int x; + +int f(int i, int j) +{ + i = i * j; + if (i < 0) + x = 1; + return i; +} diff --git a/gcc/testsuite/gcc.target/arm/thumb2-mul-space.c b/gcc/testsuite/gcc.target/arm/thumb2-mul-space.c new file mode 100644 index 00000000000..8cf0cb40f41 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb2-mul-space.c @@ -0,0 +1,10 @@ +/* Use 16-bit multiply instruction in Thumb-2 mode when optimizing for + size. */ +/* { dg-options "-mthumb -Os" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler "muls" } } */ + +int f(int i, int j) +{ + return i * j; +} diff --git a/gcc/testsuite/gcc.target/arm/thumb2-mul-speed.c b/gcc/testsuite/gcc.target/arm/thumb2-mul-speed.c new file mode 100644 index 00000000000..03cccdb654b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb2-mul-speed.c @@ -0,0 +1,27 @@ +/* Do not use 16-bit multiply instructions in Thumb-2 mode when + optimizing for speed. */ +/* { dg-options "-mthumb -O2" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-final { scan-assembler-not "muls" } } */ + +int f(int i, int j) +{ + return i * j; +} + +int x; + +void g(int i, int j) +{ + if (i * j < 0) + x = 1; +} + +int h(int i, int j) +{ + i = i * j; + if (i < 0) + x = 1; + return i; +} + diff --git a/gcc/testsuite/gcc.target/i386/movbe-1.c b/gcc/testsuite/gcc.target/i386/movbe-1.c new file mode 100644 index 00000000000..391d4ad9814 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/movbe-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmovbe" } */ + +extern int x; + +void +foo (int i) +{ + x = __builtin_bswap32 (i); +} + +int +bar () +{ + return __builtin_bswap32 (x); +} + +/* { dg-final { scan-assembler-times "movbe\[ \t\]" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/movbe-2.c b/gcc/testsuite/gcc.target/i386/movbe-2.c new file mode 100644 index 00000000000..d898f20dce4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/movbe-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmovbe" } */ + +extern long long x; + +void +foo (long long i) +{ + x = __builtin_bswap64 (i); +} + +long long +bar () +{ + return __builtin_bswap64 (x); +} + +/* { dg-final { scan-assembler-times "movbe\[ \t\]" 4 { target ilp32 } } } */ +/* { dg-final { scan-assembler-times "movbe\[ \t\]" 2 { target lp64 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr37216.c b/gcc/testsuite/gcc.target/i386/pr37216.c new file mode 100644 index 00000000000..5c847a70cfb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr37216.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -msse2" } */ +/* { dg-options "-O3 -msse2 -mpe-aligned-commons" { target pe_aligned_commons } } */ + +#include "sse2-check.h" + +int iarr[64]; +int iint = 0; + +void +sse2_test (void) +{ + int i; + + for (i = 0; i < 64; i++) + iarr[i] = -2; +} diff --git a/gcc/testsuite/gcc.target/ia64/mfused-madd-vect.c b/gcc/testsuite/gcc.target/ia64/mfused-madd-vect.c new file mode 100644 index 00000000000..e166e85daed --- /dev/null +++ b/gcc/testsuite/gcc.target/ia64/mfused-madd-vect.c @@ -0,0 +1,33 @@ +/* { dg-do compile */ +/* { dg-options "-O2 -ftree-vectorize" } */ +/* { dg-final { scan-assembler-not "fpmpy" } } */ + +/* fpma and fpms will show in either way because there are no + specific vector add/sub instructions. So we just check for fpmpy. */ + +#define N 16 +extern bar(float *, float *, float *, float *); +void foo() +{ + int i; + float a[N], b[N], c[N], d[N]; + bar(a,b,c,d); + for (i = 0; i < N; i++) { + a[i] = b[i] + c[i] * d[i]; + } + bar(a,b,c,d); +#if 0 + for (i = 0; i < N; i++) { + a[i] = b[i] - c[i] * d[i]; + } + bar(a,b,c,d); +#endif + for (i = 0; i < N; i++) { + a[i] = b[i] * c[i] + d[i]; + } + bar(a,b,c,d); + for (i = 0; i < N; i++) { + a[i] = b[i] * c[i] - d[i]; + } + bar(a,b,c,d); +} diff --git a/gcc/testsuite/gcc.target/ia64/mfused-madd.c b/gcc/testsuite/gcc.target/ia64/mfused-madd.c new file mode 100644 index 00000000000..8ecb31f0dd3 --- /dev/null +++ b/gcc/testsuite/gcc.target/ia64/mfused-madd.c @@ -0,0 +1,64 @@ +/* { dg-do compile */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "fmpy" } } */ +/* { dg-final { scan-assembler-not "fadd" } } */ +/* { dg-final { scan-assembler-not "fsub" } } */ +/* { dg-final { scan-assembler "fma" } } */ +/* { dg-final { scan-assembler "fms" } } */ +/* { dg-final { scan-assembler "fnma" } } */ + +float foo01(float a, float b, float c) {return (a + b * c);} +float foo02(float a, float b, float c) {return (a - b * c);} +float foo03(float a, float b, float c) {return (a * b + c);} +float foo04(float a, float b, float c) {return (a * b - c);} + +double foo05(double a, double b, double c) {return (a + b * c);} +double foo06(double a, double b, double c) {return (a - b * c);} +double foo07(double a, double b, double c) {return (a * b + c);} +double foo08(double a, double b, double c) {return (a * b - c);} + +__float80 foo09(__float80 a, __float80 b, __float80 c) {return (a + b * c);} +__float80 foo10(__float80 a, __float80 b, __float80 c) {return (a - b * c);} +__float80 foo11(__float80 a, __float80 b, __float80 c) {return (a * b + c);} +__float80 foo12(__float80 a, __float80 b, __float80 c) {return (a * b - c);} + + + +float foo20(double a, double b, double c) {return (float) (a + b * c);} +float foo21(double a, double b, double c) {return (float) (a - b * c);} +float foo22(double a, double b, double c) {return (float) (a * b + c);} +float foo23(double a, double b, double c) {return (float) (a * b - c);} + +float foo24(__float80 a, __float80 b, __float80 c) {return (float) (a + b * c);} +float foo25(__float80 a, __float80 b, __float80 c) {return (float) (a - b * c);} +float foo26(__float80 a, __float80 b, __float80 c) {return (float) (a * b + c);} +float foo27(__float80 a, __float80 b, __float80 c) {return (float) (a * b - c);} + +double foo28(__float80 a, __float80 b, __float80 c) {return (double) (a + b * c);} +double foo29(__float80 a, __float80 b, __float80 c) {return (double) (a - b * c);} +double foo30(__float80 a, __float80 b, __float80 c) {return (double) (a * b + c);} +double foo31(__float80 a, __float80 b, __float80 c) {return (double) (a * b - c);} + + +float foo001(float a, float b, double c) { return (a + b * c); } +float foo002(float a, float b, double c) { return (a - b * c); } + +float foo005(float a, double b, double c) { return (a + b * c); } +float foo006(float a, double b, double c) { return (a - b * c); } +float foo007(float a, double b, double c) { return (a * b + c); } +float foo008(float a, double b, double c) { return (a * b - c); } + +double foo009(double a, float b, double c) { return (a + b * c); } +double foo010(double a, float b, double c) { return (a - b * c); } +double foo011(double a, float b, double c) { return (a * b + c); } +double foo012(double a, float b, double c) { return (a * b - c); } + +float foo013(float a, double b, __float80 c) { return (a + b * c); } +float foo014(float a, double b, __float80 c) { return (a - b * c); } +float foo017(double a, float b, __float80 c) { return (a + b * c); } +float foo018(double a, float b, __float80 c) { return (a - b * c); } + +float foo021(float a, __float80 b, double c) { return (a + b * c); } +float foo022(float a, __float80 b, double c) { return (a - b * c); } +float foo023(float a, __float80 b, double c) { return (a * b + c); } +float foo024(float a, __float80 b, double c) { return (a * b - c); } diff --git a/gcc/testsuite/gcc.target/ia64/mno-fused-madd-vect.c b/gcc/testsuite/gcc.target/ia64/mno-fused-madd-vect.c new file mode 100644 index 00000000000..0e24bf6cda8 --- /dev/null +++ b/gcc/testsuite/gcc.target/ia64/mno-fused-madd-vect.c @@ -0,0 +1,31 @@ +/* { dg-do compile */ +/* { dg-options "-O2 -mno-fused-madd -ftree-vectorize" } */ +/* { dg-final { scan-assembler "fpmpy" } } */ + +/* fpma and fpms will show in either way because there are no + specific vector add/sub instructions. So we just check for fpmpy. */ + +#define N 16 +extern bar(float *, float *, float *, float *); +void foo() +{ + int i; + float a[N], b[N], c[N], d[N]; + bar(a,b,c,d); + for (i = 0; i < N; i++) { + a[i] = b[i] + c[i] * d[i]; + } + bar(a,b,c,d); + for (i = 0; i < N; i++) { + a[i] = b[i] - c[i] * d[i]; + } + bar(a,b,c,d); + for (i = 0; i < N; i++) { + a[i] = b[i] * c[i] + d[i]; + } + bar(a,b,c,d); + for (i = 0; i < N; i++) { + a[i] = b[i] * c[i] - d[i]; + } + bar(a,b,c,d); +} diff --git a/gcc/testsuite/gcc.target/ia64/mno-fused-madd.c b/gcc/testsuite/gcc.target/ia64/mno-fused-madd.c new file mode 100644 index 00000000000..d8ccc947681 --- /dev/null +++ b/gcc/testsuite/gcc.target/ia64/mno-fused-madd.c @@ -0,0 +1,64 @@ +/* { dg-do compile */ +/* { dg-options "-O2 -mno-fused-madd" } */ +/* { dg-final { scan-assembler-not "fma" } } */ +/* { dg-final { scan-assembler-not "fms" } } */ +/* { dg-final { scan-assembler-not "fnma" } } */ +/* { dg-final { scan-assembler "fmpy" } } */ +/* { dg-final { scan-assembler "fadd" } } */ +/* { dg-final { scan-assembler "fsub" } } */ + +float foo01(float a, float b, float c) {return (a + b * c);} +float foo02(float a, float b, float c) {return (a - b * c);} +float foo03(float a, float b, float c) {return (a * b + c);} +float foo04(float a, float b, float c) {return (a * b - c);} + +double foo05(double a, double b, double c) {return (a + b * c);} +double foo06(double a, double b, double c) {return (a - b * c);} +double foo07(double a, double b, double c) {return (a * b + c);} +double foo08(double a, double b, double c) {return (a * b - c);} + +__float80 foo09(__float80 a, __float80 b, __float80 c) {return (a + b * c);} +__float80 foo10(__float80 a, __float80 b, __float80 c) {return (a - b * c);} +__float80 foo11(__float80 a, __float80 b, __float80 c) {return (a * b + c);} +__float80 foo12(__float80 a, __float80 b, __float80 c) {return (a * b - c);} + + + +float foo20(double a, double b, double c) {return (float) (a + b * c);} +float foo21(double a, double b, double c) {return (float) (a - b * c);} +float foo22(double a, double b, double c) {return (float) (a * b + c);} +float foo23(double a, double b, double c) {return (float) (a * b - c);} + +float foo24(__float80 a, __float80 b, __float80 c) {return (float) (a + b * c);} +float foo25(__float80 a, __float80 b, __float80 c) {return (float) (a - b * c);} +float foo26(__float80 a, __float80 b, __float80 c) {return (float) (a * b + c);} +float foo27(__float80 a, __float80 b, __float80 c) {return (float) (a * b - c);} + +double foo28(__float80 a, __float80 b, __float80 c) {return (double) (a + b * c);} +double foo29(__float80 a, __float80 b, __float80 c) {return (double) (a - b * c);} +double foo30(__float80 a, __float80 b, __float80 c) {return (double) (a * b + c);} +double foo31(__float80 a, __float80 b, __float80 c) {return (double) (a * b - c);} + + +float foo001(float a, float b, double c) { return (a + b * c); } +float foo002(float a, float b, double c) { return (a - b * c); } + +float foo005(float a, double b, double c) { return (a + b * c); } +float foo006(float a, double b, double c) { return (a - b * c); } +float foo007(float a, double b, double c) { return (a * b + c); } +float foo008(float a, double b, double c) { return (a * b - c); } + +double foo009(double a, float b, double c) { return (a + b * c); } +double foo010(double a, float b, double c) { return (a - b * c); } +double foo011(double a, float b, double c) { return (a * b + c); } +double foo012(double a, float b, double c) { return (a * b - c); } + +float foo013(float a, double b, __float80 c) { return (a + b * c); } +float foo014(float a, double b, __float80 c) { return (a - b * c); } +float foo017(double a, float b, __float80 c) { return (a + b * c); } +float foo018(double a, float b, __float80 c) { return (a - b * c); } + +float foo021(float a, __float80 b, double c) { return (a + b * c); } +float foo022(float a, __float80 b, double c) { return (a - b * c); } +float foo023(float a, __float80 b, double c) { return (a * b + c); } +float foo024(float a, __float80 b, double c) { return (a * b - c); } diff --git a/gcc/testsuite/gcc.target/m68k/tls-gd-xgot.c b/gcc/testsuite/gcc.target/m68k/tls-gd-xgot.c new file mode 100644 index 00000000000..2a4900b5a08 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-gd-xgot.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -fpic -mxgot" } */ +/* { dg-final { scan-assembler "#foo@TLSGD,\%\[ad\]\[0-7\]" } } */ +/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */ + +extern int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-gd.c b/gcc/testsuite/gcc.target/m68k/tls-gd.c new file mode 100644 index 00000000000..2b69fbdc1b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-gd.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-final { scan-assembler "foo@TLSGD\\(\%a5\\)" } } */ +/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */ + +extern int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-ie-xgot.c b/gcc/testsuite/gcc.target/m68k/tls-ie-xgot.c new file mode 100644 index 00000000000..d3fbfdaa4b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-ie-xgot.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -mxgot" } */ +/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */ +/* { dg-final { scan-assembler "#foo@TLSIE,\%\[ad\]\[0-7\]" } } */ + +extern int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-ie.c b/gcc/testsuite/gcc.target/m68k/tls-ie.c new file mode 100644 index 00000000000..2661f9fc053 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-ie.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */ +/* { dg-final { scan-assembler "foo@TLSIE\\(\%a5\\)" } } */ + +extern int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-ld-xgot-xtls.c b/gcc/testsuite/gcc.target/m68k/tls-ld-xgot-xtls.c new file mode 100644 index 00000000000..4817de01d44 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-ld-xgot-xtls.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -fpic -mxgot -mxtls" } */ +/* { dg-final { scan-assembler "#foo@TLSLDM,\%\[ad\]\[0-7\]" } } */ +/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */ +/* { dg-final { scan-assembler "#foo@TLSLDO,\%\[ad\]\[0-7\]" } } */ + +static int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-ld-xgot.c b/gcc/testsuite/gcc.target/m68k/tls-ld-xgot.c new file mode 100644 index 00000000000..f95f7192855 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-ld-xgot.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -fpic -mxgot" } */ +/* { dg-final { scan-assembler "#foo@TLSLDM,\%\[ad\]\[0-7\]" } } */ +/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */ +/* { dg-final { scan-assembler "lea \\(foo@TLSLDO,\%a0\\)" } } */ + +static int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-ld-xtls.c b/gcc/testsuite/gcc.target/m68k/tls-ld-xtls.c new file mode 100644 index 00000000000..1bc3eaf7de5 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-ld-xtls.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -fpic -mxtls" } */ +/* { dg-final { scan-assembler "foo@TLSLDM\\(\%a5\\)" } } */ +/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */ +/* { dg-final { scan-assembler "#foo@TLSLDO,\%\[ad\]\[0-7\]" } } */ + +static int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-ld.c b/gcc/testsuite/gcc.target/m68k/tls-ld.c new file mode 100644 index 00000000000..556a11718ca --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-ld.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-final { scan-assembler "foo@TLSLDM\\(\%a5\\)" } } */ +/* { dg-final { scan-assembler "bsr.l __tls_get_addr@PLTPC" } } */ +/* { dg-final { scan-assembler "lea \\(foo@TLSLDO,\%a0\\)" } } */ + +static int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-le-xtls.c b/gcc/testsuite/gcc.target/m68k/tls-le-xtls.c new file mode 100644 index 00000000000..90061153f89 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-le-xtls.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2 -mxtls" } */ +/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */ +/* { dg-final { scan-assembler "#foo@TLSLE,\%\[ad\]\[0-7\]" } } */ + +static int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/m68k/tls-le.c b/gcc/testsuite/gcc.target/m68k/tls-le.c new file mode 100644 index 00000000000..1c0eab23886 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/tls-le.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! *-linux-* } { "*" } { "" } } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler "jsr __m68k_read_tp" } } */ +/* { dg-final { scan-assembler "lea \\(foo@TLSLE,\%a0\\)" } } */ + +static int __thread foo; + +int * +bar (void) +{ + return &foo; +} diff --git a/gcc/testsuite/gcc.target/mips/const-anchor-1.c b/gcc/testsuite/gcc.target/mips/const-anchor-1.c new file mode 100644 index 00000000000..66981671d02 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/const-anchor-1.c @@ -0,0 +1,10 @@ +/* Derive a constant (0x1233ffff) from an intermediate value + (0x1234000) used to build another constant. */ +/* { dg-options "-O" } */ +/* { dg-final { scan-assembler-not "0x12330000|305332224" } } */ +/* { dg-final { scan-assembler "addiu\t\\\$5,\\\$\[0-9\]*,-1" } } */ + +NOMIPS16 void f () +{ + g (0x12340001, 0x1233ffff); +} diff --git a/gcc/testsuite/gcc.target/mips/const-anchor-2.c b/gcc/testsuite/gcc.target/mips/const-anchor-2.c new file mode 100644 index 00000000000..ccb89bb766c --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/const-anchor-2.c @@ -0,0 +1,9 @@ +/* Derive a constant (0x30001) from another constant. */ +/* { dg-options "-O" } */ +/* { dg-final { scan-assembler-not "0x300000|196608" } } */ +/* { dg-final { scan-assembler "addiu\t\\\$5,\\\$\[0-9\]*,32763" } } */ + +NOMIPS16 void f () +{ + g (0x28006, 0x30001); +} diff --git a/gcc/testsuite/gcc.target/mips/extend-1.c b/gcc/testsuite/gcc.target/mips/extend-1.c new file mode 100644 index 00000000000..952d4a0932c --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/extend-1.c @@ -0,0 +1,14 @@ +/* { dg-options "-O -mgp64 isa=!octeon" } */ +/* { dg-final { scan-assembler-times "\tdsll\t" 5 } } */ +/* { dg-final { scan-assembler-times "\tdsra\t" 5 } } */ +/* { dg-final { scan-assembler-not "\tsll\t" } } */ + +#define TEST_CHAR(T, N) \ + NOMIPS16 T f##N (long long d, T *a, T *r) { T b = (char) d; *r = b + *a; } +#define TEST_SHORT(T, N) \ + NOMIPS16 T g##N (long long d, T *a, T *r) { T b = (short) d; *r = b + *a; } +#define TEST(T, N) TEST_CHAR (T, N) TEST_SHORT (T, N) + +TEST (int, 1); +TEST (long long, 2); +TEST_CHAR (short, 3); diff --git a/gcc/testsuite/gcc.target/mips/octeon-exts-2.c b/gcc/testsuite/gcc.target/mips/octeon-exts-2.c index fc5df639d02..42f2a3f8586 100644 --- a/gcc/testsuite/gcc.target/mips/octeon-exts-2.c +++ b/gcc/testsuite/gcc.target/mips/octeon-exts-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O -march=octeon -meb" } */ -/* { dg-final { scan-assembler-times "\texts\t" 4 } } */ +/* { dg-options "-O -march=octeon -meb -dp" } */ +/* Don't match exts in sign-extension. */ +/* { dg-final { scan-assembler-times "\texts\t\[^\\n\]*extv" 4 } } */ struct bar { diff --git a/gcc/testsuite/gcc.target/mips/octeon-exts-5.c b/gcc/testsuite/gcc.target/mips/octeon-exts-5.c index e7a4738b96f..6ec7ac7296f 100644 --- a/gcc/testsuite/gcc.target/mips/octeon-exts-5.c +++ b/gcc/testsuite/gcc.target/mips/octeon-exts-5.c @@ -1,7 +1,8 @@ /* -mel version of octeon-exts-2.c. */ /* { dg-do compile } */ -/* { dg-options "-O -march=octeon -mel" } */ -/* { dg-final { scan-assembler-times "\texts\t" 4 } } */ +/* { dg-options "-O -march=octeon -mel -dp" } */ +/* Don't match exts in sign-extension. */ +/* { dg-final { scan-assembler-times "\texts\t\[^\\n\]*extv" 4 } } */ struct bar { diff --git a/gcc/testsuite/gcc.target/mips/octeon-exts-6.c b/gcc/testsuite/gcc.target/mips/octeon-exts-6.c new file mode 100644 index 00000000000..d04e27331d9 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/octeon-exts-6.c @@ -0,0 +1,14 @@ +/* { dg-options "-O -march=octeon -mgp64" } */ +/* { dg-final { scan-assembler-times "\texts\t" 5 } } */ +/* { dg-final { scan-assembler-not "\t(dsll|dsra)\t" } } */ +/* { dg-final { scan-assembler-not "\tsll\t" } } */ + +#define TEST_CHAR(T, N) \ + NOMIPS16 T f##N (long long d, T *a, T *r) { T b = (char) d; *r = b + *a; } +#define TEST_SHORT(T, N) \ + NOMIPS16 T g##N (long long d, T *a, T *r) { T b = (short) d; *r = b + *a; } +#define TEST(T, N) TEST_CHAR (T, N) TEST_SHORT (T, N) + +TEST (int, 1); +TEST (long long, 2); +TEST_CHAR (short, 3); diff --git a/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S b/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S index 61b66e1490a..cb1e31ea785 100644 --- a/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S +++ b/gcc/testsuite/gcc.target/x86_64/abi/asm-support.S @@ -49,7 +49,9 @@ snapshot: .type snapshot_ret, @function snapshot_ret: movq %rdi, rdi(%rip) + subq $8, %rsp call *callthis(%rip) + addq $8, %rsp movq %rax, rax(%rip) movq %rdx, rdx(%rip) movdqu %xmm0, xmm_regs+0(%rip) diff --git a/gcc/testsuite/gfortran.dg/array_memset_2.f90 b/gcc/testsuite/gfortran.dg/array_memset_2.f90 index 58ce8fe6442..7805f7b9420 100644 --- a/gcc/testsuite/gfortran.dg/array_memset_2.f90 +++ b/gcc/testsuite/gfortran.dg/array_memset_2.f90 @@ -20,8 +20,8 @@ program test data c /2*1.0/ a(1,:) = 0. ! This can't be optimized to a memset. - b(1,:) = 0. ! This is optimized to memset. - c = 0. ! This is optimized to memset. + b(1,:) = 0. ! This is optimized to = {}. + c = 0. ! This is optimized to = {}. d(:,1) = 0. ! This can't be otimized to a memset. call bar(e) @@ -33,6 +33,6 @@ program test end program -! { dg-final { scan-tree-dump-times "memset" 2 "original" } } +! { dg-final { scan-tree-dump-times "= {}" 2 "original" } } ! { dg-final { cleanup-tree-dump "original" } } ! { dg-final { cleanup-modules "foo" } } diff --git a/gcc/testsuite/gfortran.dg/bound_4.f90 b/gcc/testsuite/gfortran.dg/bound_4.f90 index dd934519d53..b63ce9ec6a9 100644 --- a/gcc/testsuite/gfortran.dg/bound_4.f90 +++ b/gcc/testsuite/gfortran.dg/bound_4.f90 @@ -12,14 +12,14 @@ end program test subroutine ha0020(mf3) implicit none - integer xca(1), xda(1), mf3 + integer xca(2), xda(2), mf3 xca = 1 xda = -1 - xca(1:1) = xda(1:2:mf3) + xca(1:2:-1) = xda(1:2:mf3) - if (any (xca /= -1)) call abort + if (any (xca /= 1)) call abort if (any(xda(1:2:mf3) /= xda(1:0))) call abort if (size(xda(1:2:mf3)) /= 0) call abort if (any(shape(xda(1:2:mf3)) /= 0)) call abort diff --git a/gcc/testsuite/gfortran.dg/bounds_check_14.f90 b/gcc/testsuite/gfortran.dg/bounds_check_14.f90 index 0b7edfe565b..1e5a4aeeee3 100644 --- a/gcc/testsuite/gfortran.dg/bounds_check_14.f90 +++ b/gcc/testsuite/gfortran.dg/bounds_check_14.f90 @@ -13,14 +13,14 @@ end program test subroutine ha0020(mf3) implicit none - integer xca(1), xda(1), mf3 + integer xca(2), xda(2), mf3 xca = 1 xda = -1 - xca(1:1) = xda(1:2:mf3) + xca(1:2:-1) = xda(1:2:mf3) - if (any (xca /= -1)) call abort + if (any (xca /= 1)) call abort if (any(xda(1:2:mf3) /= xda(1:0))) call abort if (size(xda(1:2:mf3)) /= 0) call abort if (any(shape(xda(1:2:mf3)) /= 0)) call abort diff --git a/gcc/testsuite/gfortran.dg/bounds_check_fail_3.f90 b/gcc/testsuite/gfortran.dg/bounds_check_fail_3.f90 new file mode 100644 index 00000000000..0826b7d5efc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bounds_check_fail_3.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "foo" } + integer x(10), m, n + x = (/ (i, i = 1, 10) /) + m = -3 + n = -2 + x(7:1:m) = x(6:2:n) + if (any(x /= (/ 2, 2, 3, 4, 5, 6, 6, 8, 9, 10 /))) call abort() + x(8:1:m) = x(5:2:n) + end +! { dg-output "line 10 .* bound mismatch, .* dimension 1 .* array \'x\' \\\(3/2\\\)" } diff --git a/gcc/testsuite/gfortran.dg/bounds_check_fail_4.f90 b/gcc/testsuite/gfortran.dg/bounds_check_fail_4.f90 new file mode 100644 index 00000000000..dee3ca8d66e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/bounds_check_fail_4.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! { dg-options "-fbounds-check" } +! { dg-shouldfail "foo" } + integer x(10), m, n + x = (/ (i, i = 1, 10) /) + m = -3 + n = -2 + x(7:1:m) = x(1:3) + x(6:2:n) + if (any(x /= (/ 5, 2, 3, 6, 5, 6, 7, 8, 9, 10 /))) call abort() + x(8:1:m) = x(1:3) + x(5:2:n) + end +! { dg-output "line 10 .* bound mismatch, .* dimension 1 .* array \'x\' \\\(2/3\\\)" } diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4.f03 b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4.f03 new file mode 100644 index 00000000000..89b8666d7ae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4.f03 @@ -0,0 +1,115 @@ +! { dg-do run } +! { dg-additional-sources c_f_pointer_shape_tests_2_driver.c } +! Verify that the optional SHAPE parameter to c_f_pointer can be of any +! valid integer kind. We don't test all kinds here since it would be +! difficult to know what kinds are valid for the architecture we're running on. +! However, testing ones that should be different should be sufficient. +module c_f_pointer_shape_tests_4 + use, intrinsic :: iso_c_binding + implicit none +contains + subroutine test_long_long_1d(cPtr, num_elems) bind(c) + use, intrinsic :: iso_c_binding + type(c_ptr), value :: cPtr + integer(c_int), value :: num_elems + integer, dimension(:), pointer :: myArrayPtr + integer(c_long_long), dimension(1) :: shape + integer :: i + + shape(1) = num_elems + call c_f_pointer(cPtr, myArrayPtr, shape) + do i = 1, num_elems + if(myArrayPtr(i) /= (i-1)) call abort () + end do + end subroutine test_long_long_1d + + subroutine test_long_long_2d(cPtr, num_rows, num_cols) bind(c) + use, intrinsic :: iso_c_binding + type(c_ptr), value :: cPtr + integer(c_int), value :: num_rows + integer(c_int), value :: num_cols + integer, dimension(:,:), pointer :: myArrayPtr + integer(c_long_long), dimension(3) :: shape + integer :: i,j + + shape(1) = num_rows + shape(2) = -3; + shape(3) = num_cols + call c_f_pointer(cPtr, myArrayPtr, shape(1:3:2)) + do j = 1, num_cols + do i = 1, num_rows + if(myArrayPtr(i,j) /= ((j-1)*num_rows)+(i-1)) call abort () + end do + end do + end subroutine test_long_long_2d + + subroutine test_long_1d(cPtr, num_elems) bind(c) + use, intrinsic :: iso_c_binding + type(c_ptr), value :: cPtr + integer(c_int), value :: num_elems + integer, dimension(:), pointer :: myArrayPtr + integer(c_long), dimension(1) :: shape + integer :: i + + shape(1) = num_elems + call c_f_pointer(cPtr, myArrayPtr, shape) + do i = 1, num_elems + if(myArrayPtr(i) /= (i-1)) call abort () + end do + end subroutine test_long_1d + + subroutine test_int_1d(cPtr, num_elems) bind(c) + use, intrinsic :: iso_c_binding + type(c_ptr), value :: cPtr + integer(c_int), value :: num_elems + integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(1) :: shape + integer :: i + + shape(1) = num_elems + call c_f_pointer(cPtr, myArrayPtr, shape) + do i = 1, num_elems + if(myArrayPtr(i) /= (i-1)) call abort () + end do + end subroutine test_int_1d + + subroutine test_short_1d(cPtr, num_elems) bind(c) + use, intrinsic :: iso_c_binding + type(c_ptr), value :: cPtr + integer(c_int), value :: num_elems + integer, dimension(:), pointer :: myArrayPtr + integer(c_short), dimension(1) :: shape + integer :: i + + shape(1) = num_elems + call c_f_pointer(cPtr, myArrayPtr, shape) + do i = 1, num_elems + if(myArrayPtr(i) /= (i-1)) call abort () + end do + end subroutine test_short_1d + + subroutine test_mixed(cPtr, num_elems) bind(c) + use, intrinsic :: iso_c_binding + type(c_ptr), value :: cPtr + integer(c_int), value :: num_elems + integer, dimension(:), pointer :: myArrayPtr + integer(c_int), dimension(1) :: shape1 + integer(c_long_long), dimension(1) :: shape2 + integer :: i + + shape1(1) = num_elems + call c_f_pointer(cPtr, myArrayPtr, shape1) + do i = 1, num_elems + if(myArrayPtr(i) /= (i-1)) call abort () + end do + + nullify(myArrayPtr) + shape2(1) = num_elems + call c_f_pointer(cPtr, myArrayPtr, shape2) + do i = 1, num_elems + if(myArrayPtr(i) /= (i-1)) call abort () + end do + end subroutine test_mixed +end module c_f_pointer_shape_tests_4 +! { dg-final { cleanup-modules "c_f_pointer_shape_tests_4" } } + diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4_driver.c b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4_driver.c new file mode 100644 index 00000000000..1282beb12d7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_4_driver.c @@ -0,0 +1,46 @@ +#define NUM_ELEMS 10 +#define NUM_ROWS 2 +#define NUM_COLS 3 + +void test_long_long_1d(int *array, int num_elems); +void test_long_long_2d(int *array, int num_rows, int num_cols); +void test_long_1d(int *array, int num_elems); +void test_int_1d(int *array, int num_elems); +void test_short_1d(int *array, int num_elems); +void test_mixed(int *array, int num_elems); + +int main(int argc, char **argv) +{ + int my_array[NUM_ELEMS]; + int my_2d_array[NUM_ROWS][NUM_COLS]; + int i, j; + + for(i = 0; i < NUM_ELEMS; i++) + my_array[i] = i; + + for(i = 0; i < NUM_ROWS; i++) + for(j = 0; j < NUM_COLS; j++) + my_2d_array[i][j] = (i*NUM_COLS) + j; + + /* Test c_f_pointer where SHAPE is of type integer, kind=c_long_long. */ + test_long_long_1d(my_array, NUM_ELEMS); + + /* Test c_f_pointer where SHAPE is of type integer, kind=c_long_long. + The indices are transposed for Fortran. */ + test_long_long_2d(my_2d_array[0], NUM_COLS, NUM_ROWS); + + /* Test c_f_pointer where SHAPE is of type integer, kind=c_long. */ + test_long_1d(my_array, NUM_ELEMS); + + /* Test c_f_pointer where SHAPE is of type integer, kind=c_int. */ + test_int_1d(my_array, NUM_ELEMS); + + /* Test c_f_pointer where SHAPE is of type integer, kind=c_short. */ + test_short_1d(my_array, NUM_ELEMS); + + /* Test c_f_pointer where SHAPE is of type integer, kind=c_int and + kind=c_long_long. */ + test_mixed(my_array, NUM_ELEMS); + + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/c_kind_int128_test1.f03 b/gcc/testsuite/gfortran.dg/c_kind_int128_test1.f03 index 6be1ac20b64..b1919614b2e 100644 --- a/gcc/testsuite/gfortran.dg/c_kind_int128_test1.f03 +++ b/gcc/testsuite/gfortran.dg/c_kind_int128_test1.f03 @@ -2,7 +2,6 @@ ! { dg-options "-std=f2003" } ! { dg-require-effective-target fortran_integer_16 } ! -! Note: int_fast*_t currently not supported. subroutine c_kind_int128_1 use, intrinsic :: iso_c_binding @@ -10,15 +9,16 @@ subroutine c_kind_int128_1 integer(c_int128_t) :: a ! { dg-error "has no IMPLICIT type" } integer(c_int_least128_t) :: b ! { dg-error "has no IMPLICIT type" } -! integer(c_int_fast128_t) :: c - + integer(c_int_fast128_t) :: c ! { dg-error "has no IMPLICIT type" } + end subroutine c_kind_int128_1 + subroutine c_kind_int128_2 use, intrinsic :: iso_c_binding integer(c_int128_t) :: a ! { dg-error "has not been declared or is a variable" } integer(c_int_least128_t) :: b ! { dg-error "has not been declared or is a variable" } -! integer(c_int_fast128_t) :: c - + integer(c_int_fast128_t) :: c ! { dg-error "has not been declared or is a variable" } + end subroutine c_kind_int128_2 diff --git a/gcc/testsuite/gfortran.dg/c_kind_int128_test2.f03 b/gcc/testsuite/gfortran.dg/c_kind_int128_test2.f03 index 2f22b72d0be..4fe2dac2913 100644 --- a/gcc/testsuite/gfortran.dg/c_kind_int128_test2.f03 +++ b/gcc/testsuite/gfortran.dg/c_kind_int128_test2.f03 @@ -2,7 +2,7 @@ ! { dg-options "-std=gnu" } ! { dg-require-effective-target fortran_integer_16 } ! -! Note: int_fast*_t currently not supported. +! Note: int_fast128_t currently not supported. program c_kind_int128 use, intrinsic :: iso_c_binding diff --git a/gcc/testsuite/gfortran.dg/c_kind_params.f90 b/gcc/testsuite/gfortran.dg/c_kind_params.f90 index 871ae822b56..4176157887a 100644 --- a/gcc/testsuite/gfortran.dg/c_kind_params.f90 +++ b/gcc/testsuite/gfortran.dg/c_kind_params.f90 @@ -5,16 +5,16 @@ ! the -w option is needed to make f951 not report a warning for ! the -std=c99 option that the C file needs. ! -! Note: int_fast*_t currently not supported, cf. PR 448. module c_kind_params use, intrinsic :: iso_c_binding implicit none contains subroutine param_test(my_short, my_int, my_long, my_long_long, & - my_int8_t, my_int_least8_t, my_int16_t, & - my_int_least16_t, my_int32_t, my_int_least32_t, & - my_int64_t, my_int_least64_t, & + my_int8_t, my_int_least8_t, my_int_fast8_t, & + my_int16_t, my_int_least16_t, my_int_fast16_t, & + my_int32_t, my_int_least32_t, my_int_fast32_t, & + my_int64_t, my_int_least64_t, my_int_fast64_t, & my_intmax_t, my_intptr_t, my_float, my_double, my_long_double, & my_char, my_bool) bind(c) integer(c_short), value :: my_short @@ -23,16 +23,16 @@ contains integer(c_long_long), value :: my_long_long integer(c_int8_t), value :: my_int8_t integer(c_int_least8_t), value :: my_int_least8_t -! integer(c_int_fast8_t), value :: my_int_fast8_t + integer(c_int_fast8_t), value :: my_int_fast8_t integer(c_int16_t), value :: my_int16_t integer(c_int_least16_t), value :: my_int_least16_t -! integer(c_int_fast16_t), value :: my_int_fast16_t + integer(c_int_fast16_t), value :: my_int_fast16_t integer(c_int32_t), value :: my_int32_t integer(c_int_least32_t), value :: my_int_least32_t -! integer(c_int_fast32_t), value :: my_int_fast32_t + integer(c_int_fast32_t), value :: my_int_fast32_t integer(c_int64_t), value :: my_int64_t integer(c_int_least64_t), value :: my_int_least64_t -! integer(c_int_fast64_t), value :: my_int_fast64_t + integer(c_int_fast64_t), value :: my_int_fast64_t integer(c_intmax_t), value :: my_intmax_t integer(c_intptr_t), value :: my_intptr_t real(c_float), value :: my_float @@ -48,19 +48,19 @@ contains if(my_int8_t /= 1_c_int8_t) call abort() if(my_int_least8_t /= 2_c_int_least8_t ) call abort() - print *, 'c_int_fast8_t is: ', c_int_fast8_t + if(my_int_fast8_t /= 3_c_int_fast8_t ) call abort() if(my_int16_t /= 1_c_int16_t) call abort() if(my_int_least16_t /= 2_c_int_least16_t) call abort() - print *, 'c_int_fast16_t is: ', c_int_fast16_t + if(my_int_fast16_t /= 3_c_int_fast16_t ) call abort() if(my_int32_t /= 1_c_int32_t) call abort() if(my_int_least32_t /= 2_c_int_least32_t) call abort() - print *, 'c_int_fast32_t is: ', c_int_fast32_t + if(my_int_fast32_t /= 3_c_int_fast32_t ) call abort() if(my_int64_t /= 1_c_int64_t) call abort() if(my_int_least64_t /= 2_c_int_least64_t) call abort() - print *, 'c_int_fast64_t is: ', c_int_fast64_t + if(my_int_fast64_t /= 3_c_int_fast64_t ) call abort() if(my_intmax_t /= 1_c_intmax_t) call abort() if(my_intptr_t /= 0_c_intptr_t) call abort() diff --git a/gcc/testsuite/gfortran.dg/c_kinds.c b/gcc/testsuite/gfortran.dg/c_kinds.c index f79a70f7532..8fb658a98e8 100644 --- a/gcc/testsuite/gfortran.dg/c_kinds.c +++ b/gcc/testsuite/gfortran.dg/c_kinds.c @@ -3,15 +3,14 @@ #include <stdint.h> -/* Note: int_fast*_t is currently not supported, cf. PR 448 */ void param_test(short int my_short, int my_int, long int my_long, long long int my_long_long, int8_t my_int8_t, - int_least8_t my_int_least8_t, /*int_fast8_t my_int_fast8_t,*/ + int_least8_t my_int_least8_t, int_fast8_t my_int_fast8_t, int16_t my_int16_t, int_least16_t my_int_least16_t, - /*int_fast16_t my_int_fast16_t,*/ int32_t my_int32_t, - int_least32_t my_int_least32_t, /*int_fast32_t my_int_fast32_t,*/ + int_fast16_t my_int_fast16_t, int32_t my_int32_t, + int_least32_t my_int_least32_t, int_fast32_t my_int_fast32_t, int64_t my_int64_t, int_least64_t my_int_least64_t, - /*int_fast64_t my_int_fast64_t,*/ intmax_t my_intmax_t, + int_fast64_t my_int_fast64_t, intmax_t my_intmax_t, intptr_t my_intptr_t, float my_float, double my_double, long double my_long_double, char my_char, _Bool my_bool); @@ -43,10 +42,10 @@ int main(int argc, char **argv) _Bool my_bool = 1; param_test(my_short, my_int, my_long, my_long_long, my_int8_t, - my_int_least8_t, /*my_int_fast8_t, */ my_int16_t, - my_int_least16_t,/* my_int_fast16_t,*/ my_int32_t, - my_int_least32_t,/* my_int_fast32_t,*/ my_int64_t, - my_int_least64_t,/* my_int_fast64_t,*/ my_intmax_t, + my_int_least8_t, my_int_fast8_t, my_int16_t, + my_int_least16_t, my_int_fast16_t, my_int32_t, + my_int_least32_t, my_int_fast32_t, my_int64_t, + my_int_least64_t, my_int_fast64_t, my_intmax_t, my_intptr_t, my_float, my_double, my_long_double, my_char, my_bool); diff --git a/gcc/testsuite/gfortran.dg/default_format_1.f90 b/gcc/testsuite/gfortran.dg/default_format_1.f90 index 75f08af0f8d..e374f1b895d 100644 --- a/gcc/testsuite/gfortran.dg/default_format_1.f90 +++ b/gcc/testsuite/gfortran.dg/default_format_1.f90 @@ -1,7 +1,6 @@ -! { dg-do run { xfail spu-*-* *-*-cygwin* } } +! { dg-do run { xfail spu-*-* } } ! Test XFAILed on Darwin because the system's printf() lacks -! proper support for denormals. XFAILed on cygwin as the result -! is off by one bit in some cases. +! proper support for denormals. ! ! This tests that the default formats for formatted I/O of reals are ! wide enough and have enough precision, by checking that values can diff --git a/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 b/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 index adecd50c4d0..debc113ffc1 100644 --- a/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 +++ b/gcc/testsuite/gfortran.dg/default_format_denormal_1.f90 @@ -1,4 +1,4 @@ -! { dg-do run { xfail alpha*-*-* *-*-darwin[89]* *-*-freebsd* *-*-mingw* spu-*-* } } +! { dg-do run { xfail alpha*-*-* *-*-darwin[89]* *-*-freebsd* *-*-mingw* *-*-cygwin* spu-*-* } } ! Test XFAILed on these platforms because the system's printf() lacks ! proper support for denormals. ! diff --git a/gcc/testsuite/gfortran.dg/elemental_dependency_1.f90 b/gcc/testsuite/gfortran.dg/elemental_dependency_1.f90 index 3e1f67b9a71..d76fad642e3 100644 --- a/gcc/testsuite/gfortran.dg/elemental_dependency_1.f90 +++ b/gcc/testsuite/gfortran.dg/elemental_dependency_1.f90 @@ -40,14 +40,14 @@ PROGRAM main b = a CALL double((a(1:sz-1)), a(2:sz)) ! paren expression, temporary created -! { dg-final { scan-tree-dump-times "A\.17\\\[4\\\]" 1 "original" } } +! { dg-final { scan-tree-dump-times "A\.16\\\[4\\\]" 1 "original" } } IF (ANY(a /= (/ b(1), (2*b(i), i=1,sz-1) /))) CALL abort b = a CALL double(a(1:sz-1)+1, a(2:sz)) ! op expression, temporary created -! { dg-final { scan-tree-dump-times "A\.26\\\[4\\\]" 1 "original" } } +! { dg-final { scan-tree-dump-times "A\.25\\\[4\\\]" 1 "original" } } IF (ANY(a /= (/ b(1), (2*b(i)+2, i=1,sz-1) /))) CALL abort @@ -59,7 +59,7 @@ PROGRAM main b = a CALL double(self(a(1:sz-1)), a(2:sz)) ! function expr, temporary created -! { dg-final { scan-tree-dump-times "A\.38\\\[4\\\]" 1 "original" } } +! { dg-final { scan-tree-dump-times "A\.37\\\[4\\\]" 1 "original" } } IF (ANY(a /= (/ b(1), (2*b(i), i=1,sz-1) /))) CALL abort diff --git a/gcc/testsuite/gfortran.dg/erf_2.F90 b/gcc/testsuite/gfortran.dg/erf_2.F90 new file mode 100644 index 00000000000..d418d5fccb9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/erf_2.F90 @@ -0,0 +1,52 @@ +! { dg-do run } +! { dg-options "-fno-range-check -ffree-line-length-none " } +! { dg-options "-fno-range-check -ffree-line-length-none -mieee" { target alpha*-*-* } } */ +! +! Check that simplification functions and runtime library agree on ERF, +! ERFC and ERFC_SCALED. + +program test + implicit none + + interface check + procedure check_r4 + procedure check_r8 + end interface check + + real(kind=4) :: x4 + real(kind=8) :: x8 + +#define CHECK(a) \ + x8 = a ; x4 = a ; \ + call check(erf(real(a,kind=8)), erf(x8)) ; \ + call check(erf(real(a,kind=4)), erf(x4)) ; \ + call check(erfc(real(a,kind=8)), erfc(x8)) ; \ + call check(erfc(real(a,kind=4)), erfc(x4)) ; \ + call check(erfc_scaled(real(a,kind=8)), erfc_scaled(x8)) ; \ + call check(erfc_scaled(real(a,kind=4)), erfc_scaled(x4)) ; + + CHECK(0.0) + CHECK(0.9) + CHECK(1.9) + CHECK(19.) + CHECK(190.) + + CHECK(-0.0) + CHECK(-0.9) + CHECK(-1.9) + CHECK(-19.) + CHECK(-190.) + +contains + + subroutine check_r4 (a, b) + real(kind=4), intent(in) :: a, b + if (abs(a - b) > 10 * spacing(a)) call abort + end subroutine + + subroutine check_r8 (a, b) + real(kind=8), intent(in) :: a, b + if (abs(a - b) > 10 * spacing(a)) call abort + end subroutine + +end program test diff --git a/gcc/testsuite/gfortran.dg/erfc_scaled_2.f90 b/gcc/testsuite/gfortran.dg/erfc_scaled_2.f90 new file mode 100644 index 00000000000..97fa91fb915 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/erfc_scaled_2.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! +! Check that ERFC_SCALED can be used in initialization expressions + real, parameter :: r = 100*erfc_scaled(12.7) + integer(kind=int(r)) :: i + + real(kind=8), parameter :: r8 = 100*erfc_scaled(6.77) + integer(kind=int(r8)) :: j + + i = 12 + j = 8 + print *, i, j + + end diff --git a/gcc/testsuite/gfortran.dg/interface_27.f90 b/gcc/testsuite/gfortran.dg/interface_27.f90 new file mode 100644 index 00000000000..a3f1e4b2620 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_27.f90 @@ -0,0 +1,41 @@ +! { dg-do compile } +! +! PR 40039: Procedures as actual arguments: Check intent of arguments +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +module m + +contains + +subroutine a(x,f) + real :: x + interface + real function f(y) + real,intent(in) :: y + end function + end interface + print *,f(x) +end subroutine + +real function func(z) + real,intent(inout) :: z + func = z**2 +end function + +subroutine caller + interface + real function p(y) + real,intent(in) :: y + end function + end interface + pointer :: p + + call a(4.3,func) ! { dg-error "Type/rank mismatch in argument" } + p => func ! { dg-error "Interfaces don't match in procedure pointer assignment" } +end subroutine + +end module + +! { dg-final { cleanup-modules "m" } } + diff --git a/gcc/testsuite/gfortran.dg/interface_28.f90 b/gcc/testsuite/gfortran.dg/interface_28.f90 new file mode 100644 index 00000000000..53495a44348 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_28.f90 @@ -0,0 +1,39 @@ +! { dg-do compile } +! +! PR 36947: Attributes not fully checked comparing actual vs dummy procedure +! +! Contributed by Walter Spector <w6ws@earthlink.net> + +module testsub + contains + subroutine test(sub) + interface + subroutine sub(x) + integer, intent(in), optional:: x + end subroutine + end interface + print *, "In test(), about to call sub()" + call sub() + end subroutine +end module + +module sub + contains + subroutine subActual(x) + ! actual subroutine's argment is different in intent and optional + integer, intent(inout):: x + print *, "In subActual():", x + end subroutine +end module + +program interfaceCheck + use testsub + use sub + + integer :: a + + call test(subActual) ! { dg-error "Type/rank mismatch in argument" } +end program + +! { dg-final { cleanup-modules "sub testsub" } } + diff --git a/gcc/testsuite/gfortran.dg/nullify_4.f90 b/gcc/testsuite/gfortran.dg/nullify_4.f90 new file mode 100644 index 00000000000..48dcf72ca9d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nullify_4.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/40246 +! +! Check error recovery; was crashing before. +! +real, pointer :: ptr +nullify(ptr, mesh%coarser) ! { dg-error "Syntax error in NULLIFY statement" } +end diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 index 5c39f995d34..92d65423157 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 @@ -23,6 +23,7 @@ program bsp interface function p3(x) real(8) :: p3,x + intent(in) :: x end function p3 end interface diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_18.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_18.f90 new file mode 100644 index 00000000000..79cd68a513f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_18.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! +! PR 40176: Fortran 2003: Procedure pointers with array return value +! +! Original test case by Barron Bichon <barron.bichon@swri.org> +! Modified by Janus Weil <janus@gcc.gnu.org> + +PROGRAM test_prog + + PROCEDURE(triple), POINTER :: f + + f => triple + if (sum(f(2.,4.)-triple(2.,4.))>1E-3) call abort() + +CONTAINS + + FUNCTION triple(a,b) RESULT(tre) + REAL, INTENT(in) :: a, b + REAL :: tre(2) + tre(1) = 3.*a + tre(2) = 3.*b + END FUNCTION triple + +END PROGRAM test_prog + diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_19.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_19.f90 new file mode 100644 index 00000000000..a78a8d46432 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_19.f90 @@ -0,0 +1,35 @@ +! { dg-do run } +! +! PR 40176: Fortran 2003: Procedure pointers with array return value +! +! This example tests for a bug in procedure pointer assignments, +! where the rhs is a dummy. +! +! Original test case by Barron Bichon <barron.bichon@swri.org> +! Modified by Janus Weil <janus@gcc.gnu.org> + +PROGRAM test_prog + + PROCEDURE(add), POINTER :: forig, fset + + forig => add + + CALL set_ptr(forig,fset) + + if (forig(1,2) /= fset(1,2)) call abort() + +CONTAINS + + SUBROUTINE set_ptr(f1,f2) + PROCEDURE(add), POINTER :: f1, f2 + f2 => f1 + END SUBROUTINE set_ptr + + FUNCTION add(a,b) + INTEGER :: a,b,add + add = a+b + + END FUNCTION add + +END PROGRAM test_prog + diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_10.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_10.f90 new file mode 100644 index 00000000000..382f4125533 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_10.f90 @@ -0,0 +1,31 @@ +! { dg-do compile } +! +! PR 40176: Fortran 2003: Procedure pointers with array return value +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + +module m + +abstract interface + function ai() + real, dimension(3) :: ai + end function +end interface + +type t + procedure(ai), pointer, nopass :: ppc +end type + +procedure(ai), pointer :: pp + +end module + +program test +use m +type(t) :: obj +obj%ppc => pp +pp => obj%ppc +end + +! { dg-final { cleanup-modules "m" } } + diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_8.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_8.f90 new file mode 100644 index 00000000000..ed06c2bc651 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_8.f90 @@ -0,0 +1,58 @@ +! { dg-do run } +! +! PR 40164: Fortran 2003: "Arrays of procedure pointers" (using PPCs) +! +! Original test case by Barron Bichon <barron.bichon@swri.org> +! Adapted by Janus Weil <janus@gcc.gnu.org> + +PROGRAM test_prog + + ABSTRACT INTERFACE + FUNCTION fn_template(n,x) RESULT(y) + INTEGER, INTENT(in) :: n + REAL, INTENT(in) :: x(n) + REAL :: y(n) + END FUNCTION fn_template + END INTERFACE + + TYPE PPA + PROCEDURE(fn_template), POINTER, NOPASS :: f + END TYPE PPA + + TYPE ProcPointerArray + PROCEDURE(add), POINTER, NOPASS :: f + END TYPE ProcPointerArray + + TYPE (ProcPointerArray) :: f_array(3) + PROCEDURE(add), POINTER :: f + real :: r + + f_array(1)%f => add + f => f_array(1)%f + f_array(2)%f => sub + f_array(3)%f => f_array(1)%f + + r = f(1.,2.) + if (abs(r-3.)>1E-3) call abort() + r = f_array(1)%f(4.,2.) + if (abs(r-6.)>1E-3) call abort() + r = f_array(2)%f(5.,3.) + if (abs(r-2.)>1E-3) call abort() + if (abs(f_array(1)%f(1.,3.)-f_array(3)%f(2.,2.))>1E-3) call abort() + +CONTAINS + + FUNCTION add(a,b) RESULT(sum) + REAL, INTENT(in) :: a, b + REAL :: sum + sum = a + b + END FUNCTION add + + FUNCTION sub(a,b) RESULT(diff) + REAL, INTENT(in) :: a, b + REAL :: diff + diff = a - b + END FUNCTION sub + +END PROGRAM test_prog + diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_9.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_9.f90 new file mode 100644 index 00000000000..951db485fb0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_9.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! +! PR 40176: Fortran 2003: Procedure pointers with array return value +! +! Original test case by Barron Bichon <barron.bichon@swri.org> +! Modified by Janus Weil <janus@gcc.gnu.org> + +PROGRAM test_prog + + TYPE ProcPointerType + PROCEDURE(triple), POINTER, NOPASS :: f + END TYPE ProcPointerType + + TYPE (ProcPointerType) :: ppt + PROCEDURE(triple), POINTER :: f + REAL :: tres(2) + + ppt%f => triple + f => ppt%f + tres = f(2,[2.,4.]) + if (abs(tres(1)-6.)>1E-3) call abort() + if (abs(tres(2)-12.)>1E-3) call abort() + tres = ppt%f(2,[3.,5.]) + if (abs(tres(1)-9.)>1E-3) call abort() + if (abs(tres(2)-15.)>1E-3) call abort() + +CONTAINS + + FUNCTION triple(n,x) RESULT(tre) + INTEGER, INTENT(in) :: n + REAL, INTENT(in) :: x(2) + REAL :: tre(2) + tre = 3.*x + END FUNCTION triple + +END PROGRAM test_prog + diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_result_1.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_result_1.f90 index 1261791ae73..f3f7252a6ad 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_result_1.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_result_1.f90 @@ -114,7 +114,7 @@ contains pointer :: f interface integer function f(x) - integer :: x + integer,intent(in) :: x end function end interface f => iabs @@ -123,7 +123,7 @@ contains function g() interface integer function g(x) - integer :: x + integer,intent(in) :: x end function g end interface pointer :: g @@ -133,13 +133,13 @@ contains function h(arg) interface subroutine arg(b) - integer :: b + integer,intent(inout) :: b end subroutine arg end interface pointer :: h interface subroutine h(a) - integer :: a + integer,intent(inout) :: a end subroutine h end interface h => arg @@ -150,6 +150,7 @@ contains interface function i(x) integer :: i,x + intent(in) :: x end function i end interface i => iabs diff --git a/gcc/testsuite/gfortran.dg/string_1.f90 b/gcc/testsuite/gfortran.dg/string_1.f90 new file mode 100644 index 00000000000..11dc5b7a340 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/string_1.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! +program main + implicit none + integer(kind=8), parameter :: l1 = 2_8**32_8 + character (len=2_8**32_8+4_8), parameter :: s = "" ! { dg-error "too large" } + character (len=2_8**32_8+4_8) :: ch ! { dg-error "too large" } + character (len=l1 + 1_8) :: v ! { dg-error "too large" } + character (len=int(huge(0_4),kind=8) + 1_8) :: z ! { dg-error "too large" } + character (len=int(huge(0_4),kind=8) + 0_8) :: w + + print *, len(s) + +end program main diff --git a/gcc/testsuite/gfortran.dg/string_2.f90 b/gcc/testsuite/gfortran.dg/string_2.f90 new file mode 100644 index 00000000000..c94c4141bc5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/string_2.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! +program main + implicit none + character(len=10) :: s + + s = '' + print *, s(1:2_8**32_8+3_8) ! { dg-error "exceeds the string length" } + print *, s(2_8**32_8+3_8:2_8**32_8+4_8) ! { dg-error "exceeds the string length" } + print *, len(s(1:2_8**32_8+3_8)) ! { dg-error "exceeds the string length" } + +end program main diff --git a/gcc/testsuite/gfortran.dg/string_3.f90 b/gcc/testsuite/gfortran.dg/string_3.f90 new file mode 100644 index 00000000000..7daf8d31ae6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/string_3.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! +subroutine foo(i) + implicit none + integer, intent(in) :: i + character(len=i) :: s + + s = '' + print *, s(1:2_8**32_8+3_8) ! { dg-error "too large" } + print *, s(2_8**32_8+3_8:2_8**32_8+4_8) ! { dg-error "too large" } + print *, len(s(1:2_8**32_8+3_8)) ! { dg-error "too large" } + print *, len(s(2_8**32_8+3_8:2_8**32_8+4_8)) ! { dg-error "too large" } + + print *, s(2_8**32_8+3_8:1) + print *, s(2_8**32_8+4_8:2_8**32_8+3_8) + print *, len(s(2_8**32_8+3_8:1)) + print *, len(s(2_8**32_8+4_8:2_8**32_8+3_8)) + +end subroutine diff --git a/gcc/testsuite/gfortran.dg/vector_subscript_4.f90 b/gcc/testsuite/gfortran.dg/vector_subscript_4.f90 index 204468456e1..5c341dab4a5 100644 --- a/gcc/testsuite/gfortran.dg/vector_subscript_4.f90 +++ b/gcc/testsuite/gfortran.dg/vector_subscript_4.f90 @@ -9,5 +9,5 @@ integer :: i(-1:1) = 1, j(3) = 1, k(3) k = j((/1,1,1/)+i) end -! { dg-final { scan-tree-dump-times "A\.3\\\[3\\\]" 1 "original" } } +! { dg-final { scan-tree-dump-times "A\.2\\\[3\\\]" 1 "original" } } ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gnat.dg/addr6.adb b/gcc/testsuite/gnat.dg/addr6.adb new file mode 100644 index 00000000000..e357132d66f --- /dev/null +++ b/gcc/testsuite/gnat.dg/addr6.adb @@ -0,0 +1,31 @@ +-- { dg-do compile } + +procedure Addr6 is + + type Byte is mod 2**8; + + type Byte_Arr1 is array (Positive range <>) of Byte; + for Byte_Arr1'Alignment use 4; + + type Byte_Arr2 is array (Positive range <>) of Byte; + + function Length return Natural is + begin + return 1; + end; + + function Empty return Byte_Arr2 is + Null_Arr : Byte_Arr2 (1 .. 0); + begin + return Null_Arr; + end; + + A1 : Byte_Arr1 (1 .. Length); + + A2 : Byte_Arr2 (A1'Range); + for A2'Alignment use 4; + for A2'Address use A1'Address; + +begin + A2 := Empty; +end; diff --git a/gcc/testsuite/gnat.dg/loop_optimization6.adb b/gcc/testsuite/gnat.dg/loop_optimization6.adb new file mode 100644 index 00000000000..42f1717f1ad --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization6.adb @@ -0,0 +1,25 @@ +-- { dg-do compile } +-- { dg-options "-O -gnatp -fdump-tree-optimized" } + +package body Loop_Optimization6 is + procedure Foo is + begin + for I in 1 .. 1_000_000 loop + A := A + 1; + end loop; + end Foo; + + procedure Bar is + begin + for J in 1 .. 1_000 loop + Foo; + end loop; + end Bar; + + procedure Main is + begin + Bar; + end; +end Loop_Optimization6; + +-- { dg-final { scan-tree-dump-not "goto" "optimized"} } diff --git a/gcc/testsuite/gnat.dg/loop_optimization6.ads b/gcc/testsuite/gnat.dg/loop_optimization6.ads new file mode 100644 index 00000000000..9b8a2670322 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization6.ads @@ -0,0 +1,4 @@ +package Loop_Optimization6 is + A : Integer := 0; + procedure Main; +end Loop_Optimization6; diff --git a/gcc/testsuite/gnat.dg/misaligned_nest.adb b/gcc/testsuite/gnat.dg/misaligned_nest.adb new file mode 100644 index 00000000000..3b6fd845da4 --- /dev/null +++ b/gcc/testsuite/gnat.dg/misaligned_nest.adb @@ -0,0 +1,26 @@ +-- { dg-do run } +-- { dg-options "-gnatp" } + +procedure Misaligned_Nest is + + type Int is record + V : Integer; + end record; + + type Block is record + B : Boolean; + I : Int; + end record; + pragma Pack (Block); + for Block'Alignment use 1; + + type Pair is array (1 .. 2) of Block; + + P : Pair; +begin + for K in P'Range loop + P(K).I.V := 1; + end loop; +end; + + diff --git a/gcc/testsuite/gnat.dg/specs/rep_clause3.ads b/gcc/testsuite/gnat.dg/specs/rep_clause3.ads new file mode 100644 index 00000000000..438c6046868 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/rep_clause3.ads @@ -0,0 +1,36 @@ +package Rep_Clause3 is + + type Record1 is + record + Page_Handle : Integer range 0 .. 255; + Page_Owner : Integer range 0 .. 15; + end record; + for Record1 use + record + Page_Handle at 0 range 0 .. 15; + Page_Owner at 0 range 16 .. 19; + end record; + for Record1'Size use 20; + + type Range_A is range 1 .. 7; + for Range_A'Size use 16; + + type Array_Type is array (Range_A) of Record1; + pragma Pack (Array_Type); + for Array_Type'Size use 7 * 20; +-- for array_Type'alignment use 1; + + type Record2 is + record + Page_Tree_Index : Range_A; + Page_Tree : Array_Type; + end record; + + for Record2 use + record + Page_Tree_Index at 0 range 0 .. 15; + Page_Tree at 0 range 16 .. 15 + (7 * 20); + end record; + for Record2'Size use 16 + (7 * 20); + +end Rep_Clause3; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 3282d6d7b48..e2d24c8c156 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -611,6 +611,18 @@ proc check_effective_target_pthread {} { } "-pthread"] } +# Return 1 if compilation with -mpe-aligned-commons is error-free +# for trivial code, 0 otherwise. + +proc check_effective_target_pe_aligned_commons {} { + if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } { + return [check_no_compiler_messages pe_aligned_commons object { + int foo; + } "-mpe-aligned-commons"] + } + return 0 +} + # Return 1 if the target supports -fstack-protector proc check_effective_target_fstack_protector {} { return [check_runtime fstack_protector { @@ -1477,6 +1489,17 @@ proc check_effective_target_arm_thumb1_ok { } { } "-mthumb"] } +# Return 1 is this is an ARM target where -mthumb causes Thumb-2 to be +# used. + +proc check_effective_target_arm_thumb2_ok { } { + return [check_no_compiler_messages arm_thumb2_ok assembly { + #if !defined(__thumb2__) + #error FOO + #endif + } "-mthumb"] +} + # Return 1 if the target supports executing NEON instructions, 0 # otherwise. Cache the result. |