diff options
Diffstat (limited to 'gcc/testsuite')
285 files changed, 8231 insertions, 59 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1d2cca3104..8f98975fc8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,1271 @@ +2015-12-04 Release Manager + + * GCC 5.3.0 released. + +2015-11-27 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/68218 + * gfortran.dg/allocate_with_arrayspec_1.f90: New test. + +2015-11-27 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/68250 + * gcc.c-torture/execute/pr68250.c: New test. + +2015-11-27 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-11-27 Marek Polacek <polacek@redhat.com> + + * gcc.dg/pr63568.c: Convert to GIMPLE. + +2015-11-26 Bernd Edlinger <bernd.edlinger@hotmail.de> + + Backport from mainline + 2015-09-30 Bernd Edlinger <bernd.edlinger@hotmail.de> + + PR rtl-optimization/67037 + * gcc.c-torture/execute/pr67037.c: New test. + +2015-11-26 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r230938. + 2015-11-26 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR target/68416 + * gcc.target/i386/mpx/pr68416.c: New test. + +2015-11-26 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/68249 + PR rtl-optimization/68321 + * gcc.c-torture/execute/pr68249.c: New test. + * gcc.c-torture/execute/pr68321.c: New test. + +2015-11-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-11-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR rtl-optimization/67226 + * gcc.c-torture/execute/pr67226.c: New test. + +2015-11-26 Jakub Jelinek <jakub@redhat.com> + + PR c++/68508 + * g++.dg/ubsan/pr68508.C: New test. + +2015-11-26 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * lib/target-supports.exp + (check_effective_target_arm_neon_ok_nocache): Add check + for M profile. + +2015-11-25 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-11-20 Jakub Jelinek <jakub@redhat.com> + + PR c++/67354 + * g++.dg/abi/mangle67.C: New test. + +2015-11-25 Paolo Carlini <paolo.carlini@oracle.com> + + * g++.dg/cpp0x/constexpr-array13.C: Fix. + +2015-11-25 Markus Trippelsdorf <markus@trippelsdorf.de> + Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/68087 + * g++.dg/cpp0x/constexpr-array13.C: New. + +2015-11-24 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk. + PR fortran/68196 + * gfortran.dg/proc_ptr_47.f90: New test. + + Backport from trunk. + PR fortran/66465 + * gfortran.dg/pr66465.f90: New test. + +2015-11-24 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r230796. + 2015-11-24 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR c/68337 + * gcc.target/i386/mpx/pr68337-1.c: New test. + * gcc.target/i386/mpx/pr68337-2.c: New test. + +2015-11-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-11-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR rtl-optimization/68194 + PR rtl-optimization/68328 + PR rtl-optimization/68185 + * gcc.c-torture/execute/pr68185.c: New test. + * gcc.c-torture/execute/pr68328.c: Likewise. + +2015-11-24 Jakub Jelinek <jakub@redhat.com> + + PR target/68483 + * gcc.target/i386/pr68483-1.c: New test. + * gcc.target/i386/pr68483-2.c: New test. + +2015-11-23 Michael Meissner <meissner@linux.vnet.ibm.com> + + 2015-10-05 Michael Meissner <meissner@linux.vnet.ibm.com> + Peter Bergner <bergner@vnet.ibm.com> + + PR target/67808 + * gcc.target/powerpc/pr67808.c: New test. + +2015-11-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-11-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/68363 + * gcc.target/aarch64/pr68363_1.c: New test. + +2015-11-23 Martin Liska <mliska@suse.cz> + + Backport from mainline + 2015-06-22 Jan Hubicka <hubicka@ucw.cz> + Martin Liska <mliska@suse.cz> + + PR ipa/65908 + * g++.dg/ipa/pr65908.C: New testcase. + +2015-11-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-10-29 Richard Biener <rguenther@suse.de> + + PR middle-end/56956 + * c-c++-common/ubsan/pr56956.c: New testcase. + +2015-11-22 Dominique d'Humieres <dominiq@lps.ens.fr> + + Backport from mainline + 2015-09-14 Manuel López-Ibáñe<manu@gcc.gnu.org> + + PR fortran/67460 + * gfortran.dg/pr67460.f90: New test. + +2015-11-21 Jakub Jelinek <jakub@redhat.com> + + PR debug/66432 + * gcc.dg/debug/pr66432.c: New test. + +2015-11-20 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/68339 + * gcc.dg/vect/pr68339.c: New test. + +2015-11-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + Backport from mainline + * gcc.target/s390/bswap-1.c: New test. + +2015-11-20 Dominik Vogt <vogt@linux.vnet.ibm.com> + + Backport from mainline + * gcc.target/s390/pfpo.c: New test. + +2015-11-19 Jakub Jelinek <jakub@redhat.com> + + PR c++/67409 + * g++.dg/eh/goto3.C: New test. + + PR rtl-optimization/68376 + * gcc.c-torture/execute/pr68376-1.c: New test. + * gcc.c-torture/execute/pr68376-2.c: New test. + + PR target/67770 + * gcc.target/i386/pr67770.c: New test. + +2015-11-18 Dominique d'Humieres <dominiq@lps.ens.fr> + + PR fortran/65751 + * gfortran.dg/unlimited_polymorphic_2.f03: Update test. + +2015-11-18 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-11-07 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/68057 + PR ipa/68220 + * g++.dg/torture/pr68220.C: New testcase. + * g++.dg/lto/pr68057_0.C: Likewise. + * g++.dg/lto/pr68057_1.C: Likewise. + + 2015-10-23 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/pr67600 + * g++.dg/torture/pr67600.C: New testcase. + + 2015-10-11 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/67056 + * g++.dg/ipa/pr67056.C: New testcase. + + 2015-08-11 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR c/66098 + PR c/66711 + * gcc.dg/pragma-diag-3.c: New test. + * gcc.dg/pragma-diag-4.c: New test. + +2015-11-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-11-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/68143 + * gcc.c-torture/execute/pr68143_1.c: New test. + +2015-11-18 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-10-28 Richard Biener <rguenther@suse.de> + + PR middle-end/68067 + * gcc.dg/torture/pr68067-1.c: New testcase. + * gcc.dg/torture/pr68067-2.c: Likewise. + + 2015-10-26 Richard Biener <rguenther@suse.de> + Dominik Vogt <vogt@linux.vnet.ibm.com> + + PR middle-end/67443 + * gcc.target/s390/pr67443.c: New testcase. + + 2015-10-20 Richard Biener <rguenther@suse.de> + + PR tree-optimization/68017 + * gcc.dg/torture/pr68017.c: New testcase. + + 2015-09-23 Richard Biener <rguenther@suse.de> + + PR middle-end/67662 + * gcc.dg/ubsan/pr67662.c: New testcase. + +2015-11-18 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/68157 + * g++.dg/opt/pr68157.C: New test. + +2015-11-16 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/58027 + PR fortran/60993 + * gfortran.dg/pr58027.f90: New test. + +2015-11-14 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67803 + * gfortran.dg/pr67803.f90: New test. + +2015-11-13 Steven G. Kargl <kargl@gccc.gnu.org> + + PR fortran/68319 + * gfortran.dg/pr68319.f90: New test. + +2015-11-13 Dominique d'Humieres <dominiq@lps.ens.fr> + + PR fortran/47266 + * gfortran.dg/module_private_2.f90: New test. + +2015-11-12 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68318 + * gfortran.dg/pr68318_1.f90: New test. + * gfortran.dg/pr68318_2.f90: Ditto. + +2015-11-12 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.target/i386/pr67265-2.c: New test. + +2015-11-11 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.target/i386/pr67265.c: New test. + +2015-11-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/68129 + * gcc.target/aarch64/pr68129_1.c: New test. + +2015-11-09 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.target/sparc/sparc-ret.c: Rename to... + * gcc.target/sparc/sparc-ret-1.c: ...this. + * gcc.target/sparc/sparc-ret-2.c: New test. + +2015-11-08 Steven g. Kargl <kargl@gcc.gnu.org> + + PR fortran/68053 + * gfortran.dg/pr68053.f90: New test. + +2015-11-08 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68224 + * gfortran.dg/pr68224.f90: New test. + +2015-11-08 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68153 + * gfortran.dg/pr68153.f90: New test. + +2015-11-08 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68151 + * gfortran.dg/pr68151.f90: New test. + +2015-11-06 Vladimir Makarov <vmakarov@redhat.com> + + PR rtl-optimization/68106 + * testsuite/gcc.target/aarch64/pr68106.c: New. + +2015-01-25 Paul Thomas <pault@gcc.gnu.org> + + Backported from trunk. + PR fortran/67171 + * gfortran.dg/allocate_with_source_12.f03: New test + + Backported from trunk. + PR fortran/61819 + * gfortran.dg/allocate_with_source_13.f03: New test + + Backported from trunk. + PR fortran/61830 + * gfortran.dg/allocate_with_source_14.f03: New test + + Backported from trunk. + PR fortran/67933 + * gfortran.dg/allocate_with_source_15.f03: New test + +2015-11-02 Steve Ellcey <sellcey@imgtec.com> + + 2015-10-23 Steve Ellcey <sellcey@imgtec.com> + Andrew Pinski <apinski@cavium.com> + + PR rtl-optimization/67736 + * gcc.dg/torture/pr67736.c: New test. + * gcc.dg/combine-subregs.c: New test. + +2015-11-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/67929 + * gcc.target/arm/pr67929_1.c: Move to... + * gcc.c-torture/execute/pr67929_1.c: ... Here. + Remove arm-specific directives. Add noclone, noinline + attributes. + +2015-10-30 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/51993 + * gfortran.dg/pr51993.f90: New test. + +2015-10-30 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68154 + *gfortran.dg/pr68154.f90 + +2015-10-30 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/36192 + * gfortran.dg/pr36192_1.f90: New test. + +2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68055 + * gfortran.dg/pr68055.f90: New case. + +2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68054 + * gfortran.dg/pr68054.f90: New test. + +2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67939 + * gfortran.dg/pr67939.f90: New test. + +2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67885 + * gfortran.dg/pr67885.f90: New test. + +2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67805 + PR fortran/68108 + * gfortran.dg/pr67805.f90: New testcase. + * gfortran.dg/pr67805_2.f90: New test. + * gfortran.dg/array_constructor_26.f03: Update testcase. + * gfortran.dg/array_constructor_27.f03: Ditto. + * gfortran.dg/char_type_len_2.f90: Ditto. + * gfortran.dg/pr67802.f90: Ditto. + * gfortran.dg/used_before_typed_3.f90: Ditto. + +2015-10-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-10-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/68102 + * gcc.target/aarch64/pr68102_1.c: New test. + +2015-10-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-10-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR middle-end/67989 + * g++.dg/pr67989.C: New test. + +2015-10-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/67929 + * gcc.target/arm/pr67929_1.c: New test. + +2015-10-26 Paul Thomas <pault@gcc.gnu.org> + + Backport from mainline r228940: + PR fortran/67177 + * gfortran.dg/move_alloc_15.f90: New test + * gfortran.dg/move_alloc_16.f90: New test + + PR fortran/67977 + * gfortran.dg/deferred_character_assignment_1.f90: New test + +2015-10-26 Martin Jambor <mjambor@suse.cz> + + Backport from mainline + 2015-10-09 Martin Jambor <mjambor@suse.cz> + + * gcc.dg/ipa/ipa-sra-10.c: New test. + * gcc.dg/torture/pr67794.c: Likewise. + +2015-10-22 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/58754 + * gfortran.dg/pr58754.f90: New test + +2015-10-22 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + Backport from mainline + 2015-10-22 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + PR target/68015 + * gcc.target/s390/pr68015.c: New test. + +2015-10-22 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2015-10-21 Uros Bizjak <ubizjak@gmail.com> + + PR target/68018 + * gcc.target/i386/pr68018.c: New test. + +2015-10-20 Szabolcs Nagy <szabolcs.nagy@arm.com> + + Backport from mainline r229024 + 2015-10-20 Szabolcs Nagy <szabolcs.nagy@arm.com> + + PR target/66912 + * gcc.target/aarch64/pr66912.c: New. + * gcc.target/arm/pr66912.c: New. + +2015-10-19 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67900 + * gfortran.dg/pr67900.f90: New tests. + +2015-10-19 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68019 + * gfortran.dg/pr68019.f90: new test. + +2015-10-19 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67987 + * gfortran.df/pr67987.f90: New test. + * gfortran.dg/char_length_2.f90: Update testcase. + +2015-10-18 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/66079 + Backport from mainline r224383: + + * gfortran.dg/allocatable_scalar_13.f90: New test + +2015-10-18 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/67721 + PR fortran/67818 + Backport from mainline r222477: + + 2015-04-27 Andre Vehreschild <vehre@gmx.de> + + PR fortran/59678 + PR fortran/65841 + * gfortran.dg/alloc_comp_deep_copy_1.f03: New test. + * gfortran.dg/alloc_comp_deep_copy_2.f03: New test. + +2015-10-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR middle-end/66311 + * gfortran.dg/pr66311.f90: New file. + +2015-10-12 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2015-10-07 Uros Bizjak <ubizjak@gmail.com> + + PR target/66697 + * gcc.target/i386/20060512-1.c: Remove ia32 requirement. + (PUSH, POP): New defines. + (sse2_test): Use PUSH and POP to misalign runtime stack. + * gcc.target/i386/20060512-2.c: Remove ia32 requirement. + +2015-10-12 Paolo Carlini <paolo.carlini@oracle.com> + + Backport from mainline + 2015-06-15 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51048 + * g++.dg/cpp0x/local-type1.C: New. + +2015-10-12 Alexander Fomin <alexander.fomin@intel.com> + Kirill Yukhin <kirill.yukhin@intel.com> + + PR target/67849 + * gcc.target/i386/pr67480.c: New test. + +2015-10-06 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-09-15 Richard Biener <rguenther@suse.de> + + PR middle-end/67563 + * gcc.dg/pr67563.c: New testcase. + + 2015-09-24 Richard Biener <rguenther@suse.de> + + PR lto/67699 + * g++.dg/pr67699.C: New testcase. + +2015-10-06 Kirill Yukhin <kirill.yukhin@intel.com> + + * gcc.target/i386/vect-pack-trunc-1.c: New test. + * gcc.target/i386/vect-pack-trunc-2.c: Ditto. + * gcc.target/i386/vect-perm-even-1.c: Ditto. + * gcc.target/i386/vect-perm-odd-1.c: Ditto. + * gcc.target/i386/vect-unpack-1.c: Ditto. + * gcc.target/i386/vect-unpack-2.c: Ditto. + +2015-10-05 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-10-05 Marek Polacek <polacek@redhat.com> + + PR tree-optimization/67821 + * gcc.dg/torture/pr67821-2.c: New test. + * gcc.dg/torture/pr67821.c: New test. + +2015-10-05 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-10-02 Marek Polacek <polacek@redhat.com> + + PR c/67730 + * gcc.dg/pr67730-1.c: New test. + * gcc.dg/pr67730-2.c: New test. + * gcc.dg/pr67730.h: New test. + +2015-10-02 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67802 + * gfortran.dg/pr67802.f90: New test. + +2015-10-02 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67616 + * gfortran.dg/pr67616.f90: New test. + +2015-10-02 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/66979 + gfortran.dg/pr66979.f90: new test. + +2015-10-01 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-10-01 Marek Polacek <polacek@redhat.com> + + PR tree-optimization/67769 + * gcc.dg/torture/pr67769.c: New test. + +2015-10-01 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/67721 + * gfortran.dg/alloc_comp_deep_copy_3.f03: New. + +2015-10-01 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/lto/pr55113_0.c: Skip on all x86 targets. + +2015-10-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + Backport from mainline + 2015-09-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * lib/target-supports.exp (check_effective_target_pie): Check for + PIE support on Solaris 11.x and 12. + +2015-10-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-06-09 Shiva Chen <shiva0217@gmail.com> + + * gcc.target/arm/stl-cond.c: New test. + +2015-09-30 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2015-08-07 H.J. Lu <hongjiu.lu@intel.com> + + PR rtl-optimization/67029 + * gcc.dg/pr67029.c: New test. + +2015-09-30 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-09-30 Marek Polacek <polacek@redhat.com> + + PR tree-optimization/67690 + * gcc.dg/torture/pr67690.c: New test. + + PR c/67730 + * gcc.dg/pr67730.c: New test. + +2015-09-29 Vladimir Makarov <vmakarov@redhat.com> + + Backport from mainline + 2015-07-21 Vladimir Makarov <vmakarov@redhat.com> + + PR ipa/66424. + * gcc.target/i386/pr66424.c: New. + +2015-09-29 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + Backport from mainline + 2015-09-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + * gcc.target/s390/vector/vec-genbytemask-1.c: Add check for V1TI + initialization with a byte mask. No change expected here. + * gcc.target/s390/vector/vec-genmask-1.c: Fix whitespace. + * gcc.target/s390/vector/vec-genmask-2.c: Add check for V1TI + initialization with contigious bitmask. Literal pool is expectd + to be used here. + +2015-09-28 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-09-16 Richard Biener <rguenther@suse.de> + + PR middle-end/67442 + * gcc.dg/torture/pr67442.c: New testcase. + +2015-04-28 Kirill Yukhin <kirill.yukhin@intel.com> + + * gcc.target/i386/avx512vbmi-check.h (main): Fix register + name while checking for AVX-512VBMI presence. + +2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67614 + * gfortran.dg/pr67614.f90: New test. + +2015-09-25 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67525 + * gfortran.dg/pr67525.f90: New test. + +2015-09-25 Marek Polacek <polacek@redhat.com> + + PR sanitizer/64906 + * c-c++-common/ubsan/pr64906.c: New test. + +2015-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-09-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/67439 + * gcc.target/arm/pr67439_1.c: New test. + +2015-09-23 Matthew Wahab <matthew.wahab@arm.com> + + Backport from mainline + 2015-08-14 Matthew Wahab <matthew.wahab@arm.com> + Matthias Klose <doko@debian.org> + + PR target/67143 + * gcc.c-torture/compile/pr67143.c: New + * gcc.target/aarch64/atomic-op-imm.c + (atomic_fetch_add_negative_RELAXED): New. + (atomic_fetch_sub_negative_ACQUIRE): New. + +2015-09-22 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-07-23 Richard Biener <rguenther@suse.de> + + PR tree-optimization/66952 + * gcc.dg/torture/pr66952.c: Use signed char. + +2015-09-21 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67615 + * gfortran.dg/pr67615.f90: new test. + +2015-09-21 Uros Bizjak <ubizjak@gmail.com> + + PR middle-end/67619 + * gcc.dg/torture/pr67619.c: New test. + * lib/target-supports.exp (check_effective_target_builtin_eh_return): + New procedure. + +2015-09-21 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-07-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/66793 + * gcc.dg/torture/pr66793.c: New testcase. + + 2015-08-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/67055 + * g++.dg/torture/pr67055.C: New testcase. + + 2015-08-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/67121 + * gcc.dg/torture/pr67121.c: New testcase. + + 2015-09-16 Richard Biener <rguenther@suse.de> + + PR middle-end/67271 + * gcc.dg/pr67271.c: New testcase. + + 2015-07-22 Richard Biener <rguenther@suse.de> + + PR tree-optimization/66952 + * gcc.dg/torture/pr66952.c: New testcase. + + 2015-09-15 Richard Biener <rguenther@suse.de> + + PR tree-optimization/67470 + * gcc.dg/torture/pr67470.c: New testcase. + +2015-09-17 Marek Polacek <polacek@redhat.com> + + Backport from mainline: + 2015-08-18 Marek Polacek <polacek@redhat.com> + + PR middle-end/67222 + * gcc.dg/torture/pr67222.c: New test. + +2015-09-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.dg/pie-link.c: Add -pie to dg-options. + +2015-09-11 Alex Velenko <Alex.Velenko@arm.com> + + Backport from mainline + * gcc.target/arm/pr63210.c (dg-skip-if): Skip armv4t. + (dg-additional-options): Add -march=armv5t if arm_arch_v5t_ok. + +2015-09-10 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67526 + * gfortran.dg/pr67526.f90: New test. + +2015-09-10 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + PR target/67506 + * gcc.c-torture/compile/pr67506.c: New test. + +2015-09-10 Jakub Jelinek <jakub@redhat.com> + + PR c++/67523 + * g++.dg/gomp/pr67523.C: New test. + + PR c++/67522 + * g++.dg/gomp/pr67522.C: New test. + + PR middle-end/67521 + * c-c++-common/gomp/pr67521.c: New test. + + PR middle-end/67517 + * c-c++-common/gomp/pr67517.c: New test. + + PR c++/67514 + * g++.dg/gomp/pr67514.C: New test. + + PR c++/67511 + * g++.dg/gomp/pr67511.C: New test. + + PR c/67502 + * c-c++-common/gomp/pr67502.c: New test. + +2015-09-09 Marek Polacek <polacek@redhat.com> + + Backport from mainline: + 2015-09-09 Marek Polacek <polacek@redhat.com> + + PR middle-end/67512 + * gcc.dg/pr67512.c: New test. + +2015-09-09 Jakub Jelinek <jakub@redhat.com> + + PR c++/67504 + * g++.dg/gomp/pr67504.C: New test. + + PR c/67501 + * c-c++-common/gomp/pr67501.c: New test. + + PR c/67500 + * gcc.dg/gomp/pr67500.c: New test. + + PR c/67495 + * gcc.dg/gomp/pr67495.c: New test. + +2015-09-08 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67369 + * g++.dg/cpp1y/lambda-generic-ice4.C: New. + +2015-09-04 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/67452 + * gcc.dg/lto/pr67452_0.c: New test. + +2015-09-03 Richard Biener <rguenther@suse.de> + + PR ipa/66705 + * g++.dg/lto/pr66705_0.C: New testcase. + +2015-09-02 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline: + 2015-08-27 Uros Bizjak <ubizjak@gmail.com> + + PR target/67317 + * gcc.target/i386/pr67317-1.c: New test. + * gcc.target/i386/pr67317-2.c: Ditto. + * gcc.target/i386/pr67317-3.c: Ditto. + * gcc.target/i386/pr67317-4.c: Ditto. + * gcc.target/i386/adx-addcarryx32-1.c: Also scan for adcl. + * gcc.target/i386/adx-addcarryx32-2.c: Also scan for adcq. + +2015-08-31 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-08-27 Marek Polacek <polacek@redhat.com> + + PR middle-end/67005 + * gcc.dg/torture/pr67005.c: New test. + +2015-08-27 Pat Haugen <pthaugen@us.ibm.com> + + Backport from mainline: + 2015-08-27 Pat Haugen <pthaugen@us.ibm.com> + + * gcc.target/powerpc/vec-shr.c: New. + +2015-08-25 Dominik Vogt <vogt@linux.vnet.ibm.com> + + Backport from mainline + 2015-08-21 Dominik Vogt <vogt@linux.vnet.ibm.com> + + * gcc.target/s390/zvector/vec-load_bndry-1.c: New test. + +2015-08-24 Michael Meissner <meissner@linux.vnet.ibm.com> + + Backport from mainline: + 2015-08-24 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/67211 + * g++.dg/pr67211.C: New test. + +2015-08-18 Segher Boessenkool <segher@kernel.crashing.org> + + Backport from mainline: + 2015-08-08 Segher Boessenkool <segher@kernel.crashing.org> + + PR rtl-optimization/67028 + * gcc.dg/pr67028.c: New testcase. + +2015-08-16 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline: + 2015-07-25 Uros Bizjak <ubizjak@gmail.com> + + PR target/66648 + * gcc.target/i386/pr66648.c: New test. + +2015-08-11 Marek Polacek <polacek@redhat.com> + + Backported from mainline + 2015-08-03 Marek Polacek <polacek@redhat.com> + + PR sanitizer/66908 + * c-c++-common/ubsan/pr66908.c: New test. + +2015-08-07 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/66929 + * gfortran.dg/generic_30.f90: New. + * gfortran.dg/generic_31.f90: New. + +2015-08-06 David Malcolm <dmalcolm@redhat.com> + + Backport from trunk r226697: + 2015-08-06 David Malcolm <dmalcolm@redhat.com> + + * jit.dg/test-benchmark.c (main): Record all elapsed times at each + optimization level, and print a summary at the end. + +2015-08-05 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/64921 + * gfortran.dg/class_allocate_20.f90: New. + +2015-08-05 Matthew Wahab <matthew.wahab@arm.com> + + Backport from trunk: + 2015-07-01 Matthew Wahab <matthew.wahab@arm.com> + + * gcc.target/arm/armv8-sync-comp-swap.c: Replace + 'do-require-effective-target' with 'dg-require-effective-target'. + * gcc.target/arm/armv8-sync-op-full.c: Likewise. + * gcc.target/arm/armv8-sync-op-release.c: Likewise. + * gcc.target/arm/armv8-sync-op-acquire.c: Likewise. Also, replace + 'stlex' with 'strex' as the expected output. + +2015-08-05 Matthew Wahab <matthew.wahab@arm.com> + + Backport from trunk: + 2015-06-29 Matthew Wahab <matthew.wahab@arm.com> + + PR target/65697 + * gcc.target/arm/armv-sync-comp-swap.c: New. + * gcc.target/arm/armv-sync-op-acquire.c: New. + * gcc.target/arm/armv-sync-op-full.c: New. + * gcc.target/arm/armv-sync-op-release.c: New. + +2015-08-05 Matthew Wahab <matthew.wahab@arm.com> + + Backport from trunk + 2015-06-01 Matthew Wahab <matthew.wahab@arm.com> + + PR target/65697 + * gcc.target/aarch64/sync-comp-swap.c: New. + * gcc.target/aarch64/sync-comp-swap.x: New. + * gcc.target/aarch64/sync-op-acquire.c: New. + * gcc.target/aarch64/sync-op-acquire.x: New. + * gcc.target/aarch64/sync-op-full.c: New. + * gcc.target/aarch64/sync-op-full.x: New. + * gcc.target/aarch64/sync-op-release.c: New. + * gcc.target/aarch64/sync-op-release.x: New. + +2015-08-04 Szabolcs Nagy <szabolcs.nagy@arm.com> + + * gcc.target/aarch64/fnmul-1.c: Fix whitespace. + * gcc.target/aarch64/fnmul-2.c: Likewise. + * gcc.target/aarch64/fnmul-3.c: Likewise. + * gcc.target/aarch64/fnmul-4.c: Likewise. + +2015-08-04 Szabolcs Nagy <szabolcs.nagy@arm.com> + + Backport from mainline r225450: + 2015-07-06 Szabolcs Nagy <szabolcs.nagy@arm.com> + + PR target/66731 + * gcc.target/aarch64/fnmul-1.c: New. + * gcc.target/aarch64/fnmul-2.c: New. + * gcc.target/aarch64/fnmul-3.c: New. + * gcc.target/aarch64/fnmul-4.c: New. + +2015-08-03 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline: + 2015-08-03 Peter Bergner <bergner@vnet.ibm.com> + + * gcc.target/powerpc/htm-tabort-no-r0.c: New test. + +2015-08-03 Szabolcs Nagy <szabolcs.nagy@arm.com> + + Backport form mainline r226496. + 2015-08-03 Szabolcs Nagy <szabolcs.nagy@arm.com> + + PR target/66731 + * gcc.target/arm/vnmul-1.c: New. + * gcc.target/arm/vnmul-2.c: New. + * gcc.target/arm/vnmul-3.c: New. + * gcc.target/arm/vnmul-4.c: New. + +2015-07-31 Vladimir Makarov <vmakarov@redhat.com> + + PR debug/66691 + * gcc.target/i386/pr66691.c: New. + +2015-07-28 Alex Velenko <Alex.Velenko@arm.com> + + backport from trunk: + 2015-07-21 Alex Velenko <Alex.Velenko@arm.com> + + * gcc.target/arm/split-live-ranges-for-shrink-wrap.c (dg-skip-if): + Skip -march=armv4t. + (dg-additional-options): Set armv5t flag. + +2015-07-25 Tom de Vries <tom@codesourcery.com> + + backport from trunk: + 2015-07-25 Tom de Vries <tom@codesourcery.com> + + * gcc.dg/graphite/graphite.exp: Include uns-*.c files in + interchange_files and block_files variables. + * gcc.dg/graphite/uns-block-1.c (main): Change signed into unsigned + arithmetic. + * gcc.dg/graphite/uns-interchange-12.c: Same. + * gcc.dg/graphite/uns-interchange-14.c: Same. + * gcc.dg/graphite/uns-interchange-15.c: Same. + * gcc.dg/graphite/uns-interchange-9.c (foo): Same. + * gcc.dg/graphite/uns-interchange-mvt.c: Same. + + 2015-07-24 Tom de Vries <tom@codesourcery.com> + + * gcc.dg/graphite/block-1.c: Xfail scan. + * gcc.dg/graphite/interchange-12.c: Same. + * gcc.dg/graphite/interchange-14.c: Same. + * gcc.dg/graphite/interchange-15.c: Same. + * gcc.dg/graphite/interchange-9.c: Same. + * gcc.dg/graphite/interchange-mvt.c: Same. + * gcc.dg/graphite/uns-block-1.c: New test. + * gcc.dg/graphite/uns-interchange-12.c: New test. + * gcc.dg/graphite/uns-interchange-14.c: New test. + * gcc.dg/graphite/uns-interchange-15.c: New test. + * gcc.dg/graphite/uns-interchange-9.c: New test. + * gcc.dg/graphite/uns-interchange-mvt.c: New test. + +2015-07-24 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r226155. + 2015-07-24 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR ipa/66566 + * gcc.target/i386/mpx/pr66566.c: New test. + +2015-07-23 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline: + 2015-07-17 Uros Bizjak <ubizjak@gmail.com> + + PR target/66891 + * gcc.target/i386/pr66891.c: New test. + +2015-07-23 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r224643. + 2015-06-19 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR middle-end/pr66581 + * gcc.target/i386/mpx/pr66581.c: New test. + +2015-07-23 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r224602. + 2015-06-18 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR target/66569 + * gcc.target/i386/mpx/chkp-vararg.c: New test. + +2015-07-23 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r224601. + 2015-06-18 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR middle-end/66568 + * gcc.target/i386/mpx/pr66568.c: New test. + + Backport from mainline r225296. + 2015-07-01 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.target/i386/mpx/pr66568.c (exit): New prototype. +2015-07-23 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r224600. + 2015-06-18 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR middle-end/66567 + * gcc.target/i386/mpx/pr66567.c: New test. + +2015-07-23 Ilya Enkovich <enkovich.gnu@gmail.com> + + Backport from mainline r223215. + 2015-05-15 Ilya Enkovich <enkovich.gnu@gmail.com> + + PR middle-end/66134 + * gcc.target/i386/mpx/pr66134.c: New test. + +2015-07-23 Ilya Enkovich <ilya.enkovich@intel.com> + + Backport from mainline r223114. + 2015-05-13 Ilya Enkovich <ilya.enkovich@intel.com> + + PR target/66048 + * gcc.target/i386/mpx/pr66048.cc: New. + +2015-07-23 Ilya Enkovich <ilya.enkovich@intel.com> + + Backport from mainline r223216. + 2015-05-15 Ilya Enkovich <ilya.enkovich@intel.com> + + * gcc.dg/lto/chkp-wrap-asm-name_0.c: New. + +2015-07-23 Ilya Enkovich <ilya.enkovich@intel.com> + + Backport from mainline r224074. + 2015-06-03 Ilya Enkovich <ilya.enkovich@intel.com> + + * gcc.dg/lto/chkp-removed-alias_0.c: New. + +2015-07-21 Alex Velenko <Alex.Velenko@arm.com> + + Backport from mainline: + 2015-07-21 Alex Velenko <Alex.Velenko@arm.com> + + * gcc.target/arm/thumb-bitfld1.c (foo): Add explicit return type. + +2015-07-21 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/66035 + * gfortran.dg/structure_constructor_13.f03: New test. + +2015-07-21 Alex Velenko <Alex.Velenko@arm.com> + + Backport from mainline: + 2015-05-20 Alex Velenko <Alex.Velenko@arm.com> + + * gcc.target/arm/thumb1-far-jump-2.c (r4): Added int in definition. + +2015-07-21 Alex Velenko <Alex.Velenko@arm.com> + + Backport from mainline: + 2015-06-01 Alex Velenko <Alex.Velenko@arm.com> + + * gcc.target/arm/thumb-ltu.c (foo): Predefined. + (bar): Predefined. + +2015-07-21 Mantas Mikaitis <mantas.mikaitis@arm.com> + + * gcc.target/arm/macro_defs0.c: Add directive to skip + test if -marm is present. + * gcc.target/arm/macro_defs1.c: Likewise. + +2015-07-18 Uros Bizjak <ubizjak@gmail.com> + + PR target/66922 + * gcc.target/i386/pr66922.c: New test. + +2015-07-17 Mikael Morin <mikael@gcc.gnu.org> + + * gfortran.dg/coarray_collectives_16.f90: Fix patterns + as follow-up to r225932. + +2015-07-17 Uros Bizjak <ubizjak@gmail.com> + + PR target/66866 + * g++.dg/pr66866.C: New test. + +2015-07-17 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline: + 2015-07-10 Uros Bizjak <ubizjak@gmail.com> + + PR target/66703 + * gcc.target/i386/readeflags-1.c (readeflags_test): Declare with + __attribute__((noinline, noclone)). Change "x" to "volatile char" + type to prevent possible flag-clobbering zero-extensions. + * gcc.target/i386/pr66703.c: New test. + +2015-07-17 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline: + 2015-07-09 Uros Bizjak <ubizjak@gmail.com> + + PR target/66814 + * gcc.target/i386/pr66814.c: New test. + +2015-07-17 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline: + 2015-07-15 Uros Bizjak <ubizjak@gmail.com> + + PR rtl-optimization/66838 + * gcc.target/i386/pr66838.c: New test. + +2015-07-17 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> + + * gfortran.dg/co_reduce_1.f90: New file. + +2015-07-16 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/66864 + * gfortran.dg/pr66864.f90: New test. + +2015-07-16 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/66545 + * gfortran.dg/pr66545_1.f90: New test. + * gfortran.dg/pr66545_2.f90: New test. + +2015-07-16 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/56520 + * gfortran.dg/pr56520.f90: New test. + +2015-07-16 Steven G. Kargl <kargl@gcc.gnu.org> + + * gfortran.dg/iomsg_2.f90: New test. + +2015-07-16 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/66725 + * gfortran.dg/pr66725.f90: New test. + +2015-07-16 Martin Liska <mliska@suse.cz> + + * g++.dg/ipa/pr66896.c: New test. + +2015-07-16 Marek Polacek <polacek@redhat.com> + + Backported from mainline + 2015-07-08 Marek Polacek <polacek@redhat.com> + + PR c++/66748 + * g++.dg/abi/abi-tag15.C: New test. + 2015-07-16 Release Manager * GCC 5.2.0 released. @@ -792,7 +2060,7 @@ Add missing ChangeLog entry for r222341. Backport from trunk r222273 - 2015-04-21 Andreas Tobler <andreast@gcc.gnu.org> + 2015-04-21 Andreas Tobler <andreast@gcc.gnu.org> * gcc.target/i386/avx512bw-vpermi2w-2.c: Fix includes to use actual headers. * gcc.target/i386/avx512bw-vpermt2w-2.c: Likewise. diff --git a/gcc/testsuite/c-c++-common/gomp/pr67501.c b/gcc/testsuite/c-c++-common/gomp/pr67501.c new file mode 100644 index 0000000000..8a7140faf2 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67501.c @@ -0,0 +1,12 @@ +/* PR c/67501 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (void) +{ + int i, j; + #pragma omp for simd copyprivate(j /* { dg-error "before end of line" } */ + for (i = 0; i < 16; ++i) /* { dg-error "is not valid for" "" { target *-*-* } 9 } */ + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr67502.c b/gcc/testsuite/c-c++-common/gomp/pr67502.c new file mode 100644 index 0000000000..74fef4d912 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67502.c @@ -0,0 +1,16 @@ +/* PR c/67502 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ +/* { dg-additional-options "-std=c99" { target c } } */ + +void bar (int, int); + +void +foo (void) +{ +#pragma omp parallel +#pragma omp for simd collapse(2) + for (int i = 0; i < 16; ++i) + for (int j = 0; j < 16; ++j) + bar (i, j); +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr67517.c b/gcc/testsuite/c-c++-common/gomp/pr67517.c new file mode 100644 index 0000000000..3055ffb34e --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67517.c @@ -0,0 +1,13 @@ +/* PR middle-end/67517 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int +foo (int x, int y, int z) +{ + int i; + #pragma omp parallel for simd linear (y : x & 15) linear (x : 16) linear (z : x & 15) + for (i = 0; i < 256; ++i) + x += 16, y += x & 15, z += x & 15; + return x + y + z; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr67521.c b/gcc/testsuite/c-c++-common/gomp/pr67521.c new file mode 100644 index 0000000000..b34c117ae3 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67521.c @@ -0,0 +1,20 @@ +/* PR middle-end/67521 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int x) +{ + int i = 0; + #pragma omp parallel for simd + for (i = (i & x); i < 10; i = i + 2) + ; + i = 0; + #pragma omp parallel for simd + for (i = 0; i < (i & x) + 10; i = i + 2) + ; + i = 0; + #pragma omp parallel for simd + for (i = 0; i < 10; i = i + ((i & x) + 2)) + ; +} diff --git a/gcc/testsuite/c-c++-common/ubsan/pr56956.c b/gcc/testsuite/c-c++-common/ubsan/pr56956.c new file mode 100644 index 0000000000..996e1dd8a7 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr56956.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=undefined -fsanitize-undefined-trap-on-error" } */ + +unsigned int __attribute__((noinline,noclone)) +foo (unsigned int x) +{ + return x <= __INT_MAX__ ? x : -x; +} + +int +main () +{ + volatile unsigned int tem = foo (-__INT_MAX__ - 1); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/ubsan/pr64906.c b/gcc/testsuite/c-c++-common/ubsan/pr64906.c new file mode 100644 index 0000000000..e0ac0eefd5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr64906.c @@ -0,0 +1,12 @@ +/* PR sanitizer/64906 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=integer-divide-by-zero -O -Werror=maybe-uninitialized" } */ + +int +fn1 (int f, int s) +{ + int ret = 0; + if (f) + ret = s / (f ? (unsigned long) 8 : 0); + return ret; +} diff --git a/gcc/testsuite/c-c++-common/ubsan/pr66908.c b/gcc/testsuite/c-c++-common/ubsan/pr66908.c new file mode 100644 index 0000000000..5f731f0cba --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr66908.c @@ -0,0 +1,15 @@ +/* PR sanitizer/66908 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=shift,bounds -O2 -Werror=maybe-uninitialized" } */ +/* { dg-additional-options "-std=gnu90" { target c } } */ + +struct S { int a[22]; }; +static int const e[22] = { }; + +void +foo (struct S const *s, unsigned int m, unsigned int *res) +{ + unsigned int i; + for (i = 0; i < 22; ++i) + res[i] = ((s->a[i] + e[i]) << m); +} diff --git a/gcc/testsuite/g++.dg/abi/abi-tag15.C b/gcc/testsuite/g++.dg/abi/abi-tag15.C new file mode 100644 index 0000000000..bfda3a279e --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/abi-tag15.C @@ -0,0 +1,3 @@ +// PR c++/66748 + +enum __attribute__((abi_tag("foo"))) E {}; // { dg-error "redeclaration of" } diff --git a/gcc/testsuite/g++.dg/abi/mangle67.C b/gcc/testsuite/g++.dg/abi/mangle67.C new file mode 100644 index 0000000000..69ca90b029 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle67.C @@ -0,0 +1,21 @@ +// PR c++/67354 +// { dg-do compile { target c++11 } } +// { dg-options "-fabi-version=5 -Os" } + +class A +{ +}; + +template <typename T> +void +foo () +{ + T (); +} + +struct B : virtual A +{ + template <typename...> B () {} +}; + +auto f = foo<B>; diff --git a/gcc/testsuite/g++.dg/conversion/access1.C b/gcc/testsuite/g++.dg/conversion/access1.C index f187e63a9d..6ed063aa15 100644 --- a/gcc/testsuite/g++.dg/conversion/access1.C +++ b/gcc/testsuite/g++.dg/conversion/access1.C @@ -15,7 +15,7 @@ struct B : protected P struct C : public P { // C can access P's copy ctor, but can't convert b to const P&. - C(const B& b) : P(b) {} // { dg-error "inaccessible base" } + C(const B& b) : P(b) {} // { dg-error "inaccessible base" "" { xfail *-*-* } } }; void foo() diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-52.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-52.C new file mode 100644 index 0000000000..2734075390 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-52.C @@ -0,0 +1,24 @@ +// PR c++/67021 +// { dg-do compile { target c++11 } } + +template<typename> struct Dummy; +template<> struct Dummy<int> {}; + +template <class...> +struct all_same { static constexpr bool value = true; }; +template <class T, class...Rest> +struct all_same<T, T, Rest...> : all_same<T, Rest...> {}; +template <class T, class U, class...Rest> +struct all_same<T, U, Rest...> { static constexpr bool value = false; }; + +template <class R> +using ValueType = int; + +template <class I> +constexpr bool A(I i) { + return all_same<ValueType<I>, ValueType<decltype(i++)>>::value; +} + +int main() { + static_assert(A(42), ""); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas1.C b/gcc/testsuite/g++.dg/cpp0x/alignas1.C new file mode 100644 index 0000000000..d73c875d63 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignas1.C @@ -0,0 +1,16 @@ +// PR c++/65734 +// { dg-do compile { target c++11 } } + +template <class T> struct A +{ + T t; +}; + +typedef A<int> T[4] alignas (2 * alignof (int)); +A<int> a[4]; + +typedef A<char> T2[4] alignas (2 * alignof (int)); + +#define SA(X) static_assert((X),#X) +SA(alignof (T) == 2 * alignof(int)); +SA(alignof (T2) == 2 * alignof(int)); diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas2.C b/gcc/testsuite/g++.dg/cpp0x/alignas2.C new file mode 100644 index 0000000000..2e7d051c88 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignas2.C @@ -0,0 +1,20 @@ +// PR c++/65734 +// { dg-do compile { target c++11 } } + +template <typename T> +struct BVector +{ + T t; +}; +BVector<int> m; + +template <template <class> class T> +struct BV2 +{ + typedef T<float> value_type alignas (16); + value_type v; +}; +BV2<BVector> m2; + +#define SA(X) static_assert((X),#X) +SA(alignof (BV2<BVector>::value_type) == 16); diff --git a/gcc/testsuite/g++.dg/cpp0x/anon-union1.C b/gcc/testsuite/g++.dg/cpp0x/anon-union1.C new file mode 100644 index 0000000000..19f6291211 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/anon-union1.C @@ -0,0 +1,27 @@ +// PR c++/66583 +// { dg-do run { target c++11 } } + +template <class T> +T&& move(T& t) { return static_cast<T&&>(t); } + +struct A { + A() { }; + A(const A&) { } +}; + +struct B { + union { + int m_1 = 0; + int m_2; + }; + A dummy; +}; + +int main() +{ + B b; + b.m_1 = 1; + B c = move(b); + if (c.m_1 != 1) + __builtin_abort(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array13.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array13.C new file mode 100644 index 0000000000..e2a6e865e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array13.C @@ -0,0 +1,6 @@ +// PR c++/68087 +// { dg-do compile { target c++11 } } + +constexpr char c[] = "hello"; +constexpr const char *p = c; +constexpr char ch = *(p-1); // { dg-error "array subscript" } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C new file mode 100644 index 0000000000..3ebdf3b36a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C @@ -0,0 +1,29 @@ +// PR c++/67244 +// { dg-do compile { target c++11 } } + +class A { +public: + int operator*(); +}; +template <typename T, typename Predicate> +void searchGen(int, int, T, Predicate p4) { + p4(0); +} +template <typename...> struct B; +template <typename MetaFunction, typename Type, typename... Types> +struct B<MetaFunction, Type, Types...> { + static void exec() { MetaFunction::template exec<Type>; } +}; +template <typename MetaFunction, typename... Types> void forEachType() { + B<MetaFunction, Types...>::exec; +} +namespace { +struct C { + template <typename T> void exec() { + A __trans_tmp_1; + const auto target = *__trans_tmp_1; + searchGen(0, 0, 0, [=](T) { [=] { target; }; }); + } +}; +} +void ____C_A_T_C_H____T_E_S_T____75() { forEachType<C, int>; } diff --git a/gcc/testsuite/g++.dg/cpp0x/local-type1.C b/gcc/testsuite/g++.dg/cpp0x/local-type1.C new file mode 100644 index 0000000000..73bfd16738 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/local-type1.C @@ -0,0 +1,19 @@ +// PR c++/51048 +// { dg-do compile { target c++11 } } + +template<typename X> +struct A { + virtual void DoPush(X const& x) = 0; + void Push(X const& x) { DoPush(x); } +}; + +template<typename X> +struct B : A<X> { + using A<X>::Push; + virtual void DoPush(X const&) { } +}; + +int main() { + enum S { }; + B<S>().Push(S()); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn27.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn27.C new file mode 100644 index 0000000000..c9291c2b8e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn27.C @@ -0,0 +1,42 @@ +// PR c++/66919 +// { dg-do compile { target c++14 } } + +template <int> +struct A { + template <typename F, typename R, typename T> + static auto run (F fn, R, T) { auto r = fn (); } // { dg-error "" } +}; +template <typename F, typename T> +auto foo (F fn, T) +{ + A <0>::run (fn, 0, 0); +} +struct B; +struct C { + typedef B D; +}; +struct E { + virtual void bar (const int &); +}; +template <typename C> +struct F : E { + typedef typename C::D::G G; + void bar (const G &); + typename C::D::H I; +}; +struct J { struct K {}; }; +template <typename T> +void +F<T>::bar (const G &) +{ + auto s = I; + typedef decltype (s) L; + auto u =[&](L) { auto t = foo (J::K (), 0); }; // { dg-error "" } +} +struct B { + typedef int G; + typedef int H; +}; +struct M : F <C> { + M () {} +}; diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-array1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-array1.C new file mode 100644 index 0000000000..efe4617c9e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-array1.C @@ -0,0 +1,20 @@ +// PR c++/67104 +// { dg-do compile { target c++14 } } + +template <typename T, int N> struct array +{ + constexpr T &operator[](int index) { return data[index]; } + constexpr T operator[](int index) const { return data[index]; } + T data[N]; +}; + +constexpr array<long unsigned, 1001> +make_bottle_count () +{ + array<long unsigned, 1001> a{}; + a[65] = 1; + return a; +} + +constexpr auto bottle_count = make_bottle_count (); +static_assert (bottle_count[65], ""); diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-copy1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-copy1.C new file mode 100644 index 0000000000..ce0c12d729 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-copy1.C @@ -0,0 +1,25 @@ +// PR c++/67813 +// { dg-do compile { target c++14 } } + +struct Ptr { + int* p; + + constexpr Ptr(int* p) noexcept : p{p} {} + constexpr int& operator*() const { + return *p; + } +}; + +constexpr int f(int& i) { + //Ptr first{&i}; // Works. + Ptr first = &i; // Error + return *first; +} + +constexpr int g() { + int i = 42; + return f(i); +} + +#define SA(X) static_assert((X), #X) +SA(g() == 42); diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C new file mode 100644 index 0000000000..51e7a3f21d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice3.C @@ -0,0 +1,3 @@ +// PR c++/66533 +// { dg-do compile { target c++14 } } +auto a([](auto) -> decltype((void)0) {}); diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C new file mode 100644 index 0000000000..ec4db83b6e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C @@ -0,0 +1,10 @@ +// PR c++/67369 +// { dg-do compile { target c++14 } } + +int main() { + unsigned const nsz = 0; + auto repeat_conditional = [&](auto) { + auto new_sz = nsz; + }; + repeat_conditional(1); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ32.C b/gcc/testsuite/g++.dg/cpp1y/var-templ32.C new file mode 100644 index 0000000000..80077a16b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ32.C @@ -0,0 +1,7 @@ +// { dg-do compile { target c++14 } } + +template<typename T> +bool V1 = true; + +template<typename T> +bool V1<int> = false; // { dg-error "primary template|not deducible" } diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ33.C b/gcc/testsuite/g++.dg/cpp1y/var-templ33.C new file mode 100644 index 0000000000..53c6db2b97 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ33.C @@ -0,0 +1,20 @@ +// Test for variable templates in pack expansion +// { dg-do compile { target c++14 } } + +template <int I> const int Val = I; + +constexpr int f () { return 0; } +template <class T, class ...Ts> +constexpr int f(T t, Ts... ts) +{ + return t + f(ts...); +} + +template <int... Is> +constexpr int g() +{ + return f(Val<Is>...); +} + +#define SA(X) static_assert((X),#X) +SA((g<1,2,3,4>() == 1+2+3+4)); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ35.C b/gcc/testsuite/g++.dg/cpp1y/var-templ35.C new file mode 100644 index 0000000000..5ed0abca4b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ35.C @@ -0,0 +1,5 @@ +// PR c++/66595 +// { dg-do compile { target c++14 } } + +template<typename T> int typeID{42}; +template<typename T> double typeID<double>{10.10}; // { dg-error "primary template|redeclaration|not deducible" } diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ36.C b/gcc/testsuite/g++.dg/cpp1y/var-templ36.C new file mode 100644 index 0000000000..760e36fca4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ36.C @@ -0,0 +1,15 @@ +// { dg-do compile { target c++14 } } + +template <class T> +constexpr T v = T(); + +template <class T> +constexpr T v<T*> = T(); + +template <class T> +struct A { + static constexpr decltype (v<T>) v = ::v<T>; +}; + +double d1 = v<double*>; +double d2 = A<double*>::v; diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ37.C b/gcc/testsuite/g++.dg/cpp1y/var-templ37.C new file mode 100644 index 0000000000..11021a3f5b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ37.C @@ -0,0 +1,23 @@ +// PR c++/65195 +// { dg-do compile { target c++14 } } + +template<typename T> +T constant {}; + +template<typename T> +struct foo { + int operator()() const + { return 3; } +}; + +template<typename T> +auto& f = constant<foo<T>>; + +int main() +{ + // fine + auto& ref = f<int>; ref(); + + // error: f<int> cannot be used as a function + f<int>(); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ38.C b/gcc/testsuite/g++.dg/cpp1y/var-templ38.C new file mode 100644 index 0000000000..1fd76d38d4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ38.C @@ -0,0 +1,9 @@ +// PR c++/66596 +// { dg-do compile { target c++14 } } + +struct U { void f() {} }; +struct V { void f() {} }; +template<class T> U t; +template<> V t<int>; +template<class T> void g() { t<T>.f(); } +int main() { g<int>(); } diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ39.C b/gcc/testsuite/g++.dg/cpp1y/var-templ39.C new file mode 100644 index 0000000000..e06519d548 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ39.C @@ -0,0 +1,16 @@ +// PR c++/66260 +// { dg-do compile { target c++14 } } + +template <class> +constexpr bool foo = false; +template <> +constexpr bool foo<int> = true; +template <class T, int N> +constexpr bool foo<T[N]> = foo<T>; + +static_assert(foo<int>, ""); +static_assert(!foo<double>, ""); +static_assert(foo<int[3]>, ""); +static_assert(!foo<double[3]>, ""); +static_assert(foo<int[2][5][3]>, ""); +static_assert(!foo<double[2][5][3]>, ""); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ40.C b/gcc/testsuite/g++.dg/cpp1y/var-templ40.C new file mode 100644 index 0000000000..0a952c4806 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ40.C @@ -0,0 +1,9 @@ +// PR c++/66619 +// { dg-do compile { target c++14 } } + +int y; +template<class T> T val1 = y; +auto&& x1 = val1<int&>; + +template<class T> T val2 = 0; +auto&& x2 = val2<int&&>; diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ42.C b/gcc/testsuite/g++.dg/cpp1y/var-templ42.C new file mode 100644 index 0000000000..a43149d9b5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ42.C @@ -0,0 +1,17 @@ +// PR c++/67131 +// { dg-do compile { target c++14 } } + +template <typename T> typename T::_ type; +template <template <typename...> class> struct A; +template <template <typename> class f> A<f> metafunction; +namespace detail { +template <typename> struct _decltype; +} +template <template <typename...> class F> struct A { + template <typename... T> + auto operator()() -> decltype(type<F<detail::_decltype<T>...>>); +}; +template <typename F> auto valid_call(F f) -> decltype(f()); +constexpr auto valid_call(...) { return 0; } +template <typename> struct no_type; +static_assert(!valid_call(metafunction<no_type>),""); // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ43.C b/gcc/testsuite/g++.dg/cpp1y/var-templ43.C new file mode 100644 index 0000000000..414802fd6c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ43.C @@ -0,0 +1,35 @@ +// PR c++/67130 +// { dg-do compile { target c++14 } } + +namespace std { +template <typename> struct __success_type; +template <typename> void declval(); +template <typename> class decay { +public: + typedef int type; +}; +template <typename...> struct common_type; +struct A { + template <typename, typename _Up> + static __success_type<typename decay<decltype(declval<_Up>)>::type> _S_test; +}; +template <typename _Tp, typename _Up> struct __common_type_impl : A { + typedef decltype(_S_test<_Tp, _Up>) type; +}; +template <typename _Tp, typename _Up> +struct common_type<_Tp, _Up> : __common_type_impl<_Tp, _Up> {}; +} +template <typename> struct B { struct _; }; +template <typename T> typename B<T>::_ type; +template <template <typename...> class> struct C; +template <template <typename...> class f> C<f> metafunction; +template <typename T> struct B<T>::_ {}; +namespace detail { +template <typename> struct _decltype; +} +template <template <typename...> class F> struct C { + template <typename... T> + auto operator()(T...) + -> decltype(type<typename F<detail::_decltype<T>...>::type>); +}; +auto common_type = metafunction<std::common_type>(0, 0); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ44.C b/gcc/testsuite/g++.dg/cpp1y/var-templ44.C new file mode 100644 index 0000000000..2fc21a5063 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ44.C @@ -0,0 +1,29 @@ +// PR c++/67161 +// { dg-do compile { target c++14 } } + +template <typename _Tp> struct integral_constant { + static constexpr _Tp value = 0; +}; +template <bool, typename, typename> struct conditional; +template <typename...> struct __or_; +template <typename _B1, typename _B2> +struct __or_<_B1, _B2> : conditional<1, _B1, _B2>::type {}; +template <typename...> struct __and_; +template <typename> struct __not_ : integral_constant<bool> {}; +template <typename> struct __is_void_helper : integral_constant<bool> {}; +template <typename> struct is_void : __is_void_helper<int> {}; +template <bool, typename _Iftrue, typename> struct conditional { + typedef _Iftrue type; +}; +template <bool _Cond, typename _Iftrue, typename _Iffalse> +using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type; +template <typename...> using common_type_t = int; +template <typename, int> struct array {}; +template <typename _Tp> constexpr int is_void_v = is_void<_Tp>::value; +template <typename _Dest = void, typename... _Types> +constexpr auto make_array() + -> array<conditional_t<is_void_v<_Dest>, common_type_t<>, _Dest>, + sizeof...(_Types)> { + static_assert(__or_<__not_<is_void<_Dest>>, __and_<>>::value, ""); // { dg-error "static assert" } +} +auto d = make_array(); diff --git a/gcc/testsuite/g++.dg/eh/goto3.C b/gcc/testsuite/g++.dg/eh/goto3.C new file mode 100644 index 0000000000..d584ad76e8 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/goto3.C @@ -0,0 +1,14 @@ +// PR c++/67409 +// { dg-options "-fpermissive" } + +void f() +try + { + goto l2; // { dg-message "from here" } + l1: ; // { dg-error "jump to label 'l1'" } + } catch (...) + { + l2: ; // { dg-error "jump to label 'l2'" } + // { dg-message "enters catch block" "" { target *-*-*} 11 } + goto l1; // { dg-message "from here|enters try block" } + } diff --git a/gcc/testsuite/g++.dg/gomp/pr67504.C b/gcc/testsuite/g++.dg/gomp/pr67504.C new file mode 100644 index 0000000000..0f1758b6f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67504.C @@ -0,0 +1,15 @@ +// PR c++/67504 +// { dg-do compile } +// { dg-options "-fopenmp" } + +int bar (int); +double bar (double); + +template <typename T> +void +foo (T x) +{ + #pragma omp for collapse (x + 1) // { dg-error "collapse argument needs positive constant integer expression" } + for (int i = 0; i < 10; i++) + ; +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67511.C b/gcc/testsuite/g++.dg/gomp/pr67511.C new file mode 100644 index 0000000000..3e0e9a388f --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67511.C @@ -0,0 +1,20 @@ +// PR c++/67511 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct I +{ + I (); + I (const I &); + I &operator++ (); + bool operator< (const I &) const; +}; +__PTRDIFF_TYPE__ operator- (const I &, const I &); + +void +foo (I &x, I &y) +{ +#pragma omp for + for (I i = x; i < y; ++i) // { dg-error "no match for" } + ; +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67514.C b/gcc/testsuite/g++.dg/gomp/pr67514.C new file mode 100644 index 0000000000..a631b8bfed --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67514.C @@ -0,0 +1,30 @@ +// PR c++/67514 +// { dg-do compile } +// { dg-options "-fopenmp" } + +template <class T> +void +foo (T x, T y) +{ + #pragma omp parallel + #pragma omp for simd + for (T i = x; i < y; ++i) + ; + #pragma omp parallel + #pragma omp for simd collapse (2) + for (T i = x; i < y; ++i) + for (T j = x; j < y; j++) + ; +} + +void +bar (int *x, int *y) +{ + foo (x, y); +} + +void +baz (int x, int y) +{ + foo (x, y); +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67522.C b/gcc/testsuite/g++.dg/gomp/pr67522.C new file mode 100644 index 0000000000..84c854afd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67522.C @@ -0,0 +1,26 @@ +// PR c++/67522 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct S; + +template <int N> +void +foo (void) +{ + #pragma omp simd linear (S) // { dg-error "is not a variable in clause" } + for (int i = 0; i < 16; i++) + ; + + #pragma omp target map (S[0:10]) // { dg-error "is not a variable in" } + ; + + #pragma omp task depend (inout: S[0:10]) // { dg-error "is not a variable in" } + ; +} + +void +bar () +{ + foo <0> (); +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67523.C b/gcc/testsuite/g++.dg/gomp/pr67523.C new file mode 100644 index 0000000000..fb12c8c469 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67523.C @@ -0,0 +1,29 @@ +// PR c++/67523 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct S { int s; }; + +template <typename T> +void foo (T &x, T &y) +{ +#pragma omp for simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +#pragma omp parallel for simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +#pragma omp target teams distribute parallel for simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +#pragma omp target teams distribute simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +} + +void +bar () +{ + S x, y; + foo <S> (x, y); +} diff --git a/gcc/testsuite/g++.dg/inherit/access9.C b/gcc/testsuite/g++.dg/inherit/access9.C new file mode 100644 index 0000000000..cdbc640439 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/access9.C @@ -0,0 +1,14 @@ +// PR c++/66957 + +class BaseClass { +protected: + static int x; +}; + +struct DerivedA : BaseClass { }; + +struct DerivedB : BaseClass { + DerivedB() { + (void) DerivedA::x; + } +}; diff --git a/gcc/testsuite/g++.dg/init/elide3.C b/gcc/testsuite/g++.dg/init/elide3.C new file mode 100644 index 0000000000..7eb0389a3f --- /dev/null +++ b/gcc/testsuite/g++.dg/init/elide3.C @@ -0,0 +1,50 @@ +// PR c++/67557 +// { dg-do run } + +namespace std +{ + struct string + { + typedef unsigned long size_type; + const char* _M_p; + char _M_local_buf[1]; + + string(const char* s) : _M_p(_M_local_buf) + { + __builtin_printf("%p constructed\n", this); + } + + string(const string& s) : _M_p(_M_local_buf) + { + __builtin_printf("%p copied from %p\n", this, &s); + } + + ~string() + { + __builtin_printf("%p destroyed\n", this); + if (_M_p != _M_local_buf) + __builtin_abort(); + } + }; +} + +struct StartTag +{ + explicit StartTag(std::string const & tag) : tag_(tag), keepempty_(false) {} + std::string tag_; + bool keepempty_; +}; + +StartTag fontToStartTag() { return StartTag(""); } + +struct FontTag : public StartTag +{ + FontTag() : StartTag(fontToStartTag()) {} +}; + +int main() +{ + FontTag x; + __builtin_printf("%p x.tag_ in main()\n", &x.tag_); + return 0; +} diff --git a/gcc/testsuite/g++.dg/init/pr66857.C b/gcc/testsuite/g++.dg/init/pr66857.C new file mode 100644 index 0000000000..43b0927227 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/pr66857.C @@ -0,0 +1,19 @@ +// PR c++/66857 +// { dg-do run } + +const int i = 0; + +struct Test +{ + Test (const int &rhs) + { + if (&rhs != &i) + __builtin_abort (); + } +}; + +int +main (void) +{ + Test test = i; +} diff --git a/gcc/testsuite/g++.dg/ipa/pr65908.C b/gcc/testsuite/g++.dg/ipa/pr65908.C new file mode 100644 index 0000000000..38730bd0b2 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr65908.C @@ -0,0 +1,27 @@ +// PR ipa/65908 +// { dg-do compile } +// { dg-options "-O2" } +// { dg-additional-options "-fPIC" { target fpic } } + +class A +{ + A (A &); +}; +class B +{ + const A &m_fn1 () const; +}; +class C +{ + A m_fn2 () const; +}; +A +C::m_fn2 () const +{ + throw 0; +} +const A & +B::m_fn1 () const +{ + throw 0; +} diff --git a/gcc/testsuite/g++.dg/ipa/pr67056.C b/gcc/testsuite/g++.dg/ipa/pr67056.C new file mode 100644 index 0000000000..f47323b6e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr67056.C @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-std=c++11 -O3 -fdump-ipa-cp" } */ +/* { dg-additional-options "-fPIC" { target fpic } } */ +#include <memory> + +class EmptyClass { +public: + EmptyClass(); +}; + +EmptyClass::EmptyClass() { +} + +class CompositeClass { +public: + CompositeClass() {} + virtual ~CompositeClass() {} + EmptyClass object; + bool bool1; + bool bool2; +}; + +bool boolFunc() { + return true; +} + +static bool staticBoolFunc(CompositeClass * ptr) { + std::unique_ptr<CompositeClass> up(ptr); + (void)up; + + return boolFunc(); +} + +int main(int, char **) { + staticBoolFunc(new CompositeClass); + return 0; +} + +/* { dg-final { scan-ipa-dump "Speculative outer type:struct CompositeClass" "cp" } } */ diff --git a/gcc/testsuite/g++.dg/lto/pr66705_0.C b/gcc/testsuite/g++.dg/lto/pr66705_0.C new file mode 100644 index 0000000000..faf3f2d24c --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr66705_0.C @@ -0,0 +1,15 @@ +// { dg-lto-do link } +// { dg-lto-options { { -O2 -flto -flto-partition=max -fipa-pta } } } +// { dg-extra-ld-options "-r -nostdlib" } + +class A { +public: + A(); +}; +int a = 0; +void foo() { + a = 0; + A b; + for (; a;) + ; +} diff --git a/gcc/testsuite/g++.dg/lto/pr68057_0.C b/gcc/testsuite/g++.dg/lto/pr68057_0.C new file mode 100644 index 0000000000..4e124d7f5e --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr68057_0.C @@ -0,0 +1,23 @@ +// { dg-lto-do link } +/* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */ +struct SPxPricer; +struct SoPlex { + virtual void setPricer(SPxPricer *); +}; +struct SPxPricer { + virtual void load(SoPlex *); +}; +struct SLUFactor { + SLUFactor(); + virtual ~SLUFactor(); +}; +struct SPxSolver : SoPlex { + SPxPricer pr; + SLUFactor slu; + SPxSolver(); +}; +struct A : SPxSolver {}; +A a; + +void SoPlex::setPricer(SPxPricer *p1) { p1->load(this); } + diff --git a/gcc/testsuite/g++.dg/lto/pr68057_1.C b/gcc/testsuite/g++.dg/lto/pr68057_1.C new file mode 100644 index 0000000000..f45a81ec88 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr68057_1.C @@ -0,0 +1,17 @@ +struct SPxPricer; +struct SoPlex { + virtual void setPricer(SPxPricer *); +}; +struct SPxPricer { + virtual void load(SoPlex *); +}; +struct SLUFactor { + SLUFactor(); + virtual ~SLUFactor(); +}; +struct SPxSolver : SoPlex { + SPxPricer pr; + SLUFactor slu; + SPxSolver(); +}; +SPxSolver::SPxSolver() { setPricer(&pr); } diff --git a/gcc/testsuite/g++.dg/opt/pr68157.C b/gcc/testsuite/g++.dg/opt/pr68157.C new file mode 100644 index 0000000000..1d723486fb --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr68157.C @@ -0,0 +1,18 @@ +// PR tree-optimization/68157 +// { dg-do compile } +// { dg-options "-Ofast" } + +double a, b, c, d; +int h, foo (); + +void +bar () +{ + while (foo ()) + { + double e = b * a * a; + double f = b * d; + if (h) + c = e + f; + } +} diff --git a/gcc/testsuite/g++.dg/pr66866.C b/gcc/testsuite/g++.dg/pr66866.C new file mode 100644 index 0000000000..72ff3b192a --- /dev/null +++ b/gcc/testsuite/g++.dg/pr66866.C @@ -0,0 +1,29 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target sse2_runtime } +// { dg-options "-O -msse2" } + +extern "C" void abort (void); + +typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef short A __attribute__((__may_alias__)); + +__m128i __attribute__((noinline)) +shuf(const __m128i v) +{ + __m128i r; + + reinterpret_cast<A *>(&r)[5] = reinterpret_cast<const A *>(&v)[4]; + return r; +} + +int main() +{ + __attribute__((aligned(16))) short mem[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + + *reinterpret_cast<__m128i *>(mem) = shuf (*reinterpret_cast<__m128i *>(mem)); + + if (mem[5] != 4) + abort (); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/pr67211.C b/gcc/testsuite/g++.dg/pr67211.C new file mode 100644 index 0000000000..4afc69f453 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr67211.C @@ -0,0 +1,50 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-mcpu=power7 -mtune=power8 -O3 -w" } */ + +/* target/67211, compiler got a 'insn does not satisfy its constraints' error. */ + +template <typename _InputIterator, typename _ForwardIterator> +void find_first_of(_InputIterator, _InputIterator, _ForwardIterator p3, + _ForwardIterator p4) { + for (; p3 != p4; ++p3) + ; +} + +template <typename, typename, typename> struct A { + int _S_buffer_size; + int *_M_cur; + int *_M_first; + int *_M_last; + int **_M_node; + void operator++() { + if (_M_cur == _M_last) + m_fn1(_M_node + 1); + } + void m_fn1(int **p1) { + _M_node = p1; + _M_first = *p1; + _M_last = _M_first + _S_buffer_size; + } +}; + +template <typename _Tp, typename _Ref, typename _Ptr> +bool operator==(A<_Tp, _Ref, _Ptr>, A<_Tp, _Ref, _Ptr>); +template <typename _Tp, typename _Ref, typename _Ptr> +bool operator!=(A<_Tp, _Ref, _Ptr> p1, A<_Tp, _Ref, _Ptr> p2) { + return p1 == p2; +} + +class B { +public: + A<int, int, int> m_fn2(); +}; +struct { + B j; +} a; +void Linked() { + A<int, int, int> b, c, d; + find_first_of(d, c, b, a.j.m_fn2()); +} diff --git a/gcc/testsuite/g++.dg/pr67699.C b/gcc/testsuite/g++.dg/pr67699.C new file mode 100644 index 0000000000..c9ff591939 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr67699.C @@ -0,0 +1,8 @@ +// { dg-do compile } +// { dg-require-effective-target lto } +// { dg-options "-flto" } + +template <class T> class foo { + foo() { int const bar[2] = {1, 1}; } +}; +template class foo<int>; diff --git a/gcc/testsuite/g++.dg/pr67989.C b/gcc/testsuite/g++.dg/pr67989.C new file mode 100644 index 0000000000..90261c450b --- /dev/null +++ b/gcc/testsuite/g++.dg/pr67989.C @@ -0,0 +1,75 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c++11 -O2" } */ +/* { dg-additional-options "-marm -march=armv4t" { target arm*-*-* } } */ + +__extension__ typedef unsigned long long int uint64_t; +namespace std __attribute__ ((__visibility__ ("default"))) +{ + typedef enum memory_order + { + memory_order_seq_cst + } memory_order; +} + +namespace std __attribute__ ((__visibility__ ("default"))) +{ + template < typename _Tp > struct atomic + { + static constexpr int _S_min_alignment + = (sizeof (_Tp) & (sizeof (_Tp) - 1)) || sizeof (_Tp) > 16 + ? 0 : sizeof (_Tp); + static constexpr int _S_alignment + = _S_min_alignment > alignof (_Tp) ? _S_min_alignment : alignof (_Tp); + alignas (_S_alignment) _Tp _M_i; + operator _Tp () const noexcept + { + return load (); + } + _Tp load (memory_order __m = memory_order_seq_cst) const noexcept + { + _Tp tmp; + __atomic_load (&_M_i, &tmp, __m); + } + }; +} + +namespace lldb_private +{ + namespace imp + { + } + class Address; +} +namespace lldb +{ + typedef uint64_t addr_t; + class SBSection + { + }; + class SBAddress + { + void SetAddress (lldb::SBSection section, lldb::addr_t offset); + lldb_private::Address & ref (); + }; +} +namespace lldb_private +{ + class Address + { + public: + const Address & SetOffset (lldb::addr_t offset) + { + bool changed = m_offset != offset; + } + std::atomic < lldb::addr_t > m_offset; + }; +} + +using namespace lldb; +using namespace lldb_private; +void +SBAddress::SetAddress (lldb::SBSection section, lldb::addr_t offset) +{ + Address & addr = ref (); + addr.SetOffset (offset); +} diff --git a/gcc/testsuite/g++.dg/torture/pr67055.C b/gcc/testsuite/g++.dg/torture/pr67055.C new file mode 100644 index 0000000000..7cbbca275c --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr67055.C @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-additional-options "-std=c++14" } + +namespace std { + typedef __SIZE_TYPE__ size_t; + struct nothrow_t; +} +namespace vespamalloc { + void fn1(void *); + template <typename> class A { + public: + static unsigned long fillStack(unsigned long); + }; + template <typename StackRep> + unsigned long A<StackRep>::fillStack(unsigned long p1) { + void *retAddr[p1]; + fn1(retAddr); + } + class B { + protected: + B(void *); + }; + template <int StackTraceLen> class D : B { + public: + D() : B(0) {} + void alloc(int) { A<int>::fillStack(StackTraceLen); } + }; + template <typename, typename> class C { + public: + void *malloc(unsigned long); + }; + template <typename MemBlockPtrT, typename ThreadListT> + void *C<MemBlockPtrT, ThreadListT>::malloc(unsigned long) { + MemBlockPtrT mem; + mem.alloc(0); + } + C<D<16>, int> *_GmemP; +} +void *operator new(std::size_t, std::nothrow_t &) noexcept { + return vespamalloc::_GmemP->malloc(0); +} +void *operator new[](std::size_t, std::nothrow_t &) noexcept { + return vespamalloc::_GmemP->malloc(0); +} diff --git a/gcc/testsuite/g++.dg/torture/pr67600.C b/gcc/testsuite/g++.dg/torture/pr67600.C new file mode 100644 index 0000000000..0206cae186 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr67600.C @@ -0,0 +1,15 @@ +// { dg-do run } + +#include <iostream> +#include <sstream> + +int main() +{ + std::basic_ostringstream<char> ostr; + std::ostreambuf_iterator<char> iter(ostr.rdbuf()); + *iter++ = 'X'; + + + std::cout << ostr.str() << '\n'; + return 0; +} diff --git a/gcc/testsuite/g++.dg/torture/pr68220.C b/gcc/testsuite/g++.dg/torture/pr68220.C new file mode 100644 index 0000000000..8775e4dbaf --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr68220.C @@ -0,0 +1,239 @@ +// { dg-do compile } +// { dg-additional-options "-std=gnu++11" } +namespace mpl { +template <typename, typename = int> struct lambda; +template <typename T3> struct if_ { typedef T3 type; }; +template <int> struct arg { + template <typename U1, typename> struct apply { typedef U1 type; }; +}; +template <typename> struct begin_impl; +template <typename Sequence> struct begin { + typedef typename Sequence::tag tag_; + typedef typename begin_impl<tag_>::template apply<Sequence>::type type; +}; +template <typename> struct O1_size_impl; +} +template <long N> struct long_ { static const long value = N; }; +namespace mpl { +template <typename Sequence> +struct O1_size + : O1_size_impl<typename Sequence::tag>::template apply<Sequence> {}; +typedef arg<1> _1; +template <typename T> struct protect : T {}; +template <typename F> struct apply_wrap1 : F::template apply<int> {}; +template <typename F, typename T1, typename T2> +struct apply_wrap2 : F::template apply<T1, T2> {}; +template <typename F> struct apply_wrap5 : F::template apply<int> {}; +template <typename, typename, typename, typename, typename, typename> +struct resolve_bind_arg; +template <typename T, typename> struct replace_unnamed_arg { typedef T type; }; +template <typename F, typename> struct bind1 { + template <typename> struct apply { + typedef typename apply_wrap1<F>::type type; + }; +}; +template <typename F, typename T1, typename U1, typename U2, typename U3, + typename U4, typename U5> +struct resolve_bind_arg<bind1<F, T1>, U1, U2, U3, U4, U5> { + typedef typename apply_wrap5<bind1<F, T1>>::type type; +}; +template <typename F, typename, typename T2> struct bind2 { + template <typename U1, typename U2> struct apply { + typedef resolve_bind_arg<typename replace_unnamed_arg<T2, arg<1>>::type, U1, + U2, int, int, int> t2; + typedef typename apply_wrap2<F, typename U1::type, typename t2::type>::type + type; + }; +}; +template <typename T> struct quote_impl { typedef T type; }; +template <template <typename> class F> struct quote1 { + template <typename> struct apply : quote_impl<F<int>> {}; +}; +template <typename T, typename> struct lambda { + typedef T type; + typedef arg<1> result_; +}; +template <typename, template <typename> class, typename> struct le_result1; +template <template <typename> class F, typename L1> +struct le_result1<int, F, L1> { + typedef protect<bind1<quote1<F>, typename L1::result_>> type; +}; +template <template <typename> class F, typename T1, typename Tag> +struct lambda<F<T1>, Tag> { + typedef typename le_result1<int, F, lambda<T1>>::type type; +}; +template <int, typename, typename, typename> struct iter_fold_impl; +template <typename First, typename State, typename ForwardOp> +struct iter_fold_impl<1, First, State, ForwardOp> { + typedef typename apply_wrap2<ForwardOp, State, First>::type state; +}; +template <typename Sequence, typename State, typename ForwardOp> +struct iter_fold { + typedef typename iter_fold_impl<O1_size<Sequence>::value, + typename begin<Sequence>::type, State, + ForwardOp>::state type; +}; +template <typename> struct deref; +template <typename> struct push_front_impl; +template <typename T> struct l_item { + typedef int tag; + typedef l_item type; + typedef long_<1> size; + typedef T item; +}; +struct l_end { + typedef int tag; + typedef l_end type; +}; +template <> struct push_front_impl<int> { + template <typename, typename T> struct apply { typedef l_item<T> type; }; +}; +template <> struct O1_size_impl<int> { + template <typename> struct apply : l_item<int>::size {}; +}; +template <typename> struct l_iter; +template <typename Node> struct deref<l_iter<Node>> { + typedef typename Node::item type; +}; +template <> struct begin_impl<int> { + template <typename List> struct apply { + typedef l_iter<typename List::type> type; + }; +}; +template <typename> struct list : l_item<int> {}; +} +template <typename T> T &cast_storage(void *storage) { + return *static_cast<T *>(storage); +} +struct symbol; +struct visitation_impl_step { + typedef symbol type; +}; +template <typename Visitor, typename VoidPtrCV, typename T> +void visitation_impl_invoke_impl(int, Visitor visitor, VoidPtrCV storage, T *) { + visitor.internal_visit(cast_storage<T>(storage), 1); +} +int visitation_impl_invoke_internal_which, visitation_impl_logical_which; +template <typename Visitor, typename VoidPtrCV, typename T, + typename NoBackupFlag> +void visitation_impl_invoke(Visitor visitor, VoidPtrCV storage, T t, + NoBackupFlag, int) { + visitation_impl_invoke_impl(visitation_impl_invoke_internal_which, visitor, + storage, t); +} +template <typename Which, typename step0, typename Visitor, typename VoidPtrCV, + typename NoBackupFlag> +void visitation_impl(int, Visitor visitor, VoidPtrCV storage, int, + NoBackupFlag no_backup_flag, Which, step0 *) { + switch (visitation_impl_logical_which) + case 0: + visitation_impl_invoke(visitor, storage, + static_cast<typename step0::type *>(0), no_backup_flag, + 1); +} +template <long N> struct size_t { static const long value = N; }; +struct aligned_storage_imp {}; +template <long> class aligned_storage : aligned_storage_imp { +public: + void *address() { return static_cast<aligned_storage_imp *>(this); } +}; +namespace mpl { +template <typename> struct less; +template <typename> struct select_max { + template <typename OldIterator, typename> struct apply { + typedef OldIterator type; + }; +}; +template <typename Sequence, typename Predicate = less<arg<11>>> +struct max_element : iter_fold<Sequence, typename begin<Sequence>::type, + protect<select_max<Predicate>>> {}; +template <typename Sequence = int, typename T = int> +struct push_front + : push_front_impl<typename Sequence::tag>::template apply<Sequence, T> {}; +template <> struct push_front<> { + template <typename T1, typename T2> struct apply : push_front<T1, T2> {}; +}; +template <typename> struct sizeof_ : size_t<sizeof(int)> {}; +template <long, typename, typename, typename, typename> +struct reverse_fold_impl; +template <typename First, typename State, typename BackwardOp, + typename ForwardOp> +struct reverse_fold_impl<1, First, State, BackwardOp, ForwardOp> { + typedef First iter0; + typedef typename apply_wrap2< + BackwardOp, + typename apply_wrap2<ForwardOp, State, typename deref<iter0>::type>::type, + typename deref<iter0>::type>::type state; +}; +template <typename Sequence, typename State, typename BackwardOp, + typename ForwardOp = arg<1>> +struct reverse_fold { + typedef typename reverse_fold_impl<O1_size<Sequence>::value, + typename begin<Sequence>::type, State, + BackwardOp, ForwardOp>::state type; +}; +template <typename> struct inserter { + typedef mpl::l_end state; + typedef mpl::push_front<> operation; +}; +template <typename Seq, typename Op, typename In> +struct reverse_transform1_impl + : reverse_fold<Seq, typename In::state, + bind2<typename lambda<typename In::operation>::type, _1, + bind1<typename lambda<Op>::type, arg<2>>>> {}; +template <typename P1, typename P2> +struct transform1 + : if_<reverse_transform1_impl<P1, P2, inserter<push_front<>>>>::type {}; +} +template <typename, typename> struct max_value { + typedef mpl::transform1<mpl::list<symbol>, mpl::sizeof_<mpl::arg<1>>>::type + transformed_; + typedef mpl::max_element<transformed_>::type max_it; + typedef mpl::deref<max_it>::type type; +}; +template <typename> struct make_storage { + typedef max_value<int, mpl::sizeof_<int>>::type max_size; + typedef aligned_storage<max_size::value> type; +}; +struct destroyer { + template <typename T> void internal_visit(T &operand, int) { operand.~T(); } +}; +template <typename, typename...> class variant { + typedef int internal_types; + int which_; + make_storage<internal_types>::type storage_; +public: + ~variant() { + destroyer visitor; + internal_apply_visitor(visitor); + } + template <typename Visitor, typename VoidPtrCV> + void internal_apply_visitor_impl(int internal_which, int, Visitor visitor, + VoidPtrCV storage) { + visitation_impl(internal_which, visitor, storage, int(), int(), + static_cast<int>(0), + static_cast<visitation_impl_step *>(0)); + } + int internal_apply_visitor___trans_tmp_1; + template <typename Visitor> void internal_apply_visitor(Visitor visitor) { + internal_apply_visitor_impl(which_, internal_apply_visitor___trans_tmp_1, + visitor, storage_.address()); + } +}; +struct symbol { + virtual ~symbol(); +}; +using Identifier = variant<int>; +struct Fragment { + virtual void foo() const = 0; + virtual ~Fragment(); +}; +struct ProcFrag : Fragment { + ~ProcFrag() {} + void foo() const; + Identifier id; +}; +struct Fragments { + ~Fragments() { delete x; } + Fragment *x; +} fragments; diff --git a/gcc/testsuite/g++.dg/ubsan/null-6.C b/gcc/testsuite/g++.dg/ubsan/null-6.C new file mode 100644 index 0000000000..2efe5c2b8c --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/null-6.C @@ -0,0 +1,5 @@ +// PR c++/67941 +// { dg-do run { target c++11 } } +// { dg-options -fsanitize=null } + +int main(){ (+[](){})(); } diff --git a/gcc/testsuite/g++.dg/ubsan/pr68508.C b/gcc/testsuite/g++.dg/ubsan/pr68508.C new file mode 100644 index 0000000000..ffe8f0071d --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr68508.C @@ -0,0 +1,15 @@ +// PR c++/68508 +// { dg-do compile } +// { dg-options "-std=c++14 -fsanitize=vptr" } + +struct A +{ + virtual int foo () { return 0; } +}; + +const A & +bar () +{ + static A x = A (); + return (x); +} diff --git a/gcc/testsuite/g++.dg/ubsan/vptr-10.C b/gcc/testsuite/g++.dg/ubsan/vptr-10.C new file mode 100644 index 0000000000..e05c33b90b --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/vptr-10.C @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "-fsanitize=vptr -fno-sanitize-recover=vptr" } + +struct A +{ + virtual ~A() {} +}; +struct B : virtual A {}; +struct C : virtual A {}; +struct D : B, virtual C {}; + +int main() +{ + D d; +} diff --git a/gcc/testsuite/g++.dg/warn/deprecated-9.C b/gcc/testsuite/g++.dg/warn/deprecated-9.C new file mode 100644 index 0000000000..fc861ee244 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/deprecated-9.C @@ -0,0 +1,16 @@ +// PR c++/65974 +// { dg-options "-Wdeprecated" } + +struct S { + void bar(); + + __attribute__((deprecated("use bar() instead."))) + virtual void foo(); +}; + +void S::foo() { bar(); } + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr67143.c b/gcc/testsuite/gcc.c-torture/compile/pr67143.c new file mode 100644 index 0000000000..62c4186fc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr67143.c @@ -0,0 +1,21 @@ +long a, c; +int b; +int d; +void ut_dbg_assertion_failed() __attribute__((noreturn)); +long dict_index_is_spatial(int *); +void btr_block_get_func(char *); +long btr_page_get_level_low(unsigned char *); +void btr_validate_level(long p1) { + unsigned char *e; + while (p1 != btr_page_get_level_low(e)) { + if (__builtin_expect(b, 0)) + ut_dbg_assertion_failed(); + if (dict_index_is_spatial(&d)) + while (c != 5535) { + __sync_add_and_fetch(&a, 536870912); + btr_block_get_func(""); + } + } + for (long i; i; ++i) + btr_validate_level(-i); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr67506.c b/gcc/testsuite/gcc.c-torture/compile/pr67506.c new file mode 100644 index 0000000000..2826d0b3aa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr67506.c @@ -0,0 +1,53 @@ +extern struct _IO_FILE *stderr; +typedef long integer; +typedef unsigned char byte; +short nl; +byte * tfmfilearray; +integer charbase, ligkernbase; +unsigned char charsonline; +short c; +unsigned short r; +struct { + short cc; + integer rr; +} labeltable[259]; +short sortptr; +unsigned char activity[(32510) + 1]; +integer ai, acti; +extern void _IO_putc (char, struct _IO_FILE *); + +void +mainbody (void) +{ + register integer for_end; + if (c <= for_end) + do { + if (((tfmfilearray + 1001)[4 * (charbase + c) + 2] % 4) == 1) + { + if ( r < nl ) + ; + else + { + while (labeltable[sortptr ].rr > r) + labeltable[sortptr + 1 ]= labeltable[sortptr]; + } + } + } while (c++ < for_end); + + if (ai <= for_end) + do { + if (activity[ai]== 2) + { + r = (tfmfilearray + 1001)[4 * (ligkernbase + (ai))]; + if (r < 128) + { + r = r + ai + 1 ; + if (r >= nl) + { + if (charsonline > 0) + _IO_putc ('\n', stderr); + } + } + } + } while (ai++ < for_end); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr67037.c b/gcc/testsuite/gcc.c-torture/execute/pr67037.c new file mode 100644 index 0000000000..3119d327b0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr67037.c @@ -0,0 +1,49 @@ +long (*extfunc)(); + +static inline void lstrcpynW( short *d, const short *s, int n ) +{ + unsigned int count = n; + + while ((count > 1) && *s) + { + count--; + *d++ = *s++; + } + if (count) *d = 0; +} + +int __attribute__((noinline,noclone)) +badfunc(int u0, int u1, int u2, int u3, + short *fsname, unsigned int fsname_len) +{ + static const short ntfsW[] = {'N','T','F','S',0}; + char superblock[2048+3300]; + int ret = 0; + short *p; + + if (extfunc()) + return 0; + p = (void *)extfunc(); + if (p != 0) + goto done; + + extfunc(superblock); + + lstrcpynW(fsname, ntfsW, fsname_len); + + ret = 1; +done: + return ret; +} + +static long f() +{ + return 0; +} + +int main() +{ + short buf[6]; + extfunc = f; + return !badfunc(0, 0, 0, 0, buf, 6); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr67226.c b/gcc/testsuite/gcc.c-torture/execute/pr67226.c new file mode 100644 index 0000000000..c533496cbc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr67226.c @@ -0,0 +1,42 @@ +struct assembly_operand +{ + int type, value, symtype, symflags, marker; +}; + +struct assembly_operand to_input, from_input; + +void __attribute__ ((__noinline__, __noclone__)) +assemblez_1 (int internal_number, struct assembly_operand o1) +{ + if (o1.type != from_input.type) + __builtin_abort (); +} + +void __attribute__ ((__noinline__, __noclone__)) +t0 (struct assembly_operand to, struct assembly_operand from) +{ + if (to.value == 0) + assemblez_1 (32, from); + else + __builtin_abort (); +} + +int +main (void) +{ + to_input.value = 0; + to_input.type = 1; + to_input.symtype = 2; + to_input.symflags = 3; + to_input.marker = 4; + + from_input.value = 5; + from_input.type = 6; + from_input.symtype = 7; + from_input.symflags = 8; + from_input.marker = 9; + + t0 (to_input, from_input); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr67929_1.c b/gcc/testsuite/gcc.c-torture/execute/pr67929_1.c new file mode 100644 index 0000000000..ae6cfbf337 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr67929_1.c @@ -0,0 +1,15 @@ +int __attribute__ ((noinline, noclone)) +foo (float a) +{ + return a * 4.9f; +} + + +int +main (void) +{ + if (foo (10.0f) != 49) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68143_1.c b/gcc/testsuite/gcc.c-torture/execute/pr68143_1.c new file mode 100644 index 0000000000..cbfbbc2458 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68143_1.c @@ -0,0 +1,31 @@ +#define NULL 0 + +struct stuff +{ + int a; + int b; + int c; + int d; + int e; + char *f; + int g; +}; + +void __attribute__ ((noinline)) +bar (struct stuff *x) +{ + if (x->g != 2) + __builtin_abort (); +} + +int +main (int argc, char** argv) +{ + struct stuff x = {0, 0, 0, 0, 0, NULL, 0}; + x.a = 100; + x.d = 100; + x.g = 2; + /* Struct should now look like {100, 0, 0, 100, 0, 0, 0, 2}. */ + bar (&x); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68185.c b/gcc/testsuite/gcc.c-torture/execute/pr68185.c new file mode 100644 index 0000000000..826531bf71 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68185.c @@ -0,0 +1,29 @@ +int a, b, d = 1, e, f, o, u, w = 1, z; +short c, q, t; + +int +main () +{ + char g; + for (; d; d--) + { + while (o) + for (; e;) + { + c = b; + int h = o = z; + for (; u;) + for (; a;) + ; + } + if (t < 1) + g = w; + f = g; + g && (q = 1); + } + + if (q != 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68249.c b/gcc/testsuite/gcc.c-torture/execute/pr68249.c new file mode 100644 index 0000000000..9ef4802208 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68249.c @@ -0,0 +1,36 @@ +/* PR rtl-optimization/68249 */ + +int a, b, c, g, k, l, m, n; +char h; + +void +fn1 () +{ + for (; k; k++) + { + m = b || c < 0 || c > 1 ? : c; + g = l = n || m < 0 || (m > 1) > 1 >> m ? : 1 << m; + } + l = b + 1; + for (; b < 1; b++) + h = a + 1; +} + +int +main () +{ + char j; + for (; a < 1; a++) + { + fn1 (); + if (h) + j = h; + if (j > c) + g = 0; + } + + if (h != 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68250.c b/gcc/testsuite/gcc.c-torture/execute/pr68250.c new file mode 100644 index 0000000000..f00234a07f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68250.c @@ -0,0 +1,40 @@ +/* PR rtl-optimization/68250 */ + +signed char a, b, h, k, l, m, o; +short c, d, n; +int e, f, g, j, q; + +void +fn1 (void) +{ + int p = b || a; + n = o > 0 || d > 1 >> o ? d : d << o; + for (; j; j++) + m = c < 0 || m || c << p; + l = f + 1; + for (; f < 1; f = 1) + k = h + 1; +} + +__attribute__((noinline, noclone)) void +fn2 (int k) +{ + if (k != 1) + __builtin_abort (); +} + +int +main () +{ + signed char i; + for (; e < 1; e++) + { + fn1 (); + if (k) + i = k; + if (i > q) + g = 0; + } + fn2 (k); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68321.c b/gcc/testsuite/gcc.c-torture/execute/pr68321.c new file mode 100644 index 0000000000..d255103474 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68321.c @@ -0,0 +1,38 @@ +/* PR rtl-optimization/68321 */ + +int e = 1, u = 5, t2, t5, i, k; +int a[1], b, m; +char n, t; + +int +fn1 (int p1) +{ + int g[1]; + for (;;) + { + if (p1 / 3) + for (; t5;) + u || n; + t2 = p1 & 4; + if (b + 1) + return 0; + u = g[0]; + } +} + +int +main () +{ + for (; e >= 0; e--) + { + char c; + if (!m) + c = t; + fn1 (c); + } + + if (a[t2] != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68328.c b/gcc/testsuite/gcc.c-torture/execute/pr68328.c new file mode 100644 index 0000000000..edf244bb35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68328.c @@ -0,0 +1,44 @@ +int a, b, c = 1, d = 1, e; + +__attribute__ ((noinline, noclone)) + int foo (void) +{ + asm volatile ("":::"memory"); + return 4195552; +} + +__attribute__ ((noinline, noclone)) + void bar (int x, int y) +{ + asm volatile (""::"g" (x), "g" (y):"memory"); + if (y == 0) + __builtin_abort (); +} + +int +baz (int x) +{ + char g, h; + int i, j; + + foo (); + for (;;) + { + if (c) + h = d; + g = h < x ? h : 0; + i = (signed char) ((unsigned char) (g - 120) ^ 1); + j = i > 97; + if (a - j) + bar (0x123456, 0); + if (!b) + return e; + } +} + +int +main () +{ + baz (2); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68376-1.c b/gcc/testsuite/gcc.c-torture/execute/pr68376-1.c new file mode 100644 index 0000000000..cb52657646 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68376-1.c @@ -0,0 +1,24 @@ +/* PR rtl-optimization/68376 */ + +int a, b, c = 1; +signed char d; + +int +main () +{ + for (; a < 1; a++) + for (; b < 1; b++) + { + signed char e = ~d; + if (d < 1) + e = d; + d = e; + if (!c) + __builtin_abort (); + } + + if (d != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68376-2.c b/gcc/testsuite/gcc.c-torture/execute/pr68376-2.c new file mode 100644 index 0000000000..884571a892 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr68376-2.c @@ -0,0 +1,41 @@ +/* PR rtl-optimization/68376 */ + +extern void abort (void); + +__attribute__((noinline, noclone)) int +f1 (int x) +{ + return x < 0 ? ~x : x; +} + +__attribute__((noinline, noclone)) int +f2 (int x) +{ + return x < 0 ? x : ~x; +} + +__attribute__((noinline, noclone)) int +f3 (int x) +{ + return x <= 0 ? ~x : x; +} + +__attribute__((noinline, noclone)) int +f4 (int x) +{ + return x <= 0 ? x : ~x; +} + +int +main () +{ + if (f1 (5) != 5 || f1 (-5) != 4 || f1 (0) != 0) + abort (); + if (f2 (5) != -6 || f2 (-5) != -5 || f2 (0) != -1) + abort (); + if (f3 (5) != 5 || f3 (-5) != 4 || f3 (0) != -1) + abort (); + if (f4 (5) != -6 || f4 (-5) != -5 || f4 (0) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/combine-subregs.c b/gcc/testsuite/gcc.dg/combine-subregs.c new file mode 100644 index 0000000000..ccace233cf --- /dev/null +++ b/gcc/testsuite/gcc.dg/combine-subregs.c @@ -0,0 +1,36 @@ +/* { dg-do run { target { stdint_types } } } */ +/* { dg-options "-O2" } */ + +#include <stdint.h> +#include <stdlib.h> + +void __attribute__ ((noinline)) +foo (uint64_t state, uint32_t last) +{ + if (state == last) abort (); +} + +/* This function may do a bad comparision by trying to + use SUBREGS during the compare on machines where comparing + two registers always compares the entire register regardless + of mode. */ + +int __attribute__ ((noinline)) +compare (uint64_t state, uint32_t *last, uint8_t buf) +{ + if (*last == ((state | buf) & 0xFFFFFFFF)) { + foo (state, *last); + return 0; + } + return 1; +} + +int +main(int argc, char **argv) { + uint64_t state = 0xF00000100U; + uint32_t last = 0x101U; + int ret = compare(state, &last, 0x01); + if (ret != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/debug/pr66432.c b/gcc/testsuite/gcc.dg/debug/pr66432.c new file mode 100644 index 0000000000..cf36799f3a --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr66432.c @@ -0,0 +1,19 @@ +/* PR debug/66432 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ + +extern void baz (const char *, const char *) __attribute__ ((__noreturn__)); + +void +foo (int x, int y[x][x]) +{ + if (x < 2) + baz ("", ""); +} + +void +bar (void) +{ + int z[2][2] = { { 1, 2 }, { 3, 4 } }; + foo (2, z); +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr67495.c b/gcc/testsuite/gcc.dg/gomp/pr67495.c new file mode 100644 index 0000000000..1011a26697 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr67495.c @@ -0,0 +1,38 @@ +/* PR c/67495 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int a, b, c; + +void +foo (void) +{ +#pragma omp atomic capture + a = (float)a + b; /* { dg-error "invalid operator" } */ +#pragma omp atomic read + (float) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic write + (float) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic read + a = (float) b; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + (float) a = b += c; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; (float) c = a; } /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; c = (float) a; } /* { dg-error "uses two different expressions for memory" } */ +#pragma omp atomic capture + a = (int)a + b; /* { dg-error "invalid operator" } */ +#pragma omp atomic read + (int) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic write + (int) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic read + a = (int) b; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + (int) a = b += c; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; (int) c = a; } /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; c = (int) a; } /* { dg-error "lvalue required" } */ +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr67500.c b/gcc/testsuite/gcc.dg/gomp/pr67500.c new file mode 100644 index 0000000000..13a6903d72 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr67500.c @@ -0,0 +1,42 @@ +/* PR c/67500 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +#pragma omp declare simd simdlen(d) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f1 (int); /* { dg-error "undeclared here" "" { target *-*-* } 5 } */ +#pragma omp declare simd simdlen(0.5) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f2 (int); +#pragma omp declare simd simdlen(-2) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f3 (int); +#pragma omp declare simd simdlen(0) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f4 (int); + +void +foo (int *p) +{ + int i; + #pragma omp simd safelen(d) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) /* { dg-error "undeclared" "" { target *-*-* } 18 } */ + ; + #pragma omp simd safelen(0.5) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd safelen(-2) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd safelen(0) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:d) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:0.5) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:-2) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:0) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; +} diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c index d335345a69..d813a3f6ff 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-1.c +++ b/gcc/testsuite/gcc.dg/graphite/block-1.c @@ -45,5 +45,5 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "will be loop blocked" 3 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be loop blocked" 3 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp index 9dba5d6622..9e7ede6925 100644 --- a/gcc/testsuite/gcc.dg/graphite/graphite.exp +++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp @@ -41,8 +41,10 @@ set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.c ] ] set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.c ] ] set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ] set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ] -set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c ] ] -set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c ] ] +set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c \ + $srcdir/$subdir/uns-interchange-*.c ] ] +set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c \ + $srcdir/$subdir/uns-block-*.c ] ] set vect_files [lsort [glob -nocomplain $srcdir/$subdir/vect-*.c ] ] # Tests to be compiled. diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-12.c b/gcc/testsuite/gcc.dg/graphite/interchange-12.c index fc27b4c535..45dceb48b4 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-12.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-12.c @@ -53,5 +53,5 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-14.c b/gcc/testsuite/gcc.dg/graphite/interchange-14.c index b0d93a18c6..cf62033838 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-14.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-14.c @@ -55,5 +55,5 @@ main (void) } /* PRE destroys the perfect nest and we can't cope with that yet. */ -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-15.c b/gcc/testsuite/gcc.dg/graphite/interchange-15.c index d154b743f8..ee7aed6bca 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-15.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-15.c @@ -49,6 +49,6 @@ main (void) } /* PRE destroys the perfect nest and we can't cope with that yet. */ -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-9.c b/gcc/testsuite/gcc.dg/graphite/interchange-9.c index 3f8e843ea3..44ac3dd9ff 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-9.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-9.c @@ -44,5 +44,5 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c index f446dbe622..11f8b2ae1c 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-mvt.c @@ -59,6 +59,6 @@ main (void) } /* PRE destroys the perfect nest and we can't cope with that yet. */ -/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c new file mode 100644 index 0000000000..b8f81f6aed --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define MAX 100 + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int sum = 0; + unsigned int A[MAX * MAX]; + unsigned int B[MAX * MAX]; + + /* These loops should be loop blocked. */ + for (i = 0; i < MAX; i++) + for (j = 0; j < MAX; j++) + { + A[i*MAX + j] = j; + B[i*MAX + j] = j; + } + + /* These loops should be loop blocked. */ + for (i = 0; i < MAX; i++) + for (j = 0; j < MAX; j++) + A[i*MAX + j] += B[j*MAX + i]; + + /* These loops should be loop blocked. */ + for (i = 0; i < MAX; i++) + for (j = 0; j < MAX; j++) + sum += A[i*MAX + j]; + +#if DEBUG + fprintf (stderr, "sum = %d \n", sum); +#endif + + if (sum != 990000) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "will be loop blocked" 3 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c new file mode 100644 index 0000000000..289e3470ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c @@ -0,0 +1,58 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 200 + +unsigned int A[N][N], B[N][N], C[N][N]; + +static unsigned int __attribute__((noinline)) +matmult (void) +{ + int i, j, k; + + /* Loops J and K should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + for (k = 0; k < N; k++) + A[i][j] += B[i][k] * C[k][j]; + } + + return A[0][0] + A[N-1][N-1]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int res; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + A[i][j] = 0; + B[i][j] = i - j; + C[i][j] = i + j; + } + + res = matmult (); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 2626800) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c new file mode 100644 index 0000000000..609005aa9b --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c @@ -0,0 +1,60 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 200 + +unsigned int A[N][N], B[N][N], C[N][N]; + +static void __attribute__((noinline)) +matmult (void) +{ + int i, j, k; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + A[i][j] = 0; + + /* Loops J and K should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + for (k = 0; k < N; k++) + A[i][j] += B[i][k] * C[k][j]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned res = 0; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + { + B[i][j] = j; + C[i][j] = i; + } + + matmult (); + + for (i = 0; i < N; i++) + res += A[i][i]; + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 529340000) + abort (); + + return 0; +} + +/* PRE destroys the perfect nest and we can't cope with that yet. */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c new file mode 100644 index 0000000000..bef5ac8d6c --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c @@ -0,0 +1,55 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define NMAX 2000 + +static unsigned int x[NMAX], a[NMAX][NMAX]; + +static unsigned int __attribute__((noinline)) +mvt (long N) +{ + int i,j; + + /* These two loops should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x[i] += a[j][i]; + + return x[1]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int res; + + for (i = 0; i < NMAX; i++) + for (j = 0; j < NMAX; j++) + a[i][j] = j; + + for (i = 0; i < NMAX; i++) + x[i] = i; + + res = mvt (NMAX); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 2001) + abort (); + + return 0; +} + +/* PRE destroys the perfect nest and we can't cope with that yet. */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ + diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c new file mode 100644 index 0000000000..c865e7728d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define N 111 +#define M 111 + +static unsigned int __attribute__((noinline)) +foo (unsigned int *x) +{ + int i, j; + unsigned int sum = 0; + + for (j = 0; j < M; ++j) + for (i = 0; i < N; ++i) + sum += x[M * i + j]; + + return sum; +} + +extern void abort (); + +int +main (void) +{ + unsigned int A[N*M]; + int i; + unsigned int res; + + for (i = 0; i < N*M; i++) + A[i] = 2; + + res = foo (A); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 24642) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c new file mode 100644 index 0000000000..a3120f52b9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c @@ -0,0 +1,65 @@ +/* { dg-require-effective-target size32plus } */ + +#define DEBUG 0 +#if DEBUG +#include <stdio.h> +#endif + +#define NMAX 2000 + +static unsigned int x1[NMAX], x2[NMAX], a[NMAX][NMAX], y1[NMAX], y2[NMAX]; + +static unsigned int __attribute__((noinline)) +mvt (long N) +{ + + int i,j; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x1[i] = x1[i] + a[i][j] * y1[j]; + + /* These two loops should be interchanged. */ + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x2[i] = x2[i] + a[j][i] * y2[j]; + + return x1[0] + x2[0]; +} + +extern void abort (); + +int +main (void) +{ + int i, j; + unsigned int res; + + for (i = 0; i < NMAX; i++) + for (j = 0; j < NMAX; j++) + a[i][j] = i + j; + + for (i = 0; i < NMAX; i++) + { + x1[i] = 0; + x2[i] = 2*i; + y1[i] = 100 - i; + y2[i] = i; + } + + res = mvt (NMAX); + +#if DEBUG + fprintf (stderr, "res = %d \n", res); +#endif + + if (res != 199900000) + abort (); + + return 0; +} + +/* PRE destroys the perfect nest and we can't cope with that yet. */ +/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */ +/* { dg-final { cleanup-tree-dump "graphite" } } */ + diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-10.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-10.c new file mode 100644 index 0000000000..24b64d1234 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-10.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ + +extern void consume (int); +extern int glob, glob1, glob2; +extern int get (void); + + +static void __attribute__ ((noinline)) +foo (int a) +{ + a = glob; + consume (a); + a = get (); + consume (a); + __asm__ volatile("" : : ""(a)); + consume (a); + + if (glob1) + a = glob1; + else + a = glob2; + consume (a); +} + +int +bar (int a) +{ + foo (a); + glob = a; + return 0; +} + +/* { dg-final { scan-tree-dump-times "replacing an SSA name of a removed param" 4 "eipa_sra" } } */ diff --git a/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c b/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c new file mode 100644 index 0000000000..96d728d512 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/chkp-removed-alias_0.c @@ -0,0 +1,28 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -flto-partition=max -fcheck-pointer-bounds -mmpx } } } */ + +int test1 (const char *c) +{ + return c[0] * 2; +} + +int test2 (const char *c) +{ + return c[1] * 3; +} + +int test1_alias (const char *c) __attribute__ ((alias ("test1"))); +int test2_alias (const char *c) __attribute__ ((alias ("test2"))); + +struct S +{ + int (*fnptr[2]) (const char *); +} S; + +struct S s = {test1_alias, test2_alias}; + +int main (int argc, const char **argv) +{ + return s.fnptr[argc] (argv[0]); +} diff --git a/gcc/testsuite/gcc.dg/lto/chkp-wrap-asm-name_0.c b/gcc/testsuite/gcc.dg/lto/chkp-wrap-asm-name_0.c new file mode 100644 index 0000000000..6611bdb825 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/chkp-wrap-asm-name_0.c @@ -0,0 +1,20 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -fcheck-pointer-bounds -mmpx } } } */ + +typedef long unsigned int size_t; + +extern size_t strlen (const char *); +extern __typeof (strlen) strlen __asm__ ("" "__hidden_strlen") __attribute__ ((visibility ("hidden"))); + +size_t +test1 (const char *p) { return strlen (p); } + +size_t +test2 (const char *p) { return __builtin_strlen (p); } + +int +main (int argc, const char **argv) +{ + return test1 (argv[0]) - test2 (argv[0]); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr55113_0.c b/gcc/testsuite/gcc.dg/lto/pr55113_0.c index 8c309761bc..59e944c318 100644 --- a/gcc/testsuite/gcc.dg/lto/pr55113_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr55113_0.c @@ -1,8 +1,7 @@ /* PR 55113 */ /* { dg-lto-do link } */ /* { dg-lto-options { { -flto -fshort-double -O0 } } }*/ -/* { dg-skip-if "PR60410" { x86_64-*-* || { i?86-*-* && lp64 } } } */ -/* { dg-skip-if "PR60410" { i?86-*-solaris2.1[0-9]* } } */ +/* { dg-skip-if "PR60410" { i?86-*-* x86_64-*-* } } */ int main(void) diff --git a/gcc/testsuite/gcc.dg/lto/pr67452_0.c b/gcc/testsuite/gcc.dg/lto/pr67452_0.c new file mode 100644 index 0000000000..a4984ffcc9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr67452_0.c @@ -0,0 +1,23 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -O2 -flto -fopenmp-simd } } } */ + +float b[3][3]; + +__attribute__((used, noinline)) void +foo () +{ + int v1, v2; +#pragma omp simd collapse(2) + for (v1 = 0; v1 < 3; v1++) + for (v2 = 0; v2 < 3; v2++) + b[v1][v2] = 2.5; +} + +int +main () +{ + asm volatile ("" : : "g" (b) : "memory"); + foo (); + asm volatile ("" : : "g" (b) : "memory"); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pie-link.c b/gcc/testsuite/gcc.dg/pie-link.c index c16086cc19..2be07615f9 100644 --- a/gcc/testsuite/gcc.dg/pie-link.c +++ b/gcc/testsuite/gcc.dg/pie-link.c @@ -1,5 +1,5 @@ /* { dg-do link { target pie } } */ -/* { dg-options "-fpie" } */ +/* { dg-options "-fpie -pie" } */ int main(void) { diff --git a/gcc/testsuite/gcc.dg/pr63568.c b/gcc/testsuite/gcc.dg/pr63568.c index fb42bea6fc..fea74816f3 100644 --- a/gcc/testsuite/gcc.dg/pr63568.c +++ b/gcc/testsuite/gcc.dg/pr63568.c @@ -1,54 +1,70 @@ /* PR middle-end/63568 */ /* { dg-do compile } */ -/* { dg-options "-fdump-tree-original" } */ +/* { dg-options "-O -fdump-tree-cddce1" } */ int fn1 (int a, int b, int m) { - return (a & ~m) | (b & m); + int tem1 = a & ~m; + int tem2 = b & m; + return tem1 | tem2; } int fn2 (int a, int b, int m) { - return (a & ~m) | (m & b); + int tem1 = a & ~m; + int tem2 = m & b; + return tem1 | tem2; } int fn3 (int a, int b, int m) { - return (~m & a) | (m & b); + int tem1 = ~m & a; + int tem2 = m & b; + return tem1 | tem2; } int fn4 (int a, int b, int m) { - return (~m & a) | (b & m); + int tem1 = ~m & a; + int tem2 = b & m; + return tem1 | tem2; } int fn5 (int a, int b, int m) { - return (b & m) | (a & ~m); + int tem1 = b & m; + int tem2 = a & ~m; + return tem1 | tem2; } int fn6 (int a, int b, int m) { - return (m & b) | (a & ~m); + int tem1 = m & b; + int tem2 = a & ~m; + return tem1 | tem2; } int fn7 (int a, int b, int m) { - return (m & b) | (~m & a); + int tem1 = m & b; + int tem2 = ~m & a; + return tem1 | tem2; } int fn8 (int a, int b, int m) { - return (b & m) | (~m & a); + int tem1 = b & m; + int tem2 = ~m & a; + return tem1 | tem2; } -/* { dg-final { scan-tree-dump-not " \\| " "original" } } */ +/* { dg-final { scan-tree-dump-not " \\| " "cddce1" } } */ /* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/gcc.dg/pr67028.c b/gcc/testsuite/gcc.dg/pr67028.c new file mode 100644 index 0000000000..b42fb8110e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67028.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +short c = 0; + +int __attribute__ ((noinline)) f(void) +{ + int d = 5; + signed char e = (c != 1) * -2; + int a = (unsigned short)e > d; + + return a; +} + +int main(void) +{ + if (!f()) + __builtin_abort(); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr67029.c b/gcc/testsuite/gcc.dg/pr67029.c new file mode 100644 index 0000000000..f0023e524e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67029.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target { int128 && scheduling } } } */ +/* { dg-options "-O2 -fschedule-insns" } */ +/* { dg-additional-options "-fstack-protector" { target fstack_protector } } */ + +extern void fn2 (char *); +__int128 a, b; +int +fn1 (void) +{ + char e[32]; + fn2 (e); + b = 9 * (a >> 1); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr67271.c b/gcc/testsuite/gcc.dg/pr67271.c new file mode 100644 index 0000000000..b6988a3917 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67271.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +extern long int labs (long int j); +int +main () +{ + long *a = (long *)"empty"; + int i = 1441516387; + a[i] = labs (a[i]); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr67512.c b/gcc/testsuite/gcc.dg/pr67512.c new file mode 100644 index 0000000000..95f836aea0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67512.c @@ -0,0 +1,15 @@ +/* PR middle-end/67512 */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern int fn2 (void); +extern int fn3 (int); +void +fn1 (void) +{ + int z, m; + if (1 & m) /* { dg-warning "is used uninitialized" } */ + z = fn2 (); + z = 1 == m ? z : 2 == m; + fn3 (z); +} diff --git a/gcc/testsuite/gcc.dg/pr67563.c b/gcc/testsuite/gcc.dg/pr67563.c new file mode 100644 index 0000000000..34a78a23a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67563.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fexceptions" } */ + +static void +emit_package (int p1) +{ + int a; + int b[0]; + a = __fprintf_chk (0, 0, ""); +} +void emit_lua () { emit_package (0); } diff --git a/gcc/testsuite/gcc.dg/pr67730-1.c b/gcc/testsuite/gcc.dg/pr67730-1.c new file mode 100644 index 0000000000..bb82f6d8e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67730-1.c @@ -0,0 +1,16 @@ +/* PR c/67730 */ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ + +#include "pr67730.h" + +extern void bar (unsigned char *); + +unsigned char * +f (void *p) +{ + unsigned char *uc = ONEP; /* { dg-warning "request for implicit conversion" } */ + uc = ONEP; /* { dg-warning "request for implicit conversion" } */ + bar (ONEP); /* { dg-warning "request for implicit conversion" } */ + return ONEP; /* { dg-warning "request for implicit conversion" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr67730-2.c b/gcc/testsuite/gcc.dg/pr67730-2.c new file mode 100644 index 0000000000..29d726754b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67730-2.c @@ -0,0 +1,22 @@ +/* PR c/67730 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#include "pr67730.h" + +extern void bar (int); + +int +fn1 (void) +{ + int a = NULL; /* { dg-warning "initialization makes integer from pointer" } */ + a = NULL; /* { dg-warning "assignment makes integer from pointer" } */ + bar (NULL); /* { dg-warning "passing argument 1" } */ + return NULL; /* { dg-warning "return makes integer from pointer" } */ +} + +int +fn2 (void) +{ + RETURN; /* { dg-warning "return makes integer from pointer" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr67730.c b/gcc/testsuite/gcc.dg/pr67730.c new file mode 100644 index 0000000000..54d73a62cf --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67730.c @@ -0,0 +1,11 @@ +/* PR c/67730 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#include <stddef.h> + +void +fn1 (void) +{ + return NULL; /* { dg-warning "10:.return. with a value" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr67730.h b/gcc/testsuite/gcc.dg/pr67730.h new file mode 100644 index 0000000000..9a9afc9a09 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67730.h @@ -0,0 +1,32 @@ +#pragma GCC system_header +#define NULL (void *) 0 +#define ONEP (void *) 1 +#define RETURN return NULL + +extern void sysbar (unsigned char *); + +unsigned char * +sysfn1 (void *p) +{ + unsigned char *uc = ONEP; + uc = ONEP; + sysbar (ONEP); + return ONEP; +} + +extern void sysbar2 (int); + +int +sysfn2 (void) +{ + int a = NULL; + a = NULL; + sysbar2 (NULL); + return NULL; +} + +int +sysfn3 (void) +{ + RETURN; +} diff --git a/gcc/testsuite/gcc.dg/pr68129_1.c b/gcc/testsuite/gcc.dg/pr68129_1.c new file mode 100644 index 0000000000..112331e665 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr68129_1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-split-wide-types" } */ + +typedef int V __attribute__ ((vector_size (8 * sizeof (int)))); + +void +foo (V *p, V *q) +{ + *p = (*p == *q); +} diff --git a/gcc/testsuite/gcc.dg/pragma-diag-3.c b/gcc/testsuite/gcc.dg/pragma-diag-3.c new file mode 100644 index 0000000000..2ee439d7e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pragma-diag-3.c @@ -0,0 +1,64 @@ +/* { dg-do compile } */ +/* { dg-options "-Wswitch-enum -Wsign-compare -fstrict-overflow -Wstrict-overflow -Werror -Wno-error=switch-enum" } */ +/* PR c/66098 - #pragma diagnostic 'ignored' not fully undone by pop for strict-overflow + PR c/66711 - GCC does not correctly restore diagnostic state after pragma GCC diagnostic pop with -Werror +*/ +/* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */ + +void testing2() { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-overflow" + int j = 4; + j + 4 < j; +#pragma GCC diagnostic pop +} + +void testing3() { + int k = 4; + k + 4 < k; /* { dg-error "overflow" } */ +} + +int bar() +{ + unsigned x = 0; + int y = 1; + + /* generates an error - ok */ + x += x < y ? 1 : 0; /* { dg-error "comparison" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-compare" + /* generates no diagnostic - ok */ + x += x < y ? 1 : 0; +#pragma GCC diagnostic pop + + x += x < y ? 1 : 0; /* { dg-error "comparison" } */ + + return x; +} + +enum EE { ONE, TWO }; + +int f (enum EE e) +{ + int r = 0; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-enum" + + switch (e) + { + case ONE: + r = 1; + break; + } +#pragma GCC diagnostic pop + + switch (e) /* { dg-warning "switch" } */ + { + case ONE: + r = 1; + break; + } + return r; +} diff --git a/gcc/testsuite/gcc.dg/pragma-diag-4.c b/gcc/testsuite/gcc.dg/pragma-diag-4.c new file mode 100644 index 0000000000..fc8d4b1feb --- /dev/null +++ b/gcc/testsuite/gcc.dg/pragma-diag-4.c @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare -Werror=sign-compare -Werror=switch-enum" } */ +/* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */ + +int bar() +{ + unsigned x = 0; + int y = 1; + + /* generates an error - ok */ + x += x < y ? 1 : 0; /* { dg-error "comparison" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-compare" + /* generates no diagnostic - ok */ + x += x < y ? 1 : 0; +#pragma GCC diagnostic pop + + x += x < y ? 1 : 0; /* { dg-error "comparison" } */ + + return x; +} + +enum EE { ONE, TWO }; + +int f (enum EE e) +{ + int r = 0; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wswitch-enum" + + switch (e) + { + case ONE: + r = 1; + break; + } +#pragma GCC diagnostic pop + + switch (e) /* { dg-error "switch" } */ + { + case ONE: + r = 1; + break; + } + return r; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr66793.c b/gcc/testsuite/gcc.dg/torture/pr66793.c new file mode 100644 index 0000000000..3c9d5a2bb1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr66793.c @@ -0,0 +1,26 @@ +/* { dg-do link } */ + +int a, b, c; + +struct S0 +{ + int f1; +} *d; + +void +fn1 (struct S0 p) +{ + for (p.f1 = 0; p.f1 < 1; p.f1++) + c = a && b ? a && b : 1; + for (; c;) + ; +} + +int +main () +{ + struct S0 **f = &d; + d = 0; + fn1 (**f); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr66952.c b/gcc/testsuite/gcc.dg/torture/pr66952.c new file mode 100644 index 0000000000..a5f6e632a7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr66952.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ + +int a = 128, b; + +static int +fn1 (signed char p1, int p2) +{ + return p1 < 0 || p1 > 1 >> p2 ? 0 : p1 << 1; +} + +static int +fn2 () +{ + signed char c = a; + b = fn1 (c, 1); + if ((128 | c) < 0 ? 1 : 0) + return 1; + return 0; +} + +int +main () +{ + if (fn2 () != 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67005.c b/gcc/testsuite/gcc.dg/torture/pr67005.c new file mode 100644 index 0000000000..922c5c475e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67005.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int a; +void +f (void) +{ + if (!a); + else + lbl: + a = a; + + if (a) + a = 8; + goto lbl; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67121.c b/gcc/testsuite/gcc.dg/torture/pr67121.c new file mode 100644 index 0000000000..2b609ee831 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67121.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ + +int a[6], b, c = 226, d, e, f; +signed char g; + +void +fn1 (int p1) +{ + b = a[p1]; +} + +int +main () +{ + a[0] = 1; + for (f = 0; f < 9; f++) + { + signed char h = c; + int i = 1; + g = h < 0 ? h : h >> i; + e = g; + for (d = 1; d; d = 0) + ; + } + fn1 (g >> 8 & 1); + + if (b != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67222.c b/gcc/testsuite/gcc.dg/torture/pr67222.c new file mode 100644 index 0000000000..739f869852 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67222.c @@ -0,0 +1,19 @@ +/* PR middle-end/67222 */ +/* { dg-do compile } */ + +void +foo (void **p) +{ + posix_memalign (); /* { dg-warning "implicit declaration" } */ + posix_memalign (p); + posix_memalign (0); + posix_memalign (p, 1); + posix_memalign (p, "foo"); + posix_memalign ("gnu", "gcc"); + posix_memalign (1, p); + posix_memalign (1, 2); + posix_memalign (1, 2, 3); + posix_memalign (p, p, p); + posix_memalign (p, "qui", 3); + posix_memalign (p, 1, 2); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67442.c b/gcc/testsuite/gcc.dg/torture/pr67442.c new file mode 100644 index 0000000000..bc214d62d4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67442.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ + +short foo[100]; + +int main() +{ + short* bar = &foo[50]; + short i = 1; + short j = 1; + short value = bar[8 - i * 2 * j]; + return value; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67470.c b/gcc/testsuite/gcc.dg/torture/pr67470.c new file mode 100644 index 0000000000..29a23c2ee9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67470.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ + +int a, b, *c, d, e; + +void abort (void); + +int +main () +{ + int f, *g, **h = &g; + for (; b;) + { + c = &a; + for (e = 0; e < 1; e++) + *h = 0; + for (; d; d++) + if (f) + *c = 0; + else + { + *c = e = 0; + *h = &a; + } + + if (a && !g) + abort (); + + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67619.c b/gcc/testsuite/gcc.dg/torture/pr67619.c new file mode 100644 index 0000000000..9c6bb6e317 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67619.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target builtin_eh_return } */ + +void +foo () +{ + unsigned long l; + void *p = 0; + + __builtin_unwind_init (); + l = 0; + __builtin_eh_return (l, p); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67690.c b/gcc/testsuite/gcc.dg/torture/pr67690.c new file mode 100644 index 0000000000..491de516f3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67690.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ + +const int c1 = 1; +const int c2 = 2; + +int +check (int i) +{ + int j; + if (i >= 0) + j = c2 - i; + else + j = c2 - i; + return c2 - c1 + 1 > j; +} + +int invoke (int *pi) __attribute__ ((noinline,noclone)); +int +invoke (int *pi) +{ + return check (*pi); +} + +int +main () +{ + int i = c1; + int ret = invoke (&i); + if (!ret) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67736.c b/gcc/testsuite/gcc.dg/torture/pr67736.c new file mode 100644 index 0000000000..024bb207ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67736.c @@ -0,0 +1,32 @@ +/* { dg-do run { target { stdint_types } } } */ + +#include <stdint.h> +#include <stdlib.h> + +void f(uint64_t *a, uint64_t aa) __attribute__((noinline)); +void f(uint64_t *a, uint64_t aa) +{ + uint64_t new_value = aa; + uint64_t old_value = *a; + int bit_size = 32; + uint64_t mask = (uint64_t)(unsigned)(-1); + uint64_t tmp = old_value & mask; + new_value &= mask; + /* On overflow we need to add 1 in the upper bits */ + if (tmp > new_value) + new_value += 1ull<<bit_size; + /* Add in the upper bits from the old value */ + new_value += old_value & ~mask; + *a = new_value; +} +int main(void) +{ + uint64_t value, new_value, old_value; + value = 0x100000001; + old_value = value; + new_value = (value+1)&(uint64_t)(unsigned)(-1); + f(&value, new_value); + if (value != old_value+1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67769.c b/gcc/testsuite/gcc.dg/torture/pr67769.c new file mode 100644 index 0000000000..c1d17c3f3d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67769.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ + +static int +clamp (int x, int lo, int hi) +{ + return (x < lo) ? lo : ((x > hi) ? hi : x); +} + +__attribute__ ((noinline)) +short +foo (int N) +{ + short value = clamp (N, 0, 16); + return value; +} + +int +main () +{ + if (foo (-5) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67794.c b/gcc/testsuite/gcc.dg/torture/pr67794.c new file mode 100644 index 0000000000..5489e56fbc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67794.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int *b; +static void fn1(int *best, int *dmin) { + int a[64]; + dmin = a; + __asm__ volatile("" : "+&r"(dmin) : ""(best)); +} + +__attribute__((always_inline)) static inline void fn2(int *best) { fn1(best, b); } + +void fn3(void) { + int c[1]; + fn2(c); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67821-2.c b/gcc/testsuite/gcc.dg/torture/pr67821-2.c new file mode 100644 index 0000000000..38cfc8420d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67821-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +int a, b, c, d, e, g; +short f; + +void +fn1 () +{ + int i; + f = a - b; + e = (c && (i = d = (unsigned) f - 1)) || i; + g = (unsigned) f - 1; + c && (d = 0); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr67821.c b/gcc/testsuite/gcc.dg/torture/pr67821.c new file mode 100644 index 0000000000..1c9e8b9db3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67821.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int isdigit (int); + +int +foo (const char *s) +{ + int success = 1; + const char *p = s + 2; + if (!isdigit (*p)) + success = 0; + while (isdigit (*p)) + ++p; + return success; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr68017.c b/gcc/testsuite/gcc.dg/torture/pr68017.c new file mode 100644 index 0000000000..1fc219171b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68017.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +long long a; + +short +fn1 (short p1, unsigned short p2) +{ + return p1 + p2; +} + +short +fn2 () +{ + int b = a ? fn1 (fn2 (), a) : 0; + return b; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr68067-1.c b/gcc/testsuite/gcc.dg/torture/pr68067-1.c new file mode 100644 index 0000000000..a7b6aa041d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68067-1.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ + +int main() +{ + int a = -1; + static int b = -2147483647 - 1; + static int c = 0; + int t = a - (b - c); + if (t != 2147483647) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr68067-2.c b/gcc/testsuite/gcc.dg/torture/pr68067-2.c new file mode 100644 index 0000000000..38a459bf7f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr68067-2.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ + +int main() +{ + int a = -1; + static int b = -2147483647 - 1; + static int c = 0; + int t = a - (b + c*-2); + if (t != 2147483647) + __builtin_abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/ubsan/pr67662.c b/gcc/testsuite/gcc.dg/ubsan/pr67662.c new file mode 100644 index 0000000000..26fd00fbbe --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pr67662.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=undefined" } */ + +extern void abort (void); + +int +main (void) +{ + int halfmaxval = __INT_MAX__ / 2 + 1; + int maxval = halfmaxval - 1 + halfmaxval; + if (maxval != __INT_MAX__) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr68339.c b/gcc/testsuite/gcc.dg/vect/pr68339.c new file mode 100644 index 0000000000..ab0eede62e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr68339.c @@ -0,0 +1,17 @@ +/* PR middle-end/68339 */ +/* { dg-do compile } */ +/* { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0 -fopenmp-simd" } */ + +#pragma omp declare simd notinbranch +int +f1 (int x) +{ + return x; +} + +#pragma omp declare simd notinbranch +int +f2 (int x) +{ + return x; +} diff --git a/gcc/testsuite/gcc.target/aarch64/atomic-op-imm.c b/gcc/testsuite/gcc.target/aarch64/atomic-op-imm.c index 6c6f7e16df..47d7a96aa1 100644 --- a/gcc/testsuite/gcc.target/aarch64/atomic-op-imm.c +++ b/gcc/testsuite/gcc.target/aarch64/atomic-op-imm.c @@ -16,6 +16,18 @@ atomic_fetch_sub_ACQUIRE () } int +atomic_fetch_add_negative_RELAXED () +{ + return __atomic_fetch_add (&v, -4096, __ATOMIC_RELAXED); +} + +int +atomic_fetch_sub_negative_ACQUIRE () +{ + return __atomic_fetch_sub (&v, -4096, __ATOMIC_ACQUIRE); +} + +int atomic_fetch_and_SEQ_CST () { return __atomic_fetch_and (&v, 4096, __ATOMIC_SEQ_CST); @@ -75,4 +87,4 @@ atomic_or_fetch_CONSUME () return __atomic_or_fetch (&v, 4096, __ATOMIC_CONSUME); } -/* { dg-final { scan-assembler-times "\tw\[0-9\]+, w\[0-9\]+, #*4096" 12 } } */ +/* { dg-final { scan-assembler-times "\tw\[0-9\]+, w\[0-9\]+, #*4096" 14 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-1.c b/gcc/testsuite/gcc.target/aarch64/fnmul-1.c new file mode 100644 index 0000000000..92945d402f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -a * b; +} diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-2.c b/gcc/testsuite/gcc.target/aarch64/fnmul-2.c new file mode 100644 index 0000000000..2c80dc8fc3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -frounding-math" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fneg\\td\[0-9\]+, d\[0-9\]+" } } */ + /* { dg-final { scan-assembler "fmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fneg\\ts\[0-9\]+, s\[0-9\]+" } } */ + /* { dg-final { scan-assembler "fmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -a * b; +} diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-3.c b/gcc/testsuite/gcc.target/aarch64/fnmul-3.c new file mode 100644 index 0000000000..8b77eec6f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-3.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -(a * b); +} diff --git a/gcc/testsuite/gcc.target/aarch64/fnmul-4.c b/gcc/testsuite/gcc.target/aarch64/fnmul-4.c new file mode 100644 index 0000000000..3306210a63 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/fnmul-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -frounding-math" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "fnmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "fnmul\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" } } */ + return -(a * b); +} diff --git a/gcc/testsuite/gcc.target/aarch64/pr66912.c b/gcc/testsuite/gcc.target/aarch64/pr66912.c new file mode 100644 index 0000000000..b8aabcd3b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr66912.c @@ -0,0 +1,42 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -fpic" } */ + +__attribute__((visibility("protected"))) +int n_common; + +__attribute__((weak, visibility("protected"))) +int n_weak_common; + +__attribute__((visibility("protected"))) +int n_init = -1; + +__attribute__((weak, visibility("protected"))) +int n_weak_init = -1; + +int +f1 () +{ + /* { dg-final { scan-assembler ":got(page_lo15)?:n_common" } } */ + return n_common; +} + +int +f2 () +{ + /* { dg-final { scan-assembler ":got(page_lo15)?:n_weak_common" } } */ + return n_weak_common; +} + +int +f3 () +{ + /* { dg-final { scan-assembler ":got(page_lo15)?:n_init" } } */ + return n_init; +} + +int +f4 () +{ + /* { dg-final { scan-assembler ":got(page_lo15)?:n_weak_init" } } */ + return n_weak_init; +} diff --git a/gcc/testsuite/gcc.target/aarch64/pr68102_1.c b/gcc/testsuite/gcc.target/aarch64/pr68102_1.c new file mode 100644 index 0000000000..3193b276aa --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr68102_1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef __Float64x1_t float64x1_t; + +typedef long int64_t; + +extern int64_t bar (float64x1_t f); + +int +foo (void) +{ + float64x1_t f = { 3.14159265358979311599796346854 }; + int64_t c = 0x400921FB54442D18; + int64_t r; + r = bar (f); + return r == c; +} diff --git a/gcc/testsuite/gcc.target/aarch64/pr68106.c b/gcc/testsuite/gcc.target/aarch64/pr68106.c new file mode 100644 index 0000000000..dc552ecce0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr68106.c @@ -0,0 +1,50 @@ +/* { dg-do run { target aarch64*-*-* } } */ +/* { dg-options "-O" } */ + +typedef signed long long int S; +typedef unsigned long long int U; +typedef __int128 W; +__attribute__ ((noinline, noclone)) +U upseu (U x, S y, int *ovf) +{ + U res; + *ovf = __builtin_add_overflow (x, y, &res); + return res; +} +U +usueu (U x, U y, int *ovf) +{ + U res; + *ovf = __builtin_sub_overflow (x, y, &res); + return res; +} +U +usseu (U x, S y, int *ovf) +{ + U res; + *ovf = __builtin_sub_overflow (x, y, &res); + return res; +} +int +main () +{ + int i, j; + for (i = 0; i < ((unsigned char) ~0); i++) + for (j = 0; j < ((unsigned char) ~0); j++) + { + U u1 = ((W) i << ((8 - 1) * 8)); + S s2 = ((W) j << ((8 - 1) * 8)) + (-0x7fffffffffffffffLL - 1); + U u2 = ((W) j << ((8 - 1) * 8)); + W w; + int ovf; + w = ((W) u1) + ((W) s2); + if (upseu (u1, s2, &ovf) != (U) w || ovf != (w != (U) w)) + __builtin_abort (); + w = ((W) u1) - ((W) u2); + if (usueu (u1, u2, &ovf) != (U) w || ovf != (w != (U) w)) + __builtin_abort (); + w = ((W) u1) - ((W) s2); + if (usseu (u1, s2, &ovf) != (U) w || ovf != (w != (U) w)) + __builtin_abort (); + } +} diff --git a/gcc/testsuite/gcc.target/aarch64/pr68363_1.c b/gcc/testsuite/gcc.target/aarch64/pr68363_1.c new file mode 100644 index 0000000000..bb294b50dc --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr68363_1.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-mfix-cortex-a53-835769" } */ + +int +foo (int i) +{ + switch (i) + { + case 0: + case 2: + case 5: + return 0; + case 7: + case 11: + case 13: + return 1; + } + return -1; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.c b/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.c new file mode 100644 index 0000000000..126b9978f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-ipa-icf" } */ + +#include "sync-comp-swap.x" + +/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 2 } } */ +/* { dg-final { scan-assembler-times "stlxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 2 } } */ +/* { dg-final { scan-assembler-times "dmb\tish" 2 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.x b/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.x new file mode 100644 index 0000000000..eda52e407f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-comp-swap.x @@ -0,0 +1,13 @@ +int v = 0; + +int +sync_bool_compare_swap (int a, int b) +{ + return __sync_bool_compare_and_swap (&v, &a, &b); +} + +int +sync_val_compare_swap (int a, int b) +{ + return __sync_val_compare_and_swap (&v, &a, &b); +} diff --git a/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.c b/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.c new file mode 100644 index 0000000000..2639f9f9d8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include "sync-op-acquire.x" + +/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 1 } } */ +/* { dg-final { scan-assembler-times "stxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 1 } } */ +/* { dg-final { scan-assembler-times "dmb\tish" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.x b/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.x new file mode 100644 index 0000000000..4c4548c739 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-op-acquire.x @@ -0,0 +1,7 @@ +int v; + +int +sync_lock_test_and_set (int a) +{ + return __sync_lock_test_and_set (&v, a); +} diff --git a/gcc/testsuite/gcc.target/aarch64/sync-op-full.c b/gcc/testsuite/gcc.target/aarch64/sync-op-full.c new file mode 100644 index 0000000000..10fc8fc957 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-op-full.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include "sync-op-full.x" + +/* { dg-final { scan-assembler-times "ldxr\tw\[0-9\]+, \\\[x\[0-9\]+\\\]" 12 } } */ +/* { dg-final { scan-assembler-times "stlxr\tw\[0-9\]+, w\[0-9\]+, \\\[x\[0-9\]+\\\]" 12 } } */ +/* { dg-final { scan-assembler-times "dmb\tish" 12 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sync-op-full.x b/gcc/testsuite/gcc.target/aarch64/sync-op-full.x new file mode 100644 index 0000000000..c24223d5ec --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-op-full.x @@ -0,0 +1,73 @@ +int v = 0; + +int +sync_fetch_and_add (int a) +{ + return __sync_fetch_and_add (&v, a); +} + +int +sync_fetch_and_sub (int a) +{ + return __sync_fetch_and_sub (&v, a); +} + +int +sync_fetch_and_and (int a) +{ + return __sync_fetch_and_and (&v, a); +} + +int +sync_fetch_and_nand (int a) +{ + return __sync_fetch_and_nand (&v, a); +} + +int +sync_fetch_and_xor (int a) +{ + return __sync_fetch_and_xor (&v, a); +} + +int +sync_fetch_and_or (int a) +{ + return __sync_fetch_and_or (&v, a); +} + +int +sync_add_and_fetch (int a) +{ + return __sync_add_and_fetch (&v, a); +} + +int +sync_sub_and_fetch (int a) +{ + return __sync_sub_and_fetch (&v, a); +} + +int +sync_and_and_fetch (int a) +{ + return __sync_and_and_fetch (&v, a); +} + +int +sync_nand_and_fetch (int a) +{ + return __sync_nand_and_fetch (&v, a); +} + +int +sync_xor_and_fetch (int a) +{ + return __sync_xor_and_fetch (&v, a); +} + +int +sync_or_and_fetch (int a) +{ + return __sync_or_and_fetch (&v, a); +} diff --git a/gcc/testsuite/gcc.target/aarch64/sync-op-release.c b/gcc/testsuite/gcc.target/aarch64/sync-op-release.c new file mode 100644 index 0000000000..d25b46f2c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-op-release.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include "sync-op-release.x" + +/* { dg-final { scan-assembler-times "stlr" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sync-op-release.x b/gcc/testsuite/gcc.target/aarch64/sync-op-release.x new file mode 100644 index 0000000000..704bcff2b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sync-op-release.x @@ -0,0 +1,7 @@ +int v; + +void +sync_lock_release (void) +{ + __sync_lock_release (&v); +} diff --git a/gcc/testsuite/gcc.target/arm/armv8-sync-comp-swap.c b/gcc/testsuite/gcc.target/arm/armv8-sync-comp-swap.c new file mode 100644 index 0000000000..0e95986d7a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/armv8-sync-comp-swap.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8a } */ + +#include "../aarch64/sync-comp-swap.x" + +/* { dg-final { scan-assembler-times "ldrex" 2 } } */ +/* { dg-final { scan-assembler-times "stlex" 2 } } */ +/* { dg-final { scan-assembler-times "dmb" 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/armv8-sync-op-acquire.c b/gcc/testsuite/gcc.target/arm/armv8-sync-op-acquire.c new file mode 100644 index 0000000000..c448599813 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/armv8-sync-op-acquire.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8a } */ + +#include "../aarch64/sync-op-acquire.x" + +/* { dg-final { scan-assembler-times "ldrex" 1 } } */ +/* { dg-final { scan-assembler-times "strex" 1 } } */ +/* { dg-final { scan-assembler-times "dmb" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/armv8-sync-op-full.c b/gcc/testsuite/gcc.target/arm/armv8-sync-op-full.c new file mode 100644 index 0000000000..cce9e00697 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/armv8-sync-op-full.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8a } */ + +#include "../aarch64/sync-op-full.x" + +/* { dg-final { scan-assembler-times "ldrex" 12 } } */ +/* { dg-final { scan-assembler-times "stlex" 12 } } */ +/* { dg-final { scan-assembler-times "dmb" 12 } } */ diff --git a/gcc/testsuite/gcc.target/arm/armv8-sync-op-release.c b/gcc/testsuite/gcc.target/arm/armv8-sync-op-release.c new file mode 100644 index 0000000000..502a266010 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/armv8-sync-op-release.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v8a } */ + +#include "../aarch64/sync-op-release.x" + +/* { dg-final { scan-assembler-times "stl" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/macro_defs0.c b/gcc/testsuite/gcc.target/arm/macro_defs0.c index 962ff03db3..684d49ffaf 100644 --- a/gcc/testsuite/gcc.target/arm/macro_defs0.c +++ b/gcc/testsuite/gcc.target/arm/macro_defs0.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv7-m" } } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" } { "" } } */ /* { dg-options "-march=armv7-m -mcpu=cortex-m3 -mfloat-abi=soft -mthumb" } */ #ifdef __ARM_FP diff --git a/gcc/testsuite/gcc.target/arm/macro_defs1.c b/gcc/testsuite/gcc.target/arm/macro_defs1.c index d5423c7212..4cc9ae6045 100644 --- a/gcc/testsuite/gcc.target/arm/macro_defs1.c +++ b/gcc/testsuite/gcc.target/arm/macro_defs1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-march=*" } { "-march=armv6-m" } } */ +/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" } { "" } } */ /* { dg-options "-march=armv6-m -mthumb" } */ #ifdef __ARM_NEON_FP diff --git a/gcc/testsuite/gcc.target/arm/pr63210.c b/gcc/testsuite/gcc.target/arm/pr63210.c index c3ae92801f..9b63a67d3f 100644 --- a/gcc/testsuite/gcc.target/arm/pr63210.c +++ b/gcc/testsuite/gcc.target/arm/pr63210.c @@ -1,6 +1,8 @@ /* { dg-do assemble } */ /* { dg-options "-mthumb -Os " } */ /* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-skip-if "do not test on armv4t" { *-*-* } { "-march=armv4t" } } */ +/* { dg-additional-options "-march=armv5t" {target arm_arch_v5t_ok} } */ int foo1 (int c); int foo2 (int c); diff --git a/gcc/testsuite/gcc.target/arm/pr66912.c b/gcc/testsuite/gcc.target/arm/pr66912.c new file mode 100644 index 0000000000..27e4c452bd --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr66912.c @@ -0,0 +1,42 @@ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -fpic" } */ + +__attribute__((visibility("protected"))) +int n_common; + +__attribute__((weak, visibility("protected"))) +int n_weak_common; + +__attribute__((visibility("protected"))) +int n_init = -1; + +__attribute__((weak, visibility("protected"))) +int n_weak_init = -1; + +int +f1 () +{ + /* { dg-final { scan-assembler "\\.word\\tn_common\\(GOT\\)" } } */ + return n_common; +} + +int +f2 () +{ + /* { dg-final { scan-assembler "\\.word\\tn_weak_common\\(GOT\\)" } } */ + return n_weak_common; +} + +int +f3 () +{ + /* { dg-final { scan-assembler "\\.word\\tn_init\\(GOT\\)" } } */ + return n_init; +} + +int +f4 () +{ + /* { dg-final { scan-assembler "\\.word\\tn_weak_init\\(GOT\\)" } } */ + return n_weak_init; +} diff --git a/gcc/testsuite/gcc.target/arm/pr67439_1.c b/gcc/testsuite/gcc.target/arm/pr67439_1.c new file mode 100644 index 0000000000..f7a6128758 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr67439_1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-options "-O1 -mfp16-format=ieee -march=armv7-a -mfpu=neon -mthumb -mrestrict-it" } */ + +__fp16 h0 = -1.0; + +void +f (__fp16 *p) +{ + h0 = 1.0; +} diff --git a/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c b/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c index e36000b19a..3cb93dc6c8 100644 --- a/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c +++ b/gcc/testsuite/gcc.target/arm/split-live-ranges-for-shrink-wrap.c @@ -1,6 +1,8 @@ /* { dg-do assemble } */ /* { dg-options "-mthumb -Os -fdump-rtl-ira " } */ /* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-skip-if "do not test on armv4t" { *-*-* } { "-march=armv4t" } } */ +/* { dg-additional-options "-march=armv5t" {target arm_arch_v5t_ok} } */ int foo (char *, char *, int); int test (int d, char * out, char *in, int len) diff --git a/gcc/testsuite/gcc.target/arm/stl-cond.c b/gcc/testsuite/gcc.target/arm/stl-cond.c new file mode 100644 index 0000000000..de14bb580b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/stl-cond.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_arm_ok } */ +/* { dg-require-effective-target arm_arch_v8a_ok } */ +/* { dg-options "-O2 -marm" } */ +/* { dg-add-options arm_arch_v8a } */ + +struct backtrace_state +{ + int threaded; + int lock_alloc; +}; + +void foo (struct backtrace_state *state) +{ + if (state->threaded) + __sync_lock_release (&state->lock_alloc); +} + +/* { dg-final { scan-assembler "stlne" } } */ diff --git a/gcc/testsuite/gcc.target/arm/thumb-bitfld1.c b/gcc/testsuite/gcc.target/arm/thumb-bitfld1.c index ee39887d10..37630f1a1f 100644 --- a/gcc/testsuite/gcc.target/arm/thumb-bitfld1.c +++ b/gcc/testsuite/gcc.target/arm/thumb-bitfld1.c @@ -10,6 +10,8 @@ struct foo unsigned b28 : 1; unsigned rest : 28; }; + +unsigned foo(a) struct foo a; { diff --git a/gcc/testsuite/gcc.target/arm/thumb-ltu.c b/gcc/testsuite/gcc.target/arm/thumb-ltu.c index d057ea34d2..ae4ad5bdef 100644 --- a/gcc/testsuite/gcc.target/arm/thumb-ltu.c +++ b/gcc/testsuite/gcc.target/arm/thumb-ltu.c @@ -2,6 +2,9 @@ /* { dg-require-effective-target arm_thumb1_ok } */ /* { dg-options "-mcpu=arm1136jf-s -mthumb -O2" } */ +extern int foo (); +extern int bar (); + void f(unsigned a, unsigned b, unsigned c, unsigned d) { if (a <= b || c > d) diff --git a/gcc/testsuite/gcc.target/arm/thumb1-far-jump-2.c b/gcc/testsuite/gcc.target/arm/thumb1-far-jump-2.c index c6878f8ef8..78fcafaaf7 100644 --- a/gcc/testsuite/gcc.target/arm/thumb1-far-jump-2.c +++ b/gcc/testsuite/gcc.target/arm/thumb1-far-jump-2.c @@ -5,7 +5,7 @@ /* { dg-options "-Os" } */ /* { dg-skip-if "" { ! { arm_thumb1 } } } */ -volatile register r4 asm("r4"); +volatile register int r4 asm ("r4"); void f3(int i) { #define GO(n) \ diff --git a/gcc/testsuite/gcc.target/arm/vnmul-1.c b/gcc/testsuite/gcc.target/arm/vnmul-1.c new file mode 100644 index 0000000000..af0bebed20 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/vnmul-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -fno-rounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "vnmul\\.f64" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "vnmul\\.f32" } } */ + return -a * b; +} diff --git a/gcc/testsuite/gcc.target/arm/vnmul-2.c b/gcc/testsuite/gcc.target/arm/vnmul-2.c new file mode 100644 index 0000000000..909b2a44a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/vnmul-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -frounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler-not "vnmul\\.f64" } } */ + return -a * b; +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler-not "vnmul\\.f32" } } */ + return -a * b; +} diff --git a/gcc/testsuite/gcc.target/arm/vnmul-3.c b/gcc/testsuite/gcc.target/arm/vnmul-3.c new file mode 100644 index 0000000000..df028823ee --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/vnmul-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -fno-rounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "vnmul\\.f64" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "vnmul\\.f32" } } */ + return -(a * b); +} diff --git a/gcc/testsuite/gcc.target/arm/vnmul-4.c b/gcc/testsuite/gcc.target/arm/vnmul-4.c new file mode 100644 index 0000000000..670ee40e0c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/vnmul-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_vfp_ok } */ +/* { dg-skip-if "need fp instructions" { *-*-* } { "-mfloat-abi=soft" } { "" } } */ +/* { dg-options "-O2 -frounding-math -mfpu=vfp -mfloat-abi=hard" } */ + +double +foo_d (double a, double b) +{ + /* { dg-final { scan-assembler "vnmul\\.f64" } } */ + return -(a * b); +} + +float +foo_s (float a, float b) +{ + /* { dg-final { scan-assembler "vnmul\\.f32" } } */ + return -(a * b); +} diff --git a/gcc/testsuite/gcc.target/i386/20060512-1.c b/gcc/testsuite/gcc.target/i386/20060512-1.c index 374d18aea5..ec163a9bc5 100644 --- a/gcc/testsuite/gcc.target/i386/20060512-1.c +++ b/gcc/testsuite/gcc.target/i386/20060512-1.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-require-effective-target ia32 } */ /* { dg-options "-std=gnu99 -msse2 -mpreferred-stack-boundary=4" } */ /* { dg-require-effective-target sse2 } */ @@ -7,6 +6,14 @@ #include <emmintrin.h> +#ifdef __x86_64__ +# define PUSH "pushq %rsi" +# define POP "popq %rsi" +#else +# define PUSH "pushl %esi" +# define POP "popl %esi" +#endif + __m128i __attribute__ ((__noinline__)) vector_using_function () { @@ -27,9 +34,9 @@ static void sse2_test (void) { int result; - asm ("pushl %esi"); /* Disalign runtime stack. */ + asm (PUSH); /* Misalign runtime stack. */ result = self_aligning_function (g_1, g_2); if (result != 42) abort (); - asm ("popl %esi"); + asm (POP); } diff --git a/gcc/testsuite/gcc.target/i386/20060512-2.c b/gcc/testsuite/gcc.target/i386/20060512-2.c index d3a779cb4e..8ce4bd7f8b 100644 --- a/gcc/testsuite/gcc.target/i386/20060512-2.c +++ b/gcc/testsuite/gcc.target/i386/20060512-2.c @@ -1,5 +1,4 @@ /* { dg-do compile } */ -/* { dg-require-effective-target ia32 } */ /* { dg-options "-std=gnu99 -mpreferred-stack-boundary=4" } */ int outer_function (int x, int y) diff --git a/gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c b/gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c index 9fff611b6c..b0ba6e253d 100644 --- a/gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c +++ b/gcc/testsuite/gcc.target/i386/adx-addcarryx32-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-madx -O2" } */ -/* { dg-final { scan-assembler-times "adcx" 2 } } */ +/* { dg-final { scan-assembler-times "adc\[xl\]" 2 } } */ /* { dg-final { scan-assembler-times "sbbl" 1 } } */ #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c b/gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c index 3608dea79b..cbe19856c6 100644 --- a/gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c +++ b/gcc/testsuite/gcc.target/i386/adx-addcarryx64-1.c @@ -1,6 +1,6 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-madx -O2" } */ -/* { dg-final { scan-assembler-times "adcx" 2 } } */ +/* { dg-final { scan-assembler-times "adc\[xq\]" 2 } } */ /* { dg-final { scan-assembler-times "sbbq" 1 } } */ #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/i386/avx512vbmi-check.h b/gcc/testsuite/gcc.target/i386/avx512vbmi-check.h index 591ff0640e..97aca27722 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vbmi-check.h +++ b/gcc/testsuite/gcc.target/i386/avx512vbmi-check.h @@ -25,7 +25,7 @@ main () __cpuid_count (7, 0, eax, ebx, ecx, edx); - if ((avx512f_os_support ()) && ((ebx & bit_AVX512VBMI) == bit_AVX512VBMI)) + if ((avx512f_os_support ()) && ((ecx & bit_AVX512VBMI) == bit_AVX512VBMI)) { do_test (); #ifdef DEBUG diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc b/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc new file mode 100644 index 0000000000..b29cd03ed0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66048.cc @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -march=corei7-avx" } */ + +struct c1 +{ + c1 (const c1 &other) : p (other.p) { }; + int *p; +}; + +struct c2 : public c1 { }; + +c1 +test (c2 a) +{ + return a; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66134.c b/gcc/testsuite/gcc.target/i386/mpx/pr66134.c new file mode 100644 index 0000000000..3889674ed5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66134.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -fno-tree-ccp" } */ + +extern int vfork (void) __attribute__ ((__nothrow__ , __leaf__)); +void test1 (void); +void test2 (void); +void test3 (int *); + +void test (int *p) +{ + test1 (); + p++; + test2 (); + p++; + vfork (); + test3 (p); +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66566.c b/gcc/testsuite/gcc.target/i386/mpx/pr66566.c new file mode 100644 index 0000000000..a405c20ac0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66566.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */ + +union jsval_layout +{ + void *asPtr; +}; +union jsval_layout a; +union jsval_layout b; +union jsval_layout __inline__ fn1() { return b; } + +void fn2() { a = fn1(); } diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66567.c b/gcc/testsuite/gcc.target/i386/mpx/pr66567.c new file mode 100644 index 0000000000..5a7e2f29e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66567.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +void (*b) (); + +void fn1 (const int *p1) +{ + static void *a = &&conv_1234_123C; + conv_1234_123C: + ; +} + +void fn2 () +{ + b = fn1; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66568.c b/gcc/testsuite/gcc.target/i386/mpx/pr66568.c new file mode 100644 index 0000000000..2653ebc0fa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66568.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target fpic } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -O2 -fPIC" } */ + +extern void exit (int); +int a, b, c; +void *set_test () { + if (b) + a ? exit (0) : exit (1); + b = c; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66569.c b/gcc/testsuite/gcc.target/i386/mpx/pr66569.c new file mode 100644 index 0000000000..ba2023c684 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66569.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +struct s1 { + int *p; + int i; +}; + +struct s2 { + struct s1 s; + int i; +}; + +int test (struct s2 s, ...) { } diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr66581.c b/gcc/testsuite/gcc.target/i386/mpx/pr66581.c new file mode 100644 index 0000000000..015faaeae5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr66581.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +void *a; +int b; + +void +fn1 (void) +{ + void *c = &&l_nop; +l_nop: + for (; b;) + ; + int *d = c; + c = fn1; + *d = 1; + goto *a; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr68337-1.c b/gcc/testsuite/gcc.target/i386/mpx/pr68337-1.c new file mode 100644 index 0000000000..3f8d79d428 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr68337-1.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ + +#include "mpx-check.h" + +#define N 2 + +extern void abort (); + +static int +mpx_test (int argc, const char **argv) +{ + char ** src = (char **)malloc (sizeof (char *) * N); + char ** dst = (char **)malloc (sizeof (char *) * N); + int i; + + for (i = 0; i < N; i++) + src[i] = __bnd_set_ptr_bounds (argv[0] + i, i + 1); + + __builtin_memcpy(dst, src, sizeof (char *) * N); + + for (i = 0; i < N; i++) + { + char *p = dst[i]; + if (p != argv[0] + i + || __bnd_get_ptr_lbound (p) != p + || __bnd_get_ptr_ubound (p) != p + i) + abort (); + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr68337-2.c b/gcc/testsuite/gcc.target/i386/mpx/pr68337-2.c new file mode 100644 index 0000000000..8845cca79b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr68337-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx" } */ +/* { dg-final { scan-assembler-not "memcpy" } } */ + +void +test (void *dst, void *src) +{ + __builtin_memcpy (dst, src, sizeof (char *) / 2); +} diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr68416.c b/gcc/testsuite/gcc.target/i386/mpx/pr68416.c new file mode 100644 index 0000000000..10587edf25 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/pr68416.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mmpx -fcheck-pointer-bounds" } */ +/* { dg-final { scan-assembler-not "bndmov" } } */ + +int +foo(int **arr, int i) +{ + return (*arr)[i]; +} diff --git a/gcc/testsuite/gcc.target/i386/pr66424.c b/gcc/testsuite/gcc.target/i386/pr66424.c new file mode 100644 index 0000000000..f5f5e1e8b5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66424.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target ia32 } */ +int a, b, c, d, e[2], f, l, m, n, o; +long long g = 1, j; +static unsigned int h; +static int i, k; + +void +fn1 (long long p) +{ + int q = p; + f = 1 ^ e[f ^ (q & 1)]; +} + +static void +fn2 (long long p) +{ + f = 1 ^ e[(f ^ 1) & 1]; + fn1 (p >> 1 & 1); + fn1 (p >> 32 & 1); +} + +void +fn3 (int p) +{ + g |= j = p; +} + +int +main () +{ + e[0] = 1; + char p = l; + h = --g; + i = o = c; + m = d ? 1 / d : 0; + fn3 (l || 0); + b = a; + n = j++; + k--; + fn2 (g); + fn2 (h); + fn2 (i); + + if (k + f) + __builtin_abort (); + + return 0; +} + diff --git a/gcc/testsuite/gcc.target/i386/pr66648.c b/gcc/testsuite/gcc.target/i386/pr66648.c new file mode 100644 index 0000000000..88c126fff8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66648.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mstringop-strategy=unrolled_loop -mtune=nocona" } */ + +#define PATTERN 0xdeadbeef +#define SIZE 32 + +struct S { int i; char str[SIZE]; int j; }; + +void __attribute__((noclone, noinline)) +my_memcpy (char *, const char *, unsigned int); + +void +my_memcpy (char *dst, const char *src, unsigned int len) +{ + if (len < 8) + __builtin_abort (); + + __builtin_memcpy (dst, src, len); +} + +int +main (void) +{ + const char str[SIZE]= "1234567890123456789012345678901"; + struct S *s = __builtin_malloc (sizeof (struct S)); + + s->j = PATTERN; + my_memcpy (s->str, str, SIZE); + if (s->j != PATTERN) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr66691.c b/gcc/testsuite/gcc.target/i386/pr66691.c new file mode 100644 index 0000000000..da78808acd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66691.c @@ -0,0 +1,64 @@ +/* PR debug/66691 */ +/* { dg-do compile } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-O3 -g -mtune=generic -march=i686" } */ + +unsigned int a; +int b[2], c, d, e, f, g, h, i, k[8], l, m, s, t, w; +static int j; + +void +fn1 (long long p) +{ + int t = p; + c = c ^ b[c ^ (t & 1)]; +} + +static void +fn2 (long long p) +{ + c = c ^ b[1 ^ (d & 1)]; + fn1 (p >> 1 & 1); + fn1 (p >> 2); +} + +static void +fn3 () +{ + unsigned char p; + f = g = 0; + for (h = 0; h < 6; h++) + { + for (s = 0; s < 7; s++) + if (k[s+1]) + g = 0; + else + for (j = 0; j < 2; j++) + ; + t = j > 2 ? 0 : 1 >> j; + } + if (l) + { + short q[2]; + q[0] = q[1] = 0; + if (m) + for (i = 0; i < 2; i++) + { + unsigned char r = q[i]; + p = f ? r % f : r; + e = ((p > 0) <= (q[i] ^ 1)) + a; + if (k[1]) + for (e = 0; e != 18; ++e) + k[0] = 0; + } + } +} + +int +main () +{ + fn3 (); + fn2 (w); + fn2 (j); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr66703.c b/gcc/testsuite/gcc.target/i386/pr66703.c new file mode 100644 index 0000000000..0fb05829de --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66703.c @@ -0,0 +1,4 @@ +/* { dg-do run { target { ia32 } } } */ +/* { dg-options "-O0 -mtune=pentium" } */ + +#include "readeflags-1.c" diff --git a/gcc/testsuite/gcc.target/i386/pr66814.c b/gcc/testsuite/gcc.target/i386/pr66814.c new file mode 100644 index 0000000000..4ac9d234cc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66814.c @@ -0,0 +1,4 @@ +/* { dg-do compile { target { ia32 } } } */ +/* { dg-options "-march=i586 -mavx512f -O2" } */ + +#include "avx512f-klogic-2.c" diff --git a/gcc/testsuite/gcc.target/i386/pr66838.c b/gcc/testsuite/gcc.target/i386/pr66838.c new file mode 100644 index 0000000000..46effedad3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66838.c @@ -0,0 +1,36 @@ +/* { dg-do run { target lp64 } } */ +/* { dg-options "-O2" } */ + +void abort (void); + +char global; + +__attribute__((sysv_abi, noinline, noclone)) +void sysv_abi_func(char const *desc, void *local) +{ + register int esi asm ("esi"); + register int edi asm ("edi"); + + if (local != &global) + abort (); + + /* Clobber some of the extra SYSV ABI registers. */ + asm volatile ("movl\t%2, %0\n\tmovl\t%2, %1" + : "=r" (esi), "=r" (edi) + : "i" (0xdeadbeef)); +} + +__attribute__((ms_abi, noinline, noclone)) +void ms_abi_func () +{ + sysv_abi_func ("1st call", &global); + sysv_abi_func ("2nd call", &global); + sysv_abi_func ("3rd call", &global); +} + +int +main(void) +{ + ms_abi_func(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr66891.c b/gcc/testsuite/gcc.target/i386/pr66891.c new file mode 100644 index 0000000000..61a4570319 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66891.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2" } */ + +__attribute__((__stdcall__)) void fn1(); + +int a; + +static void fn2() { + for (;;) + ; +} + +void fn3() { + fn1(0); + fn2(a == 0); +} diff --git a/gcc/testsuite/gcc.target/i386/pr66922.c b/gcc/testsuite/gcc.target/i386/pr66922.c new file mode 100644 index 0000000000..46274b22ce --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66922.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -msse2" } */ +/* { dg-require-effective-target sse2 } */ + +#include "sse2-check.h" + +struct S +{ + int:31; + int:2; + int f0:16; + int f1; + int f2; +}; + +static void +sse2_test (void) +{ + struct S a = { 1, 0, 0 }; + + if (a.f0 != 1) + __builtin_abort(); +} diff --git a/gcc/testsuite/gcc.target/i386/pr67265-2.c b/gcc/testsuite/gcc.target/i386/pr67265-2.c new file mode 100644 index 0000000000..a9f2eb460e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67265-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fstack-check" } */ + +void foo (int n) +{ + volatile char arr[64 * 1024]; + + arr[n] = 1; +} diff --git a/gcc/testsuite/gcc.target/i386/pr67265.c b/gcc/testsuite/gcc.target/i386/pr67265.c new file mode 100644 index 0000000000..7827685fe5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67265.c @@ -0,0 +1,12 @@ +/* PR target/67265 */ +/* Reduced testcase by Johannes Dewender <gnu@JonnyJD.net> */ + +/* { dg-do compile } */ +/* { dg-options "-O -fstack-check -fPIC" } */ + +int a, b, c, d, e; + +void foo (void) +{ + __asm__("" : "+r"(c), "+r"(e), "+r"(d), "+r"(a) : ""(b), "mg"(foo), "mm"(c)); +} diff --git a/gcc/testsuite/gcc.target/i386/pr67317-1.c b/gcc/testsuite/gcc.target/i386/pr67317-1.c new file mode 100644 index 0000000000..7db4e5f31a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67317-1.c @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef unsigned int u32; + +u32 testcarry_u32 (u32 a, u32 b, u32 c, u32 d) +{ + u32 result0, result1; + + __builtin_ia32_addcarryx_u32 + (__builtin_ia32_addcarryx_u32 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr67317-2.c b/gcc/testsuite/gcc.target/i386/pr67317-2.c new file mode 100644 index 0000000000..97b2eff88d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67317-2.c @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef unsigned long long u64; + +u64 testcarry_u64 (u64 a, u64 b, u64 c, u64 d) +{ + u64 result0, result1; + + __builtin_ia32_addcarryx_u64 + (__builtin_ia32_addcarryx_u64 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr67317-3.c b/gcc/testsuite/gcc.target/i386/pr67317-3.c new file mode 100644 index 0000000000..c141d09810 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67317-3.c @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef unsigned int u32; + +u32 testcarry_u32 (u32 a, u32 b, u32 c, u32 d) +{ + u32 result0, result1; + + __builtin_ia32_sbb_u32 + (__builtin_ia32_sbb_u32 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr67317-4.c b/gcc/testsuite/gcc.target/i386/pr67317-4.c new file mode 100644 index 0000000000..2f95dbc16f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67317-4.c @@ -0,0 +1,18 @@ +/* PR target/67317 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +typedef unsigned long long u64; + +u64 testcarry_u64 (u64 a, u64 b, u64 c, u64 d) +{ + u64 result0, result1; + + __builtin_ia32_sbb_u64 + (__builtin_ia32_sbb_u64 (0, a, c, &result0), b, d, &result1); + + return result0 ^ result1; +} + +/* { dg-final { scan-assembler-not "addb" } } */ +/* { dg-final { scan-assembler-not "setn?c" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr67480.c b/gcc/testsuite/gcc.target/i386/pr67480.c new file mode 100644 index 0000000000..aa549682db --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67480.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx512bw -O2 -ftree-vectorize" } */ + +void +foo(const char *in, char *out, unsigned n) +{ + unsigned i; + for (i = 0; i < n; i++) + out[i] &= in[i]; +} diff --git a/gcc/testsuite/gcc.target/i386/pr67609-2.c b/gcc/testsuite/gcc.target/i386/pr67609-2.c new file mode 100644 index 0000000000..7d3fcba3be --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67609-2.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -msse2" } */ +/* { dg-require-effective-target sse2 } */ + +#include "sse2-check.h" + +#include <emmintrin.h> + +__m128d reg = { 2.0, 4.0 }; + +void +__attribute__((noinline)) +set_lower (double b) +{ + double v[2]; + _mm_store_pd(v, reg); + v[0] = b; + reg = _mm_load_pd(v); +} + +static void +sse2_test (void) +{ + set_lower (6.0); + + if (reg[1] != 4.0) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/pr67609.c b/gcc/testsuite/gcc.target/i386/pr67609.c new file mode 100644 index 0000000000..518071bdd8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67609.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-final { scan-assembler "movdqa" } } */ + +#include <emmintrin.h> +__m128d reg; +void set_lower(double b) +{ + double v[2]; + _mm_store_pd(v, reg); + v[0] = b; + reg = _mm_load_pd(v); +} diff --git a/gcc/testsuite/gcc.target/i386/pr67770.c b/gcc/testsuite/gcc.target/i386/pr67770.c new file mode 100644 index 0000000000..3826aff45b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr67770.c @@ -0,0 +1,40 @@ +/* PR target/67770 */ +/* { dg-do run { target ia32 } } */ +/* { dg-require-effective-target trampolines } */ +/* { dg-options "-O2" } */ + +#ifndef NO_TRAMPOLINES +__attribute__ ((noinline)) void +foo (int i, void (* __attribute__ ((regparm (3))) bar) (int)) +{ + bar (i); +} +#endif + +int +main () +{ +#ifndef NO_TRAMPOLINES + int p = 0; + + __attribute__ ((regparm (3), noinline)) void + bar (int i) + { + if (__builtin_expect (i, 0)) + ++p; + } + + foo (0, bar); + bar (0); + + if (p != 0) + __builtin_abort (); + + foo (1, bar); + bar (1); + + if (p != 2) + __builtin_abort (); +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68018.c b/gcc/testsuite/gcc.target/i386/pr68018.c new file mode 100644 index 0000000000..a0fa21e0b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68018.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-options "-O -mabi=ms -mstackrealign" } */ + +typedef float V __attribute__ ((vector_size (16))); + +int fn1 (V * x) +{ + V a = *x; + return a[0]; +} diff --git a/gcc/testsuite/gcc.target/i386/pr68483-1.c b/gcc/testsuite/gcc.target/i386/pr68483-1.c new file mode 100644 index 0000000000..29787e94bd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68483-1.c @@ -0,0 +1,22 @@ +/* PR target/68483 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -msse2 -mno-sse3" } */ + +void +test (int *input, int *out, unsigned x1, unsigned x2) +{ + unsigned i, j; + unsigned end = x1; + + for (i = j = 0; i < 1000; i++) + { + int sum = 0; + end += x2; + for (; j < end; j++) + sum += input[j]; + out[i] = sum; + } +} + +/* { dg-final { scan-assembler "psrldq\[^\n\r]*(8,|, 8)" { target ia32 } } } */ +/* { dg-final { scan-assembler "psrldq\[^\n\r]*(4,|, 4)" { target ia32 } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr68483-2.c b/gcc/testsuite/gcc.target/i386/pr68483-2.c new file mode 100644 index 0000000000..394dc1bac7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68483-2.c @@ -0,0 +1,15 @@ +/* PR target/68483 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -mno-sse3" } */ + +typedef int V __attribute__((vector_size (16))); + +void +foo (V *a, V *b) +{ + V c = { 0, 0, 0, 0 }; + V d = { 1, 2, 3, 4 }; + *a = __builtin_shuffle (*b, c, d); +} + +/* { dg-final { scan-assembler "psrldq\[^\n\r]*(4,|, 4)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/readeflags-1.c b/gcc/testsuite/gcc.target/i386/readeflags-1.c index 6b2fa7e8d1..8b00d7d5d1 100644 --- a/gcc/testsuite/gcc.target/i386/readeflags-1.c +++ b/gcc/testsuite/gcc.target/i386/readeflags-1.c @@ -9,10 +9,11 @@ #define EFLAGS_TYPE unsigned int #endif -static EFLAGS_TYPE +__attribute__((noinline, noclone)) +EFLAGS_TYPE readeflags_test (unsigned int a, unsigned int b) { - unsigned x = (a == b); + volatile char x = (a == b); return __readeflags (); } diff --git a/gcc/testsuite/gcc.target/i386/vect-pack-trunc-1.c b/gcc/testsuite/gcc.target/i386/vect-pack-trunc-1.c new file mode 100644 index 0000000000..1b468e4775 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-pack-trunc-1.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" + +#define N 400 +unsigned char yy[10000]; + +void +__attribute__ ((noinline)) foo (unsigned short s) +{ + unsigned short i; + for (i = 0; i < s; i++) + yy[i] = (unsigned char) i; +} + +void +avx512bw_test () +{ + unsigned short i; + foo (N); + + for (i = 0; i < N; i++) + if ( (unsigned char)i != yy [i] ) + abort (); +} + +/* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\n\]*%zmm" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/vect-pack-trunc-2.c b/gcc/testsuite/gcc.target/i386/vect-pack-trunc-2.c new file mode 100644 index 0000000000..f3d899c113 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-pack-trunc-2.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" + +#define N 400 +unsigned short yy[10000]; + +void +__attribute__ ((noinline)) foo (unsigned int s) +{ + unsigned int i; + for (i = 0; i < s; i++) + yy[i] = (unsigned short) i; +} + +void +avx512bw_test () +{ + unsigned int i; + foo (N); + for (i = 0; i < N; i++) + if ( (unsigned short)i != yy [i] ) + abort (); +} + +/* { dg-final { scan-assembler-times "vpermi2w\[ \\t\]+\[^\n\]*%zmm" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/vect-perm-even-1.c b/gcc/testsuite/gcc.target/i386/vect-perm-even-1.c new file mode 100644 index 0000000000..3de4dfabee --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-perm-even-1.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" + +#define N 400 +unsigned char yy[10000]; +unsigned char xx[10000]; + +void +__attribute__ ((noinline)) foo (unsigned short s) +{ + unsigned short i; + for (i = 0; i < s; i++) + yy[i] = xx [i*2 + 1]; +} + +void +avx512bw_test () +{ + unsigned short i; + unsigned char j = 0; + for (i = 0; i < 2 * N + 1; i++, j++) + xx [i] = j; + + foo (N); + + for (i = 0; i < N; i++) + if ( (unsigned char)(2*i+1) != yy [i] ) + abort (); +} + +/* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\n\]*%zmm" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/vect-perm-odd-1.c b/gcc/testsuite/gcc.target/i386/vect-perm-odd-1.c new file mode 100644 index 0000000000..e32d40a1ba --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-perm-odd-1.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" + +#define N 400 + +typedef struct +{ + unsigned char real; + unsigned char imag; +} complex8_t; + +void +__attribute__ ((noinline)) foo (unsigned char *a, + complex8_t *x, unsigned len) +{ + unsigned i; + for (i = 0; i < len; i++) + a[i] = x[i].imag + x[i].real; +} + +void +avx512bw_test () +{ + unsigned short i; + unsigned char j = 0; + complex8_t x [N]; + unsigned char a [N]; + + for (i = 0; i < N; i++, j++) + { + x [i].real = j; + x [i].imag = j; + } + + foo (a, x, N); + + j = 0; + for (i = 0; i < N; i++, j++) + if ( a[i] != (unsigned char)(j+j) ) + abort (); +} + +/* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\n\]*%zmm" 4 } } */ diff --git a/gcc/testsuite/gcc.target/i386/vect-unpack-1.c b/gcc/testsuite/gcc.target/i386/vect-unpack-1.c new file mode 100644 index 0000000000..84521e313e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-unpack-1.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" + +#define N 255 +unsigned int yy[10000]; + +void +__attribute__ ((noinline)) foo (unsigned char s) +{ + unsigned char i; + for (i = 0; i < s; i++) + yy[i] = (unsigned int) i; +} + +void +avx512bw_test () +{ + unsigned char i; + foo (N); + for (i = 0; i < N; i++) + if ( (unsigned int)i != yy [i] ) + abort (); +} + +/* { dg-final { scan-assembler-times "vpmovzxbw\[ \\t\]+\[^\n\]*%zmm" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/vect-unpack-2.c b/gcc/testsuite/gcc.target/i386/vect-unpack-2.c new file mode 100644 index 0000000000..482524848b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-unpack-2.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */ +/* { dg-require-effective-target avx512bw } */ + +#include "avx512bw-check.h" + +#define N 120 +signed int yy[10000]; + +void +__attribute__ ((noinline)) foo (signed char s) +{ + signed char i; + for (i = 0; i < s; i++) + yy[i] = (signed int) i; +} + +void +avx512bw_test () +{ + signed char i; + foo (N); + for (i = 0; i < N; i++) + if ( (signed int)i != yy [i] ) + abort (); +} + +/* { dg-final { scan-assembler-times "vpmovsxbw\[ \\t\]+\[^\n\]*%zmm" 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c b/gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c new file mode 100644 index 0000000000..691e517469 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/htm-tabort-no-r0.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_htm_ok } */ +/* { dg-options "-O2 -mhtm -ffixed-r3 -ffixed-r4 -ffixed-r5 -ffixed-r6 -ffixed-r7 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12" } */ + +/* { dg-final { scan-assembler-not "tabort\\.\[ \t\]0" } } */ + +int +foo (void) +{ + return __builtin_tabort (10); +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr67808.c b/gcc/testsuite/gcc.target/powerpc/pr67808.c new file mode 100644 index 0000000000..266fd97d66 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr67808.c @@ -0,0 +1,46 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-O1 -mvsx -mlra -mcpu=power7" } */ + +/* PR 67808: LRA ICEs on simple double to long double conversion test case */ + +void +dfoo (long double *ldb1, double *db1) +{ + *ldb1 = *db1; +} + +long double +dfoo2 (double *db1) +{ + return *db1; +} + +long double +dfoo3 (double x) +{ + return x; +} + +void +ffoo (long double *ldb1, float *db1) +{ + *ldb1 = *db1; +} + +long double +ffoo2 (float *db1) +{ + return *db1; +} + +long double +ffoo3 (float x) +{ + return x; +} + +/* { dg-final { scan-assembler "xxlxor" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vec-shr.c b/gcc/testsuite/gcc.target/powerpc/vec-shr.c new file mode 100644 index 0000000000..31a27c8832 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-shr.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-inline" } */ + +#include <stdlib.h> + +typedef struct { double r, i; } complex; +#define LEN 30 +complex c[LEN]; +double d[LEN]; + +void +foo (complex *c, double *d, int len1) +{ + int i; + for (i = 0; i < len1; i++) + { + c[i].r = d[i]; + c[i].i = 0.0; + } +} + +int +main (void) +{ + int i; + for (i = 0; i < LEN; i++) + d[i] = (double) i; + foo (c, d, LEN); + for (i=0;i<LEN;i++) + if ((c[i].r != (double) i) || (c[i].i != 0.0)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/s390/bswap-1.c b/gcc/testsuite/gcc.target/s390/bswap-1.c new file mode 100644 index 0000000000..e1f113a4cc --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/bswap-1.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z900 -mzarch" } */ + +#include <stdint.h> + +uint64_t u64; +uint32_t u32; +uint16_t u16; + +uint64_t +foo64a (uint64_t a) +{ + return __builtin_bswap64 (a); +} +/* { dg-final { scan-assembler-times "lrvgr\t%r2,%r2" 1 { target lp64 } } } */ + +uint64_t +foo64b () +{ + return __builtin_bswap64 (u64); +} +/* { dg-final { scan-assembler-times "lrvg\t%r2,0\\(%r\[0-9\]*\\)" 1 { target lp64 } } } */ + +uint32_t +foo32 () +{ + return __builtin_bswap32 (u32); +} +/* { dg-final { scan-assembler-times "lrv\t%r2,0\\(%r\[0-9\]*\\)" 1 } } */ + +uint16_t +foo16 () +{ + return __builtin_bswap16 (u16); +} +/* { dg-final { scan-assembler-times "lrvh\t%r2,0\\(%r\[0-9\]*\\)" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/pfpo.c b/gcc/testsuite/gcc.target/s390/pfpo.c new file mode 100644 index 0000000000..32725c991a --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pfpo.c @@ -0,0 +1,21 @@ +/* The pfpo instruction generated by this code clobbers the r1 register while + it was still in use. */ + +/* { dg-do run } */ +/* { dg-options "-O0 -march=z10 -mzarch" } */ + +int foo(int x) +{ + return x; +} + +int bar(int i, float f) +{ + return i; +} + +int main() +{ + _Decimal32 d = 7; + return bar(foo(0x10203040), (float)d) == 0x10203040 ? 0 : 1; +} diff --git a/gcc/testsuite/gcc.target/s390/pr67443.c b/gcc/testsuite/gcc.target/s390/pr67443.c new file mode 100644 index 0000000000..e011a11882 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr67443.c @@ -0,0 +1,49 @@ +/* Test case for PR/67443. */ + +/* { dg-do run { target s390*-*-* } } */ +/* { dg-prune-output "call-clobbered register used for global register variable" } */ +/* { dg-options "-march=z900 -fPIC -fomit-frame-pointer -O3" } */ + +#include <assert.h> + +/* Block all registers except the first three argument registers. */ +register long r0 asm ("r0"); +register long r1 asm ("r1"); +register long r5 asm ("r5"); +register long r6 asm ("r6"); +register long r7 asm ("r7"); +register long r8 asm ("r8"); +register long r9 asm ("r9"); +register long r10 asm ("r10"); +register long r11 asm ("r11"); + +struct s_t +{ + unsigned f1 : 8; + unsigned f2 : 24; +}; + +__attribute__ ((noinline)) +void foo (struct s_t *ps, int c, int i) +{ + /* Uses r2 as address register. */ + ps->f1 = c; + /* The calculation of the value is so expensive that it's cheaper to spill ps + to the stack and reload it later (into a different register). + ==> Uses r4 as address register.*/ + ps->f2 = i + i % 3; + /* If dead store elimination fails to detect that the address in r2 during + the first assignment is an alias of the address in r4 during the second + assignment, it eliminates the first assignment and the f1 field is not + written (bug). */ +} + +int main (void) +{ + struct s_t s = { 0x01u, 0x020304u }; + + foo (&s, 0, 0); + assert (s.f1 == 0&& s.f2 == 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/pr68015.c b/gcc/testsuite/gcc.target/s390/pr68015.c new file mode 100644 index 0000000000..b0d1f35ad1 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr68015.c @@ -0,0 +1,24 @@ +/* { dg-compile } */ +/* { dg-options "-O2 -march=z196" } */ + +extern long useme (long, ...); + +void +foo (void) +{ + long secs = useme (41); + long utc_secs = useme (42); + long h, m; + + utc_secs = useme (42); + h = secs / 3600; + m = secs / 60; + if (utc_secs >= 86400) + { + m = 59; + h--; + if (h < 0) + h = 23; + } + useme (h, m); +} diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c index dfe19f1913..ba9fd6ee1a 100644 --- a/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c +++ b/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c @@ -1,11 +1,13 @@ /* { dg-do run } */ /* { dg-options "-O3 -mzarch -march=z13 --save-temps" } */ /* { dg-require-effective-target vector } */ +/* { dg-require-effective-target int128 } */ typedef unsigned char uv16qi __attribute__((vector_size(16))); typedef unsigned short uv8hi __attribute__((vector_size(16))); typedef unsigned int uv4si __attribute__((vector_size(16))); typedef unsigned long long uv2di __attribute__((vector_size(16))); +typedef unsigned __int128 uv1ti __attribute__((vector_size(16))); uv2di __attribute__((noinline)) foo1 () @@ -45,6 +47,13 @@ foo4 () 0xff, 0, 0xff, 0, 0, 0xff, 0, 0xff }; } + +uv1ti __attribute__((noinline)) +foo5 () +{ + return (uv1ti){ 0xff00ff00ff00ff00ULL }; +} + /* { dg-final { scan-assembler-times "vgbm\t%v24,61605" 1 } } */ int @@ -64,6 +73,10 @@ main () if (foo4()[1] != 0xff) __builtin_abort (); + + if (foo5()[0] != 0xff00ff00ff00ff00ULL) + __builtin_abort (); + return 0; } diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c b/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c index e3ae34154c..46256e9253 100644 --- a/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c +++ b/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c @@ -1,10 +1,12 @@ /* { dg-do compile } */ /* { dg-options "-O3 -mzarch -march=z13" } */ +/* { dg-require-effective-target int128 } */ typedef unsigned char uv16qi __attribute__((vector_size(16))); typedef unsigned short uv8hi __attribute__((vector_size(16))); typedef unsigned int uv4si __attribute__((vector_size(16))); typedef unsigned long long uv2di __attribute__((vector_size(16))); +typedef unsigned __int128 uv1ti __attribute__((vector_size(16))); /* The elements differ. */ uv2di __attribute__((noinline)) @@ -43,4 +45,11 @@ foo4 () 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82 }; } + +/* We do not have vgmq. */ +uv1ti +foo5() +{ + return (uv1ti){ ((unsigned __int128)1 << 53) - 1 }; +} /* { dg-final { scan-assembler-not "vgm" } } */ diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-load_bndry-1.c b/gcc/testsuite/gcc.target/s390/zvector/vec-load_bndry-1.c new file mode 100644 index 0000000000..9ebf6c7064 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/vec-load_bndry-1.c @@ -0,0 +1,80 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O0 -mzarch -march=z13 -mzvector" } */ + +#include <vecintrin.h> + +signed char +foo64 (signed char *p) +{ + return vec_load_bndry (p, 64)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),0" 1 } } */ +} + +signed char +foo128 (signed char *p) +{ + return + vec_load_bndry (p, 128)[0] + + vec_load_bndry (p + 16, 128)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),1" 2 } } */ +} + +signed char +foo256 (signed char *p) +{ + return + vec_load_bndry (p, 256)[0] + + vec_load_bndry (p + 16, 256)[0] + + vec_load_bndry (p + 32, 256)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),2" 3 } } */ +} + +signed char +foo512 (signed char *p) +{ + return + vec_load_bndry (p, 512)[0] + + vec_load_bndry (p + 16, 512)[0] + + vec_load_bndry (p + 32, 512)[0] + + vec_load_bndry (p + 48, 512)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),3" 4 } } */ +} + +signed char +foo1024 (signed char *p) +{ + return + vec_load_bndry (p, 1024)[0] + + vec_load_bndry (p + 16, 1024)[0] + + vec_load_bndry (p + 32, 1024)[0] + + vec_load_bndry (p + 48, 1024)[0] + + vec_load_bndry (p + 64, 1024)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),4" 5 } } */ +} + +signed char +foo2048 (signed char *p) +{ + return + vec_load_bndry (p, 2048)[0] + + vec_load_bndry (p + 16, 2048)[0] + + vec_load_bndry (p + 32, 2048)[0] + + vec_load_bndry (p + 48, 2048)[0] + + vec_load_bndry (p + 64, 2048)[0] + + vec_load_bndry (p + 80, 2048)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),5" 6 } } */ +} + +signed char +foo4096 (signed char *p) +{ + return + vec_load_bndry (p, 4096)[0] + + vec_load_bndry (p + 16, 4096)[0] + + vec_load_bndry (p + 32, 4096)[0] + + vec_load_bndry (p + 48, 4096)[0] + + vec_load_bndry (p + 64, 4096)[0] + + vec_load_bndry (p + 80, 4096)[0] + + vec_load_bndry (p + 96, 4096)[0]; + /* { dg-final { scan-assembler-times "\tvlbb\t%v..?,0\\(%r..?\\),6" 7 } } */ +} diff --git a/gcc/testsuite/gcc.target/sparc/sparc-ret.c b/gcc/testsuite/gcc.target/sparc/sparc-ret-1.c index 808e8a98f0..808e8a98f0 100644 --- a/gcc/testsuite/gcc.target/sparc/sparc-ret.c +++ b/gcc/testsuite/gcc.target/sparc/sparc-ret-1.c diff --git a/gcc/testsuite/gcc.target/sparc/sparc-ret-2.c b/gcc/testsuite/gcc.target/sparc/sparc-ret-2.c new file mode 100644 index 0000000000..536b9b75a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/sparc-ret-2.c @@ -0,0 +1,13 @@ +/* PR target/57845 */ + +/* { dg-do compile } */ +/* { dg-options "-freg-struct-return" } */ + +struct S { short int i; }; + +struct S foo (short int i) +{ + struct S s; + s.i = i; + return s; +} diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_1.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_1.f03 new file mode 100644 index 0000000000..df42b342b6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_1.f03 @@ -0,0 +1,270 @@ +! { dg-do run } +! +! Check fix for correctly deep copying allocatable components. +! PR fortran/59678 +! Contributed by Andre Vehreschild <vehre@gmx.de> +! +program alloc_comp_copy_test + + type InnerT + integer :: ii + integer, allocatable :: ai + integer, allocatable :: v(:) + end type InnerT + + type T + integer :: i + integer, allocatable :: a_i + type(InnerT), allocatable :: it + type(InnerT), allocatable :: vec(:) + end type T + + type(T) :: o1, o2 + class(T), allocatable :: o3, o4 + o1%i = 42 + + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (allocated(o2%a_i)) call abort() + if (allocated(o2%it)) call abort() + if (allocated(o2%vec)) call abort() + + allocate (o1%a_i, source=2) + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (.not. allocated(o2%a_i)) call abort() + if (o2%a_i /= 2) call abort() + if (allocated(o2%it)) call abort() + if (allocated(o2%vec)) call abort() + + allocate (o1%it) + o1%it%ii = 3 + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (.not. allocated(o2%a_i)) call abort() + if (o2%a_i /= 2) call abort() + if (.not. allocated(o2%it)) call abort() + if (o2%it%ii /= 3) call abort() + if (allocated(o2%it%ai)) call abort() + if (allocated(o2%it%v)) call abort() + if (allocated(o2%vec)) call abort() + + allocate (o1%it%ai) + o1%it%ai = 4 + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (.not. allocated(o2%a_i)) call abort() + if (o2%a_i /= 2) call abort() + if (.not. allocated(o2%it)) call abort() + if (o2%it%ii /= 3) call abort() + if (.not. allocated(o2%it%ai)) call abort() + if (o2%it%ai /= 4) call abort() + if (allocated(o2%it%v)) call abort() + if (allocated(o2%vec)) call abort() + + allocate (o1%it%v(3), source= 5) + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (.not. allocated(o2%a_i)) call abort() + if (o2%a_i /= 2) call abort() + if (.not. allocated(o2%it)) call abort() + if (o2%it%ii /= 3) call abort() + if (.not. allocated(o2%it%ai)) call abort() + if (o2%it%ai /= 4) call abort() + if (.not. allocated(o2%it%v)) call abort() + if (any (o2%it%v /= 5) .or. size (o2%it%v) /= 3) call abort() + if (allocated(o2%vec)) call abort() + + allocate (o1%vec(2)) + o1%vec(:)%ii = 6 + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (.not. allocated(o2%a_i)) call abort() + if (o2%a_i /= 2) call abort() + if (.not. allocated(o2%it)) call abort() + if (o2%it%ii /= 3) call abort() + if (.not. allocated(o2%it%ai)) call abort() + if (o2%it%ai /= 4) call abort() + if (.not. allocated(o2%it%v)) call abort() + if (size (o2%it%v) /= 3) call abort() + if (any (o2%it%v /= 5)) call abort() + if (.not. allocated(o2%vec)) call abort() + if (size(o2%vec) /= 2) call abort() + if (any(o2%vec(:)%ii /= 6)) call abort() + if (allocated(o2%vec(1)%ai) .or. allocated(o2%vec(2)%ai)) call abort() + if (allocated(o2%vec(1)%v) .or. allocated(o2%vec(2)%v)) call abort() + + allocate (o1%vec(2)%ai) + o1%vec(2)%ai = 7 + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (.not. allocated(o2%a_i)) call abort() + if (o2%a_i /= 2) call abort() + if (.not. allocated(o2%it)) call abort() + if (o2%it%ii /= 3) call abort() + if (.not. allocated(o2%it%ai)) call abort() + if (o2%it%ai /= 4) call abort() + if (.not. allocated(o2%it%v)) call abort() + if (size (o2%it%v) /= 3) call abort() + if (any (o2%it%v /= 5)) call abort() + if (.not. allocated(o2%vec)) call abort() + if (size(o2%vec) /= 2) call abort() + if (any(o2%vec(:)%ii /= 6)) call abort() + if (allocated(o2%vec(1)%ai)) call abort() + if (.not. allocated(o2%vec(2)%ai)) call abort() + if (o2%vec(2)%ai /= 7) call abort() + if (allocated(o2%vec(1)%v) .or. allocated(o2%vec(2)%v)) call abort() + + allocate (o1%vec(1)%v(3)) + o1%vec(1)%v = [8, 9, 10] + call copyO(o1, o2) + if (o2%i /= 42) call abort () + if (.not. allocated(o2%a_i)) call abort() + if (o2%a_i /= 2) call abort() + if (.not. allocated(o2%it)) call abort() + if (o2%it%ii /= 3) call abort() + if (.not. allocated(o2%it%ai)) call abort() + if (o2%it%ai /= 4) call abort() + if (.not. allocated(o2%it%v)) call abort() + if (size (o2%it%v) /= 3) call abort() + if (any (o2%it%v /= 5)) call abort() + if (.not. allocated(o2%vec)) call abort() + if (size(o2%vec) /= 2) call abort() + if (any(o2%vec(:)%ii /= 6)) call abort() + if (allocated(o2%vec(1)%ai)) call abort() + if (.not. allocated(o2%vec(2)%ai)) call abort() + if (o2%vec(2)%ai /= 7) call abort() + if (.not. allocated(o2%vec(1)%v)) call abort() + if (any (o2%vec(1)%v /= [8,9,10])) call abort() + if (allocated(o2%vec(2)%v)) call abort() + + ! Now all the above for class objects. + allocate (o3, o4) + o3%i = 42 + + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (allocated(o4%a_i)) call abort() + if (allocated(o4%it)) call abort() + if (allocated(o4%vec)) call abort() + + allocate (o3%a_i, source=2) + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (.not. allocated(o4%a_i)) call abort() + if (o4%a_i /= 2) call abort() + if (allocated(o4%it)) call abort() + if (allocated(o4%vec)) call abort() + + allocate (o3%it) + o3%it%ii = 3 + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (.not. allocated(o4%a_i)) call abort() + if (o4%a_i /= 2) call abort() + if (.not. allocated(o4%it)) call abort() + if (o4%it%ii /= 3) call abort() + if (allocated(o4%it%ai)) call abort() + if (allocated(o4%it%v)) call abort() + if (allocated(o4%vec)) call abort() + + allocate (o3%it%ai) + o3%it%ai = 4 + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (.not. allocated(o4%a_i)) call abort() + if (o4%a_i /= 2) call abort() + if (.not. allocated(o4%it)) call abort() + if (o4%it%ii /= 3) call abort() + if (.not. allocated(o4%it%ai)) call abort() + if (o4%it%ai /= 4) call abort() + if (allocated(o4%it%v)) call abort() + if (allocated(o4%vec)) call abort() + + allocate (o3%it%v(3), source= 5) + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (.not. allocated(o4%a_i)) call abort() + if (o4%a_i /= 2) call abort() + if (.not. allocated(o4%it)) call abort() + if (o4%it%ii /= 3) call abort() + if (.not. allocated(o4%it%ai)) call abort() + if (o4%it%ai /= 4) call abort() + if (.not. allocated(o4%it%v)) call abort() + if (any (o4%it%v /= 5) .or. size (o4%it%v) /= 3) call abort() + if (allocated(o4%vec)) call abort() + + allocate (o3%vec(2)) + o3%vec(:)%ii = 6 + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (.not. allocated(o4%a_i)) call abort() + if (o4%a_i /= 2) call abort() + if (.not. allocated(o4%it)) call abort() + if (o4%it%ii /= 3) call abort() + if (.not. allocated(o4%it%ai)) call abort() + if (o4%it%ai /= 4) call abort() + if (.not. allocated(o4%it%v)) call abort() + if (size (o4%it%v) /= 3) call abort() + if (any (o4%it%v /= 5)) call abort() + if (.not. allocated(o4%vec)) call abort() + if (size(o4%vec) /= 2) call abort() + if (any(o4%vec(:)%ii /= 6)) call abort() + if (allocated(o4%vec(1)%ai) .or. allocated(o4%vec(2)%ai)) call abort() + if (allocated(o4%vec(1)%v) .or. allocated(o4%vec(2)%v)) call abort() + + allocate (o3%vec(2)%ai) + o3%vec(2)%ai = 7 + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (.not. allocated(o4%a_i)) call abort() + if (o4%a_i /= 2) call abort() + if (.not. allocated(o4%it)) call abort() + if (o4%it%ii /= 3) call abort() + if (.not. allocated(o4%it%ai)) call abort() + if (o4%it%ai /= 4) call abort() + if (.not. allocated(o4%it%v)) call abort() + if (size (o4%it%v) /= 3) call abort() + if (any (o4%it%v /= 5)) call abort() + if (.not. allocated(o4%vec)) call abort() + if (size(o4%vec) /= 2) call abort() + if (any(o4%vec(:)%ii /= 6)) call abort() + if (allocated(o4%vec(1)%ai)) call abort() + if (.not. allocated(o4%vec(2)%ai)) call abort() + if (o4%vec(2)%ai /= 7) call abort() + if (allocated(o4%vec(1)%v) .or. allocated(o4%vec(2)%v)) call abort() + + allocate (o3%vec(1)%v(3)) + o3%vec(1)%v = [8, 9, 10] + call copyO(o3, o4) + if (o4%i /= 42) call abort () + if (.not. allocated(o4%a_i)) call abort() + if (o4%a_i /= 2) call abort() + if (.not. allocated(o4%it)) call abort() + if (o4%it%ii /= 3) call abort() + if (.not. allocated(o4%it%ai)) call abort() + if (o4%it%ai /= 4) call abort() + if (.not. allocated(o4%it%v)) call abort() + if (size (o4%it%v) /= 3) call abort() + if (any (o4%it%v /= 5)) call abort() + if (.not. allocated(o4%vec)) call abort() + if (size(o4%vec) /= 2) call abort() + if (any(o4%vec(:)%ii /= 6)) call abort() + if (allocated(o4%vec(1)%ai)) call abort() + if (.not. allocated(o4%vec(2)%ai)) call abort() + if (o4%vec(2)%ai /= 7) call abort() + if (.not. allocated(o4%vec(1)%v)) call abort() + if (any (o4%vec(1)%v /= [8,9,10])) call abort() + if (allocated(o4%vec(2)%v)) call abort() + +contains + + subroutine copyO(src, dst) + type(T), intent(in) :: src + type(T), intent(out) :: dst + + dst = src + end subroutine copyO + +end program alloc_comp_copy_test + diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_2.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_2.f03 new file mode 100644 index 0000000000..582a2b8e3e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_2.f03 @@ -0,0 +1,21 @@ +! { dg-do run } +! +! Testcase for PR fortran/65841 +! Contributed by Damian Rousson +! +program alloc_comp_deep_copy_2 + type a + real, allocatable :: f + end type + type b + type(a), allocatable :: g + end type + + type(b) c,d + + c%g=a(1.) + d=c + if (d%g%f /= 1.0) call abort() + d%g%f = 2.0 + if (d%g%f /= 2.0) call abort() +end program diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_3.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_3.f03 new file mode 100644 index 0000000000..7032eaf8f3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_3.f03 @@ -0,0 +1,30 @@ +! { dg-do run } +! +! PR fortran/67721 +! Check that scalar to array assignments of derived type constructor +! deep copy the value when there are allocatable components. + +program p + implicit none + + type :: t1 + integer :: c1 + end type t1 + type :: t2 + type(t1), allocatable :: c2 + end type t2 + + block + type(t2) :: v(4) + + v = t2(t1(3)) + v(2)%c2%c1 = 7 + v(3)%c2%c1 = 11 + v(4)%c2%c1 = 13 + + if (v(1)%c2%c1 /= 3) call abort + if (v(2)%c2%c1 /= 7) call abort + if (v(3)%c2%c1 /= 11) call abort + if (v(4)%c2%c1 /= 13) call abort + end block +end program p diff --git a/gcc/testsuite/gfortran.dg/allocatable_scalar_13.f90 b/gcc/testsuite/gfortran.dg/allocatable_scalar_13.f90 new file mode 100644 index 0000000000..532f364f39 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocatable_scalar_13.f90 @@ -0,0 +1,72 @@ +! { dg-do run } +! { dg-options "-fdump-tree-original" } +! +! Test the fix for PR66079. The original problem was with the first +! allocate statement. The rest of the testcase fixes problems found +! whilst working on it but these have been commented out in 5 branch +! since the pre-requisite patches in 6 branch have not been back +! ported. +! +! Reported by Damian Rouson <damian@sourceryinstitute.org> +! + type subdata + integer, allocatable :: b + endtype +! block + call newRealVec +! end block +contains + subroutine newRealVec + type(subdata), allocatable :: d, e, f + character(:), allocatable :: g, h, i + character(8), allocatable :: j + allocate(d,source=subdata(1)) ! memory was lost, now OK + allocate(e,source=d) ! OK + allocate(f,source=create (99)) ! memory was lost, now OK + if (d%b .ne. 1) call abort + if (e%b .ne. 1) call abort + if (f%b .ne. 99) call abort + allocate (g, source = greeting1("good day")) + if (g .ne. "good day") call abort + allocate (h, source = greeting2("hello")) + if (h .ne. "hello") call abort +! allocate (i, source = greeting3("hiya!")) +! if (i .ne. "hiya!") call abort +! call greeting4 (j, "Goodbye ") ! Test that dummy arguments are OK +! if (j .ne. "Goodbye ") call abort + end subroutine + + function create (arg) result(res) + integer :: arg + type(subdata), allocatable :: res, res1 + allocate(res, res1, source = subdata(arg)) + end function + + function greeting1 (arg) result(res) ! memory was lost, now OK + character(*) :: arg + Character(:), allocatable :: res + allocate(res, source = arg) + end function + + function greeting2 (arg) result(res) + character(5) :: arg + Character(:), allocatable :: res + allocate(res, source = arg) + end function + +! function greeting3 (arg) result(res) +! character(5) :: arg +! Character(5), allocatable :: res, res1 +! allocate(res, res1, source = arg) ! Caused an ICE +! if (res1 .ne. res) call abort +! end function + +! subroutine greeting4 (res, arg) +! character(8), intent(in) :: arg +! Character(8), allocatable, intent(out) :: res +! allocate(res, source = arg) ! Caused an ICE +! end subroutine +end +! { dg-final { scan-tree-dump-times "builtin_malloc" 15 "original" } } +! { dg-final { scan-tree-dump-times "builtin_free" 17 "original" } } +! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/allocate_with_arrayspec_1.f90 b/gcc/testsuite/gfortran.dg/allocate_with_arrayspec_1.f90 new file mode 100644 index 0000000000..686b612408 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_arrayspec_1.f90 @@ -0,0 +1,29 @@ +! { dg-do run } +! { dg-options "-fdump-tree-original" } + +MODULE mo_test + + integer :: n = 0 +CONTAINS + + FUNCTION nquery() + INTEGER :: nquery + WRITE (0,*) "hello!" + n = n + 1 + nquery = n + END FUNCTION nquery + +END MODULE mo_test + + +! ---------------------------------------------------------------------- +! MAIN PROGRAM +! ---------------------------------------------------------------------- +PROGRAM example + USE mo_test + INTEGER, ALLOCATABLE :: query_buf(:) + ALLOCATE(query_buf(nquery())) + if (n /= 1 .or. size(query_buf) /= n) call abort() +END PROGRAM example + +! { dg-final { scan-tree-dump-times "nquery" 5 "original" } } diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_12.f03 b/gcc/testsuite/gfortran.dg/allocate_with_source_12.f03 new file mode 100644 index 0000000000..76deb6174d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_source_12.f03 @@ -0,0 +1,38 @@ +! { dg-do run } +! +! Checks the fix for PR67171, where the second ALLOCATE with and array section +! SOURCE produced a zero index based temporary, which threw the assignment. +! +! Contributed by Anton Shterenlikht <mexas@bristol.ac.uk> +! +program z + implicit none + integer, parameter :: DIM1_SIZE = 10 + real, allocatable :: d(:,:), tmp(:,:) + integer :: i, errstat + + allocate (d(DIM1_SIZE, 2), source = 0.0, stat=errstat ) + + d(:,1) = [( real (i), i=1,DIM1_SIZE)] + d(:,2) = [( real(2*i), i=1,DIM1_SIZE)] +! write (*,*) d(1, :) + + call move_alloc (from = d, to = tmp) +! write (*,*) tmp( 1, :) + + allocate (d(DIM1_SIZE / 2, 2), source = tmp(1 : DIM1_SIZE / 2, :) , stat=errstat) + if (any (d .ne. tmp(1:DIM1_SIZE/2,:))) call abort + deallocate (d) + + allocate (d(DIM1_SIZE / 2, 2), source = foo (tmp(1 : DIM1_SIZE / 2, :)) , stat=errstat) + if (any (d .ne. tmp(1 : DIM1_SIZE / 2, :))) call abort + + deallocate (tmp , d) + +contains + function foo (arg) result (res) + real :: arg(:,:) + real :: res(size (arg, 1), size (arg, 2)) + res = arg + end function +end program z diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_13.f03 b/gcc/testsuite/gfortran.dg/allocate_with_source_13.f03 new file mode 100644 index 0000000000..27b5c1775b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_source_13.f03 @@ -0,0 +1,220 @@ +! { dg-do compile } +! +! Tests the fix for PR61819. +! +! Contributed by Salvatore Filippone <sfilippone@uniroma2.it> +! +module foo_base_mod + integer, parameter :: foo_ipk_ = kind(1) + integer, parameter :: foo_dpk_ = kind(1.d0) + type foo_d_base_vect_type + real(foo_dpk_), allocatable :: v(:) + contains + procedure :: free => d_base_free + procedure :: get_vect => d_base_get_vect + procedure :: allocate => d_base_allocate + end type foo_d_base_vect_type + + + type foo_d_vect_type + class(foo_d_base_vect_type), allocatable :: v + contains + procedure :: free => d_vect_free + procedure :: get_vect => d_vect_get_vect + end type foo_d_vect_type + + type foo_desc_type + integer(foo_ipk_) :: nl=-1 + end type foo_desc_type + + +contains + + subroutine foo_init(ictxt) + integer :: ictxt + end subroutine foo_init + + + subroutine foo_exit(ictxt) + integer :: ictxt + end subroutine foo_exit + + subroutine foo_info(ictxt,iam,np) + integer(foo_ipk_) :: ictxt,iam,np + iam = 0 + np = 1 + end subroutine foo_info + + subroutine foo_cdall(ictxt,map,info,nl) + integer(foo_ipk_) :: ictxt, info + type(foo_desc_type) :: map + integer(foo_ipk_), optional :: nl + + if (present(nl)) then + map%nl = nl + else + map%nl = 1 + end if + end subroutine foo_cdall + + subroutine foo_cdasb(map,info) + integer(foo_ipk_) :: info + type(foo_desc_type) :: map + if (map%nl < 0) map%nl=1 + end subroutine foo_cdasb + + + subroutine d_base_allocate(this,n) + class(foo_d_base_vect_type), intent(out) :: this + + allocate(this%v(max(1,n))) + + end subroutine d_base_allocate + + subroutine d_base_free(this) + class(foo_d_base_vect_type), intent(inout) :: this + if (allocated(this%v)) & + & deallocate(this%v) + end subroutine d_base_free + + function d_base_get_vect(this) result(res) + class(foo_d_base_vect_type), intent(inout) :: this + real(foo_dpk_), allocatable :: res(:) + + if (allocated(this%v)) then + res = this%v + else + allocate(res(1)) + end if + end function d_base_get_vect + + subroutine d_vect_free(this) + class(foo_d_vect_type) :: this + if (allocated(this%v)) then + call this%v%free() + deallocate(this%v) + end if + end subroutine d_vect_free + + function d_vect_get_vect(this) result(res) + class(foo_d_vect_type) :: this + real(foo_dpk_), allocatable :: res(:) + + if (allocated(this%v)) then + res = this%v%get_vect() + else + allocate(res(1)) + end if + end function d_vect_get_vect + + subroutine foo_geall(v,map,info) + type(foo_d_vect_type), intent(out) :: v + type(foo_Desc_type) :: map + integer(foo_ipk_) :: info + + allocate(foo_d_base_vect_type :: v%v,stat=info) + if (info == 0) call v%v%allocate(map%nl) + end subroutine foo_geall + +end module foo_base_mod + + +module foo_scalar_field_mod + use foo_base_mod + implicit none + + type scalar_field + type(foo_d_vect_type) :: f + type(foo_desc_type), pointer :: map => null() + contains + procedure :: free + end type + + integer(foo_ipk_), parameter :: nx=4,ny=nx, nz=nx + type(foo_desc_type), allocatable, save, target :: map + integer(foo_ipk_) ,save :: NumMy_xy_planes + integer(foo_ipk_) ,parameter :: NumGlobalElements = nx*ny*nz + integer(foo_ipk_) ,parameter :: NumGlobal_xy_planes = nz, Num_xy_points_per_plane = nx*ny + +contains + subroutine initialize_map(ictxt,NumMyElements,info) + integer(foo_ipk_) :: ictxt, NumMyElements, info + info = 0 + if (allocated(map)) deallocate(map,stat=info) + if (info == 0) allocate(map,stat=info) + if (info == 0) call foo_cdall(ictxt,map,info,nl=NumMyElements) + if (info == 0) call foo_cdasb(map,info) + end subroutine initialize_map + + function new_scalar_field(comm) result(this) + type(scalar_field) :: this + integer(foo_ipk_) ,intent(in) :: comm + real(foo_dpk_) ,allocatable :: f_v(:) + integer(foo_ipk_) :: i,j,k,NumMyElements, iam, np, info,ip + integer(foo_ipk_), allocatable :: idxs(:) + call foo_info(comm,iam,np) + NumMy_xy_planes = NumGlobal_xy_planes/np + NumMyElements = NumMy_xy_planes*Num_xy_points_per_plane + if (.not. allocated(map)) call initialize_map(comm,NumMyElements,info) + this%map => map + call foo_geall(this%f,this%map,info) + end function + + subroutine free(this) + class(scalar_field), intent(inout) :: this + integer(foo_ipk_) ::info + write(0,*) 'Freeing scalar_this%f' + call this%f%free() + end subroutine free + +end module foo_scalar_field_mod + +module foo_vector_field_mod + use foo_base_mod + use foo_scalar_field_mod, only : scalar_field,new_scalar_field + implicit none + type vector_field + type(scalar_field) :: u(1) + contains + procedure :: free + end type +contains + function new_vector_field(comm_in) result(this) + type(vector_field) :: this + integer(foo_ipk_), intent(in) :: comm_in + this%u = [new_scalar_field(comm_in)] ! Removing this line eliminates the memory leak + end function + + subroutine free(this) + class(vector_field), intent(inout) :: this + integer :: i + associate(vf=>this%u) + do i=1, size(vf) + write(0,*) 'Freeing vector_this%u(',i,')' + call vf(i)%free() + end do + end associate + end subroutine free + +end module foo_vector_field_mod + +program main + use foo_base_mod + use foo_vector_field_mod,only: vector_field,new_vector_field + use foo_scalar_field_mod,only: map + implicit none + type(vector_field) :: u + type(foo_d_vect_type) :: v + real(foo_dpk_), allocatable :: av(:) + integer(foo_ipk_) :: ictxt, iam, np, i,info + call foo_init(ictxt) + call foo_info(ictxt,iam,np) + u = new_vector_field(ictxt) + call u%free() + do i=1,10 + u = new_vector_field(ictxt) + call u%free() + end do + call u%free() + call foo_exit(ictxt) +end program diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 b/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 new file mode 100644 index 0000000000..5ca47a62e8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 @@ -0,0 +1,214 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! Tests the fix for PR61830. +! +! Contributed by Salvatore Filippone <sfilippone@uniroma2.it> +! +module foo_base_mod + integer, parameter :: foo_dpk_ = kind(1.d0) + type foo_d_base_vect_type + real(foo_dpk_), allocatable :: v(:) + contains + procedure :: free => d_base_free + procedure :: get_vect => d_base_get_vect + procedure :: allocate => d_base_allocate + end type foo_d_base_vect_type + + + type foo_d_vect_type + class(foo_d_base_vect_type), allocatable :: v + contains + procedure :: free => d_vect_free + procedure :: get_vect => d_vect_get_vect + end type foo_d_vect_type + + type foo_desc_type + integer :: nl=-1 + end type foo_desc_type + +contains + + subroutine foo_cdall(map,nl) + type(foo_desc_type) :: map + integer, optional :: nl + + if (present(nl)) then + map%nl = nl + else + map%nl = 1 + end if + end subroutine foo_cdall + + + subroutine foo_cdasb(map,info) + integer :: info + type(foo_desc_type) :: map + if (map%nl < 0) map%nl=1 + end subroutine foo_cdasb + + + + subroutine d_base_allocate(this,n) + class(foo_d_base_vect_type), intent(out) :: this + + allocate(this%v(max(1,n))) + + end subroutine d_base_allocate + + subroutine d_base_free(this) + class(foo_d_base_vect_type), intent(inout) :: this + if (allocated(this%v)) then + write(0,*) 'Scalar deallocation' + deallocate(this%v) + end if + end subroutine d_base_free + + function d_base_get_vect(this) result(res) + class(foo_d_base_vect_type), intent(inout) :: this + real(foo_dpk_), allocatable :: res(:) + + if (allocated(this%v)) then + res = this%v + else + allocate(res(1)) + end if + end function d_base_get_vect + + subroutine d_vect_free(this) + class(foo_d_vect_type) :: this + if (allocated(this%v)) then + call this%v%free() + write(0,*) 'Deallocate class() component' + deallocate(this%v) + end if + end subroutine d_vect_free + + function d_vect_get_vect(this) result(res) + class(foo_d_vect_type) :: this + real(foo_dpk_), allocatable :: res(:) + + if (allocated(this%v)) then + res = this%v%get_vect() + else + allocate(res(1)) + end if + end function d_vect_get_vect + + subroutine foo_geall(v,map,info) + type(foo_d_vect_type), intent(out) :: v + type(foo_Desc_type) :: map + integer :: info + + allocate(foo_d_base_vect_type :: v%v,stat=info) + if (info == 0) call v%v%allocate(map%nl) + end subroutine foo_geall + +end module foo_base_mod + + +module foo_scalar_field_mod + use foo_base_mod + implicit none + + type scalar_field + type(foo_d_vect_type) :: f + type(foo_desc_type), pointer :: map => null() + contains + procedure :: free + end type + + integer, parameter :: nx=4,ny=nx, nz=nx + type(foo_desc_type), allocatable, save, target :: map + integer ,save :: NumMy_xy_planes + integer ,parameter :: NumGlobalElements = nx*ny*nz + integer ,parameter :: NumGlobal_xy_planes = nz, & + & Num_xy_points_per_plane = nx*ny + +contains + subroutine initialize_map(NumMyElements) + integer :: NumMyElements, info + info = 0 + if (allocated(map)) deallocate(map,stat=info) + if (info == 0) allocate(map,stat=info) + if (info == 0) call foo_cdall(map,nl=NumMyElements) + if (info == 0) call foo_cdasb(map,info) + end subroutine initialize_map + + function new_scalar_field() result(this) + type(scalar_field) :: this + real(foo_dpk_) ,allocatable :: f_v(:) + integer :: i,j,k,NumMyElements, iam, np, info,ip + integer, allocatable :: idxs(:) + + NumMy_xy_planes = NumGlobal_xy_planes + NumMyElements = NumMy_xy_planes*Num_xy_points_per_plane + if (.not. allocated(map)) call initialize_map(NumMyElements) + this%map => map + call foo_geall(this%f,this%map,info) + end function + + subroutine free(this) + class(scalar_field), intent(inout) :: this + integer ::info + call this%f%free() + end subroutine free + +end module foo_scalar_field_mod + +module foo_vector_field_mod + use foo_base_mod + use foo_scalar_field_mod + implicit none + type vector_field + type(scalar_field) :: u(1) + end type vector_field +contains + function new_vector_field() result(this) + type(vector_field) :: this + integer :: i + do i=1, size(this%u) + associate(sf=>this%u(i)) + sf = new_scalar_field() + end associate + end do + end function + + subroutine free_v_field(this) + class(vector_field), intent(inout) :: this + integer :: i + associate(vf=>this%u) + do i=1, size(vf) + call vf(i)%free() + end do + end associate + end subroutine free_v_field + +end module foo_vector_field_mod + +program main + use foo_base_mod + use foo_vector_field_mod + use foo_scalar_field_mod + implicit none + type(vector_field) :: u + type(foo_d_vect_type) :: v + real(foo_dpk_), allocatable :: av(:) + integer :: iam, np, i,info + + u = new_vector_field() + call foo_geall(v,map,info) + call free_v_field(u) + do i=1,10 + u = new_vector_field() + call free_v_field(u) + av = v%get_vect() + end do +! This gets rid of the "memory leak" + if (associated (u%u(1)%map)) deallocate (u%u(1)%map) + call free_v_field(u) + call v%free() + deallocate(av) +end program +! { dg-final { scan-tree-dump-times "__builtin_malloc" 21 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_free" 29 "original" } } diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_15.f03 b/gcc/testsuite/gfortran.dg/allocate_with_source_15.f03 new file mode 100644 index 0000000000..f939aa3d9d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_source_15.f03 @@ -0,0 +1,79 @@ +! { dg-do run } +! +! Tests the fix for PR67933, which was a side effect of the fix for PR67171. +! +! Contributed by Andrew <mandrew9@vt.edu> +! +module test_mod + implicit none + + type :: class_t + integer :: i + end type class_t + + type, extends(class_t) :: class_e + real :: r + end type class_e + + type :: wrapper_t + class(class_t), allocatable :: class_var +! type(class_t), allocatable :: class_var +! integer, allocatable :: class_id + end type wrapper_t + + type :: list_t + type(wrapper_t) :: classes(20) + contains + procedure :: Method + procedure :: Typeme + procedure :: Dealloc + end type list_t + +contains + subroutine Method(this) + class(list_t) :: this + integer :: i + do i = 1, 20 + if (i .gt. 10) then + allocate (this%classes(i)%class_var, source = class_t (i)) + else + allocate (this%classes(i)%class_var, source = class_e (i, real (2 * i))) + end if + end do + end subroutine Method + subroutine Dealloc(this) + class(list_t) :: this + integer :: i + do i = 1, 20 + if (allocated (this%classes(i)%class_var)) & + deallocate (this%classes(i)%class_var) + end do + end subroutine Dealloc + subroutine Typeme(this) + class(list_t) :: this + integer :: i, j(20) + real :: r(20) + real :: zero = 0.0 + do i = 1, 20 + j(i) = this%classes(i)%class_var%i + select type (p => this%classes(i)%class_var) + type is (class_e) + r(i) = p%r + class default + r(i) = zero + end select + end do +! print "(10i6,/)", j + if (any (j .ne. [(i, i = 1,20)])) call abort +! print "(10f6.2,/)", r + if (any (r(1:10) .ne. [(real (2 * i), i = 1,10)])) call abort + if (any (r(11:20) .ne. zero)) call abort + end subroutine Typeme +end module test_mod + + use test_mod + type(list_t) :: x + call x%Method + call x%Typeme + call x%dealloc +end diff --git a/gcc/testsuite/gfortran.dg/array_constructor_26.f03 b/gcc/testsuite/gfortran.dg/array_constructor_26.f03 index ac5dc90cc8..9993099af9 100644 --- a/gcc/testsuite/gfortran.dg/array_constructor_26.f03 +++ b/gcc/testsuite/gfortran.dg/array_constructor_26.f03 @@ -11,7 +11,6 @@ MODULE WinData integer :: i TYPE TWindowData CHARACTER (MAX_FLD_HED, 1) :: DWFdHd(MAXFLD) = [(" ", i = 1, MAXFLD)] - ! { dg-error "no IMPLICIT type" "" { target *-*-* } 13 } ! { dg-error "specification expression" "" { target *-*-* } 13 } END TYPE TWindowData END MODULE WinData diff --git a/gcc/testsuite/gfortran.dg/array_constructor_27.f03 b/gcc/testsuite/gfortran.dg/array_constructor_27.f03 index 8068364ce4..21adac82ad 100644 --- a/gcc/testsuite/gfortran.dg/array_constructor_27.f03 +++ b/gcc/testsuite/gfortran.dg/array_constructor_27.f03 @@ -9,7 +9,6 @@ implicit none type t character (a) :: arr (1) = [ "a" ] - ! { dg-error "no IMPLICIT type" "" { target *-*-* } 11 } ! { dg-error "specification expression" "" { target *-*-* } 11 } end type t diff --git a/gcc/testsuite/gfortran.dg/char_length_2.f90 b/gcc/testsuite/gfortran.dg/char_length_2.f90 index 5673a2ed58..f35c9b5621 100644 --- a/gcc/testsuite/gfortran.dg/char_length_2.f90 +++ b/gcc/testsuite/gfortran.dg/char_length_2.f90 @@ -1,14 +1,13 @@ -! { dg-do link } -! { dg-options "-Wsurprising" } -! Tests the fix for PR 31250 -! CHARACTER lengths weren't reduced early enough for all checks of -! them to be meaningful. Furthermore negative string lengths weren't -! dealt with correctly. +! { dg-do compile } +! Tests the fix for PR 31250. +! The fix for PR fortran/67987 supercedes PR 31250, which removes +! the -Wsurprising option. +! CHARACTER(len=0) :: c1 ! This is OK. -CHARACTER(len=-1) :: c2 ! { dg-warning "has negative length" } +CHARACTER(len=-1) :: c2 PARAMETER(I=-100) -CHARACTER(len=I) :: c3 ! { dg-warning "has negative length" } -CHARACTER(len=min(I,500)) :: c4 ! { dg-warning "has negative length" } +CHARACTER(len=I) :: c3 +CHARACTER(len=min(I,500)) :: c4 CHARACTER(len=max(I,500)) :: d1 ! no warning CHARACTER(len=5) :: d2 ! no warning diff --git a/gcc/testsuite/gfortran.dg/char_type_len_2.f90 b/gcc/testsuite/gfortran.dg/char_type_len_2.f90 index e4fab80205..bfa7945dbc 100644 --- a/gcc/testsuite/gfortran.dg/char_type_len_2.f90 +++ b/gcc/testsuite/gfortran.dg/char_type_len_2.f90 @@ -1,8 +1,11 @@ ! { dg-do compile } ! PR31251 Non-integer character length leads to segfault ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org> - character(len=2.3) :: s ! { dg-error "must be of INTEGER type" } - character(kind=1,len=4.3) :: t ! { dg-error "must be of INTEGER type" } +! +! Updated to deal with the fix for PR fortran/67805. +! + character(len=2.3) :: s ! { dg-error "INTEGER expression expected" } + character(kind=1,len=4.3) :: t ! { dg-error "INTEGER expression expected" } character(len=,,7.2,kind=1) :: u ! { dg-error "Syntax error in CHARACTER declaration" } character(len=7,kind=2) :: v ! ! { dg-error "Kind 2 is not supported for CHARACTER" } character(kind=2) :: w ! ! { dg-error "Kind 2 is not supported for CHARACTER" } diff --git a/gcc/testsuite/gfortran.dg/class_allocate_20.f90 b/gcc/testsuite/gfortran.dg/class_allocate_20.f90 new file mode 100644 index 0000000000..defe9df9d0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_allocate_20.f90 @@ -0,0 +1,32 @@ +! { dg-do run } +! +! PR fortran/64921 +! Test that the finalization wrapper procedure get the always_explicit +! attribute so that the array is not passed without descriptor from +! T3's finalization wrapper procedure to T2's one. +! +! Contributed by Mat Cross <mathewc@nag.co.uk> + +Program test + Implicit None + Type :: t1 + Integer, Allocatable :: i + End Type + Type :: t2 + Integer, Allocatable :: i + End Type + Type, Extends (t1) :: t3 + Type (t2) :: j + End Type + Type, Extends (t3) :: t4 + Integer, Allocatable :: k + End Type + Call s + Print *, 'ok' +Contains + Subroutine s + Class (t1), Allocatable :: x + Allocate (t4 :: x) + End Subroutine +End Program +! { dg-output "ok" } diff --git a/gcc/testsuite/gfortran.dg/co_reduce_1.f90 b/gcc/testsuite/gfortran.dg/co_reduce_1.f90 new file mode 100644 index 0000000000..1d3e89f65c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/co_reduce_1.f90 @@ -0,0 +1,33 @@ +! { dg-do compile } +! { dg-additional-options "-fdump-tree-original -fcoarray=lib" } +! +! Check that we don't take twice the address of procedure simple_reduction +! in the generated code. +! +! Contributed by Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> + +program simple_reduce + implicit none + + integer :: me + + me = this_image() + + sync all + + call co_reduce(me,simple_reduction) + + write(*,*) this_image(),me + +contains + + pure function simple_reduction(a,b) + integer,intent(in) :: a,b + integer :: simple_reduction + + simple_reduction = a * b + end function simple_reduction + +end program simple_reduce + +! { dg-final { scan-tree-dump "_gfortran_caf_co_reduce \\(&desc\\.\\d+,\\s*simple_reduction," "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 b/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 index d7fb00b336..064e67cf59 100644 --- a/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 @@ -33,7 +33,7 @@ contains end function hc end program test -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, &gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } } ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/deferred_character_assignment_1.f90 b/gcc/testsuite/gfortran.dg/deferred_character_assignment_1.f90 new file mode 100644 index 0000000000..f3a739f503 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/deferred_character_assignment_1.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! +! Checks the fix for PR67977 in which automatic reallocation on assignment +! was performed when the lhs had a substring reference. +! +! Contributed by Anton Shterenlikht <mexas@bristol.ac.uk> +! + character(:), allocatable :: z + integer :: length + z = "cockatoo" + length = len (z) + z(:) = '' + if (len(z) .ne. length) call abort + if (trim (z) .ne. '') call abort + z(:3) = "foo" + if (len(z) .ne. length) call abort + if (trim (z) .ne. "foo") call abort + z(4:) = "__bar" + if (len(z) .ne. length) call abort + if (trim (z) .ne. "foo__bar") call abort + deallocate (z) +end diff --git a/gcc/testsuite/gfortran.dg/generic_30.f90 b/gcc/testsuite/gfortran.dg/generic_30.f90 new file mode 100644 index 0000000000..5f82373cfb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/generic_30.f90 @@ -0,0 +1,41 @@ +! { dg-do compile } +! +! PR fortran/66929 +! Generic procedures as actual argument used to lead to +! a NULL pointer dereference in gfc_get_proc_ifc_for_expr +! because the generic symbol was used as procedure symbol, +! instead of the specific one. + +module iso_varying_string + type, public :: varying_string + character(LEN=1), dimension(:), allocatable :: chars + end type varying_string + interface operator(/=) + module procedure op_ne_VS_CH + end interface operator (/=) + interface trim + module procedure trim_ + end interface +contains + elemental function op_ne_VS_CH (string_a, string_b) result (op_ne) + type(varying_string), intent(in) :: string_a + character(LEN=*), intent(in) :: string_b + logical :: op_ne + op_ne = .true. + end function op_ne_VS_CH + elemental function trim_ (string) result (trim_string) + type(varying_string), intent(in) :: string + type(varying_string) :: trim_string + trim_string = varying_string(["t", "r", "i", "m", "m", "e", "d"]) + end function trim_ +end module iso_varying_string +module syntax_rules + use iso_varying_string, string_t => varying_string +contains + subroutine set_rule_type_and_key + type(string_t) :: key + if (trim (key) /= "") then + print *, "non-empty" + end if + end subroutine set_rule_type_and_key +end module syntax_rules diff --git a/gcc/testsuite/gfortran.dg/generic_31.f90 b/gcc/testsuite/gfortran.dg/generic_31.f90 new file mode 100644 index 0000000000..2c0d029900 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/generic_31.f90 @@ -0,0 +1,35 @@ +! { dg-do run } +! +! PR fortran/66929 +! Check that the specific FIRST symbol is used for the call to FOO, +! so that the J argument is not assumed to be present + +module m + interface foo + module procedure first + end interface foo +contains + elemental function bar(j) result(r) + integer, intent(in), optional :: j + integer :: r, s(2) + ! We used to have NULL dereference here, in case of a missing J argument + s = foo(j, [3, 7]) + r = sum(s) + end function bar + elemental function first(i, j) result(r) + integer, intent(in), optional :: i + integer, intent(in) :: j + integer :: r + if (present(i)) then + r = i + else + r = -5 + end if + end function first +end module m +program p + use m + integer :: i + i = bar() + if (i /= -10) call abort +end program p diff --git a/gcc/testsuite/gfortran.dg/iomsg_2.f90 b/gcc/testsuite/gfortran.dg/iomsg_2.f90 new file mode 100644 index 0000000000..29500ed01a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/iomsg_2.f90 @@ -0,0 +1,44 @@ +! { dg-do compile } +subroutine foo1 + implicit none + integer i + open(1, iomsg=666) ! { dg-error "IOMSG must be" } + open(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + open(1, iomsg=i) ! { dg-error "IOMSG must be" } + close(1, iomsg=666) ! { dg-error "IOMSG must be" } + close(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + close(1, iomsg=i) ! { dg-error "IOMSG must be" } +end subroutine foo1 + +subroutine foo + implicit none + integer i + real :: x = 1 + write(1, *, iomsg='sgk') x ! { dg-error "IOMSG must be" } + write(1, *, iomsg=i) x ! { dg-error "IOMSG must be" } + read(1, *, iomsg='sgk') x ! { dg-error "IOMSG must be" } + read(1, *, iomsg=i) x ! { dg-error "IOMSG must be" } + flush(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + flush(1, iomsg=i) ! { dg-error "IOMSG must be" } + rewind(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + rewind(1, iomsg=i) ! { dg-error "IOMSG must be" } + backspace(1,iomsg='sgk') ! { dg-error "IOMSG must be" } + backspace(1,iomsg=i) ! { dg-error "IOMSG must be" } + wait(1, iomsg='sgk') ! { dg-error "IOMSG must be" } + wait(1, iomsg=i) ! { dg-error "IOMSG must be" } +end subroutine foo + +subroutine bar + implicit none + integer i + real :: x = 1 + character(len=20) s(2) + open(1, iomsg=s) ! { dg-error "must be scalar" } + close(1, iomsg=s) ! { dg-error "must be scalar" } + write(1, *, iomsg=s) x ! { dg-error "must be scalar" } + read(1, *, iomsg=s) x ! { dg-error "must be scalar" } + flush(1, iomsg=s) ! { dg-error "must be scalar" } + rewind(1, iomsg=s) ! { dg-error "must be scalar" } + backspace(1,iomsg=s) ! { dg-error "must be scalar" } + wait(1, iomsg=s) ! { dg-error "must be scalar" } +end subroutine bar diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 b/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 index 0660b497a6..128376963b 100644 --- a/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 +++ b/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 @@ -1,6 +1,5 @@ ! { dg-do run } ! { dg-require-effective-target fortran_large_real } -! { dg-xfail-if "" { "*-*-freebsd*" } { "*" } { "" } } ! Testing erf and erfc library calls on large real kinds (larger than kind=8) implicit none diff --git a/gcc/testsuite/gfortran.dg/module_private_2.f90 b/gcc/testsuite/gfortran.dg/module_private_2.f90 new file mode 100644 index 0000000000..847c58d5e3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/module_private_2.f90 @@ -0,0 +1,34 @@ +! { dg-do compile } +! { dg-options "-O2 -fdump-tree-optimized" } +! +! PR fortran/47266 +! +! Check whether the private procedure "priv" is optimized away +! +module m + implicit none + private :: priv + private :: export1, export2 + public :: pub +contains + integer function priv() + priv = 44 + end function priv + integer function export1() + export1 = 45 + end function export1 + function export2() bind(C) ! { dg-warning "is marked PRIVATE" } + use iso_c_binding, only: c_int + integer(c_int) :: export2 + export2 = 46 + end function export2 + subroutine pub(a,b) + integer :: a + procedure(export1), pointer :: b + a = priv() + b => export1 + end subroutine pub +end module m +! { dg-final { scan-tree-dump-times "priv" 0 "optimized" } } +! { dg-final { scan-tree-dump-times "export1 \\(\\)" 1 "optimized" } } +! { dg-final { scan-tree-dump-times "export2 \\(\\)" 1 "optimized" } } diff --git a/gcc/testsuite/gfortran.dg/move_alloc_15.f90 b/gcc/testsuite/gfortran.dg/move_alloc_15.f90 new file mode 100644 index 0000000000..1c96ccba1c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/move_alloc_15.f90 @@ -0,0 +1,88 @@ +! { dg-do run } +! { dg-options "-fdump-tree-original" } +! +! Fix for PR...... +! +! The 'to' components of 'mytemp' would remain allocated after the call to +! MOVE_ALLOC, resulting in memory leaks. +! +! Contributed by Alberto Luaces. +! +! See https://groups.google.com/forum/#!topic/comp.lang.fortran/k3bkKUbOpFU +! +module alloctest + type myallocatable + integer, allocatable:: i(:) + end type myallocatable + +contains + subroutine f(num, array) + implicit none + integer, intent(in) :: num + integer :: i + type(myallocatable):: array(:) + + do i = 1, num + allocate(array(i)%i(5), source = [1,2,3,4,5]) + end do + + end subroutine f +end module alloctest + +program name + use alloctest + implicit none + type(myallocatable), allocatable:: myarray(:), mytemp(:) + integer, parameter:: OLDSIZE = 7, NEWSIZE = 20 + logical :: flag + + allocate(myarray(OLDSIZE)) + call f(size(myarray), myarray) + + allocate(mytemp(NEWSIZE)) + mytemp(1:OLDSIZE) = myarray + + flag = .false. + call foo + call bar + + deallocate(myarray) + if (allocated (mytemp)) deallocate (mytemp) + + allocate(myarray(OLDSIZE)) + call f(size(myarray), myarray) + + allocate(mytemp(NEWSIZE)) + mytemp(1:OLDSIZE) = myarray + +! Verfify that there is no segfault if the allocatable components +! are deallocated before the call to move_alloc + flag = .true. + call foo + call bar + + deallocate(myarray) +contains + subroutine foo + integer :: i + if (flag) then + do i = 1, OLDSIZE + deallocate (mytemp(i)%i) + end do + end if + call move_alloc(mytemp, myarray) + end subroutine + + subroutine bar + integer :: i + do i = 1, OLDSIZE + if (.not.flag .and. allocated (myarray(i)%i)) then + if (any (myarray(i)%i .ne. [1,2,3,4,5])) call abort + else + if (.not.flag) call abort + end if + end do + end subroutine +end program name +! { dg-final { scan-tree-dump-times "__builtin_malloc" 11 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_free" 11 "original" } } diff --git a/gcc/testsuite/gfortran.dg/move_alloc_16.f90 b/gcc/testsuite/gfortran.dg/move_alloc_16.f90 new file mode 100644 index 0000000000..fc09f7778c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/move_alloc_16.f90 @@ -0,0 +1,44 @@ +! { dg-do run } +! +! Tests the fix for PR67177 in which MOVE_ALLOC was not assigning the string +! length for deferred length characters. +! +! Contributed by <templed@tcd.ie> +! +program str + implicit none + + type string + character(:), Allocatable :: text + end type string + + type strings + type(string), allocatable, dimension(:) :: strlist + end type strings + + type(strings) :: teststrs + type(string) :: tmpstr + integer :: strlen = 20 + + allocate (teststrs%strlist(1)) + allocate (character(len=strlen) :: tmpstr%text) + + allocate (character(len=strlen) :: teststrs%strlist(1)%text) + +! Full string reference was required because reallocation on assignment is +! functioning when it should not if the lhs is a substring - PR67977 + tmpstr%text(1:3) = 'foo' + + if (.not.allocated (teststrs%strlist(1)%text)) call abort + if (len (tmpstr%text) .ne. strlen) call abort + + call move_alloc(tmpstr%text,teststrs%strlist(1)%text) + + if (.not.allocated (teststrs%strlist(1)%text)) call abort + if (len (teststrs%strlist(1)%text) .ne. strlen) call abort + if (trim (teststrs%strlist(1)%text(1:3)) .ne. 'foo') call abort + +! Clean up so that valgrind reports all allocated memory freed. + if (allocated (teststrs%strlist(1)%text)) deallocate (teststrs%strlist(1)%text) + if (allocated (teststrs%strlist)) deallocate (teststrs%strlist) +end program str diff --git a/gcc/testsuite/gfortran.dg/pr36192_1.f90 b/gcc/testsuite/gfortran.dg/pr36192_1.f90 new file mode 100644 index 0000000000..77df31765a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr36192_1.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! PR fortran/36192 +program three_body + real, parameter :: n = 2, d = 2 + real, dimension(n,d) :: x_hq ! { dg-error "of INTEGER type|of INTEGER type" } + call step(x_hq) + contains + subroutine step(x) + real, dimension(:,:), intent(in) :: x + end subroutine step +end program three_body +! { dg-prune-output "must have constant shape" } diff --git a/gcc/testsuite/gfortran.dg/pr51993.f90 b/gcc/testsuite/gfortran.dg/pr51993.f90 new file mode 100644 index 0000000000..753dd6fc80 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr51993.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/51993 +! Code contributed by Sebastien Bardeau <bardeau at iram dot fr> +module mymod + type :: mytyp + character(len=3) :: a = .true. ! { dg-error "convert LOGICAL" } + end type mytyp +end module mymod diff --git a/gcc/testsuite/gfortran.dg/pr56520.f90 b/gcc/testsuite/gfortran.dg/pr56520.f90 new file mode 100644 index 0000000000..b074b8024c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr56520.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! PR fortran/56520 +! +program misleading + implicit none + real a, c + a = 1.0 + c = exp(+a) ) ! { dg-error "Unclassifiable statement" } + c = exp(-a) ) ! { dg-error "Unclassifiable statement" } + c = exp((a)) ) ! { dg-error "Unclassifiable statement" } + c = exp(a) ) ! { dg-error "Unclassifiable statement" } + c = exp(a) +end program misleading diff --git a/gcc/testsuite/gfortran.dg/pr58027.f90 b/gcc/testsuite/gfortran.dg/pr58027.f90 new file mode 100644 index 0000000000..bef893c212 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr58027.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +! PR fortran/58027 +integer, parameter :: i(1)=(/z'ff800000'/) ! { dg-error "overflow converting" } +print *, isclass +end diff --git a/gcc/testsuite/gfortran.dg/pr58754.f90 b/gcc/testsuite/gfortran.dg/pr58754.f90 new file mode 100644 index 0000000000..a366985634 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr58754.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! Tests the fix for PR58754 +! + type :: char_type + character, allocatable :: chr (:) + end type + character, allocatable :: c(:) + type(char_type) :: d + character :: t(1) = ["w"] + + allocate (c (1), source = t) + if (any (c .ne. t)) call abort + c = ["a"] + if (any (c .ne. ["a"])) call abort + deallocate (c) + +! Check allocatable character components, whilst we are about it. + allocate (d%chr (2), source = [t, char (ichar (t) + 1)]) + if (any (d%chr .ne. ["w", "x"])) call abort + d%chr = ["a","b","c","d"] + if (any (d%chr .ne. ["a","b","c","d"])) call abort + deallocate (d%chr) +end diff --git a/gcc/testsuite/gfortran.dg/pr66311.f90 b/gcc/testsuite/gfortran.dg/pr66311.f90 new file mode 100644 index 0000000000..dc40cb6b72 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66311.f90 @@ -0,0 +1,60 @@ +! { dg-do run } +! { dg-additional-options "-fno-range-check -w" } +! +! Check that we can print large constants +! +! "-fno-range-check -w" is used so the testcase compiles even with targets +! that don't support large integer kinds. + +program test + use iso_fortran_env, only : ikinds => integer_kinds + implicit none + + ! Largest integer kind + integer, parameter :: k = ikinds(size(ikinds)) + integer, parameter :: hk = k / 2 + + if (k <= 8) stop + + call check(9000000000000000000_k, "9000000000000000000") + call check(90000000000000000000_k, "90000000000000000000") + call check(int(huge(1_hk), kind=k), "9223372036854775807") + call check(2_k**63, "9223372036854775808") + call check(10000000000000000000_k, "10000000000000000000") + call check(18446744065119617024_k, "18446744065119617024") + call check(2_k**64 - 1, "18446744073709551615") + call check(2_k**64, "18446744073709551616") + call check(20000000000000000000_k, "20000000000000000000") + call check(huge(0_k), "170141183460469231731687303715884105727") + call check(huge(0_k)-1, "170141183460469231731687303715884105726") + + call check(-9000000000000000000_k, "-9000000000000000000") + call check(-90000000000000000000_k, "-90000000000000000000") + call check(-int(huge(1_hk), kind=k), "-9223372036854775807") + call check(-2_k**63, "-9223372036854775808") + call check(-10000000000000000000_k, "-10000000000000000000") + call check(-18446744065119617024_k, "-18446744065119617024") + call check(-(2_k**64 - 1), "-18446744073709551615") + call check(-2_k**64, "-18446744073709551616") + call check(-20000000000000000000_k, "-20000000000000000000") + call check(-huge(0_k), "-170141183460469231731687303715884105727") + call check(-(huge(0_k)-1), "-170141183460469231731687303715884105726") + call check(-huge(0_k)-1, "-170141183460469231731687303715884105728") + + call check(2_k * huge(1_hk), "18446744073709551614") + call check((-2_k) * huge(1_hk), "-18446744073709551614") + +contains + + subroutine check (i, str) + implicit none + integer(kind=k), intent(in), value :: i + character(len=*), intent(in) :: str + + character(len=100) :: buffer + write(buffer,*) i + if (adjustl(buffer) /= adjustl(str)) call abort + end subroutine + +end + diff --git a/gcc/testsuite/gfortran.dg/pr66465.f90 b/gcc/testsuite/gfortran.dg/pr66465.f90 new file mode 100644 index 0000000000..ab86830505 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66465.f90 @@ -0,0 +1,23 @@ +! { dg-do compile } +! +! Tests the fix for PR66465, in which the arguments of the call to +! ASSOCIATED were falsly detected to have different type/kind. +! +! Contributed by Damian Rouson <damian@sourceryinstitute.org> +! + interface + real function HandlerInterface (arg) + real :: arg + end + end interface + + type TextHandlerTestCase + procedure (HandlerInterface), nopass, pointer :: handlerOut=>null() + end type + + type(TextHandlerTestCase) this + + procedure (HandlerInterface), pointer :: procPtr=>null() + + print*, associated(procPtr, this%handlerOut) +end diff --git a/gcc/testsuite/gfortran.dg/pr66545_1.f90 b/gcc/testsuite/gfortran.dg/pr66545_1.f90 new file mode 100644 index 0000000000..7daa800b60 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66545_1.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +! { dg-options "-Wall" } +! PR fortran/66545 +! +subroutine p + complex, parameter :: c1 = (c1) ! { dg-error "before its definition" } + complex, parameter :: c2 = c2 ! { dg-error "before its definition" } + complex :: c3 = (c3) ! { dg-error "has not been declared or is a variable" } + complex :: c4 = c4 ! { dg-error "has not been declared or is a variable" } +end subroutine p + +subroutine q + real, parameter :: r1 = (r1) ! { dg-error "before its definition" } + real, parameter :: r2 = r2 ! { dg-error "before its definition" } + real :: r3 = (r3) ! { dg-error "has not been declared or is a variable" } + real :: r4 = r4 ! { dg-error "has not been declared or is a variable" } +end subroutine q diff --git a/gcc/testsuite/gfortran.dg/pr66545_2.f90 b/gcc/testsuite/gfortran.dg/pr66545_2.f90 new file mode 100644 index 0000000000..e15d8ba792 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66545_2.f90 @@ -0,0 +1,23 @@ +! { dg-do compile } +! { dg-options "-Wuninitialized" } +! PR fortran/66545 +! +program foo + implicit none + call p1 + call q1 +end program foo + +subroutine p1 + complex :: c5 + complex :: c6 + c5 = (c5) ! { dg-warning "used uninitialized in this" } + c6 = c6 ! { dg-warning "used uninitialized in this" } +end subroutine p1 + +subroutine q1 + real :: r5 + real :: r6 + r5 = (r5) ! { dg-warning "used uninitialized in this" } + r6 = r6 ! { dg-warning "used uninitialized in this" } +end subroutine q1 diff --git a/gcc/testsuite/gfortran.dg/pr66725.f90 b/gcc/testsuite/gfortran.dg/pr66725.f90 new file mode 100644 index 0000000000..8ad97f7e18 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66725.f90 @@ -0,0 +1,31 @@ +! { dg-do compile } +! PR fortran/66725 +! +program foo + + open(unit=1,access = 999) ! { dg-error "ACCESS requires" } + open(unit=1,action = 999) ! { dg-error "ACTION requires" } + open(unit=1,asynchronous = 999) ! { dg-error "ASYNCHRONOUS requires" } + open(unit=1,blank = 999) ! { dg-error "BLANK requires" } + open(unit=1,decimal = 999) ! { dg-error "DECIMAL requires" } + open(unit=1,delim = 999) ! { dg-error "DELIM requires" } + open(unit=1,encoding = 999) ! { dg-error "ENCODING requires" } + open(unit=1,form = 999) ! { dg-error "FORM requires" } + open(unit=1,pad = 999) ! { dg-error "PAD requires" } + open(unit=1,position = 999) ! { dg-error "POSITION requires" } + open(unit=1,round = 999) ! { dg-error "ROUND requires" } + open(unit=1,sign = 999) ! { dg-error "SIGN requires" } + open(unit=1,status = 999) ! { dg-error "STATUS requires" } + + close(unit=1, status=999) ! { dg-error "STATUS requires" } + + write (unit=1, asynchronous=257) ! { dg-error "ASYNCHRONOUS requires" } + write (unit=1, delim=257) ! { dg-error "DELIM requires" } + write (unit=1, decimal=257) ! { dg-error "DECIMAL requires" } + write (unit=1, round=257) ! { dg-error "ROUND requires" } + write (unit=1, sign=257) ! { dg-error "SIGN requires" } + + write (unit=1, blank=257) ! { dg-error "BLANK requires" } + write (unit=1, pad=257) ! { dg-error "PAD requires" } + +end program foo diff --git a/gcc/testsuite/gfortran.dg/pr66864.f90 b/gcc/testsuite/gfortran.dg/pr66864.f90 new file mode 100644 index 0000000000..ebea99b389 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66864.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! PR fortran/66864 +! +program t + implicit none + real(8) x + x = 2.0d0**26.5d0 + if (floor(x) /= 94906265) call abort + if (floor(2.0d0**26.5d0)/= 94906265) call abort + x = 777666555.6d0 + if (floor(x) /= 777666555) call abort + if (floor(777666555.6d0) /= 777666555) call abort + x = 2000111222.6d0 + if (floor(x) /= 2000111222) call abort + if (floor(2000111222.6d0) /= 2000111222) call abort +end program t diff --git a/gcc/testsuite/gfortran.dg/pr66979.f90 b/gcc/testsuite/gfortran.dg/pr66979.f90 new file mode 100644 index 0000000000..c102e91e91 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr66979.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR fortran/66979 +program p + implicit none + integer::i + flush (iostat=i) ! { dg-error "UNIT number missing" } +end program p diff --git a/gcc/testsuite/gfortran.dg/pr67460.f90 b/gcc/testsuite/gfortran.dg/pr67460.f90 new file mode 100644 index 0000000000..ede55e1229 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67460.f90 @@ -0,0 +1,24 @@ +! Bogus "all warnings being treated as errors" +! { dg-do compile } +! { dg-options "-std=f2003 -Werror" } +MODULE btree_i8_k_sp2d_v + TYPE btree_node + INTEGER id + TYPE(btree_node_p), DIMENSION(:), POINTER :: subtrees + TYPE(btree_node), POINTER :: parent + END TYPE btree_node + TYPE btree_node_p + TYPE(btree_node), POINTER :: node + END TYPE btree_node_p +CONTAINS + RECURSIVE SUBROUTINE btree_verify_node (tree, node, level, nids, lastv,& + count, num_nodes, max_leaf_level, min_leaf_level, printing) + TYPE(btree_node), INTENT(IN) :: node + INTEGER :: branch + IF (ASSOCIATED (node%subtrees(branch)%node)) THEN + IF (node%subtrees(branch)%node%parent%id .NE. node%id) THEN + WRITE(*,*)'foo' + ENDIF + ENDIF + END SUBROUTINE btree_verify_node +END MODULE btree_i8_k_sp2d_v diff --git a/gcc/testsuite/gfortran.dg/pr67525.f90 b/gcc/testsuite/gfortran.dg/pr67525.f90 new file mode 100644 index 0000000000..35f716dc6b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67525.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! PR fortran/67525 +! Code contributed by Gerhard Steinmetz +! +real function f(x) + select type (x) ! { dg-error "shall be polymorphic" } + end select +end function f + +real function g(x) + select type (x=>null()) ! { dg-error "shall be polymorphic" } + end select +end function g + +subroutine a(x) + select type (x) ! { dg-error "shall be polymorphic" } + end select +end subroutine a diff --git a/gcc/testsuite/gfortran.dg/pr67526.f90 b/gcc/testsuite/gfortran.dg/pr67526.f90 new file mode 100644 index 0000000000..3c0834f28d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67526.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! Original code from gerhard dot steinmetz dot fortran at t-online dot de +! PR fortran/67526 +program p + character :: c1 = 'abc'(: ! { dg-error "error in SUBSTRING" } + character :: c2 = 'abc'(3: ! { dg-error "error in SUBSTRING" } + character :: c3 = 'abc'(:1 ! { dg-error "error in SUBSTRING" } + character :: c4 = 'abc'(2:2 ! { dg-error "error in SUBSTRING" } +end diff --git a/gcc/testsuite/gfortran.dg/pr67614.f90 b/gcc/testsuite/gfortran.dg/pr67614.f90 new file mode 100644 index 0000000000..ed07385970 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67614.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-std=legacy" } +! PR fortran/67614 +! +program foo + implicit none + integer, pointer :: z + if (null(z)) 10, 20, 30 ! { dg-error "Invalid NULL" } +10 continue +20 continue +30 continue +end program foo diff --git a/gcc/testsuite/gfortran.dg/pr67615.f90 b/gcc/testsuite/gfortran.dg/pr67615.f90 new file mode 100644 index 0000000000..fb95958007 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67615.f90 @@ -0,0 +1,33 @@ +! { dg-do compile } +! { dg-options "-std=legacy" } +! PR fortran/67615 +! +program foo + + implicit none + + integer i(2), j + real x + complex z + + j = 2 + if (j) 10, 20, 30 + + x = -1 + if (x) 10, 20, 30 + + z = (1,2) + if (z) 10, 20, 30 ! { dg-error "Arithmetic IF statement" } + + i = [1, 2] + if (i) 10, 20, 30 ! { dg-error "Arithmetic IF statement" } + + if ( [1] ) 10, 20, 30 ! { dg-error "Arithmetic IF statement" } + if ( [1, -1] ) 10, 20, 30 ! { dg-error "Arithmetic IF statement" } + if ( [real :: 1, -1] ) 10, 20, 30 ! { dg-error "Arithmetic IF statement" } + +10 stop +20 stop +30 stop + +end program foo diff --git a/gcc/testsuite/gfortran.dg/pr67616.f90 b/gcc/testsuite/gfortran.dg/pr67616.f90 new file mode 100644 index 0000000000..3c2107d175 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67616.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! PR fortran/67616 +! Original code contributed by Gerhard Steinmetz +program p + type t + end type + type(t) :: y + data y /t()/ + block + type(t) :: x + data x /t()/ ! Prior to patch, this would ICE. + end block +end diff --git a/gcc/testsuite/gfortran.dg/pr67802.f90 b/gcc/testsuite/gfortran.dg/pr67802.f90 new file mode 100644 index 0000000000..2ccd8c5111 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67802.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/67802 +! Original code contribute by gerhard.steinmetz.fortran at t-online.de +program p + character(1.) :: c1 = ' ' ! { dg-error "INTEGER expression expected" } + character(1d1) :: c2 = ' ' ! { dg-error "INTEGER expression expected" } + character((0.,1.)) :: c3 = ' ' ! { dg-error "INTEGER expression expected" } + character(.true.) :: c4 = ' ' ! { dg-error "INTEGER expression expected" } +end program p diff --git a/gcc/testsuite/gfortran.dg/pr67803.f90 b/gcc/testsuite/gfortran.dg/pr67803.f90 new file mode 100644 index 0000000000..b9a0a9e5c7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67803.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! PR fortran/67803 +! Original code submitted by Gerhard Steinmetz +! <gerhard dot steinmetz dot fortran at t-online dot de > +! +program p + character(2) :: x(1) + x = '0' // [character :: 1] ! { dg-error "Incompatiable typespec for" } + x = '0' // [character :: 1.] ! { dg-error "Incompatiable typespec for" } + x = '0' // [character :: 1d1] ! { dg-error "Incompatiable typespec for" } + x = '0' // [character :: (0.,1.)] ! { dg-error "Incompatiable typespec for" } + x = '0' // [character :: .true.] ! { dg-error "Incompatiable typespec for" } + x = '0' // [character :: null()] ! { dg-error "Incompatiable typespec for" } +end diff --git a/gcc/testsuite/gfortran.dg/pr67805.f90 b/gcc/testsuite/gfortran.dg/pr67805.f90 new file mode 100644 index 0000000000..7371991717 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67805.f90 @@ -0,0 +1,37 @@ +! { dg-do compile } +! PR fortran/67805 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +! +subroutine p + integer, parameter :: n = 1 + integer, parameter :: m(3) = [1, 2, 3] + character(len=1) s(2) + s = [character((m(1))) :: 'x', 'y'] ! OK. + s = [character(m(1)) :: 'x', 'y'] ! OK. + s = [character(m) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + + ! The next line should case an error, but causes an ICE. + s = [character(m(2:3)) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + + call foo(s) + s = [character('') :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character(['']) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character([.true.]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character([.false.]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character([1.]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character([1d1]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character([(0.,1.)]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character([null()]) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + s = [character(null()) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + call foo(s) +end subroutine p + +subroutine q + print *, '1: ', [character(.true.) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + print *, '2: ', [character(.false.) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + print *, '3: ', [character(1.) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + print *, '4: ', [character(1d1) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + print *, '5: ', [character((0.,1.)) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" } + print *, '6: ', [character(null()) :: 'x', 'y'] ! { dg-error "INTEGER expression expected" }. +end subroutine q diff --git a/gcc/testsuite/gfortran.dg/pr67805_2.f90 b/gcc/testsuite/gfortran.dg/pr67805_2.f90 new file mode 100644 index 0000000000..4438d3e691 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67805_2.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! PR fortran/68108 +! Code contributed by Juergen Reuter (juergen.reuter at desy dot de) +! Test fix for regression caused by PR fortran/67805. +module lexers + implicit none + type :: template_t + character(256) :: charset1 + integer :: len1 + end type template_t + +contains + + subroutine match_quoted (tt, s, n) + type(template_t), intent(in) :: tt + character(*), intent(in) :: s + integer, intent(out) :: n + character(tt%len1) :: ch1 + ch1 = tt%charset1 + end subroutine match_quoted + +end module lexers diff --git a/gcc/testsuite/gfortran.dg/pr67885.f90 b/gcc/testsuite/gfortran.dg/pr67885.f90 new file mode 100644 index 0000000000..9b9adce490 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67885.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! PR fortran/67885 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +program p + block + integer, parameter :: a(2) = [1, 2] + integer :: x(2) + x = a + if (x(1) /= 1) call abort + end block +end diff --git a/gcc/testsuite/gfortran.dg/pr67900.f90 b/gcc/testsuite/gfortran.dg/pr67900.f90 new file mode 100644 index 0000000000..c077fbcfd8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67900.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! PR fortran/67900 +! Original code contributed by Giorgian Borca-Tasciuc +! giorgianb at gmail dot com +! +program main + implicit none + interface f + function f_real(x) + real, bind(c) :: x + real :: f_real + end function f_real + + function f_integer(x) + integer, bind(c) :: x + integer :: f_integer + end function f_integer + end interface f +end program main diff --git a/gcc/testsuite/gfortran.dg/pr67939.f90 b/gcc/testsuite/gfortran.dg/pr67939.f90 new file mode 100644 index 0000000000..d1694bb043 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67939.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! PR fortran/67939 +! Original code by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +! +program p + character(100) :: x + data x(998:99) /'ab'/ ! { dg-warning "Unused initialization string" } + call a +end + +subroutine a + character(2) :: x + data x(:-1) /'ab'/ ! { dg-warning "Unused initialization string" } +end subroutine a + +subroutine b + character(8) :: x + data x(3:1) /'abc'/ ! { dg-warning "Unused initialization string" } +end subroutine b + diff --git a/gcc/testsuite/gfortran.dg/pr67987.f90 b/gcc/testsuite/gfortran.dg/pr67987.f90 new file mode 100644 index 0000000000..1d57f9bda0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67987.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! PR fortran/67987 +! PR fortran/67988 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +subroutine p + character(-8) :: c = ' ' +end subroutine p + +subroutine pp + character(3), parameter :: c = 'abc' + character(3) :: x(1) + x = c(:-2) + print *, len(trim(x(1))) + x = [ c(:-2) ] + print *, len(trim(x(1))) +end subroutine pp + diff --git a/gcc/testsuite/gfortran.dg/pr68019.f90 b/gcc/testsuite/gfortran.dg/pr68019.f90 new file mode 100644 index 0000000000..2e304c3a26 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68019.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! Original code from Gerhard Steinmetz +! Gerhard dot Steinmetz for fortran at t-online dot de +! PR fortran/68019 +! +program p + integer :: i + type t + integer :: n + end type + type(t), parameter :: vec(*) = [(t(i), i = 1, 4)] + type(t), parameter :: arr(*) = reshape(vec, [2, 2]) ! { dg-error "ranks 1 and 2 in assignment" } +end diff --git a/gcc/testsuite/gfortran.dg/pr68053.f90 b/gcc/testsuite/gfortran.dg/pr68053.f90 new file mode 100644 index 0000000000..e59693c5f6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68053.f90 @@ -0,0 +1,10 @@ +! { dg-do run } +! PR fortran/68053 +! Original code contributed by Gerhard Steinmetz +! <gerhard dot steinmetx dot fortran at t-online dot de> +program p + integer, parameter :: n(3) = [1,2,3] + integer, parameter :: x(1) = 7 + integer, parameter :: z(n(2):*) = x + if (lbound(z,1) /= 2) call abort +end diff --git a/gcc/testsuite/gfortran.dg/pr68054.f90 b/gcc/testsuite/gfortran.dg/pr68054.f90 new file mode 100644 index 0000000000..c4b6a341f5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68054.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/68054 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +! +!program p + real, protected :: x ! { dg-error "only allowed in specification" } +end diff --git a/gcc/testsuite/gfortran.dg/pr68055.f90 b/gcc/testsuite/gfortran.dg/pr68055.f90 new file mode 100644 index 0000000000..c84a6451d5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68055.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! PR fortran/68055 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +! + integer*3 c ! { dg-error "not supported at" } + real*9 x ! { dg-error "not supported at" } + logical*11 a ! { dg-error "not supported at" } + complex*42 z ! { dg-error "not supported at" } + c = 1 + x = 1 + call foo(a) +end diff --git a/gcc/testsuite/gfortran.dg/pr68151.f90 b/gcc/testsuite/gfortran.dg/pr68151.f90 new file mode 100644 index 0000000000..830d9f4f43 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68151.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! PR fortran/68151 +! Original code contribute by Gerhard Steinmetz +! <gerhard dot steinmetz dot fortran at t-online dot de> +! +program p + integer :: k = 1 + select case (k) + case (:huge(1._4)) ! { dg-error "Expression in CASE" } + case (:huge(2._8)) ! { dg-error "Expression in CASE" } + case ((1.0,2.0)) ! { dg-error "Expression in CASE" } + end select +end diff --git a/gcc/testsuite/gfortran.dg/pr68153.f90 b/gcc/testsuite/gfortran.dg/pr68153.f90 new file mode 100644 index 0000000000..1a360f80cd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68153.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/68153 +! Original code contribute by Gerhard Steinmetz +! <gerhard dot steinmetz dot fortran at t-online dot de> +! +program foo + integer, parameter :: a(2) = [2, -2] + integer, parameter :: b(2,2) = reshape([1, 2, 3, 4], a) ! { dg-error "cannot be negative" } +end program foo diff --git a/gcc/testsuite/gfortran.dg/pr68154.f90 b/gcc/testsuite/gfortran.dg/pr68154.f90 new file mode 100644 index 0000000000..6415eb0b80 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68154.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/68154 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +program p + character(1), parameter :: x1(2) = 'a' + character(*), parameter :: x2(2) = x1 + character(*), parameter :: x3(*) = x1 +end diff --git a/gcc/testsuite/gfortran.dg/pr68224.f90 b/gcc/testsuite/gfortran.dg/pr68224.f90 new file mode 100644 index 0000000000..a5962bb866 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68224.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/68224 +! Original code contribute by Gerhard Steinmetz +! <gerhard dot steinmetz dot fortran at t-online dot de> +! +program p + integer, parameter :: a(null()) = [1, 2] ! { dg-error "scalar INTEGER expression" } + integer, parameter :: b(null():*) = [1, 2] ! { dg-error "scalar INTEGER expression" } + integer, parameter :: c(1:null()) = [1, 2] ! { dg-error "scalar INTEGER expression" } +end program p diff --git a/gcc/testsuite/gfortran.dg/pr68318_1.f90 b/gcc/testsuite/gfortran.dg/pr68318_1.f90 new file mode 100644 index 0000000000..1a3d59402f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68318_1.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! { dg-options "-O0" +! PR fortran/68318 +! Original code submitted by Gerhard Steinmetz +! <gerhard dot steinmetz dot fortran at t-online dot de> +! +module m + implicit none +contains + subroutine s1 + entry e ! { dg-error "(2)" } + end + subroutine s2 + entry e ! { dg-error "is already defined" } + end +end module +! { dg-prune-output "Duplicate ENTRY attribute specified" } + diff --git a/gcc/testsuite/gfortran.dg/pr68318_2.f90 b/gcc/testsuite/gfortran.dg/pr68318_2.f90 new file mode 100644 index 0000000000..451b28f2a4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68318_2.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! PR fortran/68318 +! Original code submitted by Gerhard Steinmetz +! <gerhard dot steinmetz dot fortran at t-online dot de> +! +module m1 + implicit none +contains + subroutine s1 + entry e + end +end module + +module m2 + use m1 ! { dg-error "(2)" } + implicit none +contains + subroutine s2 + entry e ! { dg-error "is already defined" } + end +end module +! { dg-prune-output "Cannot change attribute" } diff --git a/gcc/testsuite/gfortran.dg/pr68319.f90 b/gcc/testsuite/gfortran.dg/pr68319.f90 new file mode 100644 index 0000000000..941316d71e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68319.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! PR fortran/68319 +! +subroutine foo + + interface + + real function bar(i) + f(i) = 2 * i ! { dg-error "cannot appear within" } + end function bar + + real function bah(j) + entry boo(j) ! { dg-error "cannot appear within" } + end function bah + + real function fu(j) + data i /1/ ! { dg-error "cannot appear within" } + end function fu + + real function fee(j) +10 format('(A)') ! { dg-error "cannot appear within" } + end function fee + + end interface + +end subroutine foo diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_47.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_47.f90 new file mode 100644 index 0000000000..43084f67e4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_47.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! Tests the fix for PR68196 +! +! Contributed by Damian Rouson <damian@sourceryinstitute.org> +! + type AA + integer :: i + procedure(foo), pointer :: funct + end type + class(AA), allocatable :: my_AA + type(AA) :: res + + allocate (my_AA, source = AA (1, foo)) + + res = my_AA%funct () + + if (res%i .ne. 3) call abort + if (.not.associated (res%funct)) call abort + if (my_AA%i .ne. 4) call abort + if (associated (my_AA%funct)) call abort + +contains + function foo(A) + class(AA), allocatable :: A + type(AA) foo + + if (.not.allocated (A)) then + allocate (A, source = AA (2, foo)) + endif + + select type (A) + type is (AA) + foo = AA (3, foo) + A = AA (4, NULL ()) + end select + end function +end diff --git a/gcc/testsuite/gfortran.dg/structure_constructor_13.f03 b/gcc/testsuite/gfortran.dg/structure_constructor_13.f03 new file mode 100644 index 0000000000..c74e325ce8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/structure_constructor_13.f03 @@ -0,0 +1,28 @@ +! { dg-do run } +! +! Contributed by Melven Roehrig-Zoellner <Melven.Roehrig-Zoellner@DLR.de> +! PR fortran/66035 + +program test_pr66035 + type t + end type t + type w + class(t), allocatable :: c + end type w + + type(t) :: o + + call test(o) +contains + subroutine test(o) + class(t), intent(inout) :: o + type(w), dimension(:), allocatable :: list + + select type (o) + class is (t) + list = [w(o)] ! This caused an ICE + class default + call abort() + end select + end subroutine +end program diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_2.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_2.f03 index 5eea79dec7..13d7f8e466 100644 --- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_2.f03 +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_2.f03 @@ -48,7 +48,7 @@ contains call foo (y)
y => tgt ! This is OK, of course.
- tgt => y ! { dg-error "must be unlimited polymorphic" }
+ tgt => y ! { dg-error "Data-pointer-object at .1. must be unlimited polymorphic" }
select type (y) ! This is the correct way to accomplish the previous
type is (integer)
diff --git a/gcc/testsuite/gfortran.dg/used_before_typed_3.f90 b/gcc/testsuite/gfortran.dg/used_before_typed_3.f90 index 5654d97688..ef2c679e08 100644 --- a/gcc/testsuite/gfortran.dg/used_before_typed_3.f90 +++ b/gcc/testsuite/gfortran.dg/used_before_typed_3.f90 @@ -17,14 +17,14 @@ CONTAINS test1 = "foobar" END FUNCTION test1 - CHARACTER(len=x) FUNCTION test2 (x) ! { dg-bogus "used before|of INTEGER" } + CHARACTER(len=x) FUNCTION test2 (x) ! { dg-error "of INTEGER" } IMPLICIT INTEGER(a-z) test2 = "foobar" END FUNCTION test2 END MODULE testmod -CHARACTER(len=i) FUNCTION test3 (i) ! { dg-bogus "used before|of INTEGER" } +CHARACTER(len=i) FUNCTION test3 (i) ! i is IMPLICIT INTEGER by default test3 = "foobar" END FUNCTION test3 diff --git a/gcc/testsuite/jit.dg/test-benchmark.c b/gcc/testsuite/jit.dg/test-benchmark.c index 324ba933b7..48f0faf904 100644 --- a/gcc/testsuite/jit.dg/test-benchmark.c +++ b/gcc/testsuite/jit.dg/test-benchmark.c @@ -209,13 +209,14 @@ main (int argc, char **argv) { int opt_level; int num_iterations = 100; + double elapsed_time[4]; ticks_to_msec = TICKS_TO_MSEC; for (opt_level = 0; opt_level < 4; opt_level++) { int i; - double start_time, end_time, elapsed_time; + double start_time, end_time; start_time = get_wallclock_time (); for (i = 1; i <= num_iterations; i++) { @@ -226,15 +227,26 @@ main (int argc, char **argv) test_jit (argv[0], opt_level); } end_time = get_wallclock_time (); - elapsed_time = end_time - start_time; + elapsed_time[opt_level] = end_time - start_time; pass ("%s: survived %i iterations at optlevel %i", argv[0], num_iterations, opt_level); note (("%s: %i iterations at optlevel %i" " took a total of %.3fs (%.3fs per iteration)"), argv[0], num_iterations, opt_level, - elapsed_time, elapsed_time / num_iterations); + elapsed_time[opt_level], + elapsed_time[opt_level] / num_iterations); } + totals (); + /* Print a summary. */ + printf ("%s: %i iterations: time taken (lower is better)\n", + argv[0], num_iterations); + for (opt_level = 0; opt_level < 4; opt_level++) + printf ("optlevel %i: %.3fs (%.3fs per iteration)\n", + opt_level, + elapsed_time[opt_level], + elapsed_time[opt_level] / num_iterations); + return 0; } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 8f360c3801..950db11637 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -957,6 +957,13 @@ proc check_effective_target_pie { } { || [istarget *-*-gnu*] } { return 1; } + if { [istarget *-*-solaris2.1\[1-9\]*] } { + # Full PIE support was added in Solaris 11.x and Solaris 12, but gcc + # errors out if missing, so check for that. + return [check_no_compiler_messages pie executable { + int main (void) { return 0; } + } "-pie -fpie"] + } return 0 } @@ -2637,8 +2644,8 @@ proc check_effective_target_arm_neon_ok_nocache { } { int dummy; /* Avoid the case where a test adds -mfpu=neon, but the toolchain is configured for -mcpu=arm926ej-s, for example. */ - #if __ARM_ARCH < 7 - #error Architecture too old for NEON. + #if __ARM_ARCH < 7 || __ARM_ARCH_PROFILE == 'M' + #error Architecture does not support NEON. #endif } "$flags"] } { set et_arm_neon_flags $flags @@ -6277,3 +6284,13 @@ proc check_effective_target_comdat_group {} { int (*fn) () = foo; }] } + +# Return 1 if target supports __builtin_eh_return +proc check_effective_target_builtin_eh_return { } { + return [check_no_compiler_messages builtin_eh_return object { + void test (long l, void *p) + { + __builtin_eh_return (l, p); + } + } "" ] +} |