diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2022-04-29 17:54:39 +0100 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2022-04-29 17:54:39 +0100 |
commit | 3e5f7ca352c26a222bb588741b7c700a3052a372 (patch) | |
tree | 283aec084274668fe34c23c49ab2999390ed9778 /gcc/testsuite | |
parent | 2ce0608ca3dca30518bec525c435f7bc4d7f9b70 (diff) | |
parent | b85e79dce149df68b92ef63ca2a40ff1dfa61396 (diff) | |
download | gcc-devel/c++-coroutines.tar.gz |
Merge master r12-8312.devel/c++-coroutines
* Merge master r12-8312-gb85e79dce149.
Diffstat (limited to 'gcc/testsuite')
258 files changed, 6256 insertions, 220 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3d70f27149e..d3022f1a6d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,856 @@ +2022-04-27 Thomas Koenig <tkoenig@gcc.gnu.org> + + * gfortran.dg/pr70673.f90: Removed second invalid + line. + +2022-04-27 Marek Polacek <polacek@redhat.com> + + PR c++/105398 + * g++.dg/cpp1y/lambda-generic-enum2.C: New test. + +2022-04-27 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/104492 + * g++.dg/warn/pr104492.C: New test. + +2022-04-27 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/70673 + PR fortran/78054 + * gfortran.dg/pr70673.f90: Remove invalid statement. + * gfortran.dg/pr70673_2.f90: New test to check that + ICE does not re-appear. + +2022-04-27 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/103662 + PR fortran/105379 + * gfortran.dg/class_dummy_8.f90: New test. + * gfortran.dg/class_dummy_9.f90: New test. + +2022-04-27 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/102043 + PR fortran/105381 + * gfortran.dg/character_array_dummy_1.f90: New test. + +2022-04-27 Christophe Lyon <christophe.lyon@arm.com> + + PR tree-optimization/105374 + * gcc.target/arm/simd/pr105374.C: New. + +2022-04-27 Andreas Krebbel <krebbel@linux.ibm.com> + + PR target/102024 + * g++.target/s390/pr102024-1.C: New test. + * g++.target/s390/pr102024-2.C: New test. + * g++.target/s390/pr102024-3.C: New test. + * g++.target/s390/pr102024-4.C: New test. + * g++.target/s390/pr102024-5.C: New test. + * g++.target/s390/pr102024-6.C: New test. + +2022-04-27 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/105396 + * gcc.dg/asan/pr105396.c: New test. + +2022-04-27 Kewen Lin <linkw@linux.ibm.com> + + PR target/105271 + * gcc.target/powerpc/pr105271.c: New test. + +2022-04-26 Jason Merrill <jason@redhat.com> + + PR c++/102629 + * g++.dg/cpp2a/lambda-pack-init7.C: New test. + +2022-04-26 Patrick Palka <ppalka@redhat.com> + + PR c++/105386 + * g++.dg/cpp0x/decltype81.C: New test. + +2022-04-26 Segher Boessenkoool <segher@kernel.crashing.org> + + PR target/105349 + * lib/target-supports.exp (check_effective_target_has_arch_pwr5): Use + the specified dg-options. + (check_effective_target_has_arch_pwr6): Ditto. + (check_effective_target_has_arch_pwr7): Ditto. + (check_effective_target_has_arch_pwr8): Ditto. + (check_effective_target_has_arch_pwr9): Ditto. + (check_effective_target_has_arch_pwr10): Ditto. + (check_effective_target_has_arch_ppc64): Ditto. + +2022-04-26 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/105314 + * gcc.target/riscv/pr105314.c: New test. + +2022-04-26 Jakub Jelinek <jakub@redhat.com> + + PR c++/65211 + * g++.target/i386/vec-tmpl1.C: Add -Wno-psabi as + dg-additional-options. + +2022-04-26 Jakub Jelinek <jakub@redhat.com> + + PR target/105367 + * gcc.target/i386/pr105367.c: New test. + +2022-04-26 Jakub Jelinek <jakub@redhat.com> + + PR fortran/103662 + * lib/target-supports.exp (check_effective_target___OPTIMIZE__): Add + a var definition to avoid pedwarn about empty translation unit. + * gfortran.dg/unlimited_polymorphic_3.f03: Remove -ftree-dse from + dg-additional-options, guard scan-tree-dump-not directives on + __OPTIMIZE__ target. + +2022-04-26 Jason Merrill <jason@redhat.com> + + PR c++/104624 + * g++.dg/cpp1y/lambda-generic-variadic22.C: New test. + +2022-04-26 Patrick Palka <ppalka@redhat.com> + + PR c++/105304 + * g++.dg/cpp2a/concepts-requires30.C: New test. + +2022-04-26 Patrick Palka <ppalka@redhat.com> + + PR c++/105289 + PR c++/86193 + * g++.dg/template/partial-specialization11.C: New test. + * g++.dg/template/partial-specialization12.C: New test. + +2022-04-25 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/105365 + PR analyzer/105366 + * gcc.dg/analyzer/pr105365.c: New test. + * gcc.dg/analyzer/pr105366.c: New test. + +2022-04-25 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/104308 + * gcc.dg/analyzer/pr104308.c: Add test coverage. + +2022-04-25 Jakub Jelinek <jakub@redhat.com> + Thomas Schwinge <thomas@codesourcery.com> + + PR fortran/104717 + * gfortran.dg/goacc/pr104717.f90: New test. + * gfortran.dg/goacc/privatization-1-compute-loop.f90: Adjust. + +2022-04-25 Marek Polacek <polacek@redhat.com> + + PR c++/105353 + * g++.dg/ext/builtin-shufflevector-3.C: New test. + +2022-04-25 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/105276 + * g++.dg/pr105276.C: New. + +2022-04-25 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/103662 + * gfortran.dg/unlimited_polymorphic_3.f03: Force execution of + the DSE optimization pass. + +2022-04-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/100810 + * gcc.dg/torture/pr100810.c: New testcase. + * gcc.dg/torture/pr105337.c: Likewise. + +2022-04-25 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/105231 + * gcc.dg/torture/pr105231.c: New testcase. + +2022-04-25 Hongyu Wang <hongyu.wang@intel.com> + + PR target/105339 + * gcc.target/i386/sse-14.c: Add tests for new macro. + +2022-04-24 Jeff Law <jeffreyalaw@gmail.com> + + * gcc.dg/lto/pr94157_0.c: Also request executable stack from + the linker. + +2022-04-24 Mikael Morin <mikael@gcc.gnu.org> + Jakub Jelinek <jakub@redhat.com> + + PR fortran/103662 + * gfortran.dg/unlimited_polymorphic_3.f03 (foo): Separate + bind(c) and sequence checks to... + (foo_bc, foo_sq): ... two different procedures. + (main, foo*): Change type declarations so that type name, + component name, and either bind(c) or sequence attribute match + between the main type declarations and the procedure type + declarations. + (toplevel): Add optimization dump checks. + +2022-04-23 Jakub Jelinek <jakub@redhat.com> + + PR target/105338 + * gcc.target/i386/pr105338.c: New test. + +2022-04-22 Mikael Morin <mikael@gcc.gnu.org> + Richard Biener <rguenther@suse.de> + + PR fortran/102043 + * gfortran.dg/array_reference_3.f90: New. + * gfortran.dg/negative_stride_1.f90: New. + * gfortran.dg/vector_subscript_8.f90: New. + * gfortran.dg/vector_subscript_9.f90: New. + * gfortran.dg/c_loc_test_22.f90: Update dump patterns. + * gfortran.dg/finalize_10.f90: Same. + +2022-04-22 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/102043 + * gfortran.dg/dependency_49.f90: Update variable occurence + count. + +2022-04-22 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/105333 + * gcc.dg/pr105333.c: New test. + +2022-04-21 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/103197 + PR target/102146 + * gcc.target/powerpc/bswap-brw.c: Add xfail on scan-assembler for -m32. + +2022-04-21 Segher Boessenkool <segher@kernel.crashing.org> + + * lib/target-supports.exp (check_effective_target_has_arch_ppc64): New. + +2022-04-21 Marek Polacek <polacek@redhat.com> + + PR c++/105321 + * g++.dg/cpp0x/constexpr-105321.C: New test. + +2022-04-21 Fritz Reese <foreese@gcc.gnu.org> + + PR fortran/105310 + * gfortran.dg/dec_union_12.f90: New test. + +2022-04-21 Jakub Jelinek <jakub@redhat.com> + + PR debug/105203 + * gfortran.dg/g77/pr105203.f: New test. + +2022-04-20 Ed Catmur <ed@catmur.uk> + + PR c++/104996 + * g++.dg/cpp0x/initlist129.C: New test. + +2022-04-20 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105312 + * gcc.target/arm/pr105312.c: New testcase. + +2022-04-20 Jan Hubicka <hubicka@ucw.cz> + + * gcc.c-torture/compile/103818.c: New test. + +2022-04-20 Jakub Jelinek <jakub@redhat.com> + + PR ipa/105306 + * g++.dg/opt/pr105306.C: New test. + +2022-04-19 Jakub Jelinek <jakub@redhat.com> + + PR target/105257 + * gcc.dg/pr105257.c: New test. + +2022-04-19 Jakub Jelinek <jakub@redhat.com> + + PR c++/105256 + * g++.dg/cpp0x/pr105256.C: New test. + +2022-04-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/104010 + PR tree-optimization/103941 + * gcc.target/i386/pr103941-1.c: New testcase. + * gcc.target/i386/pr103941-2.c: Likewise. + +2022-04-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/104880 + * g++.dg/opt/pr104880.cc: Rename to ... + * g++.dg/opt/pr104880.C: ... this. + +2022-04-18 Kewen Lin <linkw@linux.ibm.com> + + PR testsuite/105266 + * gcc.dg/pr105250.c: Skip for powerpc*-*-* and s390*-*-*. + +2022-04-15 Paul A. Clarke <pc@us.ibm.com> + + * g++.dg/debug/dwarf2/const2.C: Move to g++.target/powerpc. + * g++.dg/other/darwin-minversion-1.C: Likewise. + * g++.dg/eh/ppc64-sighandle-cr.C: Likewise. + * g++.dg/eh/simd-5.C: Likewise. + * g++.dg/eh/simd-4.C: Move to g++.target/powerpc, adjust dg directives. + * g++.dg/eh/uncaught3.C: Likewise. + * g++.dg/other/spu2vmx-1.C: Likewise. + * g++.target/powerpc/const2.C: New file. + * g++.target/powerpc/darwin-minversion-1.C: New file. + * g++.target/powerpc/ppc64-sighandle-cr.C: New file. + * g++.target/powerpc/simd-4.C: New file. + * g++.target/powerpc/simd-5.C: New file. + * g++.target/powerpc/spu2vmx-1.C: New file. + * g++.target/powerpc/uncaught3.C: New file. + +2022-04-15 Marek Polacek <polacek@redhat.com> + + PR c++/105268 + * g++.dg/concepts/variadic6.C: New test. + +2022-04-15 Hongyu Wang <hongyu.wang@intel.com> + + * gcc.target/i386/crc32-6.c: Adjust dg-error message. + * gcc.target/i386/crc32-7.c: New test. + +2022-04-15 Jason Merrill <jason@redhat.com> + + PR c++/102804 + * g++.dg/ext/unsigned-typedef1.C: New test. + +2022-04-15 Jason Merrill <jason@redhat.com> + + PR c++/102987 + * g++.dg/diagnostic/using1.C: New test. + +2022-04-14 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/105264 + * gcc.dg/analyzer/torture/symbolic-10.c: New test. + +2022-04-14 Jason Merrill <jason@redhat.com> + + PR c++/104646 + * g++.dg/cpp0x/constexpr-fno-elide-ctors1.C: New test. + +2022-04-14 Jason Merrill <jason@redhat.com> + + PR c++/82980 + * g++.dg/cpp0x/lambda/lambda-current-inst1.C: New test. + +2022-04-14 Indu Bhagat <indu.bhagat@oracle.com> + + PR debug/105089 + * gcc.dg/debug/ctf/ctf-array-2.c: Refactor testcase. Move some + checks ... + * gcc.dg/debug/ctf/ctf-array-5.c: ... to here. + * gcc.dg/debug/ctf/ctf-variables-3.c: ... and here. Add + additional checks for one CTF variable and one CTF object info + record. + +2022-04-14 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/105252 + * gcc.dg/analyzer/pr105252.c: New test. + +2022-04-14 Jakub Jelinek <jakub@redhat.com> + + PR target/105247 + * gcc.c-torture/compile/pr105247.c: New test. + +2022-04-14 Robin Dapp <rdapp@linux.ibm.com> + + * gcc.target/s390/pr80725.c: Add -Wno-int-to-pointer-cast. + +2022-04-14 Jason Merrill <jason@redhat.com> + + PR c++/65211 + * g++.target/i386/vec-tmpl1.C: New test. + +2022-04-14 Jason Merrill <jason@redhat.com> + + PR c++/97219 + * g++.dg/cpp1y/lambda-generic-local-fn1.C: New test. + +2022-04-14 Jason Merrill <jason@redhat.com> + + PR c++/101698 + * g++.dg/template/conv19.C: New test. + +2022-04-14 Jason Merrill <jason@redhat.com> + + PR c++/101442 + * g++.dg/cpp0x/initlist-nrv1.C: New test. + +2022-04-14 Jason Merrill <jason@redhat.com> + + PR c++/105265 + PR c++/100838 + * g++.dg/cpp0x/initlist-new6.C: New test. + +2022-04-13 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/105254 + * g++.dg/vect/pr105254.cc: New test. + +2022-04-13 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/105242 + * gfortran.dg/gomp/loop-exit.f90: New test. + +2022-04-13 Jason Merrill <jason@redhat.com> + + PR c++/105245 + PR c++/100111 + * g++.dg/cpp1y/constexpr-empty2.C: Add -fno-elide-constructors. + +2022-04-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105263 + * gcc.dg/pr105263.c: New testcase. + +2022-04-13 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/105253 + * gcc.target/i386/pr105253.c: New test. + +2022-04-13 Jakub Jelinek <jakub@redhat.com> + + PR c++/105233 + * g++.dg/cpp2a/is-constant-evaluated13.C: New test. + +2022-04-13 Martin Jambor <mjambor@suse.cz> + + PR testsuite/105183 + * gcc.dg/ipa/remref-7.c: Add --param max-inline-insns-auto=100 to options. + +2022-04-13 Marek Polacek <polacek@redhat.com> + + PR c++/97296 + * g++.dg/cpp0x/ref-bind4.C: Add dg-error. + * g++.dg/cpp0x/ref-bind8.C: New test. + +2022-04-13 Richard Biener <rguenther@suse.de> + + PR middle-end/105259 + * gcc.target/i386/auto-init-4.c: Adjust. + +2022-04-13 Jakub Jelinek <jakub@redhat.com> + + PR target/105234 + * gcc.c-torture/compile/pr105234.c: New test. + +2022-04-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105250 + * gcc.dg/pr105250.c: New testcase. + +2022-04-13 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/powerpc/pr60203.c: Skip on no 128-bit long double. + +2022-04-13 Alexandre Oliva <oliva@adacore.com> + + PR target/102146 + * gcc.target/powerpc/pr56605.c: Accept SImode compare operand. + +2022-04-13 Xi Ruoyao <xry111@mengyan1223.wang> + + * gcc.target/mips/pr102024-4.c (dg-options): Add + -ffat-lto-objects. + +2022-04-12 Antoni Boucher <bouanto@zoho.com> + + PR jit/104293 + * jit.dg/all-non-failing-tests.h: Mention + test-setting-alignment. + * jit.dg/test-setting-alignment.c: New test. + +2022-04-12 Antoni Boucher <bouanto@zoho.com> + + PR jit/104072 + * jit.dg/all-non-failing-tests.h: Add new + test-register-variable. + * jit.dg/harness.h: Add -fdiagnostics-color=never to context's + command-line options. + * jit.dg/test-error-register-variable-bad-name.c: New test. + * jit.dg/test-error-register-variable-size-mismatch.c: New test. + * jit.dg/test-register-variable.c: New test. + +2022-04-12 Antoni Boucher <bouanto@zoho.com> + + PR jit/104071 + * jit.dg/all-non-failing-tests.h: Add new test-bitcast. + * jit.dg/test-bitcast.c: New test. + * jit.dg/test-error-bad-bitcast.c: New test. + * jit.dg/test-error-bad-bitcast2.c: New test. + +2022-04-12 Antoni Boucher <bouanto@zoho.com> + + PR target/95325 + * jit.dg/test-types.c: Add tests for sized integer types. + +2022-04-12 Jason Merrill <jason@redhat.com> + + PR c++/104669 + * g++.target/i386/mv31.C: New test. + +2022-04-12 Jason Merrill <jason@redhat.com> + + PR c++/102071 + * g++.dg/cpp1z/aligned-new9.C: Add single-object test. + +2022-04-12 Patrick Palka <ppalka@redhat.com> + + PR c++/103105 + * g++.dg/cpp2a/concepts-requires29.C: New test. + * g++.dg/cpp2a/concepts-requires29a.C: New test. + +2022-04-12 Richard Earnshaw <rearnsha@arm.com> + + PR target/101755 + * gcc.target/arm/reg_equal_test.c: Convert to gimple test. Restrict + to architectures with MOVW/MOVT. + +2022-04-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105235 + * g++.dg/opt/pr105235-1.C: New testcase. + +2022-04-12 Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com> + + PR target/104144 + * gcc.target/arm/multilib.exp: Updated tests. + +2022-04-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105226 + * gcc.dg/pr105226.c: New testcase. + +2022-04-12 Jakub Jelinek <jakub@redhat.com> + + PR target/105214 + * gcc.dg/asan/pr105214.c: New test. + +2022-04-12 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/105211 + * gcc.dg/pr105211.c: New test. + +2022-04-12 Jason Merrill <jason@redhat.com> + + PR c++/104142 + * g++.dg/opt/const7.C: New test. + +2022-04-12 Jason Merrill <jason@redhat.com> + + PR c++/105223 + PR c++/92918 + * g++.dg/template/using31.C: New test. + +2022-04-11 Peter Bergner <bergner@linux.ibm.com> + + PR target/104894 + * gcc.target/powerpc/pr104894.c: New test. + * gcc.target/powerpc/pr104894-2.c: New test. + +2022-04-11 Jason Merrill <jason@redhat.com> + + PR c++/98249 + * g++.dg/lookup/new3.C: New test. + +2022-04-11 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/105218 + * gcc.dg/pr105218.c: New test. + +2022-04-11 Alexandre Oliva <oliva@adacore.com> + + PR target/104253 + * gcc.target/powerpc/pr104253.c: Add missing dg- before + require-effective-target. Prune warning about -mfloat128 + possibly not being fully supported. + +2022-04-11 Tamar Christina <tamar.christina@arm.com> + + PR target/105197 + * gcc.target/aarch64/sve/pr105197-1.c: New test. + * gcc.target/aarch64/sve/pr105197-2.c: New test. + +2022-04-11 Jason Merrill <jason@redhat.com> + + PR c++/100370 + * g++.dg/warn/Wplacement-new-size-11.C: New test. + +2022-04-11 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/104639 + * gcc.dg/tree-ssa/pr104639-1.c: New test. + * gcc.dg/tree-ssa/pr104639-2.c: New test. + +2022-04-11 Jakub Jelinek <jakub@redhat.com> + + PR c++/105186 + * c-c++-common/pr105186.c: New test. + +2022-04-11 Kewen Lin <linkw@linux.ibm.com> + + PR testsuite/103196 + * gcc.target/powerpc/p9-vec-length-epil-7.c: Add option + -fdisable-tree-cunroll. + * gcc.target/powerpc/p9-vec-length-full-7.c: Likewise. + +2022-04-10 Harald Anlauf <anlauf@gmx.de> + + PR fortran/105184 + * gfortran.dg/coarray_44.f90: Adjust expected output. + * gfortran.dg/coarray_allocate_11.f90: Likewise. + * gfortran.dg/coarray_allocate_12.f90: New test. + +2022-04-09 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/103892 + * gcc.dg/analyzer/pr103892.c: New test. + * gcc.dg/analyzer/pr96841.c: Drop redundant + -Wno-analyzer-too-complex. + +2022-04-09 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/103376 + * gcc.c-torture/compile/pr103376.c: New test. + +2022-04-09 Jan Hubicka <hubicka@ucw.cz> + + * gcc.dg/ipa/pr105160.c: New test. + +2022-04-09 Xi Ruoyao <xry111@mengyan1223.wang> + + * gcc.dg/stack-usage-1.c: Adjust for LoongArch LP64. + +2022-04-09 Xi Ruoyao <xry111@mengyan1223.wang> + + * gcc.dg/builtin-apply2.c (dg-skip-if): Add loongarch*-*-*. + +2022-04-09 Jason Merrill <jason@redhat.com> + + PR c++/105191 + PR c++/92385 + * g++.dg/cpp0x/constexpr-array28.C: New test. + +2022-04-09 Jason Merrill <jason@redhat.com> + + PR c++/91618 + PR c++/96604 + * g++.dg/cpp0x/friend7.C: Remove xfail. + * g++.dg/template/friend72.C: New test. + * g++.dg/template/friend72a.C: New test. + * g++.dg/template/friend73.C: New test. + +2022-04-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105198 + * gcc.dg/torture/pr105198.c: New testcase. + +2022-04-08 Jakub Jelinek <jakub@redhat.com> + + PR c++/105187 + * c-c++-common/torture/20050113-1.c: Add dg-additional-options + -Wno-psabi. + +2022-04-08 Jakub Jelinek <jakub@redhat.com> + + PR c/105149 + * gcc.dg/pr105149.c: New test. + +2022-04-08 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/105189 + * g++.dg/torture/pr105189.C: New test. + +2022-04-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105175 + * gcc.dg/pr105175.c: New testcase. + +2022-04-07 Michael Meissner <meissner@linux.ibm.com> + + PR target/104253 + * lib/target-supports.exp (check_ppc_float128_sw_available): Do + not run float128 tests on VxWorks. + (check_ppc_float128_hw_available): Likewise. + (check_effective_target_ppc_ieee128_ok): Likewise. + +2022-04-07 Tamar Christina <tamar.christina@arm.com> + + PR testsuite/105196 + * gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c: Remove slp1 check. + +2022-04-07 Richard Biener <rguenther@suse.de> + Jan Hubicka <hubicka@ucw.cz> + + PR ipa/104303 + * gnat.dg/concat5.adb: New. + * gnat.dg/concat5_pkg1.adb: Likewise. + * gnat.dg/concat5_pkg1.ads: Likewise. + * gnat.dg/concat5_pkg2.adb: Likewise. + * gnat.dg/concat5_pkg2.ads: Likewise. + +2022-04-07 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/102208 + * gcc.dg/analyzer/symbolic-9.c: New test. + * gcc.dg/analyzer/torture/leak-pr102308-1.c: New test. + * gcc.dg/analyzer/torture/leak-pr102308-2.c: New test. + +2022-04-07 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105185 + * gcc.dg/torture/pr105185.c: New testcase. + +2022-04-07 Tamar Christina <tamar.christina@arm.com> + + PR target/104049 + * gcc.target/aarch64/vadd_reduc-1.c: New test. + * gcc.target/aarch64/vadd_reduc-2.c: New test. + +2022-04-07 Tamar Christina <tamar.christina@arm.com> + + PR testsuite/105095 + * gcc.dg/vect/complex/fast-math-complex-add-double.c: Update for codegen. + * gcc.dg/vect/complex/fast-math-complex-add-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-add-half-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-mla-half-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-mls-double.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-mls-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-mls-half-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-mul-double.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-mul-float.c: Likewise. + * gcc.dg/vect/complex/fast-math-complex-mul-half-float.c: Likewise. + * gcc.dg/vect/vect.exp: Add extra letter to filter. + +2022-04-07 Tamar Christina <tamar.christina@arm.com> + + * gcc.target/aarch64/pr103350-1.c: Skip on BE. + * gcc.target/aarch64/pr103350-2.c: Likewise. + +2022-04-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/102586 + * g++.dg/torture/builtin-clear-padding-5.C: New test. + * g++.dg/cpp2a/builtin-clear-padding1.C (bar): Uncomment one + call that is now accepted. + +2022-04-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/105150 + * gcc.dg/pr105150.c: New test. + +2022-04-07 Richard Biener <rguenther@suse.de> + + PR middle-end/105165 + * gcc.dg/pr105165.c: New testcase. + +2022-04-07 Andreas Krebbel <krebbel@linux.ibm.com> + + PR target/105147 + * gcc.dg/pr105140.c: Skip for s390*-*-*. + +2022-04-07 Jason Merrill <jason@redhat.com> + + PR c++/101051 + * g++.dg/cpp0x/trailing15.C: New test. + +2022-04-07 Jason Merrill <jason@redhat.com> + + PR c++/101717 + * g++.dg/cpp1y/lambda-generic-this4.C: New test. + +2022-04-07 Jason Merrill <jason@redhat.com> + + PR c++/105187 + * gcc.c-torture/compile/20050113-1.c: Moved to... + * c-c++-common/torture/20050113-1.c: ...here. + +2022-04-06 Jakub Jelinek <jakub@redhat.com> + + PR c++/104668 + * g++.dg/cpp0x/pr104668.C: New test. + +2022-04-06 Patrick Palka <ppalka@redhat.com> + + PR c++/105143 + * g++.dg/cpp2a/nodiscard1.C: New test. + * g++.dg/warn/Wctad-maybe-unsupported4.C: New test. + +2022-04-06 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/105147 + * gcc.dg/pr105140.c: Skip for powerpc*-*-*. + +2022-04-06 Jason Merrill <jason@redhat.com> + + PR c++/104702 + * g++.dg/warn/Wunused-19.C: New test. + +2022-04-06 Xi Ruoyao <xry111@mengyan1223.wang> + + * g++.target/mips/cxx17_empty_base.C: New test. + +2022-04-06 Jason Merrill <jason@redhat.com> + + PR c++/100608 + * g++.dg/warn/Wshadow-compatible-local-3.C: New test. + +2022-04-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105173 + * gcc.dg/pr105173.c: New testcase. + +2022-04-06 Richard Biener <rguenther@suse.de> + + PR ipa/105166 + * gcc.dg/torture/pr105166.c: New testcase. + +2022-04-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105163 + * gcc.dg/torture/pr105163.c: New testcase. + +2022-04-06 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/103761 + * gcc.dg/vect/pr103761.c: New test. + * gcc.target/aarch64/sve/pr103761.c: Likewise. + +2022-04-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105148 + * gcc.dg/torture/pr105148.c: New testcase. + +2022-04-06 Roger Sayle <roger@nextmovesoftware.com> + + * gcc.target/i386/sse2-v1ti-andnot.c: New test case. + +2022-04-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/105142 + * g++.dg/torture/pr105142.C: New testcase. + +2022-04-06 Richard Biener <rguenther@suse.de> + + PR testsuite/105122 + * gcc.dg/memcpy-6.c: Adjust. + * gcc.dg/strlenopt-73.c: Likewise. + * gcc.dg/strlenopt-80.c: Likewise. + 2022-04-05 Sandra Loosemore <sandra@codesourcery.com> * gfortran.dg/gomp/masked-taskloop.f90: New. diff --git a/gcc/testsuite/c-c++-common/pr105186.c b/gcc/testsuite/c-c++-common/pr105186.c new file mode 100644 index 00000000000..ea687eacc4c --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr105186.c @@ -0,0 +1,5 @@ +/* PR c++/105186 */ +/* { dg-do compile } */ + +__attribute__((__int128)) int i; /* { dg-warning "'__int128' attribute directive ignored" } */ +__attribute__((__int128__)) int j; /* { dg-warning "'__int128' attribute directive ignored" } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20050113-1.c b/gcc/testsuite/c-c++-common/torture/20050113-1.c index 6e36ed6fd7c..8ec4935352c 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20050113-1.c +++ b/gcc/testsuite/c-c++-common/torture/20050113-1.c @@ -1,4 +1,5 @@ /* PR c/17297 */ +/* { dg-additional-options "-Wno-psabi" } */ typedef float V2SF __attribute__ ((vector_size (8))); diff --git a/gcc/testsuite/g++.dg/concepts/variadic6.C b/gcc/testsuite/g++.dg/concepts/variadic6.C new file mode 100644 index 00000000000..0b386b0cd6d --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/variadic6.C @@ -0,0 +1,20 @@ +// PR c++/105268 +// { dg-do compile { target concepts } } + +template<typename> concept C_one = true; +template<typename...> concept C_many = true; + +template<bool B> struct S { }; + +template<typename T = S<C_one<int>>> void f(); +template<typename T = S<C_many<int>>> void g(); + +void +fn (auto a = S<C_one<int>>{}) +{ +} + +void +fn2 (auto a = S<C_many<int>>{}) +{ +} diff --git a/gcc/testsuite/g++.dg/coroutines/pr103868.C b/gcc/testsuite/g++.dg/coroutines/pr103868.C new file mode 100644 index 00000000000..8687effb563 --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/pr103868.C @@ -0,0 +1,150 @@ +// { dg-additional-options "-fpreprocessed -std=gnu++20 -w -fconcepts" } +int _M_invoke___functor; +namespace std { +template <int __v> struct integral_constant { + static constexpr bool value = __v; +}; +template <typename> struct decay { typedef int type; }; +template <bool, typename> struct enable_if; +template <typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; }; +template <typename, typename _Fn, typename... _Args> +void __invoke_impl(_Fn __f, _Args... __args) { + __f(__args...); +} +template <typename, typename _Callable, typename... _Args> +void __invoke_r(_Callable __fn, _Args... __args) { + using __result = int; + using __type = __result; + __invoke_impl<__type>(__fn, __args...); +} +template <typename> class function; +template <typename _Functor> struct _Base_manager { + static _Functor *_M_get_pointer(int) {} +}; +template <typename, typename> class _Function_handler; +template <typename _Res, typename _Functor, typename... _ArgTypes> +struct _Function_handler<_Res(_ArgTypes...), _Functor> { + static _Res _M_invoke(_ArgTypes... __args) { + auto __trans_tmp_1 = + _Base_manager<_Functor>::_M_get_pointer(_M_invoke___functor); + __invoke_r<_Res>(*__trans_tmp_1, __args...); + } +}; +template <typename _Res, typename... _ArgTypes> +struct function<_Res(_ArgTypes...)> { + template <typename _Functor> function(_Functor) { + _Function_handler<_Res(_ArgTypes...), _Functor>::_M_invoke; + } +}; +template <typename _Tp> struct __shared_ptr_access { + using element_type = _Tp; + element_type *operator->(); +}; +template <typename> void make_shared(); +} // namespace std +namespace boost { +using std::decay; +using std::enable_if; +using std::integral_constant; +namespace asio { +namespace detail { +template <typename> struct is_completion_signature; +template <typename R, typename... Args> +struct is_completion_signature<R(Args...)> : integral_constant<true> {}; +} // namespace detail +template <typename T> +concept completion_signature = detail::is_completion_signature<T>::value; +template <typename...> struct async_result; +namespace detail { +template <completion_signature> +struct async_result_has_initiate_memfn : integral_constant<1> {}; +} // namespace detail +template <typename CompletionToken, completion_signature... Signatures, + typename Initiation> +enable_if<detail::async_result_has_initiate_memfn<Signatures...>::value, + decltype(async_result<typename decay<CompletionToken>::type, + Signatures...>::initiate(0))>::type +async_initiate(Initiation) {} +} // namespace asio +} // namespace boost +namespace malloy::websocket { +struct connection { + auto read(auto, auto done) { + auto wrapper = [] {}; + return boost::asio::async_initiate<decltype(done), void()>(wrapper); + } +}; +} // namespace malloy::websocket +namespace std { +template <typename...> struct coroutine_traits; +template <typename = void> struct coroutine_handle { + operator coroutine_handle<>(); +}; +struct suspend_always { + bool await_ready(); + void await_suspend(coroutine_handle<>); + void await_resume(); +}; +} // namespace std +namespace boost { +namespace asio { +namespace detail { +using std::coroutine_handle; +using std::suspend_always; +template <typename> class awaitable_frame; +} // namespace detail +template <typename, typename = int> struct awaitable { + bool await_ready(); + template <class U> + void await_suspend(detail::coroutine_handle<detail::awaitable_frame<U>>); + void await_resume(); +}; +namespace detail { +struct awaitable_frame_base { + auto initial_suspend() { return suspend_always(); } + auto final_suspend() noexcept { + struct result { + bool await_ready() noexcept; + void await_suspend(coroutine_handle<>) noexcept; + void await_resume() noexcept; + }; + return result{}; + } + void unhandled_exception(); + template <typename T> auto await_transform(T a) { return a; } +}; +template <> struct awaitable_frame<void> : awaitable_frame_base { + void get_return_object(); +}; +} // namespace detail +} // namespace asio +} // namespace boost +namespace std { +template <typename T, typename Executor, typename... Args> +struct coroutine_traits<boost::asio::awaitable<T, Executor>, Args...> { + typedef boost::asio::detail::awaitable_frame<T> promise_type; +}; +} // namespace std +namespace boost { +namespace asio { +struct use_awaitable_t { + use_awaitable_t(char, int, char); +} use_awaitable(0, 0, 0); +template <typename Executor, typename R, typename... Args> +struct async_result<Executor, R(Args...)> { + template <typename Initiation> static awaitable<int> initiate(Initiation); +}; +} // namespace asio +} // namespace boost +namespace malloy::test { +void roundtrip_coro(std::function<void(int)>); +} +using boost::asio::awaitable; +template <int> awaitable<void> client_ws_handler_coro() { + std::__shared_ptr_access<malloy::websocket::connection> conn; + auto buffer = std::make_shared<int>; + co_await conn->read(buffer, boost::asio::use_awaitable); +} +void port() { + malloy::test::roundtrip_coro([](auto) { client_ws_handler_coro<false>; }); +} diff --git a/gcc/testsuite/g++.dg/coroutines/pr104051.C b/gcc/testsuite/g++.dg/coroutines/pr104051.C new file mode 100644 index 00000000000..ce7ae55405a --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/pr104051.C @@ -0,0 +1,29 @@ +// { dg-additional-options "-fsyntax-only" } +#include <coroutine> +#include <vector> +template <typename> struct promise { + struct final_awaitable { + bool await_ready() noexcept; + template <typename Promise> + std::coroutine_handle<> + await_suspend(std::coroutine_handle<Promise>) noexcept; + void await_resume() noexcept; + }; + auto get_return_object() { + return std::coroutine_handle<promise>::from_promise(*this); + } + auto initial_suspend() { return std::suspend_always(); } + auto final_suspend() noexcept { return true; } + void unhandled_exception(); +}; +template <typename T> struct task { + using promise_type = promise<T>; + task(std::coroutine_handle<promise<T>>); + bool await_ready(); + std::coroutine_handle<> await_suspend(std::coroutine_handle<>); + T await_resume(); +}; +task<std::vector<int>> foo() { // { dg-error {awaitable type 'bool' is not a structure} } + while ((co_await foo()).empty()) + ; +} diff --git a/gcc/testsuite/g++.dg/coroutines/pr105287.C b/gcc/testsuite/g++.dg/coroutines/pr105287.C new file mode 100644 index 00000000000..9790945287d --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/pr105287.C @@ -0,0 +1,48 @@ +// { dg-additional-options "-fanalyzer" } +// { dg-excess-errors "lots of analyzer output, but no ICE" } +namespace std { +template <typename _Result> struct coroutine_traits : _Result {}; +template <typename = void> struct coroutine_handle { + operator coroutine_handle<>(); +}; +} +struct coro1 { + using handle_type = std::coroutine_handle<>; + coro1(handle_type); + struct suspend_always_prt { + bool await_ready() noexcept; + void await_suspend(handle_type) noexcept; + void await_resume() noexcept; + }; + struct promise_type { + std::coroutine_handle<> ch_; + auto get_return_object() { return ch_; } + auto initial_suspend() { return suspend_always_prt{}; } + auto final_suspend() noexcept { return suspend_always_prt{}; } + void unhandled_exception(); + }; +}; +struct BoolAwaiter { + BoolAwaiter(bool); + bool await_ready(); + void await_suspend(std::coroutine_handle<>); + bool await_resume(); +}; +struct IntAwaiter { + IntAwaiter(int); + bool await_ready(); + void await_suspend(std::coroutine_handle<>); + int await_resume(); +}; +coro1 my_coro() { + int a = 1; + if (a == 0) { + int b = 5; + + } + { + int c = 10; + } + co_await BoolAwaiter(true) && co_await IntAwaiter(a); + + } diff --git a/gcc/testsuite/g++.dg/coroutines/pr105301.C b/gcc/testsuite/g++.dg/coroutines/pr105301.C new file mode 100644 index 00000000000..33a0b03cf5d --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/pr105301.C @@ -0,0 +1,49 @@ +// { dg-additional-options "-fsyntax-only" } +namespace std { +template <class T, class = void> +struct traits_sfinae_base {}; + +template <class Ret, class... Args> +struct coroutine_traits : public traits_sfinae_base<Ret> {}; +} + +template<typename Promise> struct coro {}; +template <typename Promise, typename... Ps> +struct std::coroutine_traits<coro<Promise>, Ps...> { + using promise_type = Promise; +}; + +struct awaitable { + bool await_ready() noexcept; + template <typename F> + void await_suspend(F) noexcept; + void await_resume() noexcept; +} a; + +struct suspend_always { + bool await_ready() noexcept { return false; } + template <typename F> + void await_suspend(F) noexcept; + void await_resume() noexcept {} +}; + +namespace std { +template <class PromiseType = void> +struct coroutine_handle {}; +} + +struct bad_promise_6 { + coro<bad_promise_6> get_return_object(); + suspend_always initial_suspend(); + suspend_always final_suspend() noexcept; + void unhandled_exception(); + void return_void(); + void return_value(int) const; + void return_value(int); +}; + +coro<bad_promise_6> +bad_implicit_return() // { dg-error {.aka 'bad_promise_6'. declares both 'return_value' and 'return_void'} } +{ + co_await a; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-105321.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-105321.C new file mode 100644 index 00000000000..adb6830ff22 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-105321.C @@ -0,0 +1,18 @@ +// PR c++/105321 +// { dg-do compile { target c++11 } } + +bool handle_error(); + +constexpr int echo(int value, bool yes = true) noexcept +{ + return (yes || handle_error()), value; +} + +static_assert(echo(10) == 10, ""); + +constexpr int echo2(int value, bool no = false) noexcept +{ + return (!no || handle_error()), value; +} + +static_assert(echo2(10) == 10, ""); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array28.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array28.C new file mode 100644 index 00000000000..d7706b9f0b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array28.C @@ -0,0 +1,21 @@ +// PR c++/105191 +// { dg-do compile { target c++11 } } + +struct A { + const char* message = ""; +}; + +enum class B { }; + +struct C { + A a; + B b; +}; + +struct D { + C cs[1]; +}; + +constexpr D ds[4] = { + D{}, +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-fno-elide-ctors1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-fno-elide-ctors1.C new file mode 100644 index 00000000000..71c76fa0247 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-fno-elide-ctors1.C @@ -0,0 +1,89 @@ +// PR c++/104646 +// { dg-do compile { target c++11 } } +// { dg-additional-options -fno-elide-constructors } + +template <typename _T1> struct pair { + _T1 first; + int second; +}; +template <typename _Iterator> class __normal_iterator { + _Iterator __traits_type; + +public: + constexpr __normal_iterator() {} +}; +template <typename> class allocator; +template <typename> struct allocator_traits; +template <typename _Tp> struct allocator_traits<allocator<_Tp>> { + using value_type = _Tp; + template <typename _Up> using rebind_alloc = allocator<_Up>; +}; +template <typename _Alloc> struct __alloc_traits { + typedef allocator_traits<_Alloc> _Base_type; + typedef typename _Base_type::value_type &const_reference; + template <typename _Tp> struct rebind { + typedef typename _Base_type::template rebind_alloc<_Tp> other; + }; +}; +template <typename _Tp, typename _Alloc> struct _Vector_base { + typedef typename __alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; +}; +template <typename _Tp, typename _Alloc = allocator<_Tp>> class vector { +public: + typename __alloc_traits< + typename _Vector_base<_Tp, _Alloc>::_Tp_alloc_type>::const_reference + operator[](long); +}; +enum match_flag_type {}; +template <typename, typename> class Trans_NS___cxx11_basic_regex; +class Trans_NS___cxx11_match_results; +enum _RegexExecutorPolicy { _S_auto }; +template <typename, typename, typename _CharT, typename _TraitsT, + _RegexExecutorPolicy, bool> +bool __regex_algo_impl(Trans_NS___cxx11_match_results &, + const Trans_NS___cxx11_basic_regex<_CharT, _TraitsT> &); +template <typename, typename, typename, bool> class _Executor; +template <typename _Ch_type, typename = _Ch_type> +class Trans_NS___cxx11_basic_regex {}; +class Trans_NS___cxx11_match_results : vector<int> { + template <typename, typename, typename _Cp, typename _Rp, + _RegexExecutorPolicy, bool> + friend bool __regex_algo_impl(Trans_NS___cxx11_match_results &, + const Trans_NS___cxx11_basic_regex<_Cp, _Rp> &); +}; +template <typename _Bi_iter, typename _Alloc, typename _Ch_type, + typename _Rx_traits> +void regex_search(_Bi_iter, _Alloc, + Trans_NS___cxx11_basic_regex<_Ch_type, _Rx_traits>) { + __regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, _S_auto, false>; +} +match_flag_type __regex_algo_impl___flags; +template <typename, typename, typename _CharT, typename _TraitsT, + _RegexExecutorPolicy, bool> +bool __regex_algo_impl( + Trans_NS___cxx11_match_results &__m, + const Trans_NS___cxx11_basic_regex<_CharT, _TraitsT> &__re) { + __normal_iterator<const char *> __e, __s; + _Executor<int, int, _TraitsT, false> __executor(__s, __e, __m, __re, + __regex_algo_impl___flags); + __executor._M_match(); + return false; +} +template <typename, typename, typename, bool> class _Executor { +public: + _Executor(__normal_iterator<const char *>, __normal_iterator<const char *>, + vector<int>, Trans_NS___cxx11_basic_regex<char>, match_flag_type); + void _M_match() { _M_dfs(); } + void _M_dfs(); + vector<pair<__normal_iterator<char *>>> _M_rep_count; +}; +long _M_rep_once_more___i; +template <typename _BiIter, typename _Alloc, typename _TraitsT, bool __dfs_mode> +void _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>::_M_dfs() { + auto __rep_count = _M_rep_count[_M_rep_once_more___i]; +} +char main___trans_tmp_1; +void main___trans_tmp_2() { + Trans_NS___cxx11_basic_regex<char> re; + regex_search(main___trans_tmp_1, main___trans_tmp_2, re); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype81.C b/gcc/testsuite/g++.dg/cpp0x/decltype81.C new file mode 100644 index 00000000000..7d25db39d9c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype81.C @@ -0,0 +1,15 @@ +// PR c++/105386 +// { dg-do compile { target c++11 } } + +template<class T> struct NoInst { + static_assert(sizeof(T) == 9999, "NoInst instantiated"); +}; + +template<class T> NoInst<T> f(T); + +template<class> +struct A { + using type = decltype(f(0)); +}; + +A<int> a; diff --git a/gcc/testsuite/g++.dg/cpp0x/friend7.C b/gcc/testsuite/g++.dg/cpp0x/friend7.C index e1d5f449f5c..4d0961c0397 100644 --- a/gcc/testsuite/g++.dg/cpp0x/friend7.C +++ b/gcc/testsuite/g++.dg/cpp0x/friend7.C @@ -21,7 +21,7 @@ struct S { friend class __attribute__((deprecated)) N3; [[deprecated]] friend void foo<>(int, int); // { dg-warning "attribute ignored" } [[deprecated]] friend void ::foo(int, int); // { dg-warning "attribute ignored" } - // { dg-bogus "should have" "PR100339" { xfail *-*-* } .-1 } + // { dg-bogus "should have" "PR100339" } }; template<typename T> diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-new6.C b/gcc/testsuite/g++.dg/cpp0x/initlist-new6.C new file mode 100644 index 00000000000..0ef27806acf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-new6.C @@ -0,0 +1,39 @@ +// PR c++/105265 +// { dg-do run { target c++11 } } + +int c; + +class Block +{ +public: + Block(int n) : data{new char[n]}, size{n} + { + ++c; + } + + ~Block() + { + --c; + delete[] data; + } + +private: + char* data; + int size; +}; + +struct Cargo +{ + Block const& block; +}; + +int main() +{ + { + Cargo* c = new Cargo{{4000}}; + delete c; + } + if (c != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-nrv1.C b/gcc/testsuite/g++.dg/cpp0x/initlist-nrv1.C new file mode 100644 index 00000000000..e44dbecfece --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist-nrv1.C @@ -0,0 +1,34 @@ +// PR c++/101442 +// { dg-do run { target c++11 } } + +bool destroyed = false; + +struct A +{ + A() {} + A(const A &) = delete; + A &operator=(const A &) = delete; + ~A() {destroyed = true;} +}; + +struct B +{ + const A &a; + struct string { + string(const char*) { } + ~string() { } + } s; +}; + +B foo() +{ + B ret{ A{}, "" }; + return ret; +} + +int main() +{ + B b = foo(); + if (!destroyed) + __builtin_abort(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist129.C b/gcc/testsuite/g++.dg/cpp0x/initlist129.C new file mode 100644 index 00000000000..4d4faa9e08d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist129.C @@ -0,0 +1,6 @@ +// PR c++/104996 +// { dg-do compile { target c++11 } } + +template<unsigned size> char f(int (&&)[size]); +template<unsigned size> int f(int const (&)[size]); +static_assert(sizeof(f({1, 2, 3})) == 1, ""); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-current-inst1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-current-inst1.C new file mode 100644 index 00000000000..a6631c5ca99 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-current-inst1.C @@ -0,0 +1,18 @@ +// PR c++/82980 +// { dg-do compile { target c++11 } } + +template <class T> +struct Outer +{ + template <class U> + void f(); + + void bar(Outer outer) { + [outer](){ outer.f<int>(); }; + } + void baz(Outer *p) { + [&](){ p->f<int>(); }; + } +}; + +int main() { } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr105256.C b/gcc/testsuite/g++.dg/cpp0x/pr105256.C new file mode 100644 index 00000000000..98ce5e8b7bf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr105256.C @@ -0,0 +1,18 @@ +// PR c++/105256 +// { dg-do compile { target c++11 } } + +int bar (int &); + +struct S { + struct T { + struct U { + int i = bar (i); + } u; + }; +}; + +void +foo (S::T *p) +{ + *p = {}; +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-bind4.C b/gcc/testsuite/g++.dg/cpp0x/ref-bind4.C index 85ac9fbfd79..d296d7c3b72 100644 --- a/gcc/testsuite/g++.dg/cpp0x/ref-bind4.C +++ b/gcc/testsuite/g++.dg/cpp0x/ref-bind4.C @@ -51,6 +51,6 @@ g (int *p, const int *pc, const int **q) similar types T1 and T2 (_conv.qual_), respectively, and the cv- qualification signature of type T1 is a proper subset of the cv- qualification signature of type T2 */ - f8 (q); + f8 (q); // { dg-error "call of overloaded" } f9 (q); } diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-bind8.C b/gcc/testsuite/g++.dg/cpp0x/ref-bind8.C new file mode 100644 index 00000000000..eee78fd5e74 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/ref-bind8.C @@ -0,0 +1,10 @@ +// PR c++/97296 +// { dg-do compile } + +void f(const int * const &); +void f(const int *); +int *x; +int main() +{ + f(x); // { dg-error "call of overloaded" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing15.C b/gcc/testsuite/g++.dg/cpp0x/trailing15.C new file mode 100644 index 00000000000..3fa74d08e39 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/trailing15.C @@ -0,0 +1,14 @@ +// PR c++/101051 +// { dg-do compile { target c++11 } } + +template <class T> +class Foo +{ + constexpr operator T() -> T {} // { dg-error "trailing return" } +}; + +struct S { + operator int() const -> double; // { dg-error "trailing return" } +}; + +class A { operator auto*() -> int; }; // { dg-error "auto|trailing return" } diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-empty2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-empty2.C index 2acfa98364b..9768b89904e 100644 --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-empty2.C +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-empty2.C @@ -1,4 +1,5 @@ // { dg-do compile { target c++14 } } +// { dg-additional-options -fno-elide-constructors } struct A { diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum2.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum2.C new file mode 100644 index 00000000000..77cf0bb9d02 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-enum2.C @@ -0,0 +1,15 @@ +// PR c++/105398 +// { dg-do compile { target c++14 } } + +auto f = [](auto &&m) { + enum E { _,e3,e2,e1,C4,C3,C2,C1 }; + static constexpr int x_coeffs[3][4] = { + {e1,C2,C3,C4}, + {e2,C1,C3,C4}, + {e3,C1,C2,C4}, + }; +}; + +int main() { + f(0); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-fn1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-fn1.C new file mode 100644 index 00000000000..06919c535d8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-local-fn1.C @@ -0,0 +1,17 @@ +// PR c++/97219 +// { dg-do compile { target c++14 } } + +struct B; + +template <typename T> +auto f(T *) { + void q(B *, void * = static_cast<T *>(0)); + return [](auto *p) { q(p); }; +} + +void q(void *) = delete; + +int main(void) { + B *bp = 0; + f(bp)(bp); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this4.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this4.C new file mode 100644 index 00000000000..38d582bec5e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-this4.C @@ -0,0 +1,7 @@ +// PR c++/101717 +// { dg-do compile { target c++14 } } + +struct x { + static void f() { } + void (*_)() = [] { [=](auto) { f(); }(0); }; +}; diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic22.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic22.C new file mode 100644 index 00000000000..670c598a865 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic22.C @@ -0,0 +1,15 @@ +// PR c++/104624 +// { dg-do compile { target c++14 } } + +template <typename T> +auto f (T) +{ + auto a = [](auto ... i) // { dg-prune-output "incomplete type" } + { + int x[][i] = { 0 }; // { dg-error "not expanded" } + }(); +} +void g () +{ + f(0); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C b/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C index 7854299419a..3fa0ed996bd 100644 --- a/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C +++ b/gcc/testsuite/g++.dg/cpp1z/aligned-new9.C @@ -23,4 +23,8 @@ int main() X *p = new X[n]; if (nalign != align) __builtin_abort (); + + X *p2 = new X; + if (nalign != alignof (X)) + __builtin_abort (); } diff --git a/gcc/testsuite/g++.dg/cpp2a/builtin-clear-padding1.C b/gcc/testsuite/g++.dg/cpp2a/builtin-clear-padding1.C index 7b1282e7798..ed74ebf19c3 100644 --- a/gcc/testsuite/g++.dg/cpp2a/builtin-clear-padding1.C +++ b/gcc/testsuite/g++.dg/cpp2a/builtin-clear-padding1.C @@ -43,7 +43,7 @@ bar () __builtin_clear_padding (&c2); __builtin_clear_padding (&c3); __builtin_clear_padding (&c4); -// __builtin_clear_padding (&c5); + __builtin_clear_padding (&c5); __builtin_clear_padding (&c6); __builtin_clear_padding (&c7); __builtin_clear_padding (&c8); diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires29.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires29.C new file mode 100644 index 00000000000..2cf69433d99 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires29.C @@ -0,0 +1,18 @@ +// PR c++/103105 +// { dg-do compile { target c++20 } } + +template<bool> struct A; + +template<class... Ts> +using wrap = A<1 != (0 + ... + requires { Ts(); })>; + +template<class... Ts> using type = wrap<Ts...>; + +using ty0 = type<>; +using ty0 = A<true>; + +using ty1 = type<int>; +using ty1 = A<false>; + +using ty2 = type<int, int>; +using ty2 = A<true>; diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires29a.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires29a.C new file mode 100644 index 00000000000..84c226918f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires29a.C @@ -0,0 +1,23 @@ +// PR c++/103105 +// { dg-do compile { target c++20 } } + +template<class...> struct list; + +template<bool> struct A; + +template<class T, class... Ts> +using wrap = A<1 != (0 + ... + requires { T() = Ts(); })>; + +template<class... Ts> using type = list<wrap<Ts, Ts...>...>; + +using ty0 = type<>; +using ty0 = list<>; + +using ty1 = type<int>; +using ty1 = list<A<true>>; + +using ty2 = type<int, int>; +using ty2 = list<A<true>, A<true>>; + +using ty3 = type<int, int, int>; +using ty3 = list<A<true>, A<true>, A<true>>; diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C new file mode 100644 index 00000000000..f500af3f616 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires30.C @@ -0,0 +1,10 @@ +// PR c++/105304 +// { dg-do compile { target c++20 } } +// { dg-additional-options "-Wall -Wsequence-point" } + +struct A { }; + +int main() { + if (requires { A(); }) + ; +} diff --git a/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C new file mode 100644 index 00000000000..4a8af29b086 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C @@ -0,0 +1,19 @@ +// PR c++/105233 +// { dg-do compile { target c++14 } } + +template <typename T> +constexpr T +foo (T x) noexcept +{ + bool a = __builtin_is_constant_evaluated (); + T b = 4 * alignof (int); + return x < b ? b : x; +} + +template <typename T> +struct A { T a, b, c; }; + +template <typename T> +struct alignas (foo (sizeof (A<T>))) B { A<T> d; }; + +B<int> e; diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init7.C b/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init7.C new file mode 100644 index 00000000000..f3c3899e97a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-pack-init7.C @@ -0,0 +1,18 @@ +// PR c++/102629 +// { dg-do compile { target c++20 } } + +template <class T> T&& forward(T&); +template <class T> T&& forward(T&&); + +struct S {}; + +template <typename... Args> +void foo(Args&&... args) { + [...args = forward<Args> /*(args)*/] { // { dg-error "" } + [](auto...) { } (forward<Args>(args)...); + }; +} + +void bar( ) { + foo(S{}); +} diff --git a/gcc/testsuite/g++.dg/diagnostic/using1.C b/gcc/testsuite/g++.dg/diagnostic/using1.C new file mode 100644 index 00000000000..eb4f18d1d8b --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/using1.C @@ -0,0 +1,16 @@ +// PR c++/102987 +// { dg-do compile { target c++11 } } + +struct a { + bool b(); +}; +template <typename c> struct d : c { + using c::e; + using f = d; + constexpr int g(decltype(e.b())) { return buh; } // { dg-error "buh" } +}; +struct h { + a e; +}; +using i = d<h>; +auto j = i{}.g(1); diff --git a/gcc/testsuite/g++.dg/ext/builtin-shufflevector-3.C b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-3.C new file mode 100644 index 00000000000..0f3cbbee563 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/builtin-shufflevector-3.C @@ -0,0 +1,23 @@ +// PR c++/105353 +// { dg-do compile { target c++17 } } +// { dg-additional-options "-Wno-psabi" } + +typedef unsigned char Simd128U8VectT __attribute__((__vector_size__(16))); + +template<int ShuffleIndex> +static inline Simd128U8VectT ShufFunc(Simd128U8VectT vect) noexcept { + if constexpr(unsigned(ShuffleIndex) >= 16) + return Simd128U8VectT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + else if constexpr(ShuffleIndex == 0) + return vect; + else + return __builtin_shufflevector(vect, vect, ShuffleIndex, ShuffleIndex + 1, + ShuffleIndex + 2, ShuffleIndex + 3, ShuffleIndex + 4, ShuffleIndex + 5, + ShuffleIndex + 6, ShuffleIndex + 7, ShuffleIndex + 8, ShuffleIndex + 9, + ShuffleIndex + 10, ShuffleIndex + 11, ShuffleIndex + 12, ShuffleIndex + 13, + ShuffleIndex + 14, ShuffleIndex + 15); +} + +auto func1(Simd128U8VectT vect) noexcept { + return ShufFunc<5>(vect); +} diff --git a/gcc/testsuite/g++.dg/ext/unsigned-typedef1.C b/gcc/testsuite/g++.dg/ext/unsigned-typedef1.C new file mode 100644 index 00000000000..360b5f81edf --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/unsigned-typedef1.C @@ -0,0 +1,9 @@ +// PR c++/102804 +// { dg-do compile { target c++11 } } +// { dg-options "-Wpedantic" } + +using int32_t = int; +enum: unsigned int32_t { foo }; // { dg-warning "int32_t" } +int f(int) = delete; +int f(unsigned); +auto x = f(1 ? foo : 1); diff --git a/gcc/testsuite/g++.dg/lookup/new3.C b/gcc/testsuite/g++.dg/lookup/new3.C new file mode 100644 index 00000000000..36afb5b48e2 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/new3.C @@ -0,0 +1,10 @@ +// PR c++/98249 + +#include <new> +struct Incomplete; +template<class T> struct Holder { T t; }; +Holder<Incomplete> *p; +void test() { + ::new (p) int; + new (p) int; +} diff --git a/gcc/testsuite/g++.dg/lto/pr105399_0.C b/gcc/testsuite/g++.dg/lto/pr105399_0.C new file mode 100644 index 00000000000..fc9149a7aa2 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr105399_0.C @@ -0,0 +1,9 @@ +// PR lto/105399 +// { dg-lto-do link } +// { dg-lto-options { { -fPIC -flto -Ofast } } } +// { dg-require-effective-target shared } +// { dg-require-effective-target fpic } +// { dg-extra-ld-options "-shared -O2" } + +struct S { S (); }; +S::S () {} diff --git a/gcc/testsuite/g++.dg/opt/const7.C b/gcc/testsuite/g++.dg/opt/const7.C new file mode 100644 index 00000000000..5bcf94897a8 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/const7.C @@ -0,0 +1,7 @@ +// PR c++/104142 +// { dg-do compile { target c++11 } } +// { dg-additional-options -Wunused-variable } + +struct B { B()=default; }; +static const B b_var; // { dg-bogus "" } +// { dg-final { scan-assembler-symbol-section {b_var} {^\.(const|rodata)|\[RO\]} } } diff --git a/gcc/testsuite/g++.dg/opt/pr104880.cc b/gcc/testsuite/g++.dg/opt/pr104880.C index de56a5acfd4..de56a5acfd4 100644 --- a/gcc/testsuite/g++.dg/opt/pr104880.cc +++ b/gcc/testsuite/g++.dg/opt/pr104880.C diff --git a/gcc/testsuite/g++.dg/opt/pr105235-1.C b/gcc/testsuite/g++.dg/opt/pr105235-1.C new file mode 100644 index 00000000000..b74d2034f5b --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr105235-1.C @@ -0,0 +1,12 @@ +// PR tree-optimization/105235 +// { dg-do compile } +// { dg-options "-O -fno-tree-dominator-opts -fexceptions -fnon-call-exceptions -fno-tree-fre" } + +struct S { ~S (); }; + +double +foo (double d) +{ + S s; + return __builtin_ilogbl (d) + __builtin_sinl (d); +} diff --git a/gcc/testsuite/g++.dg/opt/pr105306.C b/gcc/testsuite/g++.dg/opt/pr105306.C new file mode 100644 index 00000000000..552d37491bc --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr105306.C @@ -0,0 +1,13 @@ +// PR ipa/105306 +// { dg-do compile } +// { dg-options "-Ofast" } + +#pragma GCC optimize 0 +template <typename T> void foo (T); +struct B { ~B () {} }; +struct C { B f; }; +template <typename> struct E { + void bar () { foo (g); } + C g; +}; +template class E<char>; diff --git a/gcc/testsuite/g++.dg/parse/qualified6.C b/gcc/testsuite/g++.dg/parse/qualified6.C new file mode 100644 index 00000000000..68b51f771ec --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/qualified6.C @@ -0,0 +1,10 @@ +// PR c++/90107 +// { dg-do compile } + +struct A; +namespace N { extern A a; } +struct A {} ::N::a; + +struct A1; +struct B { static A1 a1; }; +struct A1 {} ::B::a1; diff --git a/gcc/testsuite/g++.dg/pr105276.C b/gcc/testsuite/g++.dg/pr105276.C new file mode 100644 index 00000000000..ad0e9dd7e09 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr105276.C @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +bool +foo(unsigned i) +{ + bool result = true; + while (i) + { + i = i % 3; + i = i - (i == 2 ? 2 : i ? 1 : 0); + result = !result; + } + return result; +} + +/* We should be able to eliminate the i - operation. */ +/* { dg-final { scan-tree-dump-not "i_.* - " "optimized" } } */ diff --git a/gcc/testsuite/g++.dg/template/conv19.C b/gcc/testsuite/g++.dg/template/conv19.C new file mode 100644 index 00000000000..7a3da939c1f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/conv19.C @@ -0,0 +1,34 @@ +// PR c++/101698 +// { dg-do compile { target c++11 } } + +class Base { + public: + template <class T> + operator const T&() const = delete; + + virtual operator const int&() const { + static int res; + return res; + } +}; + +template <class T> +class Derive : public Base { + public: + operator const T&() const override { + using Y = int; + //static_assert(__is_same_as(T,Y), ""); + + static int res; + + res = Base::operator const Y&(); // OK + res = Base::operator const T&(); // { dg-bogus "deleted" } + return res; + } +}; + +int main() { + Derive<int> a; + const int& b = a; + (void)b; +} diff --git a/gcc/testsuite/g++.dg/template/friend72.C b/gcc/testsuite/g++.dg/template/friend72.C new file mode 100644 index 00000000000..b499909076d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend72.C @@ -0,0 +1,15 @@ +// PR c++/91618 +// { dg-do link } + +template <class T> int f(T t) +{ return t.i; } + +class A { + friend int ::f(A); + int i; +}; + +int main() +{ + f(A()); // link error, trying to call non-template function +} diff --git a/gcc/testsuite/g++.dg/template/friend72a.C b/gcc/testsuite/g++.dg/template/friend72a.C new file mode 100644 index 00000000000..ef6834aae2d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend72a.C @@ -0,0 +1,14 @@ +// PR c++/91618 + +template <class T> int f(T t, int) +{ return t.i; } + +class A { + friend int ::f(A); // { dg-error "" } + int i; +}; + +int main() +{ + f(A()); // { dg-error "no match" } +} diff --git a/gcc/testsuite/g++.dg/template/friend73.C b/gcc/testsuite/g++.dg/template/friend73.C new file mode 100644 index 00000000000..d009ec7a990 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend73.C @@ -0,0 +1,5 @@ +// PR c++/96604 + +struct A { template<typename T> operator T(); }; +struct X {}; +struct B { friend A::operator X(); }; diff --git a/gcc/testsuite/g++.dg/template/partial-specialization11.C b/gcc/testsuite/g++.dg/template/partial-specialization11.C new file mode 100644 index 00000000000..556224a3104 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial-specialization11.C @@ -0,0 +1,11 @@ +// PR c++/86193 +// CWG 455 (active) +// { dg-options "" } // clear -pedantic-errors + +template<class T> struct value_type; + +template<class T, typename value_type<T>::type V> +struct A; + +template<class T, int V> +struct A<T*, V> { }; // { dg-warning "not more specialized" } diff --git a/gcc/testsuite/g++.dg/template/partial-specialization12.C b/gcc/testsuite/g++.dg/template/partial-specialization12.C new file mode 100644 index 00000000000..5f51e8a27de --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial-specialization12.C @@ -0,0 +1,12 @@ +// PR c++/105289 +// CWG 455 (active) +// { dg-do compile { target c++11 } } + +template<class T> +struct value_type; + +template<class List, typename value_type<List>::type Element> +struct push_front_vlist; + +template<template<class X, X...> class XList, class T, T Arg, T... Vs> +struct push_front_vlist<XList<T, Vs...>, Arg> { }; // { dg-error "not more specialized" } diff --git a/gcc/testsuite/g++.dg/template/using31.C b/gcc/testsuite/g++.dg/template/using31.C new file mode 100644 index 00000000000..bfeb94f2788 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/using31.C @@ -0,0 +1,16 @@ +// PR c++/105223 + +struct ServiceReferenceBase { + void operator=(int); +}; + +template<class> +struct ServiceReference : ServiceReferenceBase { + void foo() { operator=(0); } + using ServiceReferenceBase::operator=; +}; + +int main() { + ServiceReference<int> sr; + sr.foo(); +} diff --git a/gcc/testsuite/g++.dg/torture/builtin-clear-padding-5.C b/gcc/testsuite/g++.dg/torture/builtin-clear-padding-5.C new file mode 100644 index 00000000000..b5f01914781 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/builtin-clear-padding-5.C @@ -0,0 +1,44 @@ +// PR tree-optimization/102586 +// { dg-options "-Wno-inaccessible-base" } + +struct C0 {}; +struct C1 {}; +struct C2 : C1, virtual C0 {}; +struct C3 : virtual C2, C1 { virtual int foo () { return 1; } }; +struct C4 : virtual C3, C1 { virtual int foo () { return 2; } }; +struct C5 : C4 { virtual int foo () { return 3; } }; +struct C6 { char c; }; +struct C7 : virtual C6, virtual C3, C1 { virtual int foo () { return 4; } }; +struct C8 : C7 { virtual int foo () { return 5; } }; + +__attribute__((noipa)) int +bar (C5 *p) +{ + return p->foo (); +} + +__attribute__((noipa)) int +baz (C3 *p) +{ + return p->foo (); +} + +__attribute__((noipa)) int +qux (C8 *p) +{ + return p->foo (); +} + +int +main () +{ + C5 c5; + C8 c8; + c8.c = 42; + __builtin_clear_padding (&c5); + __builtin_clear_padding (&c8); + if (bar (&c5) != 3 || baz (&c5) != 3) + __builtin_abort (); + if (qux (&c8) != 5 || baz (&c8) != 5 || c8.c != 42) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/torture/pr105189.C b/gcc/testsuite/g++.dg/torture/pr105189.C new file mode 100644 index 00000000000..a3870772cfe --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr105189.C @@ -0,0 +1,19 @@ +// PR tree-optimization/105189 +// { dg-do run } + +int +foo () +{ + return -1; +} + +int +main () +{ + int c = foo () >= 0U && 1; + if (c != 1) + __builtin_abort (); + int d = foo () >= 3U && 1; + if (d != 1) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/vect/pr105254.cc b/gcc/testsuite/g++.dg/vect/pr105254.cc new file mode 100644 index 00000000000..34814671a54 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr105254.cc @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fvect-cost-model=dynamic -mcpu=zeus" { target aarch64*-*-* } } */ + +template <typename> +struct complex; + +template <> +struct complex<double> { + void operator+= (complex r) { v_ += r.v_; } + _Complex v_; +}; + +template <typename T> +void +bar (T); + +void +foo (complex<double> *x) +{ + complex<double> s = {0.0}; + + for (int i = 0; i < 16; ++i) + s += x[i]; + + bar<complex<double> > (s); +} diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-11.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-11.C new file mode 100644 index 00000000000..a6fe82e90ae --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-11.C @@ -0,0 +1,15 @@ +// PR c++/100370 +// { dg-do compile { target c++11 } } + +using size_t = decltype(sizeof(1)); +inline void *operator new (size_t s, void *p) { return p; } + +int main() +{ + struct s1 { int iv[4]; }; + struct s2 { union { char* cp; int* ip; }; }; + + s2 b; + b.ip=new int[8]; + new (b.ip+4) s1; // { dg-bogus "-Wplacement-new" } +} diff --git a/gcc/testsuite/g++.dg/warn/pr104492.C b/gcc/testsuite/g++.dg/warn/pr104492.C new file mode 100644 index 00000000000..229414d6dd3 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr104492.C @@ -0,0 +1,115 @@ +// PR middle-end/104492 +// { dg-do compile { target c++14 } } +// { dg-options "-O3 -Wall" } + +namespace std { +typedef decltype (sizeof 0) size_t; +template <typename _Tp, _Tp __v> struct integral_constant { + static constexpr _Tp value = __v; +}; +template <typename _Tp, typename _Up> +struct is_same : integral_constant<bool, __is_same(_Tp, _Up)> {}; +template <bool, typename> struct enable_if; +template <typename _Tp> _Tp forward; +} +class QString; +struct random_access_iterator_tag {}; +template <typename> struct iterator_traits { + typedef random_access_iterator_tag iterator_category; +}; +template <typename _Iter> +typename iterator_traits<_Iter>::iterator_category __iterator_category(_Iter); +namespace __gnu_cxx { +namespace __ops { +template <typename> struct _Iter_equals_val { + template <typename _Iterator> bool operator()(_Iterator); +}; +template <typename _Value> _Iter_equals_val<_Value> __iter_equals_val(_Value); +} +} +namespace std { +template <typename _RandomAccessIterator, typename _Predicate> +_RandomAccessIterator __find_if(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Predicate __pred, + random_access_iterator_tag) { + if (__pred(__first)) + return __first; + return __last; +} +template <typename _Iterator, typename _Predicate> +_Iterator __find_if(_Iterator __first, _Iterator __last, _Predicate __pred) { + return __find_if(__first, __last, __pred, __iterator_category(__first)); +} +template <typename _Tp, size_t _Nm> _Tp *begin(_Tp (&__arr)[_Nm]) { + return __arr; +} +template <typename _Tp, size_t _Nm> _Tp *end(_Tp (&__arr)[_Nm]) { + return __arr + _Nm; +} +template <typename _InputIterator, typename _Tp> +_InputIterator find(_InputIterator __first, _InputIterator __last, _Tp __val) { + return __find_if(__first, __last, __gnu_cxx::__ops::__iter_equals_val(__val)); +} +} +struct QStringView { + template <typename T> + using if_compatible_qstring_like = std::enable_if<std::is_same<T, QString>::value, bool>; + template <typename String> QStringView(String); +}; +template <typename Haystack, typename> struct QStringTokenizerBase { + class sentinel {}; + struct iterator { + Haystack operator*(); + iterator operator++(int); + bool operator!=(sentinel); + }; + iterator begin(); + template <bool = std::is_same<iterator, sentinel>::value> sentinel end(); +}; +namespace QtPrivate { +namespace Tok { +template <typename Haystack, typename Needle> +using TokenizerBase = QStringTokenizerBase<Haystack, Needle>; +} +} +template <typename Haystack, typename Needle> +struct QStringTokenizer + : public QtPrivate::Tok::TokenizerBase<Haystack, Needle> { + QStringTokenizer(Haystack, Needle); +}; +namespace QtPrivate { +namespace Tok { +template <typename Haystack, typename Needle> +using TokenizerResult = QStringTokenizer<Haystack, Needle>; +} +} +template <typename Haystack, typename Needle> +auto qTokenize(Haystack, Needle) + -> decltype(QtPrivate::Tok::TokenizerResult<Haystack, Needle>{ + std::forward<Haystack>, std::forward<Needle>}); +struct QLatin1String { + QLatin1String(const char *) {} +}; +class QString {}; +class QLibrary { + bool isLibrary(const QString &); +}; + +bool QLibrary::isLibrary(const QString &fileName) +{ + QString completeSuffix = fileName; + auto isValidSuffix = [](QStringView s) { + const QLatin1String candidates[] = { + QLatin1String("so"), + }; + return std::find(std::begin(candidates), std::end(candidates), s) != std::end(candidates); + }; + auto suffixes = qTokenize(completeSuffix, u'.'); + auto it = suffixes.begin(); + const auto end = suffixes.end(); + while (it != end) { + if (isValidSuffix(*it++)) // { dg-bogus "dangling pointer to .candidates. may be used" } + return true; + } + return false; +} diff --git a/gcc/testsuite/g++.target/i386/mv31.C b/gcc/testsuite/g++.target/i386/mv31.C new file mode 100644 index 00000000000..70a40f1e28a --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv31.C @@ -0,0 +1,11 @@ +// PR c++/104669 +// { dg-require-ifunc "" } + +void bar() +{ + int foo(void); + int foo(void) __attribute__((target("sse"))); + int foo(void) __attribute__((target("default"))); + int (*p)(void) = &foo; + return; +} diff --git a/gcc/testsuite/g++.target/i386/vec-tmpl1.C b/gcc/testsuite/g++.target/i386/vec-tmpl1.C new file mode 100644 index 00000000000..e0865e3515b --- /dev/null +++ b/gcc/testsuite/g++.target/i386/vec-tmpl1.C @@ -0,0 +1,17 @@ +// PR c++/65211 +// { dg-additional-options "-Wno-psabi" } +// { dg-final { scan-assembler-not "movdqa" } } + +typedef unsigned v4ui __attribute__ ((vector_size(16), aligned (16))); + +template<int I> +static v4ui t1(unsigned *dest_data) +{ + typedef unsigned v4ui_1 __attribute__ ((vector_size (16), aligned (4))); + return ((const v4ui_1*)dest_data)[0]; +} + +v4ui f(unsigned int *array) +{ + return t1<1>(array+7); +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/const2.C b/gcc/testsuite/g++.target/powerpc/const2.C index 27f4c265851..27f4c265851 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/const2.C +++ b/gcc/testsuite/g++.target/powerpc/const2.C diff --git a/gcc/testsuite/g++.dg/other/darwin-minversion-1.C b/gcc/testsuite/g++.target/powerpc/darwin-minversion-1.C index cbf5ff1d20b..cbf5ff1d20b 100644 --- a/gcc/testsuite/g++.dg/other/darwin-minversion-1.C +++ b/gcc/testsuite/g++.target/powerpc/darwin-minversion-1.C diff --git a/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C b/gcc/testsuite/g++.target/powerpc/ppc64-sighandle-cr.C index 32561736077..32561736077 100644 --- a/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C +++ b/gcc/testsuite/g++.target/powerpc/ppc64-sighandle-cr.C diff --git a/gcc/testsuite/g++.dg/eh/simd-4.C b/gcc/testsuite/g++.target/powerpc/simd-4.C index 8c9b58bf868..a01f19c2736 100644 --- a/gcc/testsuite/g++.dg/eh/simd-4.C +++ b/gcc/testsuite/g++.target/powerpc/simd-4.C @@ -1,4 +1,4 @@ -/* { dg-do run { target powerpc*-*-darwin* } } */ +/* { dg-do run { target *-*-darwin* } } */ /* { dg-options "-fexceptions -fnon-call-exceptions -O -maltivec" } */ #include <cstdlib> diff --git a/gcc/testsuite/g++.dg/eh/simd-5.C b/gcc/testsuite/g++.target/powerpc/simd-5.C index 71e117ead2a..71e117ead2a 100644 --- a/gcc/testsuite/g++.dg/eh/simd-5.C +++ b/gcc/testsuite/g++.target/powerpc/simd-5.C diff --git a/gcc/testsuite/g++.dg/other/spu2vmx-1.C b/gcc/testsuite/g++.target/powerpc/spu2vmx-1.C index d9c8faf9459..496b46c22c9 100644 --- a/gcc/testsuite/g++.dg/other/spu2vmx-1.C +++ b/gcc/testsuite/g++.target/powerpc/spu2vmx-1.C @@ -1,4 +1,4 @@ -/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-do compile } */ /* { dg-require-effective-target powerpc_spu } */ /* { dg-options "-maltivec" } */ diff --git a/gcc/testsuite/g++.dg/eh/uncaught3.C b/gcc/testsuite/g++.target/powerpc/uncaught3.C index 1b3333eaab3..f891401584e 100644 --- a/gcc/testsuite/g++.dg/eh/uncaught3.C +++ b/gcc/testsuite/g++.target/powerpc/uncaught3.C @@ -1,4 +1,4 @@ -// { dg-do compile { target powerpc*-*-darwin* } } +// { dg-do compile { target *-*-darwin* } } // { dg-final { scan-assembler-not "__cxa_get_exception" } } // { dg-options "-mmacosx-version-min=10.4" } // { dg-additional-options "-Wno-deprecated" { target c++17 } } diff --git a/gcc/testsuite/g++.target/s390/pr102024-1.C b/gcc/testsuite/g++.target/s390/pr102024-1.C new file mode 100644 index 00000000000..a2cdd40df2a --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr102024-1.C @@ -0,0 +1,12 @@ +// PR target/102024 +// { dg-do compile } + +struct S { float a; int : 0; }; +void foo (struct S x); + +void +bar (void) +{ + struct S s = { 0.0f }; + foo (s); // { dg-message "with zero-width bit fields members changed in GCC 12" } +} diff --git a/gcc/testsuite/g++.target/s390/pr102024-2.C b/gcc/testsuite/g++.target/s390/pr102024-2.C new file mode 100644 index 00000000000..3ca7ce666d9 --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr102024-2.C @@ -0,0 +1,14 @@ +// PR target/102024 +// { dg-do compile } + +/* struct would never be passed in an FPR so no warning expected. */ + +struct S { float a; int :0; float b; }; +void foo (struct S x); + +void +bar (void) +{ + struct S s = { 0.0f }; + foo (s); // { dg-bogus "with zero-width bit fields members changed in GCC 12" } +} diff --git a/gcc/testsuite/g++.target/s390/pr102024-3.C b/gcc/testsuite/g++.target/s390/pr102024-3.C new file mode 100644 index 00000000000..51514c3fcf5 --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr102024-3.C @@ -0,0 +1,15 @@ +// PR target/102024 +// { dg-do compile } + +/* struct S would not be passed as single value anyway so no warning expected. */ + +struct T { float a; float b; }; +struct S { struct T t; int :0; }; +void foo (struct S x); + +void +bar (void) +{ + struct S s = { { 0.0f, 0.0f } }; + foo (s); // { dg-bogus "with zero-width bit fields members changed in GCC 12" } +} diff --git a/gcc/testsuite/g++.target/s390/pr102024-4.C b/gcc/testsuite/g++.target/s390/pr102024-4.C new file mode 100644 index 00000000000..075d5713f49 --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr102024-4.C @@ -0,0 +1,15 @@ +// PR target/102024 +// { dg-do compile } + +/* struct S would not be passed as single value anyway so no warning expected. */ + +struct T { float a; int :0; }; +struct S { struct T t; int x; }; +void foo (struct S x); + +void +bar (void) +{ + struct S s = { { 0.0f }, 0 }; + foo (s); // { dg-bogus "with zero-width bit fields members changed in GCC 12" } +} diff --git a/gcc/testsuite/g++.target/s390/pr102024-5.C b/gcc/testsuite/g++.target/s390/pr102024-5.C new file mode 100644 index 00000000000..a4355e71da2 --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr102024-5.C @@ -0,0 +1,14 @@ +// PR target/102024 +// { dg-do compile } + +struct U { float a; int :0; }; +struct T { struct U u; }; +struct S { struct T t; }; +void foo (struct S x); + +void +bar (void) +{ + struct S s = { { { 0.0f } } }; + foo (s); // { dg-message "with zero-width bit fields members changed in GCC 12" } +} diff --git a/gcc/testsuite/g++.target/s390/pr102024-6.C b/gcc/testsuite/g++.target/s390/pr102024-6.C new file mode 100644 index 00000000000..9dd506e59c8 --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr102024-6.C @@ -0,0 +1,12 @@ +// PR target/102024 +// { dg-do compile } + +struct S { int :0; float a; }; +void foo (struct S x); + +void +bar (void) +{ + struct S s = { 0.0f }; + foo (s); // { dg-message "with zero-width bit fields members changed in GCC 12" } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/103818.c b/gcc/testsuite/gcc.c-torture/compile/103818.c new file mode 100644 index 00000000000..e6cbe7860cf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/103818.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target lp64 } } */ +struct A { int b[1]; }; + +void +foo (struct A *d) +{ + d->b[0] = d->b[-144115188075855873LL] + d->b[11] * d->b[2] + + d->b[0] % d->b[1025] + d->b[5]; + d->b[0] = d->b[144678138029277184LL] + d->b[0] & d->b[-3] * d->b[053] + + d->b[7] ^ d->b[-9] + d->b[14] + d->b[9] % d->b[49] + + d->b[024] + d->b[82] & d->b[4096]; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr103376.c b/gcc/testsuite/gcc.c-torture/compile/pr103376.c new file mode 100644 index 00000000000..8c14c3ded38 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr103376.c @@ -0,0 +1,9 @@ +/* { dg-additional-options "-Ofast" } */ +__attribute__ ((optimize ("no-associative-math"))) double +fn3 (double h, double l) +{ + return h + l; +} + +double fn3 (double, double) __attribute__ ((optimize ("O2,no-associative-math"))); + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr105234.c b/gcc/testsuite/gcc.c-torture/compile/pr105234.c new file mode 100644 index 00000000000..3fdfed8b562 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr105234.c @@ -0,0 +1,14 @@ +/* PR target/105234 */ +/* { dg-do compile } */ + +static inline __attribute__((always_inline)) int foo (int x) { return x + 1; } +#pragma GCC push_options +static inline __attribute__((always_inline)) int bar (int x) { return x + 2; } +#pragma GCC pop_options +static inline __attribute__((always_inline)) int baz (int x) { return x + 3; } + +int +qux (void) +{ + return foo (bar (baz (42))); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr105247.c b/gcc/testsuite/gcc.c-torture/compile/pr105247.c new file mode 100644 index 00000000000..88892d98453 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr105247.c @@ -0,0 +1,10 @@ +/* PR target/105247 */ + +int a; + +void +foo (void) +{ + int y = -8; + a = 1 << y; +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr103892.c b/gcc/testsuite/gcc.dg/analyzer/pr103892.c new file mode 100644 index 00000000000..e9775b69ad0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr103892.c @@ -0,0 +1,75 @@ +/* { dg-additional-options "-O2" } */ + +extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__)); + +enum pipecmd_tag +{ + PIPECMD_PROCESS, + PIPECMD_SEQUENCE +}; + +struct pipecmd { + enum pipecmd_tag tag; + union { + struct pipecmd_process { + int argc; + int argv_max; + char **argv; + } process; + struct pipecmd_sequence { + int ncommands; + int commands_max; + struct pipecmd **commands; + } sequence; + } u; +}; + +static char *argstr_get_word (const char **argstr) +{ + while (**argstr) { + switch (**argstr) { + case ' ': + case '\t': + return (void *) 0; + } + } + return (void *) 0; +} + +struct pipecmd *pipecmd_new_argstr (const char *argstr) +{ + argstr_get_word (&argstr); + return (void *) 0; +} + +void pipecmd_free (struct pipecmd *cmd) +{ + int i; + + if (!cmd) + return; + + switch (cmd->tag) { + case PIPECMD_PROCESS: { + struct pipecmd_process *cmdp = &cmd->u.process; + + for (i = 0; i < cmdp->argc; ++i) + free (cmdp->argv[i]); + free (cmdp->argv); + + break; + } + + case PIPECMD_SEQUENCE: { + struct pipecmd_sequence *cmds = &cmd->u.sequence; + + for (i = 0; i < cmds->ncommands; ++i) + pipecmd_free (cmds->commands[i]); + free (cmds->commands); + + break; + } + } + + free (cmd); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr104308.c b/gcc/testsuite/gcc.dg/analyzer/pr104308.c index 9cd5ee6feee..a3a0cbb7317 100644 --- a/gcc/testsuite/gcc.dg/analyzer/pr104308.c +++ b/gcc/testsuite/gcc.dg/analyzer/pr104308.c @@ -1,8 +1,19 @@ +/* Verify that we have source locations for + -Wanalyzer-use-of-uninitialized-value warnings involving folded + memory ops. */ + #include <string.h> -int main() +int test_memmove_within_uninit (void) { char s[5]; /* { dg-message "region created on stack here" } */ memmove(s, s + 1, 2); /* { dg-warning "use of uninitialized value" } */ return 0; } + +int test_memcpy_from_uninit (void) +{ + char a1[5]; + char a2[5]; /* { dg-message "region created on stack here" } */ + return (memcpy(a1, a2, 5) == a1); /* { dg-warning "use of uninitialized value" } */ +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr105252.c b/gcc/testsuite/gcc.dg/analyzer/pr105252.c new file mode 100644 index 00000000000..a093eababc5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr105252.c @@ -0,0 +1,20 @@ +/* { dg-additional-options "-fnon-call-exceptions -O" } */ + +typedef unsigned char C; +typedef unsigned char __attribute__((__vector_size__ (4))) V; + +C m; + +static inline void +bar (C c, V v, V *r) +{ + v %= (c | v) % m; + *r = v; +} + +void +foo (void) +{ + V x; + bar (0, (V){2}, &x); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr105365.c b/gcc/testsuite/gcc.dg/analyzer/pr105365.c new file mode 100644 index 00000000000..aa576d08632 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr105365.c @@ -0,0 +1,17 @@ +/* { dg-require-effective-target int128 } */ + +typedef _Float32 f32; +typedef _Complex _Float32 cf32; +_Float32 g; +__int128 i; + +extern void bar(int); + +void +foo(_Float32 k) { + f32 f = 0; + f /= (_Complex char)__builtin_llround(g); + k /= (cf32)__builtin_copysignf(0, i); + bar(f + k); + foo(0); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr105366.c b/gcc/testsuite/gcc.dg/analyzer/pr105366.c new file mode 100644 index 00000000000..3dba870e4e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr105366.c @@ -0,0 +1,19 @@ +/* { dg-require-effective-target int128 } */ +/* { dg-additional-options "-O" } */ + +extern void bar(int); +extern void baz(void); + +typedef unsigned u32; + +void +foo(u32 u, __int128 i) { + baz(); + _Complex int c = i; + c /= (u32)(__UINTPTR_TYPE__)foo; + short s = (short)(__UINTPTR_TYPE__)foo; + u /= (_Complex short)s; + u32 r = u + c; + bar(r); + foo(0, 0); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/pr96841.c b/gcc/testsuite/gcc.dg/analyzer/pr96841.c index c76658288b7..14f3f7a86a3 100644 --- a/gcc/testsuite/gcc.dg/analyzer/pr96841.c +++ b/gcc/testsuite/gcc.dg/analyzer/pr96841.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-Wno-analyzer-too-complex -O1 -Wno-builtin-declaration-mismatch" } */ +/* { dg-additional-options "-O1 -Wno-builtin-declaration-mismatch" } */ int l8 (void); diff --git a/gcc/testsuite/gcc.dg/analyzer/symbolic-9.c b/gcc/testsuite/gcc.dg/analyzer/symbolic-9.c new file mode 100644 index 00000000000..54ed30f132c --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/symbolic-9.c @@ -0,0 +1,197 @@ +#include "analyzer-decls.h" + +struct st +{ + void *ptr[10]; + int arr[10]; +}; + +/* Various combinations of a pair of writes, involving + symbolic vs concrete clusters, with symbolic vs concrete keys + within them. */ + +struct st g; + +/* "ptr" write: fully concrete. */ + +struct st +test_conc_conc_ptr_conc_conc_arr (void) +{ + struct st s; + s.ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + s.arr[5] = 42; + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + __analyzer_describe (0, s.arr[5]); /* { dg-warning "42" } */ + return s; +} + +struct st +test_conc_conc_ptr_conc_sym_arr (int j) +{ + struct st s; + s.ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + s.arr[j] = 42; + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, s.arr[j]); /* { dg-warning "42" } */ + return s; +} + +struct st +test_conc_conc_ptr_sym_conc_arr (struct st *p) +{ + struct st s; + s.ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + p->arr[5] = 42; + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + __analyzer_describe (0, p->arr[5]); /* { dg-warning "42" } */ + return s; +} + +struct st +test_conc_conc_ptr_sym_sym_arr (struct st *p, int j) +{ + struct st s; + s.ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + p->arr[j] = 42; + __analyzer_describe (0, s.ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + __analyzer_describe (0, p->arr[j]); /* { dg-warning "42" } */ + return s; +} + +/* "ptr" write: symbolic region, but at concrete offset. */ + +void +test_sym_conc_ptr_conc_conc_arr (struct st *p) +{ + p->ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + g.arr[5] = 42; + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, g.arr[5]); /* { dg-warning "42" } */ +} + +void +test_sym_conc_ptr_conc_sym_arr (struct st *p, int j) +{ + p->ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + g.arr[j] = 42; + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, g.arr[j]); /* { dg-warning "42" } */ +} + +void +test_sym_conc_ptr_sym_conc_arr (struct st *p, struct st *q) +{ + p->ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + q->arr[5] = 42; + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, q->arr[5]); /* { dg-warning "42" } */ +} + +void +test_sym_conc_ptr_sym_sym_arr (struct st *p, struct st *q, int j) +{ + p->ptr[1] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + q->arr[j] = 42; + __analyzer_describe (0, p->ptr[1]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, q->arr[j]); /* { dg-warning "42" } */ +} + +/* "ptr" write: concrete region, but at symbolic offset. */ + +struct st +test_conc_sym_ptr_conc_conc_arr (int i) +{ + struct st s; + s.ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + s.arr[5] = 42; + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, s.arr[5]); /* { dg-warning "42" } */ + return s; +} + +struct st +test_conc_sym_ptr_conc_sym_arr (int i, int j) +{ + struct st s; + s.ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + s.arr[j] = 42; + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, s.arr[j]); /* { dg-warning "42" } */ + return s; +} + +struct st +test_conc_sym_ptr_sym_conc_arr (int i, struct st *p) +{ + struct st s; + s.ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + p->arr[5] = 42; + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + __analyzer_describe (0, p->arr[5]); /* { dg-warning "42" } */ + return s; +} /* { dg-bogus "leak" "PR analyzer/105190" { xfail *-*-* } } */ + +struct st +test_conc_sym_ptr_sym_sym_arr (int i, struct st *p, int j) +{ + struct st s; + s.ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + p->arr[j] = 42; + __analyzer_describe (0, s.ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + __analyzer_describe (0, p->arr[j]); /* { dg-warning "42" } */ + return s; +} /* { dg-bogus "leak" "PR analyzer/105190" { xfail *-*-* } } */ + +/* "ptr" write: symbolic region, with symbolic offset. */ + +void +test_sym_sym_ptr_conc_conc_arr (struct st *p, int i) +{ + p->ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + g.arr[5] = 42; + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, g.arr[5]); /* { dg-warning "42" } */ +} + +void +test_sym_sym_ptr_conc_sym_arr (struct st *p, int i, int j) +{ + p->ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + g.arr[j] = 42; + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, g.arr[j]); /* { dg-warning "42" } */ +} + +void +test_sym_sym_ptr_sym_conc_arr (struct st *p, int i, struct st *q) +{ + p->ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + q->arr[5] = 42; + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, q->arr[5]); /* { dg-warning "42" } */ +} + +void +test_sym_sym_ptr_sym_sym_arr (struct st *p, int i, struct st *q, int j) +{ + p->ptr[i] = __builtin_malloc (1024); + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "HEAP_ALLOCATED_REGION" } */ + q->arr[j] = 42; + __analyzer_describe (0, p->ptr[i]); /* { dg-warning "UNKNOWN" } */ + __analyzer_describe (0, q->arr[j]); /* { dg-warning "42" } */ +} diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/leak-pr102308-1.c b/gcc/testsuite/gcc.dg/analyzer/torture/leak-pr102308-1.c new file mode 100644 index 00000000000..31747168505 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/torture/leak-pr102308-1.c @@ -0,0 +1,19 @@ +#include <stdlib.h> + +struct s { + char *p; + int arr[2]; +}; + +int main(void) { + struct s *s = malloc(sizeof *s); + if (s) { + s->p = malloc(1); + for (int i = 0; i < 2; i++) + s->arr[i] = -1; /* { dg-bogus "leak" } */ + } + if (s) { + free(s->p); + free(s); + } +} diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/leak-pr102308-2.c b/gcc/testsuite/gcc.dg/analyzer/torture/leak-pr102308-2.c new file mode 100644 index 00000000000..d65f1768a26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/torture/leak-pr102308-2.c @@ -0,0 +1,12 @@ +#include <stdlib.h> +struct s { + char *p; + int arr[1]; +}; +int main(void) { + struct s s; + s.p = malloc(1); + for (int i = 0; i < 1; i++) + s.arr[i] = -1; /* { dg-bogus "leak" } */ + free(s.p); +} diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/symbolic-10.c b/gcc/testsuite/gcc.dg/analyzer/torture/symbolic-10.c new file mode 100644 index 00000000000..b2f3a8a1d86 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/torture/symbolic-10.c @@ -0,0 +1,40 @@ +/* Verify that -fanalyzer considers that mmfs escapes when passing either: + *(mmfs + i) + and + (&mmfs[i]) + to an external function (for symbolic i). */ + +typedef struct s_mmfile { + char *ptr; + long size; +} mmfile_t; + +void init_mmfile(mmfile_t *ptr); + +long test__init_via_ptr_arith__read_via_array_idx(int i) +{ + mmfile_t mmfs[3]; + init_mmfile(mmfs + i); + return mmfs[i].size; /* { dg-bogus "uninit" } */ +} + +long test__init_via_array_idx__read_via_ptr_arith(int i) +{ + mmfile_t mmfs[3]; + init_mmfile(&mmfs[i]); + return (mmfs + i)->size; /* { dg-bogus "uninit" } */ +} + +long test__ptr_arith_for_both(int i) +{ + mmfile_t mmfs[3]; + init_mmfile(mmfs + i); + return (mmfs + i)->size; /* { dg-bogus "uninit" } */ +} + +long test__array_idx_for_both(int i) +{ + mmfile_t mmfs[3]; + init_mmfile(&mmfs[i]); + return mmfs[i].size; /* { dg-bogus "uninit" } */ +} diff --git a/gcc/testsuite/gcc.dg/asan/pr105214.c b/gcc/testsuite/gcc.dg/asan/pr105214.c new file mode 100644 index 00000000000..a755336c7d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr105214.c @@ -0,0 +1,16 @@ +/* PR target/105214 */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */ +/* { dg-options "-Ofast -fnon-call-exceptions -fexceptions -fstack-check=generic -fsanitize=address -fno-finite-math-only -fsignaling-nans -fno-associative-math" } */ + +float f; +void bar (int *); + +void +foo (void) +{ + int a[1600], b[1]; + f += __builtin_log1pf (f); + bar (a); + bar (b); +} diff --git a/gcc/testsuite/gcc.dg/asan/pr105396.c b/gcc/testsuite/gcc.dg/asan/pr105396.c new file mode 100644 index 00000000000..d4bd7f12476 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr105396.c @@ -0,0 +1,19 @@ +/* PR sanitizer/105396 */ +/* { dg-do run } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ +/* { dg-shouldfail "asan" } */ + +int +main () +{ + int a; + int *b[1]; + int c[10]; + int d[1][1]; + for (a = 0; a < 1; a++) + d[1][a] = 0; + return 0; +} + +/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" } */ +/* { dg-output "WRITE of size.*" } */ diff --git a/gcc/testsuite/gcc.dg/builtin-apply2.c b/gcc/testsuite/gcc.dg/builtin-apply2.c index 9049af5821f..0f350f4ac16 100644 --- a/gcc/testsuite/gcc.dg/builtin-apply2.c +++ b/gcc/testsuite/gcc.dg/builtin-apply2.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-require-effective-target untyped_assembly } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-* nds32*-*-* amdgcn-*-*" } } */ -/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs." { "csky*-*-* riscv*-*-* or1k*-*-* msp430-*-* pru-*-*" } } */ +/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs." { "csky*-*-* riscv*-*-* or1k*-*-* msp430-*-* pru-*-* loongarch*-*-*" } } */ /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { arm*-*-* && arm_hf_eabi } } */ /* PR target/12503 */ diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c index 2a19da050fe..4721c4fb2f9 100644 --- a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-2.c @@ -5,34 +5,26 @@ TBD_CTF_FORMAT_OPEN_ISSUES (1) - This testcase makes a note of the case of a probable misrepresentation. - See Note 1 and Note 2 below. + See Note 1 below. In the CTF section, these types are encoded as : Variables: - _CTF_NEWSTR -> 7: const char [0] (size 0x0) - _CTF_SECTION -> 6: const char [5] (size 0x5) - b1 -> 2: int [0] (size 0x0) - b2 -> 3: int [0] (size 0x0) + b1 -> 3: int [0] (size 0x0) + b2 -> 5: int [0] (size 0x0) Note 1 : There is misrepresentation in that b1 and b2 are specified differently by the user. - Note 2 : It is arguable though whether the representation for - _CTF_NEWSTR is incorrect. */ + + In this testcase, two CTF array records each of type int [0] is expected. */ /* { dg-do compile ) */ /* { dg-options "-O0 -gctf -dA" } */ -/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 5 } } */ +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ -/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 3 } } */ -/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 2 } } */ static int b1[] = {}; int b2[0]; - -const char _CTF_SECTION[] = ".ctf"; - -extern const char _CTF_NEWSTR[]; -const char _CTF_NEWSTR[] = "ctfinfo"; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c new file mode 100644 index 00000000000..ec504412ef5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-array-5.c @@ -0,0 +1,17 @@ +/* CTF generation for unsized (but initialized) arrays + + In this testcase, one CTF array type record of size 5 is expected. + + Variables: + _CTF_SECTION -> 5: const const char [5] (size 0x5) -> 4: const char [5] (size 0x5) + +*/ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 1 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0x5\[\t \]+\[^\n\]*cta_nelems" 1 } } */ + +const char _CTF_SECTION[] = ".ctf"; diff --git a/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c new file mode 100644 index 00000000000..8aea1e82749 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-3.c @@ -0,0 +1,22 @@ +/* CTF generation for extern variable with defining and non-defining decl + in the same CU. + + This testcase checks the case when a non-defining decl is followed by + a defining decl for the same variable. See PR debug/105089. + + In this testcase, although two CTF array types are generated, only a + single CTF variable and a single entry in the CTF object info section + are expected. */ + +/* { dg-do compile ) */ +/* { dg-options "-O0 -gctf -dA" } */ + +/* { dg-final { scan-assembler-times "0x12000000\[\t \]+\[^\n\]*ctt_info" 2 } } */ + +/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "\[\t \]0x8\[\t \]+\[^\n\]*cta_nelems" 1 } } */ +/* { dg-final { scan-assembler-times "ctv_name" 1 } } */ +/* { dg-final { scan-assembler-times "objtinfo_var_type" 1 } } */ + +extern const char _CTF_NEWSTR[]; +const char _CTF_NEWSTR[] = "ctfinfo"; diff --git a/gcc/testsuite/gcc.dg/ipa/pr105160.c b/gcc/testsuite/gcc.dg/ipa/pr105160.c new file mode 100644 index 00000000000..ea80545b102 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr105160.c @@ -0,0 +1,77 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-ipa-modref" } */ +#define sysreg_read(regname) \ +({ \ + unsigned long __sr_val; \ + asm volatile(""); \ + \ + __sr_val; \ +}) + +#define sysreg_write(regname, __sw_val) \ +do { \ + asm volatile(""); \ +} while (0) + +#define isb() \ +do { \ + asm volatile( \ + "isb" \ + : \ + : \ + : "memory"); \ +} while (0) + +static unsigned long sctlr_read(void) +{ + return sysreg_read(sctlr_el1); +} + +static void sctlr_write(unsigned long val) +{ + sysreg_write(sctlr_el1, val); +} + +static void sctlr_rmw(void) +{ + unsigned long val; + + val = sctlr_read(); + val |= 1UL << 7; + sctlr_write(val); +} + +void sctlr_read_multiple(void) +{ + sctlr_read(); + sctlr_read(); + sctlr_read(); + sctlr_read(); +} + +void sctlr_write_multiple(void) +{ + sctlr_write(0); + sctlr_write(0); + sctlr_write(0); + sctlr_write(0); + sctlr_write(0); +} + +void sctlr_rmw_multiple(void) +{ + sctlr_rmw(); + sctlr_rmw(); + sctlr_rmw(); + sctlr_rmw(); +} + +void function(void) +{ + sctlr_read_multiple(); + sctlr_write_multiple(); + sctlr_rmw_multiple(); + + isb(); +} +/* { dg-final { scan-ipa-dump-not "Function found to be const" "modref" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/remref-7.c b/gcc/testsuite/gcc.dg/ipa/remref-7.c index b2c26ab7fd5..152b9d0ca94 100644 --- a/gcc/testsuite/gcc.dg/ipa/remref-7.c +++ b/gcc/testsuite/gcc.dg/ipa/remref-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-early-inlining -fno-ipa-sra -fdump-ipa-inline" } */ +/* { dg-options "-O2 -fno-early-inlining -fno-ipa-sra -fdump-ipa-inline --param max-inline-insns-auto=100" } */ int rglobal = 0; int g; diff --git a/gcc/testsuite/gcc.dg/lto/pr94157_0.c b/gcc/testsuite/gcc.dg/lto/pr94157_0.c index a6e308b855b..a76141b1809 100644 --- a/gcc/testsuite/gcc.dg/lto/pr94157_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr94157_0.c @@ -1,6 +1,6 @@ /* { dg-lto-do link } */ /* { dg-require-effective-target gas } */ -/* { dg-lto-options { { -O0 -fipa-vrp -flto -Wa,--noexecstack -Wa,--noexecstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack } } } */ +/* { dg-lto-options { { -O0 -fipa-vrp -flto -Wa,--noexecstack -Wa,--noexecstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wa,--execstack -Wl,-z,execstack} } } */ int main() { diff --git a/gcc/testsuite/gcc.dg/pr105140.c b/gcc/testsuite/gcc.dg/pr105140.c index da34e7ad656..7d30985e850 100644 --- a/gcc/testsuite/gcc.dg/pr105140.c +++ b/gcc/testsuite/gcc.dg/pr105140.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Os -w -Wno-psabi" } */ -/* { dg-skip-if "PR105147" { powerpc*-*-* } } */ +/* { dg-skip-if "PR105147" { powerpc*-*-* s390*-*-* } } */ typedef char __attribute__((__vector_size__ (16 * sizeof (char)))) U; typedef int __attribute__((__vector_size__ (16 * sizeof (int)))) V; diff --git a/gcc/testsuite/gcc.dg/pr105149.c b/gcc/testsuite/gcc.dg/pr105149.c new file mode 100644 index 00000000000..b748f454d6d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105149.c @@ -0,0 +1,16 @@ +/* PR c/105149 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include <stdarg.h> + +void +foo (int s, ...) +{ + int e; + va_list ap; + + va_start (ap, s); + e = va_arg (ap, int (void)) (); /* { dg-error "second argument to 'va_arg' is a function type" } */ + va_end (ap); +} diff --git a/gcc/testsuite/gcc.dg/pr105150.c b/gcc/testsuite/gcc.dg/pr105150.c new file mode 100644 index 00000000000..900460c1555 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105150.c @@ -0,0 +1,8 @@ +/* PR tree-optimization/105150 */ +/* { dg-options "-w -Ofast" } */ + +#define A(name) __typeof (__builtin_##name (0)) name (); \ + float name##1 () { return !name (1); } \ + double name##2 () { return name (1.0L); } +#define B(name) A(name) A(name##l) +B (sqrt) diff --git a/gcc/testsuite/gcc.dg/pr105165.c b/gcc/testsuite/gcc.dg/pr105165.c new file mode 100644 index 00000000000..055a10528b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105165.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +unsigned int _Complex a0; +unsigned int _Complex +foo (unsigned int _Complex a1, unsigned int _Complex a2) +{ + unsigned int _Complex x; + asm goto ("" : "=r" (x) : : : lab); /* { dg-message "sorry, unimplemented" } */ + a0 = x; + lab: + return x + a1 + a2 + 1; +} diff --git a/gcc/testsuite/gcc.dg/pr105175.c b/gcc/testsuite/gcc.dg/pr105175.c new file mode 100644 index 00000000000..d8d7edb942a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105175.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wvector-operation-performance" } */ +/* { dg-additional-options "-mno-sse" { target x86_64-*-* i?86-*-* } } */ + +enum { QEMU_MIGRATION_COOKIE_PERSISTENT = 1 }; +struct { + unsigned flags; + unsigned flagsMandatory; +} qemuMigrationCookieGetPersistent_mig; +void qemuMigrationCookieGetPersistent() +{ + qemuMigrationCookieGetPersistent_mig.flags &= /* { dg-bogus "will be expanded" } */ + QEMU_MIGRATION_COOKIE_PERSISTENT; + qemuMigrationCookieGetPersistent_mig.flagsMandatory &= + QEMU_MIGRATION_COOKIE_PERSISTENT; +} diff --git a/gcc/testsuite/gcc.dg/pr105211.c b/gcc/testsuite/gcc.dg/pr105211.c new file mode 100644 index 00000000000..9bafe6feb19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105211.c @@ -0,0 +1,11 @@ +/* PR rtl-optimization/105211 */ +/* { dg-do compile } */ +/* { dg-options "-Os -ffast-math" } */ +/* { dg-add-options float32 } */ +/* { dg-require-effective-target float32 } */ + +short +foo (_Float32 f) +{ + return __builtin_roundf (f); +} diff --git a/gcc/testsuite/gcc.dg/pr105218.c b/gcc/testsuite/gcc.dg/pr105218.c new file mode 100644 index 00000000000..0070057c32d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105218.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/105218 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ + +int a, c; +void bar (void); + +void +foo (void) +{ + int b = 131; + if (a) + b = c == 2 ? 1 : c; + while (b) + bar (); +} diff --git a/gcc/testsuite/gcc.dg/pr105226.c b/gcc/testsuite/gcc.dg/pr105226.c new file mode 100644 index 00000000000..9c4941dc6fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105226.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ +/* { dg-require-effective-target indirect_jumps } */ + +#include <setjmp.h> +struct longjmp_buf { + jmp_buf buf; +}; +void g (); +void f () +{ + int i, n; + long *a; + long *args; + struct longjmp_buf b; + setjmp (b.buf); + for (;;) + { + for (i = 0; i < n; i++) + a[i] = args[i]; + g (); + } +} diff --git a/gcc/testsuite/gcc.dg/pr105250.c b/gcc/testsuite/gcc.dg/pr105250.c new file mode 100644 index 00000000000..4683e0e63a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105250.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-w -Wno-psabi -O2" } */ +/* { dg-skip-if "PR105266" { powerpc*-*-* s390*-*-* } } */ + +typedef int __attribute__((__vector_size__(4))) T; +typedef int __attribute__((__vector_size__(8))) U; +typedef int __attribute__((__vector_size__(16))) V; +typedef int __attribute__((__vector_size__(32))) W; +typedef _Float32 __attribute__((__vector_size__(16))) F; +typedef _Float64 __attribute__((__vector_size__(32))) G; +void foo(); + +foo(int, int, int, int, U, U, V, V, W, W, int, + T, int, U, U, V, V, W, W, T, + T, int, U, U, V, V, W, W, T, + T, int, W, W, T, T, int, int, int, + int, int, int, W, int, int, int, int, int, int, + V, W, T, int, int, U, F, int, int, int, + int, int, int, G) +{ + foo(0, 0, 0, 0, (U){}, (U){}, (V){}, (V){}, (W){}, + (W){}, 2, (T){}, 0, 0, 0, 0, (U){}, (U){}, + (V){}, (V){}, (W){}, (W){}, (T){}, + (T){}, 0, 0, 0, 0, (U){}, (U){}, (V){}, + (V){}, (W){}, (W){}, (T){}, (T){}, 0, 0, 0, + 0, 0, 0, (T){}, + (T){}, (W){}, + (W){}, (T){}, (T){}, 0, 0, 0, 0, 0, 0, (W){}, + (V){}, (W){}, (T){}, 0, 0, (U){}, (F){}); +} diff --git a/gcc/testsuite/gcc.dg/pr105257.c b/gcc/testsuite/gcc.dg/pr105257.c new file mode 100644 index 00000000000..4232942d791 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105257.c @@ -0,0 +1,16 @@ +/* PR target/105257 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +extern int sigsetjmp (void **, int); +void *buf[32]; +void (*fn) (void); + +const char * +bar (void) +{ + sigsetjmp (buf, 0); + fn (); + return ""; +} diff --git a/gcc/testsuite/gcc.dg/pr105263.c b/gcc/testsuite/gcc.dg/pr105263.c new file mode 100644 index 00000000000..5cb7fcd09a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105263.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target dfp } } */ +/* { dg-options "-O -ffast-math -w -Wno-psabi" } */ + +typedef _Decimal64 __attribute__((__vector_size__ (8))) U; +typedef _Decimal64 __attribute__((__vector_size__ (16))) V; + +V v; + +U +foo (U u) +{ + u *= u; + u *= -(U){ v[1] }; + return u; +} diff --git a/gcc/testsuite/gcc.dg/pr105331.c b/gcc/testsuite/gcc.dg/pr105331.c new file mode 100644 index 00000000000..06cf6d6d901 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105331.c @@ -0,0 +1,11 @@ +/* PR target/105331 */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +#include <stdarg.h> + +int +foo (va_list *va) +{ + return va_arg (*va, double _Complex); /* { dg-bogus "may be used uninitialized" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr105333.c b/gcc/testsuite/gcc.dg/pr105333.c new file mode 100644 index 00000000000..bd8bd4cd56c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105333.c @@ -0,0 +1,21 @@ +/* PR rtl-optimization/105333 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-Og -fno-tree-coalesce-vars -fno-tree-fre" } */ + +int g; +short s; + +static inline unsigned short +bar (short a, __int128 b) +{ + b ^= (unsigned long) -a; + __builtin_strncpy ((void *) &s, (void *) &a, 1); + b *= 14; + return b; +} + +void +foo (void) +{ + g *= (__int128) bar (1, 1); +} diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index 1d7d1fee435..21cce0f440c 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-1.c +++ b/gcc/testsuite/gcc.dg/stack-usage-1.c @@ -105,6 +105,8 @@ # define SIZE 252 #elif defined (__CRIS__) # define SIZE 252 +#elif defined (__loongarch_lp64) +# define SIZE 240 /* 256 - 8 bytes for $fp, and 8 bytes for a temp value */ #else # define SIZE 256 #endif diff --git a/gcc/testsuite/gcc.dg/torture/pr100810.c b/gcc/testsuite/gcc.dg/torture/pr100810.c new file mode 100644 index 00000000000..63566f530f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100810.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ + +int a, b = 1, c = 1, e, f = 1, g, h, j; +volatile int d; +static void k() +{ + int i; + h = b; + if (c && a >= 0) { + while (a) { + i++; + h--; + } + if (g) + for (h = 0; h < 2; h++) + ; + if (!b) + i &&d; + } +} +static void l() +{ + for (; j < 1; j++) + if (!e && c && f) + k(); +} +int main() +{ + if (f) + l(); + if (h != 1) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr104676.c b/gcc/testsuite/gcc.dg/torture/pr104676.c index 50845bb9e15..0991b78f758 100644 --- a/gcc/testsuite/gcc.dg/torture/pr104676.c +++ b/gcc/testsuite/gcc.dg/torture/pr104676.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-additional-options "-ftree-loop-distribution -ftree-parallelize-loops=2" } */ +/* { dg-additional-options "-ftree-loop-distribution -ftree-parallelize-loops=2" { target pthread } } */ struct S { int f; diff --git a/gcc/testsuite/gcc.dg/torture/pr105185.c b/gcc/testsuite/gcc.dg/torture/pr105185.c new file mode 100644 index 00000000000..6ab32360de1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr105185.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +int foo (fmt) +char* fmt; +{ + return (__builtin_strchr (fmt, '*') != 0 + || __builtin_strchr (fmt, 'n') != 0); +} +void bar () +{ + if (foo ()) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr105198.c b/gcc/testsuite/gcc.dg/torture/pr105198.c new file mode 100644 index 00000000000..91f92afc163 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr105198.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fno-tree-pre -fpredictive-commoning" } */ + +static __attribute__ ((noipa)) void +next_set(int *x, int n, int k) +{ + int j = k - 1; + int tmp = x[j]++; + while (j > 0) + { + if (x[j] < n - (k - 1 -j)) + break; + j--; + x[j]++; + tmp = x[j]; + } + if (tmp != 2 || j != 1 || x[0] != 0 || x[1] != 2 || x[2] != 5) + __builtin_abort (); +} + +int main() +{ + int x[3] = {0, 1, 4}; + next_set(x, 5, 3); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr105231.c b/gcc/testsuite/gcc.dg/torture/pr105231.c new file mode 100644 index 00000000000..00121fd8d1e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr105231.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target dfp } */ +/* { dg-additional-options "-fsanitize-coverage=trace-pc -fnon-call-exceptions --param=max-cse-insns=1 -frounding-math" } */ +/* { dg-additional-options "-mstack-arg-probe" { target x86_64-*-* i?86-*-* } } */ + +void baz (int *); +void bar (double, double, _Decimal64); + +void +foo (void) +{ + int s __attribute__((cleanup (baz))); + bar (0xfffffffffffffffe, 0xebf3fff2fbebaf7f, 0xffffffffffffff); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr105337.c b/gcc/testsuite/gcc.dg/torture/pr105337.c new file mode 100644 index 00000000000..4a0bdf0363c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr105337.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ + +__attribute__((noipa)) void +bar (int x) +{ + (void) x; +} + +int a; + +int +foo (void) +{ + int b, c; + for (b = 0; b < 3; b++) + { + if (!a) + break; + c--; + bar (c); + } + return b; +} + +int +main () +{ + if (foo ()) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr104639-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr104639-1.c new file mode 100644 index 00000000000..183fa374afc --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr104639-1.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/104639 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-not "PHI <" "optimized" } } */ +/* { dg-final { scan-tree-dump-times "i_\[0-9]*\\\(D\\\) != 0;" 1 "optimized" } } */ + +_Bool +foo (int i) +{ + while (i == 4) + i += 2; + return i; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr104639-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr104639-2.c new file mode 100644 index 00000000000..e2511470675 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr104639-2.c @@ -0,0 +1,54 @@ +/* PR tree-optimization/104639 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-pre -g -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-not "PHI <" "optimized" } } */ +/* { dg-final { scan-tree-dump-times "x_\[0-9]*\\\(D\\\) != 42;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "y_\[0-9]*\\\(D\\\) > 6;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "z_\[0-9]*\\\(D\\\) > 9;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "u_\[0-9]*\\\(D\\\) <= 7;" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "v_\[0-9]*\\\(D\\\) <= 42;" 1 "optimized" } } */ + +int +f1 (int x) +{ + if (x == 4) + x = 6; + int xd = x; + return x != 42; +} + +int +f2 (int y) +{ + if (y == 4) + y = 6; + int yd = y; + return y > 6; +} + +int +f3 (int z) +{ + if (z == 4) + z = 6; + int zd = z; + return z >= 10; +} + +int +f4 (int u) +{ + if (u == 4) + u = 6; + int ud = u; + return u < 8; +} + +int +f5 (int v) +{ + if (v == 4) + v = 6; + int vd = v; + return v <= 42; +} diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-double.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-double.c index f935405e3d9..5cff373b80d 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-double.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-double.c @@ -6,7 +6,7 @@ #define N 200 #include "complex-add-template.c" -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 2 "vect" { target { vect_complex_add_double } } } } */ -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 2 "vect" { target { vect_complex_add_double } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_double } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_double } } } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-float.c index 71f391db7bb..312df88ee68 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-float.c @@ -6,7 +6,7 @@ #define N 200 #include "complex-add-template.c" -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 2 "vect" { target { vect_complex_add_float } } } } */ -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 2 "vect" { target { vect_complex_add_float } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_float } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_float } } } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-half-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-half-float.c index e5b826f1ca7..c656a2f6d56 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-half-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-half-float.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target vect_complex_add_half } */ /* { dg-require-effective-target float16 } */ /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ @@ -6,5 +7,7 @@ #define N 200 #include "complex-add-template.c" -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 2 "vect" { target { vect_complex_add_half } } } } */ -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 2 "vect" { target { vect_complex_add_half } } } } */ +/* Vectorization is failing for these cases. They should work but for now ignore. */ + +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "slp1" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "slp1" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c index 5b70d834c24..9c8b99bc003 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-double.c @@ -6,8 +6,7 @@ #define N 200 #include "complex-add-pattern-template.c" -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 4 "vect" { target { vect_complex_add_double } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_double } } } } */ /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_double } } } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ -/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "slp1" } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c index 3ef05645a2c..ca5f5b257d3 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-float.c @@ -6,8 +6,7 @@ #define N 200 #include "complex-add-pattern-template.c" -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 4 "vect" { target { vect_complex_add_float } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_float } } } } */ /* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_float } } } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ -/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "slp1" } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c index 06a9216add7..c6617f5dad0 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-add-pattern-half-float.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target vect_float } */ +/* { dg-require-effective-target vect_complex_add_half } */ /* { dg-require-effective-target float16 } */ /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ @@ -7,10 +7,8 @@ #define N 200 #include "complex-add-pattern-template.c" -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 4 "vect" { target { vect_complex_add_half } } } } */ -/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_half } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" { target { vect_complex_add_half } } } } */ +/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" { target { vect_complex_add_half } && ! target { arm*-*-* } } } } */ -/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "slp1" } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT270" "vect" } } */ -/* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "slp1" } } */ /* { dg-final { scan-tree-dump "Found COMPLEX_ADD_ROT90" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mla-half-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mla-half-float.c index 34146f3d1e7..7beb6b8b5d8 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mla-half-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mla-half-float.c @@ -1,5 +1,7 @@ /* { dg-do compile } */ /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ +/* { dg-require-effective-target vect_complex_add_half } */ +/* { dg-require-effective-target float16 } */ #define TYPE _Float16 #define N 200 diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-double.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-double.c index 0982a2b8ead..fc4cd6151c7 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-double.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-double.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target vect_complex_add_double } */ /* { dg-add-options arm_v8_3a_complex_neon } */ #define TYPE double diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-float.c index a069533b22a..a931ca61387 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-float.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target vect_complex_add_float } */ /* { dg-add-options arm_v8_3a_complex_neon } */ #define TYPE float diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-half-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-half-float.c index 89ac54c2a42..dd153e49902 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-half-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mls-half-float.c @@ -1,4 +1,6 @@ /* { dg-do compile } */ +/* { dg-require-effective-target vect_complex_add_half } */ +/* { dg-require-effective-target float16 } */ /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ #define TYPE _Float16 diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-double.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-double.c index 56a8ea4ae02..b6b21529a10 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-double.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-double.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target vect_complex_add_double } */ /* { dg-add-options arm_v8_3a_complex_neon } */ #define TYPE double diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-float.c index 969416d7dc7..aa8efb4c2db 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-float.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target vect_complex_add_float } */ /* { dg-add-options arm_v8_3a_complex_neon } */ #define TYPE float diff --git a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-half-float.c b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-half-float.c index da1b9213a6b..51331625745 100644 --- a/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-half-float.c +++ b/gcc/testsuite/gcc.dg/vect/complex/fast-math-complex-mul-half-float.c @@ -1,4 +1,6 @@ /* { dg-do compile } */ +/* { dg-require-effective-target vect_complex_add_half } */ +/* { dg-require-effective-target float16 } */ /* { dg-add-options arm_v8_3a_fp16_complex_neon } */ #define TYPE _Float16 diff --git a/gcc/testsuite/gcc.dg/vect/pr105219.c b/gcc/testsuite/gcc.dg/vect/pr105219.c new file mode 100644 index 00000000000..0cb7ae2f4d6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr105219.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-additional-options "-O3" } */ +/* { dg-additional-options "-mtune=intel" { target x86_64-*-* i?86-*-* } } */ + +#include "tree-vect.h" + +int data[128]; + +void __attribute((noipa)) +foo (int *data, int n) +{ + for (int i = 0; i < n; ++i) + data[i] = i; +} + +int main() +{ + check_vect (); + for (int start = 0; start < 16; ++start) + for (int n = 1; n < 3*16; ++n) + { + __builtin_memset (data, 0, sizeof (data)); + foo (&data[start], n); + for (int j = 0; j < n; ++j) + if (data[start + j] != j) + __builtin_abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index 5271608cde5..dcaef1e0a37 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -121,7 +121,7 @@ et-dg-runtest dg-runtest [lsort \ set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS lappend DEFAULT_VECTCFLAGS "-ffast-math" et-dg-runtest dg-runtest [lsort \ - [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsv\]*.\[cS\]]] \ + [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsvc\]*.\[cS\]]] \ "" $DEFAULT_VECTCFLAGS # -ffast-math SLP tests diff --git a/gcc/testsuite/gcc.target/aarch64/pr103350-1.c b/gcc/testsuite/gcc.target/aarch64/pr103350-1.c index 61c796dc6e8..a0e764e8653 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr103350-1.c +++ b/gcc/testsuite/gcc.target/aarch64/pr103350-1.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target le } } */ /* { dg-additional-options "-Os -fno-tree-ter -save-temps -fdump-rtl-ree-all -free -std=c99 -w" } */ typedef unsigned char u8; diff --git a/gcc/testsuite/gcc.target/aarch64/pr103350-2.c b/gcc/testsuite/gcc.target/aarch64/pr103350-2.c index 2696212710b..f799dfc77ce 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr103350-2.c +++ b/gcc/testsuite/gcc.target/aarch64/pr103350-2.c @@ -1,4 +1,4 @@ -/* { dg-do run } */ +/* { dg-do run { target le } } */ /* { dg-additional-options "-O2 -save-temps -fdump-rtl-ree-all -free -std=c99 -w" } */ typedef unsigned char __attribute__((__vector_size__ (8))) v64u8; diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr105197-1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr105197-1.c new file mode 100644 index 00000000000..e33532d8bed --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr105197-1.c @@ -0,0 +1,20 @@ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-additional-options "-O -ftree-vectorize" } */ + +unsigned char arr_7[9][3]; +unsigned char (*main_arr_7)[3] = arr_7; +int main() { + char arr_2[9]; + int arr_6[9]; + int x; + unsigned i; + for (i = 0; i < 9; ++i) { + arr_2[i] = 21; + arr_6[i] = 6; + } + for (i = arr_2[8] - 21; i < 2; i++) + x = arr_6[i] ? (main_arr_7[8][i] ? main_arr_7[8][i] : 8) : (char)arr_6[i]; + if (x != 8) + __builtin_abort (); +} + diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr105197-2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr105197-2.c new file mode 100644 index 00000000000..5eec5cd837d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr105197-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O -ftree-vectorize" } */ + +void f(int n, int y, char *arr_2, char *arr_6) { + for (int i = y; i < n; i++) + arr_6[i] = arr_6[i] ? (arr_2[i] ? 3 : 8) : 1; +} + +/* { dg-final { scan-assembler-not {\tand\tp[0-9]+.b} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/vadd_reduc-1.c b/gcc/testsuite/gcc.target/aarch64/vadd_reduc-1.c new file mode 100644 index 00000000000..271a1c3e8c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vadd_reduc-1.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +#include <arm_neon.h> + +typedef int v4si __attribute__ ((vector_size (16))); + +/* +**bar: +** ... +** addv s0, v0.4s +** fmov w0, s0 +** lsr w1, w0, 16 +** add w0, w1, w0, uxth +** ret +*/ +int bar (v4si x) +{ + unsigned int sum = vaddvq_s32 (x); + return (((uint16_t)(sum & 0xffff)) + ((uint32_t)sum >> 16)); +} diff --git a/gcc/testsuite/gcc.target/aarch64/vadd_reduc-2.c b/gcc/testsuite/gcc.target/aarch64/vadd_reduc-2.c new file mode 100644 index 00000000000..0ad96954ff7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vadd_reduc-2.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3 -std=c99" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +#include <stdint.h> + +#pragma GCC target "+nosve" + +/* +**test: +** ... +** addv s0, v0.4s +** fmov w0, s0 +** and w1, w0, 65535 +** add w0, w1, w0, lsr 16 +** lsr w0, w0, 1 +** ret +*/ +int test (uint8_t *p, uint32_t t[1][1], int n) { + + int sum = 0; + uint32_t a0; + for (int i = 0; i < 4; i++, p++) + t[i][0] = p[0]; + + for (int i = 0; i < 4; i++) { + { + int t0 = t[0][i] + t[0][i]; + a0 = t0; + }; + sum += a0; + } + return (((uint16_t)sum) + ((uint32_t)sum >> 16)) >> 1; +} diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp index ddbb4439314..2fa648c61da 100644 --- a/gcc/testsuite/gcc.target/arm/multilib.exp +++ b/gcc/testsuite/gcc.target/arm/multilib.exp @@ -135,14 +135,17 @@ if {[multilib_config "aprofile"] } { {-march=armv8.6-a+simd+fp16 -mfloat-abi=softfp} "thumb/v8-a+simd/softfp" {-march=armv8.6-a+simd+fp16+nofp -mfloat-abi=softfp} "thumb/v8-a/nofp" {-march=armv8.6-a+simd+nofp+fp16 -mfloat-abi=softfp} "thumb/v8-a+simd/softfp" - {-march=armv9-a+crypto -mfloat-abi=soft} "thumb/v9-a/nofp" - {-march=armv9-a+simd+crypto -mfloat-abi=softfp} "thumb/v9-a+simd/softfp" - {-march=armv9-a+simd+crypto+nofp -mfloat-abi=softfp} "thumb/v9-a/nofp" - {-march=armv9-a+simd+nofp+crypto -mfloat-abi=softfp} "thumb/v9-a+simd/softfp" - {-march=armv9-a+fp16 -mfloat-abi=soft} "thumb/v9-a/nofp" - {-march=armv9-a+simd+fp16 -mfloat-abi=softfp} "thumb/v9-a+simd/softfp" - {-march=armv9-a+simd+fp16+nofp -mfloat-abi=softfp} "thumb/v9-a/nofp" - {-march=armv9-a+simd+nofp+fp16 -mfloat-abi=softfp} "thumb/v9-a+simd/softfp" + {-march=armv9-a+crypto -mfloat-abi=soft} "thumb/v8-a/nofp" + {-march=armv9-a+simd+crypto -mfloat-abi=softfp} "thumb/v8-a+simd/softfp" + {-march=armv9-a+simd+crypto+nofp -mfloat-abi=softfp} "thumb/v8-a/nofp" + {-march=armv9-a+simd+nofp+crypto -mfloat-abi=softfp} "thumb/v8-a+simd/softfp" + {-march=armv9-a+fp16 -mfloat-abi=soft} "thumb/v8-a/nofp" + {-march=armv9-a+simd+fp16 -mfloat-abi=softfp} "thumb/v8-a+simd/softfp" + {-march=armv9-a+simd+fp16+nofp -mfloat-abi=softfp} "thumb/v8-a/nofp" + {-march=armv9-a+simd+nofp+fp16 -mfloat-abi=softfp} "thumb/v8-a+simd/softfp" + {-march=armv9-a+simd -mfpu=auto -mfloat-abi=hard} "thumb/v8-a+simd/hard" + {-march=armv9-a+simd -mfpu=auto -mfloat-abi=hard -marm} "thumb/v8-a+simd/hard" + {-march=armv9-a+simd -mfpu=auto -mfloat-abi=hard -mthumb} "thumb/v8-a+simd/hard" {-mcpu=cortex-a53+crypto -mfloat-abi=hard} "thumb/v8-a+simd/hard" {-mcpu=cortex-a53+nofp -mfloat-abi=softfp} "thumb/v8-a/nofp" {-march=armv8-a+crc -mfloat-abi=hard -mfpu=vfp} "thumb/v8-a+simd/hard" diff --git a/gcc/testsuite/gcc.target/arm/pr105312.c b/gcc/testsuite/gcc.target/arm/pr105312.c new file mode 100644 index 00000000000..a02831bcbcf --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr105312.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon_ok } */ +/* { dg-options "-mcpu=cortex-a15" } */ +/* { dg-add-options arm_neon } */ + +typedef float stress_matrix_type_t; +typedef unsigned int size_t; +static void __attribute__((optimize("-O3"))) stress_matrix_xy_identity( + const size_t n, + stress_matrix_type_t a[restrict n][n], + stress_matrix_type_t b[restrict n][n], + stress_matrix_type_t r[restrict n][n]) +{ + register size_t i; + (void)a; + (void)b; + for (i = 0; i < n; i++) { + register size_t j; + for (j = 0; j < n; j++) + r[i][j] = (i == j) ? 1.0 : 0.0; + return; + } +} diff --git a/gcc/testsuite/gcc.target/arm/reg_equal_test.c b/gcc/testsuite/gcc.target/arm/reg_equal_test.c index 58fa9dd9b94..d87c75cc27c 100644 --- a/gcc/testsuite/gcc.target/arm/reg_equal_test.c +++ b/gcc/testsuite/gcc.target/arm/reg_equal_test.c @@ -1,24 +1,15 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-rtl-expand" } */ +/* { dg-options "-fgimple -O1 -fdump-rtl-expand" } */ +/* { dg-skip-if "" { ! { arm_thumb2_ok || arm_thumb1_movt_ok } } } */ -extern void abort (void); -unsigned int a = 1; - -int -main (void) +void __GIMPLE (ssa,startwith ("expand")) +x () { - unsigned int b, c, d; - - if (sizeof (int) != 4 || (int) 0xc7d24b5e > 0) - return 0; - - c = 0xc7d24b5e; - d = a | -2; - b = (d == 0) ? c : (c % d); - if (b != c) - abort (); + unsigned int d; - return 0; + __BB(2,guessed_local(1073741824)): + d_1 = 3352447838u; + return; } /* { dg-final { scan-rtl-dump "expr_list:REG_EQUAL \\(const_int -942519458" "expand" } } */ diff --git a/gcc/testsuite/gcc.target/arm/simd/pr105374.C b/gcc/testsuite/gcc.target/arm/simd/pr105374.C new file mode 100644 index 00000000000..2b9096f1f52 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/simd/pr105374.C @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ + +typedef float v4f __attribute__((vector_size(4 * sizeof(float)))); +v4f f_x, f_y; +long f() { return (f_x < f_y | f_x <= f_y)[2]; } diff --git a/gcc/testsuite/gcc.target/i386/auto-init-4.c b/gcc/testsuite/gcc.target/i386/auto-init-4.c index 1803dd45842..5b4fd870c36 100644 --- a/gcc/testsuite/gcc.target/i386/auto-init-4.c +++ b/gcc/testsuite/gcc.target/i386/auto-init-4.c @@ -15,5 +15,6 @@ long double foo() } -/* { dg-final { scan-assembler-times "long\t-16843010" 5 { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-times "long\t-16843010" 3 { target { ia32 } } } } */ +/* The long double init isn't expanded optimally, see PR105259. For ia32 + it uses zero-initialization. */ +/* { dg-final { scan-assembler-times "long\t-16843010" 3 } } */ diff --git a/gcc/testsuite/gcc.target/i386/crc32-6.c b/gcc/testsuite/gcc.target/i386/crc32-6.c index 464e3444069..7f2b42df3a2 100644 --- a/gcc/testsuite/gcc.target/i386/crc32-6.c +++ b/gcc/testsuite/gcc.target/i386/crc32-6.c @@ -10,4 +10,4 @@ test_mm_crc32_u8 (unsigned int CRC, unsigned char V) return _mm_crc32_u8 (CRC, V); } -/* { dg-error "needs isa option -mcrc32" "" { target *-*-* } 0 } */ +/* { dg-error "target specific option mismatch" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.target/i386/crc32-7.c b/gcc/testsuite/gcc.target/i386/crc32-7.c new file mode 100644 index 00000000000..2e310e38b82 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/crc32-7.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcrc32" } */ +/* { dg-final { scan-assembler "crc32b\[^\\n\]*eax" } } */ +/* { dg-final { scan-assembler "crc32w\[^\\n\]*eax" } } */ +/* { dg-final { scan-assembler "crc32l\[^\\n\]*eax" } } */ +/* { dg-final { scan-assembler "crc32q\[^\\n\]*rax" { target { ! ia32 } } } } */ + +#include <immintrin.h> + +unsigned int +test_mm_crc32_u8 (unsigned int CRC, unsigned char V) +{ + return _mm_crc32_u8 (CRC, V); +} + +unsigned int +test_mm_crc32_u16 (unsigned int CRC, unsigned short V) +{ + return _mm_crc32_u16 (CRC, V); +} + +unsigned int +test_mm_crc32_u32 (unsigned int CRC, unsigned int V) +{ + return _mm_crc32_u32 (CRC, V); +} + +#ifdef __x86_64__ +unsigned long long +test_mm_crc32_u64 (unsigned long long CRC, unsigned long long V) +{ + return _mm_crc32_u64 (CRC, V); +} +#endif diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c index 970aa741971..860fcc9f801 100644 --- a/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-10.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=skylake -mno-sse" } */ -/* { dg-final { scan-assembler "jmp\tmemcpy" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler "jmp\t_?memcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\t_?memcpy" { target ia32 } } } */ /* { dg-final { scan-assembler-not "rep movsb" } } */ void diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c index 83c333b551d..833e37fa325 100644 --- a/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-5.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=tigerlake -mno-sse" } */ -/* { dg-final { scan-assembler "jmp\tmemcpy" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\tmemcpy" { target ia32 } } } */ +/* { dg-final { scan-assembler "jmp\t_?memcpy" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\t_?memcpy" { target ia32 } } } */ /* { dg-final { scan-assembler-not "rep movsb" } } */ void diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-5.c b/gcc/testsuite/gcc.target/i386/memset-strategy-5.c index dc1de8e79c2..73ce2df6060 100644 --- a/gcc/testsuite/gcc.target/i386/memset-strategy-5.c +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-5.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=tigerlake -mno-sse" } */ -/* { dg-final { scan-assembler "jmp\tmemset" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler "jmp\t_?memset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\t_?memset" { target ia32 } } } */ /* { dg-final { scan-assembler-not "rep stosb" } } */ void diff --git a/gcc/testsuite/gcc.target/i386/memset-strategy-7.c b/gcc/testsuite/gcc.target/i386/memset-strategy-7.c index 07c2816910c..653829e6fc7 100644 --- a/gcc/testsuite/gcc.target/i386/memset-strategy-7.c +++ b/gcc/testsuite/gcc.target/i386/memset-strategy-7.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=skylake -mno-sse" } */ -/* { dg-final { scan-assembler "jmp\tmemset" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\tmemset" { target ia32 } } } */ +/* { dg-final { scan-assembler "jmp\t_?memset" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\t_?memset" { target ia32 } } } */ /* { dg-final { scan-assembler-not "rep stosb" } } */ void diff --git a/gcc/testsuite/gcc.target/i386/pr103941-1.c b/gcc/testsuite/gcc.target/i386/pr103941-1.c new file mode 100644 index 00000000000..524fdd0b4b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr103941-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +unsigned char ur[16], ua[16], ub[16]; + +void avgu_v2qi (void) +{ + int i; + + for (i = 0; i < 2; i++) + ur[i] = (ua[i] + ub[i] + 1) >> 1; +} + +/* { dg-final { scan-assembler "pavgb" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr103941-2.c b/gcc/testsuite/gcc.target/i386/pr103941-2.c new file mode 100644 index 00000000000..972a32be997 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr103941-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +void foo (int *c, float *x, float *y) +{ + c[0] = x[0] < y[0]; + c[1] = x[1] < y[1]; + c[2] = x[2] < y[2]; + c[3] = x[3] < y[3]; +} + +/* { dg-final { scan-assembler "cmpltps" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr105253.c b/gcc/testsuite/gcc.target/i386/pr105253.c new file mode 100644 index 00000000000..79444e5b28b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr105253.c @@ -0,0 +1,17 @@ +/* PR middle-end/105253 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-popcnt" } */ +/* { dg-final { scan-assembler-not "__popcount\[sd]i2" } } */ + +int +foo (unsigned long long *p) +{ + int i, cnt = 0; + unsigned long long elem; + for (i = 0; i < 4; i++) + { + for (elem = p[i]; elem; cnt++) + elem &= elem - 1; + } + return cnt; +} diff --git a/gcc/testsuite/gcc.target/i386/pr105338.c b/gcc/testsuite/gcc.target/i386/pr105338.c new file mode 100644 index 00000000000..a7b879444f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr105338.c @@ -0,0 +1,26 @@ +/* PR target/105338 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-ipa-icf -masm=att" } */ +/* { dg-final { scan-assembler-times "\tnegl\t" 3 } } */ +/* { dg-final { scan-assembler-times "\tsbbl\t" 3 } } */ +/* { dg-final { scan-assembler-times "\tandl\t" 3 } } */ + +int +foo (int i) +{ + return i ? 5 : 0; +} + +int +bar (int b) +{ + return !!b * 5; +} + +int +baz (int b) +{ + if (!b) + return 0; + return 5; +} diff --git a/gcc/testsuite/gcc.target/i386/pr105367.c b/gcc/testsuite/gcc.target/i386/pr105367.c new file mode 100644 index 00000000000..558e3e58e4e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr105367.c @@ -0,0 +1,12 @@ +/* PR target/105367 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -mveclibabi=acml" } */ + +_Float64 g; + +void +foo (void) +{ + _Float64 f = __builtin_sin (g); + g = __builtin_fmax (__builtin_sin (f), f); +} diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c index 956a9d16f84..f41493b93f3 100644 --- a/gcc/testsuite/gcc.target/i386/sse-14.c +++ b/gcc/testsuite/gcc.target/i386/sse-14.c @@ -430,7 +430,9 @@ test_3 (_mm_maskz_mul_round_sd, __m128d, __mmask8, __m128d, __m128d, 9) test_3 (_mm512_maskz_mul_round_ps, __m512, __mmask16, __m512, __m512, 9) test_3 (_mm_maskz_mul_round_ss, __m128, __mmask8, __m128, __m128, 9) test_3 (_mm512_maskz_scalef_round_pd, __m512d, __mmask8, __m512d, __m512d, 9) +test_3 (_mm_maskz_scalef_round_sd, __m128d, __mmask8, __m128d, __m128d, 9) test_3 (_mm512_maskz_scalef_round_ps, __m512, __mmask16, __m512, __m512, 9) +test_3 (_mm_maskz_scalef_round_ss, __m128, __mmask8, __m128, __m128, 9) test_3 (_mm512_maskz_shuffle_f32x4, __m512, __mmask16, __m512, __m512, 1) test_3 (_mm512_maskz_shuffle_f64x2, __m512d, __mmask8, __m512d, __m512d, 1) test_3 (_mm512_maskz_shuffle_i32x4, __m512i, __mmask16, __m512i, __m512i, 1) @@ -545,7 +547,9 @@ test_4 (_mm_mask_mul_round_sd, __m128d, __m128d, __mmask8, __m128d, __m128d, 9) test_4 (_mm512_mask_mul_round_ps, __m512, __m512, __mmask16, __m512, __m512, 9) test_4 (_mm_mask_mul_round_ss, __m128, __m128, __mmask8, __m128, __m128, 9) test_4 (_mm512_mask_scalef_round_pd, __m512d, __m512d, __mmask8, __m512d, __m512d, 9) +test_4 (_mm_mask_scalef_round_sd, __m128d, __m128d, __mmask8, __m128d, __m128d, 9) test_4 (_mm512_mask_scalef_round_ps, __m512, __m512, __mmask16, __m512, __m512, 9) +test_4 (_mm_mask_scalef_round_ss, __m128, __m128, __mmask8, __m128, __m128, 9) test_4 (_mm512_mask_shuffle_f32x4, __m512, __m512, __mmask16, __m512, __m512, 1) test_4 (_mm512_mask_shuffle_f64x2, __m512d, __m512d, __mmask8, __m512d, __m512d, 1) test_4 (_mm512_mask_shuffle_i32x4, __m512i, __m512i, __mmask16, __m512i, __m512i, 1) diff --git a/gcc/testsuite/gcc.target/loongarch/zero-size-field-pass.c b/gcc/testsuite/gcc.target/loongarch/zero-size-field-pass.c new file mode 100644 index 00000000000..999dc913a71 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/zero-size-field-pass.c @@ -0,0 +1,30 @@ +/* Test that LoongArch backend ignores zero-sized fields of aggregates in + argument passing. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -mdouble-float -mabi=lp64d" } */ +/* { dg-final { scan-assembler "\\\$f1" } } */ + +struct test +{ + int empty1[0]; + double empty2[0]; + int : 0; + float x; + long empty3[0]; + long : 0; + float y; + unsigned : 0; + char empty4[0]; +}; + +extern void callee (struct test); + +void +caller (void) +{ + struct test test; + test.x = 114; + test.y = 514; + callee (test); +} diff --git a/gcc/testsuite/gcc.target/loongarch/zero-size-field-ret.c b/gcc/testsuite/gcc.target/loongarch/zero-size-field-ret.c new file mode 100644 index 00000000000..40137d97555 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/zero-size-field-ret.c @@ -0,0 +1,28 @@ +/* Test that LoongArch backend ignores zero-sized fields of aggregates in + returning. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -mdouble-float -mabi=lp64d" } */ +/* { dg-final { scan-assembler-not "\\\$r4" } } */ + +struct test +{ + int empty1[0]; + double empty2[0]; + int : 0; + float x; + long empty3[0]; + long : 0; + float y; + unsigned : 0; + char empty4[0]; +}; + +extern struct test callee (void); + +float +caller (void) +{ + struct test test = callee (); + return test.x + test.y; +} diff --git a/gcc/testsuite/gcc.target/mips/pr102024-4.c b/gcc/testsuite/gcc.target/mips/pr102024-4.c index 2147cc769d0..ea49e890ee5 100644 --- a/gcc/testsuite/gcc.target/mips/pr102024-4.c +++ b/gcc/testsuite/gcc.target/mips/pr102024-4.c @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-mabi=64 -mhard-float" } +// { dg-options "-mabi=64 -mhard-float -ffat-lto-objects" } struct __attribute__((aligned(16))) test { int x[0]; diff --git a/gcc/testsuite/gcc.target/powerpc/bswap-brw.c b/gcc/testsuite/gcc.target/powerpc/bswap-brw.c index b3f923eea84..0ed2a7bd1d2 100644 --- a/gcc/testsuite/gcc.target/powerpc/bswap-brw.c +++ b/gcc/testsuite/gcc.target/powerpc/bswap-brw.c @@ -17,6 +17,6 @@ bswap_int_dbl (unsigned int a) /* Force the value to be loaded into a vector register. */ __asm__ (" # %x0" : "+wa" (b)); - /* { dg-final { scan-assembler {\mxxbrw\M} } } */ + /* { dg-final { scan-assembler {\mxxbrw\M} {xfail {has_arch_pwr10 && {! has_arch_ppc64}}} } } */ return (double) __builtin_bswap32 (b); } diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c index a27ee347ca1..011b731f7c5 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c @@ -1,5 +1,7 @@ /* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ -/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math" } */ +/* Pass cunroll isn't disabled by -fno-unroll-loops, so use explicit + disabling option for it. */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math -fdisable-tree-cunroll" } */ /* { dg-additional-options "--param=vect-partial-vector-usage=1" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c index 89ff38443e7..e0e51d9a972 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-7.c @@ -1,5 +1,7 @@ /* { dg-do compile { target { lp64 && powerpc_p9vector_ok } } } */ -/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math" } */ +/* Pass cunroll isn't disabled by -fno-unroll-loops, so use explicit + disabling option for it. */ +/* { dg-options "-mdejagnu-cpu=power9 -O2 -ftree-vectorize -fno-vect-cost-model -fno-unroll-loops -ffast-math -fdisable-tree-cunroll" } */ /* { dg-additional-options "--param=vect-partial-vector-usage=2" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr104253.c b/gcc/testsuite/gcc.target/powerpc/pr104253.c index 02049cc978f..e5f9499b7c8 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr104253.c +++ b/gcc/testsuite/gcc.target/powerpc/pr104253.c @@ -6,8 +6,9 @@ */ /* { dg-do run } */ -/* { require-effective-target ppc_float128_sw } */ +/* { dg-require-effective-target ppc_float128_sw } */ /* { dg-options "-O2 -mvsx -mfloat128" } */ +/* { dg-prune-output ".-mfloat128. option may not be fully supported" } */ /* * PR target/104253 diff --git a/gcc/testsuite/gcc.target/powerpc/pr104894-2.c b/gcc/testsuite/gcc.target/powerpc/pr104894-2.c new file mode 100644 index 00000000000..d1a011ef4d9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr104894-2.c @@ -0,0 +1,22 @@ +/* PR target/104894 */ +/* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -fno-plt" } */ + +/* Verify we do not ICE on the following test case and that we emit one + indirect call and one indirect sibcall, with r12 and CTR containing + the function addresses. */ + +void foo (void); + +void +bar (void) +{ + foo (); + foo (); +} + +/* { dg-final { scan-assembler-times {\mmtctr 12\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mbctrl\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mbctr\M} 1 } } */ +/* { dg-final { scan-assembler-not {\mbl\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr104894.c b/gcc/testsuite/gcc.target/powerpc/pr104894.c new file mode 100644 index 00000000000..f46fe88168f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr104894.c @@ -0,0 +1,20 @@ +/* PR target/104894 */ +/* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-require-effective-target power10_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power10 -fno-plt" } */ + +/* Verify we do not ICE on the following test case and that we emit an + indirect sibcall, with r12 and CTR containing the function address. */ + +void foo (void); + +void +bar (void) +{ + foo (); +} + +/* { dg-final { scan-assembler-times {\mmtctr 12\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mbctr\M} 1 } } */ +/* { dg-final { scan-assembler-not {\mbl\M} } } */ +/* { dg-final { scan-assembler-not {\mbctrl\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr105271.c b/gcc/testsuite/gcc.target/powerpc/pr105271.c new file mode 100644 index 00000000000..1c5f88cadcf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr105271.c @@ -0,0 +1,14 @@ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-mdejagnu-cpu=power7" } */ + +/* It's to verify no ICE here, ignore error messages about + the required options for vec_neg here. */ +/* { dg-excess-errors "pr105271" } */ + +#include <altivec.h> + +vector signed long long +test (vector signed long long x) +{ + return vec_neg (x); +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr105334.c b/gcc/testsuite/gcc.target/powerpc/pr105334.c new file mode 100644 index 00000000000..7664e033dd0 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr105334.c @@ -0,0 +1,31 @@ +/* Skip this on aix, since it takes soft-float and long-double-128 + incompatible and warns it. */ +/* { dg-skip-if "aix long-double-128 soft-float" { powerpc*-*-aix* } } */ +/* { dg-options "-mlong-double-128 -msoft-float" } */ + +/* Verify there is no ICE. */ + +#include <stddef.h> +#include <stdlib.h> +#include <math.h> + +#define PACK __builtin_pack_ibm128 +#define UNPACK __builtin_unpack_ibm128 +#define LDOUBLE __ibm128 + +extern LDOUBLE bar (LDOUBLE); + +int +main (void) +{ + double high = pow (2.0, 60); + double low = 2.0; + LDOUBLE a = ((LDOUBLE) high) + ((LDOUBLE) low); + double x0 = UNPACK (a, 0); + double x1 = UNPACK (a, 1); + LDOUBLE b = PACK (x0, x1); + LDOUBLE c = bar (b); + + return c > a; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/pr56605.c b/gcc/testsuite/gcc.target/powerpc/pr56605.c index fdedbfc573d..7695f87db6f 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr56605.c +++ b/gcc/testsuite/gcc.target/powerpc/pr56605.c @@ -11,5 +11,5 @@ void foo (short* __restrict sb, int* __restrict ia) ia[i] = (int) sb[i]; } -/* { dg-final { scan-rtl-dump-times {\(compare:CC \((?:and|zero_extend):(?:DI) \((?:sub)?reg:[SD]I} 1 "combine" } } */ +/* { dg-final { scan-rtl-dump-times {\(compare:CC \((?:and|zero_extend):(?:[SD]I) \((?:sub)?reg:[SD]I} 1 "combine" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr60203.c b/gcc/testsuite/gcc.target/powerpc/pr60203.c index 7ada64a32db..a5a574a8837 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr60203.c +++ b/gcc/testsuite/gcc.target/powerpc/pr60203.c @@ -1,5 +1,6 @@ /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-require-effective-target longdouble128 } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-options "-mdejagnu-cpu=power8 -O3" } */ diff --git a/gcc/testsuite/gcc.target/riscv/pr105314.c b/gcc/testsuite/gcc.target/riscv/pr105314.c new file mode 100644 index 00000000000..7a54577e9a9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr105314.c @@ -0,0 +1,12 @@ +/* PR rtl-optimization/105314 */ +/* { dg-do compile } * +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "\tbeq\t" } } */ + +long +foo (long a, long b, long c) +{ + if (c) + a = 0; + return a; +} diff --git a/gcc/testsuite/gcc.target/s390/pr80725.c b/gcc/testsuite/gcc.target/s390/pr80725.c index d556e6ba7ca..18f1427b25e 100644 --- a/gcc/testsuite/gcc.target/s390/pr80725.c +++ b/gcc/testsuite/gcc.target/s390/pr80725.c @@ -1,7 +1,7 @@ /* Regression test for PR/80725. */ /* { dg-do compile } */ -/* { dg-options "-O2 -march=zEC12" } */ +/* { dg-options "-O2 -march=zEC12 -Wno-int-to-pointer-cast" } */ int a, e; const char b; diff --git a/gcc/testsuite/gdc.test/compilable/betterCarray.d b/gcc/testsuite/gdc.test/compilable/betterCarray.d index 3e9a881c3d6..72dcc6b5ee3 100644 --- a/gcc/testsuite/gdc.test/compilable/betterCarray.d +++ b/gcc/testsuite/gdc.test/compilable/betterCarray.d @@ -26,3 +26,10 @@ void issue19234() A[10] b; b[] = a[]; } + +/**********************************************/ +// https://issues.dlang.org/show_bug.cgi?id=22922 +void issue22922() +{ + int[] x = []; +} diff --git a/gcc/testsuite/gdc.test/compilable/extra-files/header1.d b/gcc/testsuite/gdc.test/compilable/extra-files/header1.d index 3c2e90ab8ac..93f05a50c31 100644 --- a/gcc/testsuite/gdc.test/compilable/extra-files/header1.d +++ b/gcc/testsuite/gdc.test/compilable/extra-files/header1.d @@ -607,3 +607,13 @@ T throwStuff(T)(T t) if (false) test13x(1, throw new Exception(""), 2); return t ? t : throw new Exception("Bad stuff happens!"); } + +class C12344 +{ + abstract int c12344(int x) in(x > 0) out(result) {assert(result > 0);}; +} + +interface I12344 +{ + int i12344(int x) in(x > 0) out(result) {assert(result > 0);}; +} diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp17434a.d b/gcc/testsuite/gdc.test/compilable/imports/imp17434a.d new file mode 100644 index 00000000000..5046cbb31ce --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/imp17434a.d @@ -0,0 +1 @@ +module imp17434a.test1; diff --git a/gcc/testsuite/gdc.test/compilable/imports/imp17434b.d b/gcc/testsuite/gdc.test/compilable/imports/imp17434b.d new file mode 100644 index 00000000000..88c37ab488a --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/imp17434b.d @@ -0,0 +1,6 @@ +module imp.imports17434b; + +void testing() +{ + return; +} diff --git a/gcc/testsuite/gdc.test/compilable/interpret3.d b/gcc/testsuite/gdc.test/compilable/interpret3.d index ff85856b62e..2c9a84eddfb 100644 --- a/gcc/testsuite/gdc.test/compilable/interpret3.d +++ b/gcc/testsuite/gdc.test/compilable/interpret3.d @@ -2473,12 +2473,12 @@ static assert(checkPass("foobar") == 1); struct Toq { - const(char)* m; + char* m; } Toq ptrRet(bool b) { - string x = "abc"; + char[] x = "abc".dup; return Toq(b ? x[0 .. 1].ptr : null); } @@ -7808,3 +7808,101 @@ int test9937() } static assert(test9937()); + +/************************************************/ +// static array .tupleof + +struct SArrayTupleEquiv(T) +{ + T f1; + T f2; +} + +// basic .tupleof invariants +bool testSArrayTupleA() +{ + int[2] xs; + assert(xs.tupleof == TypeTuple!(0, 0)); + assert(xs.tupleof == (cast(int[2])[0, 0]).tupleof); + + xs.tupleof = TypeTuple!(1, 2); + assert(xs.tupleof == TypeTuple!(1, 2)); + + auto ys = SArrayTupleEquiv!int(1, 2); + assert(xs.tupleof == ys.tupleof); + + return true; +} +static assert(testSArrayTupleA()); + +// tuples with side effects +bool testSArrayTupleB() +{ + // Counter records lifetime events in copies/dtors, as a cheap way to check that .tupleof for + // static arrays exhibit all the same side effects as an equivalent struct's .tupleof + int[int] copies; + int[int] dtors; + struct Counter + { + int id = -1; + + this(this) + { + copies[id] = copies.get(id, 0) + 1; + } + + ~this() + { + dtors[id] = dtors.get(id, 0) + 1; + } + } + + void consume(Counter, Counter) {} + Counter[2] produce(int id1, int id2) + { + return [Counter(id1), Counter(id2)]; + } + + // first sample expected behavior from struct .tupleof + // braces create a subscope, shortening lifetimes + { + auto a = SArrayTupleEquiv!Counter(Counter(0), Counter(1)); + + typeof(a) b; + b.tupleof = a.tupleof; + + Counter x, y; + TypeTuple!(x, y) = a.tupleof; + + a.tupleof[0] = Counter(2); + a.tupleof[1] = Counter(3); + consume(a.tupleof); + + a.tupleof = produce(4, 5).tupleof; + } + int[int][2] expected = [copies.dup, dtors.dup]; + copies = null; // .clear is not CTFE friendly + dtors = null; + + // the real test -- sample behavior of array .tupleof + { + Counter[2] a = [Counter(0), Counter(1)]; + + typeof(a) b; + b.tupleof = a.tupleof; + + Counter x, y; + TypeTuple!(x, y) = a.tupleof; + + a.tupleof[0] = Counter(2); + a.tupleof[1] = Counter(3); + consume(a.tupleof); + + a.tupleof = produce(4, 5).tupleof; + } + assert(expected[0] == copies); + assert(expected[1] == dtors); + + return true; +} +static assert(testSArrayTupleB()); diff --git a/gcc/testsuite/gdc.test/compilable/json.d b/gcc/testsuite/gdc.test/compilable/json.d index 73d3101b835..f4d68e7dc8c 100644 --- a/gcc/testsuite/gdc.test/compilable/json.d +++ b/gcc/testsuite/gdc.test/compilable/json.d @@ -203,14 +203,14 @@ extern(C) int vlinakgeC; extern(C++) __gshared int vlinkageCpp; extern(Windows) int vlinkageWindows; extern(Objective-C) int vlinkageObjc; - +extern(System) int vlinkageSystem; extern int flinkageDefault(); extern(D) int flinkageD(); extern(C) int linakgeC(); extern(C++) int flinkageCpp(); extern(Windows) int flinkageWindows(); extern(Objective-C) int flinkageObjc(); - +extern(System) int flinkageSystem(); mixin template test18211(int n) { static foreach (i; 0 .. n>10 ? 10 : n) diff --git a/gcc/testsuite/gdc.test/compilable/mixintype2.d b/gcc/testsuite/gdc.test/compilable/mixintype2.d index d160bd410ad..a61adc570fa 100644 --- a/gcc/testsuite/gdc.test/compilable/mixintype2.d +++ b/gcc/testsuite/gdc.test/compilable/mixintype2.d @@ -115,3 +115,9 @@ void test_statements_22356() mixin("int") y22356, z22356; static assert(is(typeof(y22356) == int) && is(typeof(z22356) == int)); } + +/**************************************************/ +// https://issues.dlang.org/show_bug.cgi?id=22969 + +enum e = 0; +alias a = mixin("e"); diff --git a/gcc/testsuite/gdc.test/compilable/must_use_assign.d b/gcc/testsuite/gdc.test/compilable/must_use_assign.d new file mode 100644 index 00000000000..bd1983a40e6 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/must_use_assign.d @@ -0,0 +1,9 @@ +import core.attribute; + +@mustuse struct S {} + +void test() +{ + S a, b; + a = b; +} diff --git a/gcc/testsuite/gdc.test/compilable/must_use_not_reserved.d b/gcc/testsuite/gdc.test/compilable/must_use_not_reserved.d new file mode 100644 index 00000000000..c6001198489 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/must_use_not_reserved.d @@ -0,0 +1,5 @@ +import core.attribute; + +@mustuse int n; +@mustuse alias A = int; +@mustuse template tpl() {} diff --git a/gcc/testsuite/gdc.test/compilable/must_use_opassign.d b/gcc/testsuite/gdc.test/compilable/must_use_opassign.d new file mode 100644 index 00000000000..8e877dd69b6 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/must_use_opassign.d @@ -0,0 +1,15 @@ +import core.attribute; + +@mustuse struct S +{ + ref S opAssign(S rhs) return + { + return this; + } +} + +void test() +{ + S a, b; + a = b; +} diff --git a/gcc/testsuite/gdc.test/compilable/must_use_opopassign.d b/gcc/testsuite/gdc.test/compilable/must_use_opopassign.d new file mode 100644 index 00000000000..0176354ed1d --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/must_use_opopassign.d @@ -0,0 +1,15 @@ +import core.attribute; + +@mustuse struct S +{ + ref S opOpAssign(string op)(S rhs) return + { + return this; + } +} + +void test() +{ + S a, b; + a += b; +} diff --git a/gcc/testsuite/gdc.test/compilable/must_use_opunary.d b/gcc/testsuite/gdc.test/compilable/must_use_opunary.d new file mode 100644 index 00000000000..fc9650ebed5 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/must_use_opunary.d @@ -0,0 +1,18 @@ +import core.attribute; + +@mustuse struct S +{ + ref S opUnary(string op)() return + { + return this; + } +} + +void test() +{ + S s; + ++s; + --s; + s++; + s--; +} diff --git a/gcc/testsuite/gdc.test/compilable/must_use_suppress.d b/gcc/testsuite/gdc.test/compilable/must_use_suppress.d new file mode 100644 index 00000000000..63ad75c2928 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/must_use_suppress.d @@ -0,0 +1,10 @@ +import core.attribute; + +@mustuse struct S {} + +S fun() { return S(); } + +void test() +{ + cast(void) fun(); +} diff --git a/gcc/testsuite/gdc.test/compilable/revert_dip1000.d b/gcc/testsuite/gdc.test/compilable/revert_dip1000.d new file mode 100644 index 00000000000..ad6a6d8aade --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/revert_dip1000.d @@ -0,0 +1,7 @@ +/* +REQUIRED_ARGS: -revert=dip1000 +TEST_OUTPUT: +--- +--- +*/ +int* oops(scope int* p) @safe { return p; } diff --git a/gcc/testsuite/gdc.test/compilable/test17419.d b/gcc/testsuite/gdc.test/compilable/test17419.d index e34e7da5444..1a92a1c9112 100644 --- a/gcc/testsuite/gdc.test/compilable/test17419.d +++ b/gcc/testsuite/gdc.test/compilable/test17419.d @@ -17,10 +17,7 @@ static assert(__traits(getLinkage, food) == "D"); static assert(__traits(getLinkage, foocpp) == "C++"); static assert(__traits(getLinkage, foow) == "Windows"); static assert(__traits(getLinkage, fooobjc) == "Objective-C"); -version (Windows) - static assert(__traits(getLinkage, foos) == "Windows"); -else - static assert(__traits(getLinkage, foos) == "C"); +static assert(__traits(getLinkage, foos) == "System"); extern (C) int global; static assert(__traits(getLinkage, global) == "C"); diff --git a/gcc/testsuite/gdc.test/compilable/test17434.d b/gcc/testsuite/gdc.test/compilable/test17434.d new file mode 100644 index 00000000000..82bfa570b5f --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test17434.d @@ -0,0 +1,11 @@ +// https://issues.dlang.org/show_bug.cgi?id=17434 + +// EXTRA_FILES: test17434a.d imports/imp17434a.d imports/imp17434b.d +module test17434; + +import test17434a; + +void main() +{ + imports.imp17434b.testing(); +} diff --git a/gcc/testsuite/gdc.test/compilable/test17434a.d b/gcc/testsuite/gdc.test/compilable/test17434a.d new file mode 100644 index 00000000000..c9175fe385b --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test17434a.d @@ -0,0 +1,5 @@ +// EXTRA_FILES: imports/imp17434a.d imports/imp17434b.d +module test17434a; + +private import imports.imp17434a; +public import imports.imp17434b; diff --git a/gcc/testsuite/gdc.test/compilable/test18216.d b/gcc/testsuite/gdc.test/compilable/test18216.d new file mode 100644 index 00000000000..43f5629a3c7 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test18216.d @@ -0,0 +1,40 @@ +// https://issues.dlang.org/show_bug.cgi?id=18216 + +struct Node +{ + mixin Type!(); + Pointer left; +} + +mixin template Type() +{ + alias Base = typeof(this); + + static struct Proxy + { + struct Node + { + Base m_payload; + } + static immutable default_value = Base.init; // just remove this will work + } + + alias pNode = shared(Proxy.Node)*; + + static struct Pointer + { + Base* _ptr; + auto ptr() + { + return cast(pNode) _ptr; + } + + void opAssign(ref Pointer other) {} // just remove this will work + + alias getThis this; // just remove this will work + ref auto getThis() return + { + return ptr.m_payload; + } + } +} diff --git a/gcc/testsuite/gdc.test/compilable/test19097.d b/gcc/testsuite/gdc.test/compilable/test19097.d index 19e189caf5d..a6d30024881 100644 --- a/gcc/testsuite/gdc.test/compilable/test19097.d +++ b/gcc/testsuite/gdc.test/compilable/test19097.d @@ -21,3 +21,43 @@ void foo(scope int* pf) betty(rf, pf); boop(rf, pf); } + +// https://issues.dlang.org/show_bug.cgi?id=22801 +struct Wrapper +{ + int* ptr; + + this(return ref int var) @safe + { + this.ptr = &var; + } +} + +void main() @safe +{ + int i; + auto w = Wrapper(i); + auto wt = WrapperT!()(i); +} + +void assign(ref scope int* x, return ref int y) @safe +{ + x = &y; +} + +// https://issues.dlang.org/show_bug.cgi?id=22967 +// inference of `return ref` when assigned to first parameter +struct WrapperT() +{ + int* ptr; + + this(ref int var) @safe + { + this.ptr = &var; + } + + static void assignInferred(ref scope int* xi, ref int yi) @safe + { + xi = &yi; + } +} diff --git a/gcc/testsuite/gdc.test/compilable/test22635.d b/gcc/testsuite/gdc.test/compilable/test22635.d new file mode 100644 index 00000000000..c2abc837956 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test22635.d @@ -0,0 +1,13 @@ +// https://issues.dlang.org/show_bug.cgi?id=22635 +// opCast prevent calling destructor for const this + +struct Foo +{ + bool opCast(T : bool)() const { assert(0); } + ~this() {} +} + +struct Bar +{ + const Foo foo; +} diff --git a/gcc/testsuite/gdc.test/compilable/test22988.d b/gcc/testsuite/gdc.test/compilable/test22988.d new file mode 100644 index 00000000000..6be3921e67b --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test22988.d @@ -0,0 +1,15 @@ +// https://issues.dlang.org/show_bug.cgi?id=22988 + +enum a1 = 0; +enum b1 = a1 ? 1 << a1 - 1 : 0; + +enum l = 0; +enum int[l] a2 = []; +enum b2 = l ? a2[l - 1] : 0; + +enum a3 = 0 ? 1 << -1 : 0; + +enum int[0] a4 = []; +enum b4 = 0 ? a4[0] : 0; + +enum b5 = false ? (1 << -1) : 0; diff --git a/gcc/testsuite/gdc.test/compilable/test22997.d b/gcc/testsuite/gdc.test/compilable/test22997.d new file mode 100644 index 00000000000..3cad527b4c2 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test22997.d @@ -0,0 +1,14 @@ +// https://issues.dlang.org/show_bug.cgi?id=22997 + +struct Forward {} + +struct Foo +{ + this(ref typeof(this) rhs) + { + this(rhs, Forward.init); + } + + this(ref typeof(this) rhs, Forward) {} + this(typeof(this) rhs, int i, double d, string s) {} +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag11198.d b/gcc/testsuite/gdc.test/fail_compilation/diag11198.d index ebefa4dc6af..279d62a5496 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag11198.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag11198.d @@ -1,8 +1,12 @@ /* TEST_OUTPUT: --- -fail_compilation/diag11198.d(11): Error: version conditions can only be declared at module scope -fail_compilation/diag11198.d(12): Error: debug conditions can only be declared at module scope +fail_compilation/diag11198.d(15): Error: version `blah` declaration must be at module level +fail_compilation/diag11198.d(16): Error: debug `blah` declaration must be at module level +fail_compilation/diag11198.d(17): Error: version `1` level declaration must be at module level +fail_compilation/diag11198.d(18): Error: debug `2` level declaration must be at module level +fail_compilation/diag11198.d(19): Error: identifier or integer expected, not `""` +fail_compilation/diag11198.d(20): Error: identifier or integer expected, not `""` --- */ @@ -10,4 +14,8 @@ void main() { version = blah; debug = blah; + version = 1; + debug = 2; + version = ""; + debug = ""; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag14235.d b/gcc/testsuite/gdc.test/fail_compilation/diag14235.d index 3c8a98e6e35..29261b4ea1c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag14235.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag14235.d @@ -2,8 +2,8 @@ EXTRA_FILES: imports/a14235.d TEST_OUTPUT: --- -fail_compilation/diag14235.d(12): Error: template identifier `Undefined` is not a member of module `imports.a14235` -fail_compilation/diag14235.d(13): Error: template identifier `Something` is not a member of module `imports.a14235`, did you mean struct `SomeThing(T...)`? +fail_compilation/diag14235.d(12): Error: undefined identifier `Undefined` in module `imports.a14235` +fail_compilation/diag14235.d(13): Error: undefined identifier `Something` in module `imports.a14235`, did you mean struct `SomeThing(T...)`? fail_compilation/diag14235.d(14): Error: `imports.a14235.SomeClass` is not a template, it is a class --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d index 282665ff8d5..301472ca28a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag8101.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag8101.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/diag8101.d(57): Error: function `diag8101.f_0(int)` is not callable using argument types `()` -fail_compilation/diag8101.d(57): missing argument for parameter #1: `int` +fail_compilation/diag8101.d(57): too few arguments, expected `1`, got `0` fail_compilation/diag8101.d(58): Error: none of the overloads of `f_1` are callable using argument types `()` fail_compilation/diag8101.d(33): Candidates are: `diag8101.f_1(int)` fail_compilation/diag8101.d(34): `diag8101.f_1(int, int)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag_funclit.d b/gcc/testsuite/gdc.test/fail_compilation/diag_funclit.d index b46c562e87d..1279d7c2a2a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diag_funclit.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diag_funclit.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/diag_funclit.d(103): Error: function literal `__lambda1(x, y, z)` is not callable using argument types `()` -fail_compilation/diag_funclit.d(103): missing argument for parameter #1: `x` +fail_compilation/diag_funclit.d(103): too few arguments, expected `3`, got `0` fail_compilation/diag_funclit.d(106): Error: function literal `__lambda2(x, y, z)` is not callable using argument types `(int, string, int, int)` fail_compilation/diag_funclit.d(106): too many arguments, expected `3`, got `4` fail_compilation/diag_funclit.d(108): Error: function literal `__lambda3(x, y, string z = "Hello")` is not callable using argument types `(int, int, string, string)` diff --git a/gcc/testsuite/gdc.test/fail_compilation/diagin.d b/gcc/testsuite/gdc.test/fail_compilation/diagin.d index eb88a23151a..1418ced43a2 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/diagin.d +++ b/gcc/testsuite/gdc.test/fail_compilation/diagin.d @@ -3,7 +3,7 @@ PERMUTE_ARGS: -preview=in TEST_OUTPUT: --- fail_compilation/diagin.d(14): Error: function `diagin.foo(in int)` is not callable using argument types `()` -fail_compilation/diagin.d(14): missing argument for parameter #1: `in int` +fail_compilation/diagin.d(14): too few arguments, expected `1`, got `0` fail_compilation/diagin.d(16): Error: none of the overloads of template `diagin.foo1` are callable using argument types `!()(bool[])` fail_compilation/diagin.d(20): Candidate is: `foo1(T)(in T v, string)` --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail22202.d b/gcc/testsuite/gdc.test/fail_compilation/fail22202.d new file mode 100644 index 00000000000..167d3624879 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail22202.d @@ -0,0 +1,22 @@ +// https://issues.dlang.org/show_bug.cgi?id=22202 + +/* +TEST_OUTPUT: +--- +fail_compilation/fail22202.d(21): Error: function `fail22202.fun(SystemCopy _param_0)` is not callable using argument types `(SystemCopy)` +fail_compilation/fail22202.d(21): `inout ref inout(SystemCopy)(ref inout(SystemCopy) other)` copy constructor cannot be called from a `pure @safe nogc` context +--- +*/ + +struct SystemCopy +{ + this(ref inout SystemCopy other) inout {} +} + +void fun(SystemCopy) @safe pure @nogc {} + +void main() @safe pure @nogc +{ + SystemCopy s; + fun(s); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail23036.d b/gcc/testsuite/gdc.test/fail_compilation/fail23036.d new file mode 100644 index 00000000000..8920586c67a --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/fail23036.d @@ -0,0 +1,22 @@ +// https://issues.dlang.org/show_bug.cgi?id=23036 + +/* +TEST_OUTPUT: +--- +fail_compilation/fail23036.d(12): Error: `struct S` may not define both a rvalue constructor and a copy constructor +fail_compilation/fail23036.d(15): rvalue constructor defined here +fail_compilation/fail23036.d(14): copy constructor defined here +--- +*/ + +struct S +{ + this(ref S) {} + this(S, int a = 2) {} +} + +void main() +{ + S a; + S b = a; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2656.d b/gcc/testsuite/gdc.test/fail_compilation/fail2656.d index ffd38de4502..520c1b14bfb 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail2656.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail2656.d @@ -1,20 +1,20 @@ /* TEST_OUTPUT: --- -fail_compilation/fail2656.d(21): Error: octal literals `0123` are no longer supported, use `std.conv.octal!123` instead -fail_compilation/fail2656.d(22): Error: octal literals `01000000000000000000000` are no longer supported, use `std.conv.octal!1000000000000000000000` instead -fail_compilation/fail2656.d(23): Error: octal literals `0100000L` are no longer supported, use `std.conv.octal!100000L` instead -fail_compilation/fail2656.d(24): Error: octal literals `01777777777777777777777u` are no longer supported, use `std.conv.octal!1777777777777777777777u` instead -fail_compilation/fail2656.d(25): Error: octal literals `017777777777uL` are no longer supported, use `std.conv.octal!17777777777uL` instead -fail_compilation/fail2656.d(26): Error: octal literals `0177777` are no longer supported, use `std.conv.octal!177777` instead -fail_compilation/fail2656.d(27): Error: octal literals `020000000000L` are no longer supported, use `std.conv.octal!20000000000L` instead -fail_compilation/fail2656.d(28): Error: octal literals `0200000u` are no longer supported, use `std.conv.octal!200000u` instead -fail_compilation/fail2656.d(29): Error: octal literals `037777777777uL` are no longer supported, use `std.conv.octal!37777777777uL` instead -fail_compilation/fail2656.d(30): Error: octal literals `040000000000` are no longer supported, use `std.conv.octal!40000000000` instead -fail_compilation/fail2656.d(31): Error: octal literals `0777777777777777777777L` are no longer supported, use `std.conv.octal!777777777777777777777L` instead -fail_compilation/fail2656.d(32): Error: octal literals `077777u` are no longer supported, use `std.conv.octal!77777u` instead -fail_compilation/fail2656.d(33): Error: octal literals `077777uL` are no longer supported, use `std.conv.octal!77777uL` instead -fail_compilation/fail2656.d(34): Error: octal literals `077777uL` are no longer supported, use `std.conv.octal!77777uL` instead +fail_compilation/fail2656.d(21): Error: octal literals `0123` are no longer supported, use `std.conv.octal!"123"` instead +fail_compilation/fail2656.d(22): Error: octal literals `01000000000000000000000` are no longer supported, use `std.conv.octal!"1000000000000000000000"` instead +fail_compilation/fail2656.d(23): Error: octal literals `0100000L` are no longer supported, use `std.conv.octal!"100000L"` instead +fail_compilation/fail2656.d(24): Error: octal literals `01777777777777777777777u` are no longer supported, use `std.conv.octal!"1777777777777777777777u"` instead +fail_compilation/fail2656.d(25): Error: octal literals `017777777777uL` are no longer supported, use `std.conv.octal!"17777777777uL"` instead +fail_compilation/fail2656.d(26): Error: octal literals `0177777` are no longer supported, use `std.conv.octal!"177777"` instead +fail_compilation/fail2656.d(27): Error: octal literals `020000000000L` are no longer supported, use `std.conv.octal!"20000000000L"` instead +fail_compilation/fail2656.d(28): Error: octal literals `0200000u` are no longer supported, use `std.conv.octal!"200000u"` instead +fail_compilation/fail2656.d(29): Error: octal literals `037777777777uL` are no longer supported, use `std.conv.octal!"37777777777uL"` instead +fail_compilation/fail2656.d(30): Error: octal literals `040000000000` are no longer supported, use `std.conv.octal!"40000000000"` instead +fail_compilation/fail2656.d(31): Error: octal literals `0777777777777777777777L` are no longer supported, use `std.conv.octal!"777777777777777777777L"` instead +fail_compilation/fail2656.d(32): Error: octal literals `077777u` are no longer supported, use `std.conv.octal!"77777u"` instead +fail_compilation/fail2656.d(33): Error: octal literals `077777uL` are no longer supported, use `std.conv.octal!"77777uL"` instead +fail_compilation/fail2656.d(34): Error: octal literals `077777uL` are no longer supported, use `std.conv.octal!"77777uL"` instead --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail99.d b/gcc/testsuite/gdc.test/fail_compilation/fail99.d index c147b810ee6..e4cba9530bf 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail99.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail99.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/fail99.d(13): Error: delegate `dg(int)` is not callable using argument types `()` -fail_compilation/fail99.d(13): missing argument for parameter #1: `int` +fail_compilation/fail99.d(13): too few arguments, expected `1`, got `0` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d b/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d index 41a8c2d85e3..07c3766d490 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_scope.d @@ -2,6 +2,13 @@ REQUIRED_ARGS: TEST_OUTPUT: --- +fail_compilation/fail_scope.d(29): Deprecation: scope variable `da` may not be returned +fail_compilation/fail_scope.d(31): Deprecation: scope variable `o` may not be returned +fail_compilation/fail_scope.d(32): Deprecation: scope variable `dg` may not be returned +fail_compilation/fail_scope.d(34): Deprecation: scope variable `da` may not be returned +fail_compilation/fail_scope.d(36): Deprecation: scope variable `o` may not be returned +fail_compilation/fail_scope.d(37): Deprecation: scope variable `dg` may not be returned +fail_compilation/fail_scope.d(39): Deprecation: scope variable `p` may not be returned fail_compilation/fail_scope.d(44): Error: returning `cast(char[])string` escapes a reference to local variable `string` fail_compilation/fail_scope.d(62): Error: returning `s.bar()` escapes a reference to local variable `s` fail_compilation/fail_scope.d(73): Error: `fail_scope.foo8` called with argument types `(int)` matches both: @@ -15,26 +22,19 @@ fail_compilation/fail_scope.d(107): Deprecation: escaping reference to outer loc fail_compilation/fail_scope.d(126): Error: returning `s.bar()` escapes a reference to local variable `s` fail_compilation/fail_scope.d(136): Error: returning `foo16226(i)` escapes a reference to local variable `i` --- -//fail_compilation/fail_scope.d(30): Error: scope variable `da` may not be returned -//fail_compilation/fail_scope.d(32): Error: scope variable `o` may not be returned -//fail_compilation/fail_scope.d(33): Error: scope variable `dg` may not be returned -//fail_compilation/fail_scope.d(35): Error: scope variable `da` may not be returned -//fail_compilation/fail_scope.d(37): Error: scope variable `o` may not be returned -//fail_compilation/fail_scope.d(38): Error: scope variable `dg` may not be returned -//fail_compilation/fail_scope.d(40): Error: scope variable `p` may not be returned */ alias int delegate() dg_t; -int[] checkEscapeScope1(scope int[] da) { return da; } -int[3] checkEscapeScope2(scope int[3] sa) { return sa; } -Object checkEscapeScope3(scope Object o) { return o; } -dg_t checkEscapeScope4(scope dg_t dg) { return dg; } +int[] checkEscapeScope1(scope int[] da) @safe { return da; } +int[3] checkEscapeScope2(scope int[3] sa) @safe { return sa; } +Object checkEscapeScope3(scope Object o) @safe { return o; } +dg_t checkEscapeScope4(scope dg_t dg) @safe { return dg; } -int[] checkEscapeScope1() { scope int[] da = []; return da; } -int[3] checkEscapeScope2() { scope int[3] sa = [1,2,3]; return sa; } -Object checkEscapeScope3() { scope Object o = new Object; return o; } // same with fail7294.d -dg_t checkEscapeScope4() { scope dg_t dg = () => 1; return dg; } +int[] checkEscapeScope1() @safe { scope int[] da = []; return da; } +int[3] checkEscapeScope2() @safe { scope int[3] sa = [1,2,3]; return sa; } +Object checkEscapeScope3() @safe { scope Object o = new Object; return o; } // same with fail7294.d +dg_t checkEscapeScope4() @safe { scope dg_t dg = () => 1; return dg; } int* test(scope int* p) @safe { return p; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/fix19059.d b/gcc/testsuite/gdc.test/fail_compilation/fix19059.d index 0be003a2f3b..b6bd9d33cf9 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fix19059.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fix19059.d @@ -5,7 +5,7 @@ fail_compilation/fix19059.d(16): Error: octal digit expected, not `8` fail_compilation/fix19059.d(16): Error: octal literals larger than 7 are no longer supported fail_compilation/fix19059.d(17): Error: octal digit expected, not `9` fail_compilation/fix19059.d(17): Error: octal literals larger than 7 are no longer supported -fail_compilation/fix19059.d(18): Error: octal literals `010` are no longer supported, use `std.conv.octal!10` instead +fail_compilation/fix19059.d(18): Error: octal literals `010` are no longer supported, use `std.conv.octal!"10"` instead --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d index c227ee55eb4..f3a7a57a689 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice10922.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice10922.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/ice10922.d(10): Error: function `ice10922.__lambda4(in uint n)` is not callable using argument types `()` -fail_compilation/ice10922.d(10): missing argument for parameter #1: `in uint n` +fail_compilation/ice10922.d(10): too few arguments, expected `1`, got `0` --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d index f95cb974c79..ce705078ac0 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/ice9540.d +++ b/gcc/testsuite/gdc.test/fail_compilation/ice9540.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/ice9540.d(35): Error: function `ice9540.A.test.AddFront!(this, f).AddFront.dg(int _param_0)` is not callable using argument types `()` -fail_compilation/ice9540.d(35): missing argument for parameter #1: `int _param_0` +fail_compilation/ice9540.d(35): too few arguments, expected `1`, got `0` fail_compilation/ice9540.d(26): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/must_use.d b/gcc/testsuite/gdc.test/fail_compilation/must_use.d new file mode 100644 index 00000000000..e3b5fedfd4d --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/must_use.d @@ -0,0 +1,16 @@ +/+ +TEST_OUTPUT: +--- +fail_compilation/must_use.d(15): Error: ignored value of `@mustuse` type `must_use.S`; prepend a `cast(void)` if intentional +--- ++/ +import core.attribute; + +@mustuse struct S {} + +S fun() { return S(); } + +void test() +{ + fun(); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/must_use_comma.d b/gcc/testsuite/gdc.test/fail_compilation/must_use_comma.d new file mode 100644 index 00000000000..4621ab5ec29 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/must_use_comma.d @@ -0,0 +1,17 @@ +/+ +TEST_OUTPUT: +--- +fail_compilation/must_use_comma.d(16): Error: ignored value of `@mustuse` type `must_use_comma.S`; prepend a `cast(void)` if intentional +--- ++/ +import core.attribute; + +@mustuse struct S {} + +S fun() { return S(); } +void sideEffect() {} + +void test() +{ + (fun(), sideEffect()); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d b/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d new file mode 100644 index 00000000000..59248a969c4 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/must_use_opunary.d @@ -0,0 +1,21 @@ +/+ +TEST_OUTPUT: +--- +fail_compilation/must_use_opunary.d(20): Error: ignored value of `@mustuse` type `must_use_opunary.S`; prepend a `cast(void)` if intentional +--- ++/ +import core.attribute; + +@mustuse struct S +{ + ref S opUnary(string op)() return + { + return this; + } +} + +void test() +{ + S s; + -s; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/must_use_reserved.d b/gcc/testsuite/gdc.test/fail_compilation/must_use_reserved.d new file mode 100644 index 00000000000..96edbd3cbe4 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/must_use_reserved.d @@ -0,0 +1,20 @@ +/+ +TEST_OUTPUT: +--- +fail_compilation/must_use_reserved.d(14): Error: `@mustuse` on `class` types is reserved for future use +fail_compilation/must_use_reserved.d(15): Error: `@mustuse` on `interface` types is reserved for future use +fail_compilation/must_use_reserved.d(16): Error: `@mustuse` on `enum` types is reserved for future use +fail_compilation/must_use_reserved.d(17): Error: `@mustuse` on functions is reserved for future use +fail_compilation/must_use_reserved.d(19): Error: `@mustuse` on `class` types is reserved for future use +fail_compilation/must_use_reserved.d(20): Error: template instance `must_use_reserved.CT!int` error instantiating +--- ++/ +import core.attribute; + +@mustuse class C {} +@mustuse interface I {} +@mustuse enum E { x } +@mustuse int fun() { return 0; } + +@mustuse class CT(T) {} +alias _ = CT!int; diff --git a/gcc/testsuite/gdc.test/fail_compilation/must_use_template.d b/gcc/testsuite/gdc.test/fail_compilation/must_use_template.d new file mode 100644 index 00000000000..eeaa774ea20 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/must_use_template.d @@ -0,0 +1,16 @@ +/+ +TEST_OUTPUT: +--- +fail_compilation/must_use_template.d(15): Error: ignored value of `@mustuse` type `must_use_template.S!int`; prepend a `cast(void)` if intentional +--- ++/ +import core.attribute; + +@mustuse struct S(T) {} + +S!int fun() { return S!int(); } + +void test() +{ + fun(); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/must_use_union.d b/gcc/testsuite/gdc.test/fail_compilation/must_use_union.d new file mode 100644 index 00000000000..d42b324ee9b --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/must_use_union.d @@ -0,0 +1,16 @@ +/+ +TEST_OUTPUT: +--- +fail_compilation/must_use_union.d(15): Error: ignored value of `@mustuse` type `must_use_union.U`; prepend a `cast(void)` if intentional +--- ++/ +import core.attribute; + +@mustuse union U {} + +U fun() { return U(); } + +void test() +{ + fun(); +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d index 7e68bfc4702..6d5807b641a 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/retscope6.d +++ b/gcc/testsuite/gdc.test/fail_compilation/retscope6.d @@ -201,8 +201,8 @@ void hmac(scope ubyte[] secret) /* TEST_OUTPUT: --- -fail_compilation/retscope6.d(12011): Error: reference to local variable `x` assigned to non-scope parameter `r` calling retscope6.escape_m_20150 -fail_compilation/retscope6.d(12022): Error: reference to local variable `x` assigned to non-scope parameter `r` calling retscope6.escape_c_20150 +fail_compilation/retscope6.d(12011): Error: returning `escape_m_20150(& x)` escapes a reference to local variable `x` +fail_compilation/retscope6.d(12022): Error: returning `escape_c_20150(& x)` escapes a reference to local variable `x` --- */ @@ -210,23 +210,23 @@ fail_compilation/retscope6.d(12022): Error: reference to local variable `x` assi // https://issues.dlang.org/show_bug.cgi?id=20150 -int* escape_m_20150(int* r) @safe pure +int* escape_m_20150(int* r) @safe pure nothrow { return r; } -int* f_m_20150() @safe +int* f_m_20150() @safe nothrow { int x = 42; return escape_m_20150(&x); } -const(int)* escape_c_20150(const int* r) @safe pure +const(int)* escape_c_20150(const int* r) @safe pure nothrow { return r; } -const(int)* f_c_20150() @safe +const(int)* f_c_20150() @safe nothrow { int x = 42; return escape_c_20150(&x); @@ -251,3 +251,39 @@ void escape_throw_20150() @safe immutable(char)[4] str; f_throw(str[]); } + +/* TEST_OUTPUT: +--- +fail_compilation/retscope6.d(14019): Error: scope variable `scopePtr` assigned to non-scope parameter `x` calling retscope6.noInfer23021 +fail_compilation/retscope6.d(14022): Error: scope variable `scopePtr` may not be returned +--- +*/ + +#line 14000 +// https://issues.dlang.org/show_bug.cgi?id=23021 + +ref int infer23021(ref int* x) @safe pure nothrow +{ + return *x; +} + +ref int noInfer23021(ref int* x, const(int)** escapeHole = null) @safe pure nothrow +{ + *escapeHole = x; + return *x; +} + +ref int escape23021() @safe +{ + scope int* scopePtr; + int* nonScopePtr = null; + + // don't infer scope + cast(void) noInfer23021(scopePtr); // error + + // ensure we infer return scope + return infer23021(scopePtr); // error + + // ensure we do not infer return ref + return infer23021(nonScopePtr); // no error +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test11176.d b/gcc/testsuite/gdc.test/fail_compilation/test11176.d index cf60b80fd7a..5ef7324ce8c 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test11176.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test11176.d @@ -12,6 +12,10 @@ fail_compilation/test11176.d(16): Error: `b.ptr` cannot be used in `@safe` code, return *b.ptr; } -@safe ubyte oops(ubyte[3] b) { +@safe ubyte oops(ubyte[0] b) { + return *b.ptr; +} + +@safe ubyte cool(ubyte[1] b) { return *b.ptr; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/test17284.d b/gcc/testsuite/gdc.test/fail_compilation/test17284.d index 713be42e595..5bb3c2cc9f6 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test17284.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test17284.d @@ -1,8 +1,8 @@ +/* TEST_OUTPUT: --- -fail_compilation/test17284.d(1): Error: no identifier for declarator `TEST_OUTPUT` -fail_compilation/test17284.d(1): Error: declaration expected, not `:` -fail_compilation/test17284.d(12): Error: unmatched closing brace +fail_compilation/test17284.d(16): Error: field `U.c` cannot access pointers in `@safe` code that overlap other fields +pure nothrow @safe void(U t) --- */ diff --git a/gcc/testsuite/gdc.test/fail_compilation/test19097.d b/gcc/testsuite/gdc.test/fail_compilation/test19097.d index 034813b5316..9c025a83ff0 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test19097.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test19097.d @@ -1,12 +1,19 @@ /* REQUIRED_ARGS: -preview=dip1000 * TEST_OUTPUT: --- -fail_compilation/test19097.d(37): Error: scope variable `s` may not be returned -fail_compilation/test19097.d(66): Error: scope variable `z` assigned to `refPtr` with longer lifetime -fail_compilation/test19097.d(97): Error: scope variable `s` may not be returned +fail_compilation/test19097.d(44): Error: scope variable `s` may not be returned +fail_compilation/test19097.d(48): Error: scope variable `s1` may not be returned +fail_compilation/test19097.d(77): Error: scope variable `z` assigned to `refPtr` with longer lifetime +fail_compilation/test19097.d(108): Error: scope variable `s4` may not be returned +fail_compilation/test19097.d(126): Error: scope variable `s5c` may not be returned +fail_compilation/test19097.d(130): Error: scope variable `s5m` may not be returned +fail_compilation/test19097.d(147): Error: scope variable `s6c` may not be returned +fail_compilation/test19097.d(151): Error: scope variable `s6m` may not be returned --- */ +// Test extended return-scope / return-ref semantics, e.g. assigning to `this` or the first parameter + // https://issues.dlang.org/show_bug.cgi?id=19097 @safe: @@ -35,6 +42,10 @@ S thorin() int i; S s = S(&i); // should infer scope for s return s; // so this should error + + S s1; + s1.mem(&i); + return s1; } /************************/ @@ -93,6 +104,49 @@ struct S4 int* escape2() { int x; - auto s = S4(0, &x); - return s.p; + auto s4 = S4(0, &x); + return s4.p; +} + +/************************/ +// https://issues.dlang.org/show_bug.cgi?id=22801 +struct S5 +{ + int* a; + this(return ref int b) { a = &b; } + + int* c; + void mem(return ref int d) scope { c = &d; } +} + +S5 frerin() +{ + int i; + S5 s5c = S5(i); // should infer scope for s + return s5c; // so this should error + + S5 s5m; + s5m.mem(i); + return s5m; +} + + +struct S6 +{ + int** a; + this(return ref int* b) { a = &b; } + + int** c; + void mem(return ref int* d) scope { c = &d; } +} + +S6 dis() +{ + int* i = null; + S6 s6c = S6(i); // should infer scope for s + return s6c; // so this should error + + S6 s6m; + s6m.mem(i); + return s6m; } diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21008.d b/gcc/testsuite/gdc.test/fail_compilation/test21008.d index d5cf96a6c3a..998cf1752d0 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/test21008.d +++ b/gcc/testsuite/gdc.test/fail_compilation/test21008.d @@ -5,12 +5,12 @@ fail_compilation/test21008.d(110): Error: function `test21008.C.after` circular fail_compilation/test21008.d(117): Error: need `this` for `toString` of type `string()` fail_compilation/test21008.d(117): Error: need `this` for `toHash` of type `nothrow @trusted $?:32=uint|64=ulong$()` fail_compilation/test21008.d(117): Error: function `object.Object.opCmp(Object o)` is not callable using argument types `()` -fail_compilation/test21008.d(117): missing argument for parameter #1: `Object o` +fail_compilation/test21008.d(117): too few arguments, expected `1`, got `0` fail_compilation/test21008.d(117): Error: function `object.Object.opEquals(Object o)` is not callable using argument types `()` -fail_compilation/test21008.d(117): missing argument for parameter #1: `Object o` +fail_compilation/test21008.d(117): too few arguments, expected `1`, got `0` fail_compilation/test21008.d(117): Error: `Monitor` has no effect fail_compilation/test21008.d(117): Error: function `object.Object.factory(string classname)` is not callable using argument types `()` -fail_compilation/test21008.d(117): missing argument for parameter #1: `string classname` +fail_compilation/test21008.d(117): too few arguments, expected `1`, got `0` fail_compilation/test21008.d(105): called from here: `handleMiddlewareAnnotation()` fail_compilation/test21008.d(108): Error: class `test21008.C` no size because of forward reference --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/test22999.d b/gcc/testsuite/gdc.test/fail_compilation/test22999.d new file mode 100644 index 00000000000..99dfe70378b --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test22999.d @@ -0,0 +1,27 @@ +/* +REQUIRED_ARGS: -de +TEST_OUTPUT: +--- +fail_compilation/test22999.d(18): Deprecation: switch case fallthrough - use 'goto default;' if intended +fail_compilation/test22999.d(25): Deprecation: switch case fallthrough - use 'goto case;' if intended +--- +*/ + +// no switch fallthrough error with multi-valued case +// https://issues.dlang.org/show_bug.cgi?id=22999 +void main() +{ + int i; + switch (0) + { + case 0, 1: i = 20; + default: assert(0); + } + + switch (0) + { + default: + case 0, 1: i = 20; + case 2, 3: i = 30; + } +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/test23017.d b/gcc/testsuite/gdc.test/fail_compilation/test23017.d new file mode 100644 index 00000000000..743789a6b52 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test23017.d @@ -0,0 +1,20 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test23017.d(16): Error: class `test23017.CppChildA` with C++ linkage cannot inherit from class `DClass` with D linkage +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=23017 +// C++ class may not derive from D class +extern(D) class DClass {} +extern(C++) class CppClass +{ + void foo(); +} + +extern(C++) class CppChildA : DClass {} // error +extern(C++) class CppChildB : CppClass {} + +extern(D) class DChildA : DClass {} +extern(D) class DChildB : CppClass {} // automatically made extern(C++) diff --git a/gcc/testsuite/gdc.test/runnable/test20603.d b/gcc/testsuite/gdc.test/runnable/test20603.d new file mode 100644 index 00000000000..47fd3985555 --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/test20603.d @@ -0,0 +1,31 @@ +// https://issues.dlang.org/show_bug.cgi?id=20603 + +enum immutable(int)* x = new int(3); +enum const(int)* y = new int(5); + +struct Base { + union { + int overlap; + immutable(Sub)* sub; + } + + this(Sub) { + sub = new Sub; + } +} + +struct Sub { + Base base; +} + +immutable c0 = Base(Sub.init); + +void main() +{ + enum const(int)* z = new int(9); + + assert(*x == 3); + assert(*y == 5); + assert(*z == 9); + assert(c0.sub.base.sub == null); +} diff --git a/gcc/testsuite/gdc.test/runnable/testscope.d b/gcc/testsuite/gdc.test/runnable/testscope.d index 32d66b58c76..0ca04df188d 100644 --- a/gcc/testsuite/gdc.test/runnable/testscope.d +++ b/gcc/testsuite/gdc.test/runnable/testscope.d @@ -242,22 +242,6 @@ void test7435() { /********************************************/ -char[] dup12()(char[] a) // although inferred pure, don't infer a is 'return' -{ - char[] res; - foreach (ref e; a) - {} - return res; -} - -char[] foo12() -{ - char[10] buf; - return dup12(buf); -} - -/********************************************/ - void test7049() @safe { int count = 0; diff --git a/gcc/testsuite/gdc.test/runnable/xtest46.d b/gcc/testsuite/gdc.test/runnable/xtest46.d index eeaa1dbe72d..8ae08ad2e47 100644 --- a/gcc/testsuite/gdc.test/runnable/xtest46.d +++ b/gcc/testsuite/gdc.test/runnable/xtest46.d @@ -3816,8 +3816,8 @@ void test153() /***************************************************/ // https://issues.dlang.org/show_bug.cgi?id=3632 - -void test154() { +void test154() +{ float f; assert(f is float.init); double d; @@ -3832,6 +3832,87 @@ void test154() { /***************************************************/ +__gshared int global3632 = 1; + +void test3632() +{ + int test(T)() + { + static struct W + { + T f; + this(T g) { if (__ctfe || global3632) f = g; } + } + auto nan = W(T.nan); + auto nan2 = W(T.nan); + auto init = W(T.init); + auto init2 = W(T.init); + auto zero = W(cast(T)0); + auto zero2 = W(cast(T)0); + auto nzero2 = W(-cast(T)0); + + // Struct equality + assert(!(nan == nan2)); + assert(!(nan == init2)); + assert(!(init == init2)); + assert( (zero == zero2)); + assert( (zero == nzero2)); + + // Float equality + assert(!(nan.f == nan2.f)); + assert(!(nan.f == init2.f)); + assert(!(init.f == init2.f)); + assert( (zero.f == zero2.f)); + assert( (zero.f == nzero2.f)); + + // Struct identity + assert( (nan is nan2)); + assert( (nan is init2)); + assert( (init is init2)); + assert( (zero is zero2)); + assert(!(zero is nzero2)); + + // Float identity + assert( (nan.f is nan2.f)); + assert( (nan.f is init2.f)); + assert( (init.f is init2.f)); + assert( (zero.f is zero2.f)); + assert(!(zero.f is nzero2.f)); + + // Struct !identity + assert(!(nan !is nan2)); + assert( (nan is init2)); + assert(!(init !is init2)); + assert(!(zero !is zero2)); + assert( (zero !is nzero2)); + + // float !identity + assert(!(nan.f !is nan2.f)); + assert( (nan.f is init2.f)); + assert(!(init.f !is init2.f)); + assert(!(zero.f !is zero2.f)); + assert( (zero.f !is nzero2.f)); + + // .init identity + assert(W.init is W.init); + + return 1; + } + + auto rtF = test!float(); + enum ctF = test!float(); + auto rtD = test!double(); + enum ctD = test!double(); + auto rtR = test!real(); + enum ctR = test!real(); + + assert(float.nan !is -float.nan); + assert(double.nan !is -double.nan); + assert(real.nan !is -real.nan); +} + +/***************************************************/ + void test6545() { static int[] func() @@ -8142,6 +8223,7 @@ int main() test155(); test156(); test658(); + test3632(); test4258(); test4539(); test4963(); diff --git a/gcc/testsuite/gfortran.dg/array_reference_3.f90 b/gcc/testsuite/gfortran.dg/array_reference_3.f90 new file mode 100644 index 00000000000..85fa3317d98 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/array_reference_3.f90 @@ -0,0 +1,195 @@ +! { dg-do run } +! { dg-additional-options "-fdump-tree-original" } +! +! PR fortran/102043 +! Array indexing was causing the middle-end to conclude the index +! to be non-negative, which can be wrong for arrays with a "reversed-order" +! descriptor. This was fixed by using pointer arithmetic when +! the index can be negative. +! +! This test checks the code generated for array references of various kinds +! of arrays, using either array indexing or pointer arithmetic. + +program p + implicit none + call check_assumed_shape_elem + call check_assumed_shape_scalarized + call check_descriptor_dim + call check_cfi_dim + call check_substring + call check_ptr_elem + call check_ptr_scalarized + call check_explicit_shape_elem + call check_explicit_shape_scalarized + call check_tmp_array + call check_allocatable_array_elem + call check_allocatable_array_scalarized +contains + subroutine cases(assumed_shape_x) + integer :: assumed_shape_x(:) + assumed_shape_x(2) = 10 + end subroutine cases + subroutine check_assumed_shape_elem + integer :: x(3) + x = 0 + call cases(x) + if (any(x /= (/ 0, 10, 0 /))) stop 10 + ! Assumed shape array are referenced with pointer arithmetic. + ! { dg-final { scan-tree-dump-times "\\*\\(\\(integer\\(kind=4\\) \\*\\) assumed_shape_x.\\d+ \\+ \\(sizetype\\) \\(\\(stride.\\d+ \\* 2 \\+ offset.\\d+\\) \\* 4\\)\\) = 10;" 1 "original" } } + end subroutine check_assumed_shape_elem + subroutine casss(assumed_shape_y) + integer :: assumed_shape_y(:) + assumed_shape_y = 11 + end subroutine casss + subroutine check_assumed_shape_scalarized + integer :: y(3) + call casss(y) + if (any(y /= 11)) stop 11 + ! Assumed shape array are referenced with pointer arithmetic. + ! { dg-final { scan-tree-dump-times "\\*\\(\\(integer\\(kind=4\\) \\*\\) assumed_shape_y.\\d+ \\+ \\(sizetype\\) \\(\\(S.\\d+ \\* D.\\d+ \\+ D.\\d+\\) \\* 4\\)\\) = 11;" 1 "original" } } + end subroutine check_assumed_shape_scalarized + subroutine check_descriptor_dim + integer, allocatable :: descriptor(:) + allocate(descriptor(4)) + descriptor(:) = 12 + if (any(descriptor /= 12)) stop 12 + ! The descriptor’s dim array is referenced with array indexing. + ! { dg-final { scan-tree-dump-times "descriptor\\.dim\\\[0\\\]\\.ubound = 4;" 1 "original" } } + end subroutine check_descriptor_dim + subroutine ccfis(cfi_descriptor) bind(c) + integer :: cfi_descriptor(:) + cfi_descriptor = 13 + end subroutine ccfis + subroutine check_cfi_dim + integer :: x(5) + call ccfis(x) + if (any(x /= 13)) stop 13 + ! The cfi descriptor’s dim array is referenced with array indexing. + ! { dg-final { scan-tree-dump-times "cfi_descriptor->dim\\\[idx.\\d+\\\]\\.ubound = _cfi_descriptor->dim\\\[idx.\\d+\\\]\\.extent \\+ \\(cfi_descriptor->dim\\\[idx.\\d+\\\]\\.lbound \\+ -1\\);" 1 "original" } } + end subroutine check_cfi_dim + subroutine css(c) bind(c) + character :: c + c = 'k' + end subroutine css + subroutine check_substring + character(5) :: x + x = 'abcde' + call css(x(3:3)) + if (x /= 'abkde') stop 14 + ! Substrings use array indexing + ! { dg-final { scan-tree-dump-times "css \\(\\(character\\(kind=1\\)\\\[\\d+:\\d+\\\] \\*\\) &x\\\[3\\\].lb: \\d+ sz: \\d+.\\);" 1 "original" } } + end subroutine check_substring + subroutine check_ptr_elem + integer, target :: x(7) + integer, pointer :: ptr_x(:) + x = 0 + ptr_x => x + ptr_x(4) = 16 + if (any(ptr_x /= (/ 0, 0, 0, 16, 0, 0, 0 /))) stop 16 + ! pointers are referenced with pointer arithmetic. + ! { dg-final { scan-tree-dump-times "\\*\\(integer\\(kind=4\\) \\*\\) \\(ptr_x\\.data \\+ \\(sizetype\\) \\(\\(ptr_x\\.offset \\+ ptr_x\\.dim\\\[0\\\]\\.stride \\* 4\\) \\* ptr_x\\.span\\)\\) = 16;" 1 "original" } } + end subroutine check_ptr_elem + subroutine check_ptr_scalarized + integer, target :: y(8) + integer, pointer :: ptr_y(:) + y = 0 + ptr_y => y + ptr_y = 17 + if (any(ptr_y /= 17)) stop 17 + ! pointers are referenced with pointer arithmetic. + ! { dg-final { scan-tree-dump-times "\\*\\(\\(integer\\(kind=4\\) \\*\\) D.\\d+ \\+ \\(sizetype\\) \\(\\(S.\\d+ \\* D.\\d+ \\+ D.\\d+\\) \\* ptr_y\\.span\\)\\) = 17;" 1 "original" } } + end subroutine check_ptr_scalarized + subroutine check_explicit_shape_elem + integer :: explicit_shape_x(9) + explicit_shape_x = 0 + explicit_shape_x(5) = 18 + if (any(explicit_shape_x /= (/ 0, 0, 0, 0, 18, 0, 0, 0, 0 /))) stop 18 + ! Explicit shape arrays are referenced with array indexing. + ! { dg-final { scan-tree-dump-times "explicit_shape_x\\\[4\\\] = 18;" 1 "original" } } + end subroutine check_explicit_shape_elem + subroutine check_explicit_shape_scalarized + integer :: explicit_shape_y(3) + explicit_shape_y = 19 + if (any(explicit_shape_y /= 19)) stop 19 + ! Explicit shape arrays are referenced with array indexing. + ! { dg-final { scan-tree-dump-times "explicit_shape_y\\\[S.\\d+ \\+ -1\\\] = 19;" 1 "original" } } + end subroutine check_explicit_shape_scalarized + subroutine check_tmp_array + integer :: non_tmp(6) + non_tmp = 15 + non_tmp(2:5) = non_tmp(1:4) + non_tmp(3:6) + if (any(non_tmp /= (/ 15, 30, 30, 30, 30, 15 /))) stop 15 + ! temporary arrays use array indexing + ! { dg-final { scan-tree-dump-times "\\(*\\(integer\\(kind=4\\)\\\[4\\\] \\* restrict\\) atmp.\\d+\\.data\\)\\\[S.\\d+\\\] = non_tmp\\\[S.\\d+\\\] \\+ non_tmp\\\[S.\\d+ \\+ 2\\\];" 1 "original" } } + ! { dg-final { scan-tree-dump-times "non_tmp\\\[S.\\d+ \\+ 1\\\] = \\(\\*\\(integer\\(kind=4\\)\\\[4\\\] \\* restrict\\) atmp.\\d+\\.data\\)\\\[S.\\d+\\\];" 1 "original" } } + end subroutine check_tmp_array + subroutine check_allocatable_array_elem + integer, allocatable :: allocatable_x(:) + allocate(allocatable_x(4),source=0) + allocatable_x(2) = 20 + if (any(allocatable_x /= (/ 0, 20, 0, 0 /))) stop 20 + ! Allocatable arrays are referenced with array indexing. + ! { dg-final { scan-tree-dump-times "\\(\\*\\(integer\\(kind=4\\)\\\[0:\\\] \\* restrict\\) allocatable_x\\.data\\)\\\[allocatable_x\\.offset \\+ 2\\\] = 20;" 1 "original" } } + end subroutine check_allocatable_array_elem + subroutine check_allocatable_array_scalarized + integer, allocatable :: allocatable_y(:) + allocate(allocatable_y(5),source=0) + allocatable_y = 21 + if (any(allocatable_y /= 21)) stop 21 + ! Allocatable arrays are referenced with array indexing. + ! { dg-final { scan-tree-dump-times "\\(\\*D.\\d+\\)\\\[S.\\d+ \\+ \\D.\\d+\\\] = 21;" 1 "original" } } + end subroutine check_allocatable_array_scalarized + subroutine cares(assumed_rank_x) + integer :: assumed_rank_x(..) + select rank(rank_1_var_x => assumed_rank_x) + rank(1) + rank_1_var_x(3) = 22 + end select + end subroutine cares + subroutine check_assumed_rank_elem + integer :: x(6) + x = 0 + call cares(x) + if (any(x /= (/ 0, 0, 22, 0, 0, 0 /))) stop 22 + ! Assumed rank arrays are referenced with pointer arithmetic. + ! { dg-final { scan-tree-dump-times "\\*\\(\\(integer\\(kind=4\\) \\*\\) __tmp_INTEGER_4_rank_1\\.data \\+ \\(sizetype\\) \\(\\(__tmp_INTEGER_4_rank_1\\.offset \\+ __tmp_INTEGER_4_rank_1\\.dim\\\[0\\\]\\.stride \\* 3\\) \\* 4\\)\\) = 22;" 1 "original" } } + end subroutine check_assumed_rank_elem + subroutine carss(assumed_rank_y) + integer :: assumed_rank_y(..) + select rank(rank_1_var_y => assumed_rank_y) + rank(1) + rank_1_var_y = 23 + end select + end subroutine carss + subroutine check_assumed_rank_scalarized + integer :: y(7) + call carss(y) + if (any(y /= 23)) stop 23 + ! Assumed rank arrays are referenced with pointer arithmetic. + ! { dg-final { scan-tree-dump-times "\\*\\(\\(integer\\(kind=4\\) \\*\\) D.\\d+ \\+ \\(sizetype\\) \\(\\(S.\\d+ \\* D.\\d+ \\+ D.\\d+\\) \\* 4\\)\\) = 23;" 1 "original" } } + end subroutine check_assumed_rank_scalarized + subroutine casces(assumed_shape_cont_x) + integer, dimension(:), contiguous :: assumed_shape_cont_x + assumed_shape_cont_x(4) = 24 + end subroutine casces + subroutine check_assumed_shape_cont_elem + integer :: x(8) + x = 0 + call casces(x) + if (any(x /= (/ 0, 0, 0, 24, 0, 0, 0, 0 /))) stop 24 + ! Contiguous assumed shape arrays are referenced with array indexing. + ! { dg-final { scan-tree-dump-times "\\(\\*assumed_shape_cont_x.\\d+\\)\\\[stride.\\d+ \\* 4 \\+ offset.\\d+\\\] = 24;" 1 "original" } } + end subroutine check_assumed_shape_cont_elem + subroutine cascss(assumed_shape_cont_y) + integer, dimension(:), contiguous :: assumed_shape_cont_y + assumed_shape_cont_y = 25 + end subroutine cascss + subroutine check_assumed_shape_cont_scalarized + integer :: y(9) + call cascss(y) + if (any(y /= 25)) stop 25 + ! Contiguous assumed shape arrays are referenced with array indexing. + ! { dg-final { scan-tree-dump-times "\\(\\*assumed_shape_cont_y.\\d+\\)\\\[S.\\d+ \\* D.\\d+ \\+ D.\\d+\\\] = 25;" 1 "original" } } + end subroutine check_assumed_shape_cont_scalarized +end program p + diff --git a/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 b/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 index 9c40b26d830..7b1149aaa45 100644 --- a/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 +++ b/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 @@ -17,7 +17,7 @@ end ! { dg-final { scan-tree-dump-not " _gfortran_internal_pack" "original" } } ! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.xxx.\[0-9\]+\\)\\\[0\\\];" 1 "original" } } ! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.xxx.\[0-9\]+\\)\\\[D.\[0-9\]+ \\* 4\\\];" 1 "original" } } -! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.yyy.\[0-9\]+\\)\\\[0\\\];" 1 "original" } } -! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.yyy.\[0-9\]+\\)\\\[D.\[0-9\]+ \\* 4\\\];" 1 "original" } } +! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) yyy.\[0-9\]+;" 1 "original" } } +! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) yyy.\[0-9\]+ \\+ \\(sizetype\\) \\(D.\[0-9\]+ \\* 16\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "D.\[0-9\]+ = parm.\[0-9\]+.data;\[^;]+ptr\[1-4\] = D.\[0-9\]+;" 4 "original" } } diff --git a/gcc/testsuite/gfortran.dg/character_array_dummy_1.f90 b/gcc/testsuite/gfortran.dg/character_array_dummy_1.f90 new file mode 100644 index 00000000000..da5ed636f4f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/character_array_dummy_1.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! +! PR fortran/105381 +! Infinite recursion with array references of character dummy arguments. +! +! Contributed by Harald Anlauf <anlauf@gmx.de> + +MODULE m + implicit none + integer, parameter :: ncrit = 8 + integer, parameter :: nterm = 7 +contains + + subroutine new_thin_rule (rule1) + character(*),intent(in) ,optional :: rule1(ncrit) + character(len=8) :: rules (ncrit,nterm) + rules = '' + if (present (rule1)) rules(:,1) = rule1 ! <-- compile time hog + end subroutine new_thin_rule + +end module m diff --git a/gcc/testsuite/gfortran.dg/class_dummy_8.f90 b/gcc/testsuite/gfortran.dg/class_dummy_8.f90 new file mode 100644 index 00000000000..0976a725866 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_dummy_8.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! +! PR fortran/105379 +! Type comparison of class containers used to trigger an ICE when one of the +! class containers had a non-constant array spec. +! +! Contributed by Gerhard Steinmetz <gscfq@t-online.de>. + +program p + type t + end type +contains + subroutine s1(x) + class(t) :: x(3) + end + subroutine s2(n, x) + integer :: n + class(t) :: x(n) + end +end diff --git a/gcc/testsuite/gfortran.dg/class_dummy_9.f90 b/gcc/testsuite/gfortran.dg/class_dummy_9.f90 new file mode 100644 index 00000000000..0fd98c05be2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_dummy_9.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! +! PR fortran/105379 +! Type comparison of class containers used to trigger an ICE when one of the +! class containers had a non-constant array spec. +! +! Contributed by Gerhard Steinmetz <gscfq@t-online.de>. + +program p + type t + end type + integer :: m = 3 +contains + subroutine s1(x) + class(t) :: x(3) + end + subroutine s3(x) + class(t) :: x(m) + end +end diff --git a/gcc/testsuite/gfortran.dg/coarray_44.f90 b/gcc/testsuite/gfortran.dg/coarray_44.f90 index 15fb8c76ce4..545b5462251 100644 --- a/gcc/testsuite/gfortran.dg/coarray_44.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_44.f90 @@ -10,3 +10,5 @@ program pr70071 allocate (z(2)[1::2,*]) ! { dg-error "Bad array dimension" } allocate (z(1::2)[2,*]) ! { dg-error "Bad array specification in ALLOCATE" } end program pr70071 + +! { dg-prune-output "Bad coarray specification in ALLOCATE statement" } diff --git a/gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 b/gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 index 0e806f0955b..0e4f64e1e3d 100644 --- a/gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_allocate_11.f90 @@ -3,10 +3,10 @@ program p integer, allocatable :: z[:,:] integer :: i - allocate (z[1:,*]) ! { dg-error "Bad array specification in ALLOCATE statement" } - allocate (z[:2,*]) ! { dg-error "Bad array specification in ALLOCATE statement" } + allocate (z[1:,*]) ! { dg-error "Bad coarray specification in ALLOCATE statement" } + allocate (z[:2,*]) ! { dg-error "Bad coarray specification in ALLOCATE statement" } allocate (z[2:1,*]) ! { dg-error "Upper cobound is less than lower cobound" } - allocate (z[:0,*]) ! { dg-error "Bad array specification in ALLOCATE statement" } + allocate (z[:0,*]) ! { dg-error "Bad coarray specification in ALLOCATE statement" } allocate (z[0,*]) ! { dg-error "Upper cobound is less than lower cobound" } allocate (z[1,*]) ! This is OK allocate (z[1:1,*]) ! This is OK diff --git a/gcc/testsuite/gfortran.dg/coarray_allocate_12.f90 b/gcc/testsuite/gfortran.dg/coarray_allocate_12.f90 new file mode 100644 index 00000000000..2169aa19998 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_allocate_12.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +! PR fortran/105184 +! Based on testcases by Gerhard Steinmetz + +program p + real, allocatable :: x[:,:] + integer :: n = 2 + allocate (x[ n, *]) + allocate (x[1:n, *]) + allocate (x[n:n, *]) + allocate (x[n, 5:*]) + allocate (x[ :n, *]) ! { dg-error "Bad coarray specification" } + allocate (x[::n, *]) ! { dg-error "Bad coarray specification" } + allocate (x[ :1:1, *]) ! { dg-error "Bad coarray specification" } + allocate (x[1:n:n, *]) ! { dg-error "Bad coarray specification" } + allocate (x[1, : *]) ! { dg-error "Missing lower bound" } +end diff --git a/gcc/testsuite/gfortran.dg/dec_union_12.f90 b/gcc/testsuite/gfortran.dg/dec_union_12.f90 new file mode 100755 index 00000000000..26671230b05 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dec_union_12.f90 @@ -0,0 +1,43 @@ +! { dg-do compile } +! { dg-options "-std=legacy -ffree-form -finit-local-zero -finit-derived -fdec-structure" } +! +! PR fortran/105310 +! +! Test that gfc_conv_union_initializer does not cause an ICE when called +! to build the constructor for a field which triggers a vector resize. +! + +program dec_union_12 + implicit none +STRUCTURE /foo8u/ + ! 8 fields + INTEGER(4) :: a,b,c,d,e,f,g,h + UNION + MAP + ENDMAP + ENDUNION +ENDSTRUCTURE +STRUCTURE /foo16u/ + ! 16 fields + INTEGER(4) :: a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p + UNION + MAP + ENDMAP + ENDUNION +ENDSTRUCTURE +STRUCTURE /foo32u/ + ! 32 fields + INTEGER(4) :: a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p + INTEGER(4) :: aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap + UNION + MAP + ENDMAP + ENDUNION +ENDSTRUCTURE + record /foo8u/ bar8u + record /foo16u/ bar16u + record /foo32u/ bar32u + bar8u.a = 1 + bar16u.a = 1 + bar32u.a = 1 +end diff --git a/gcc/testsuite/gfortran.dg/dependency_49.f90 b/gcc/testsuite/gfortran.dg/dependency_49.f90 index 73d517e8f76..9638f65c069 100644 --- a/gcc/testsuite/gfortran.dg/dependency_49.f90 +++ b/gcc/testsuite/gfortran.dg/dependency_49.f90 @@ -11,4 +11,5 @@ program main a%x = a%x(2:3) print *,a%x end program main -! { dg-final { scan-tree-dump-times "__var_1" 4 "original" } } +! The temporary var appears three times: declaration, copy-in and copy-out +! { dg-final { scan-tree-dump-times "__var_1" 3 "original" } } diff --git a/gcc/testsuite/gfortran.dg/finalize_10.f90 b/gcc/testsuite/gfortran.dg/finalize_10.f90 index 937dff5a167..c0e4170fd66 100644 --- a/gcc/testsuite/gfortran.dg/finalize_10.f90 +++ b/gcc/testsuite/gfortran.dg/finalize_10.f90 @@ -31,7 +31,7 @@ end subroutine foo ! { dg-final { scan-tree-dump-times "x->_vptr->_copy \\(" 1 "original" } } ! FINALIZE TYPE: -! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void \\*\\) &\\(\\*aa.\[0-9\]+\\)\\\[0\\\];" 1 "original" } } +! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void \\*\\) aa.\[0-9\]+;" 1 "original" } } ! { dg-final { scan-tree-dump-times "__final_m_T2 \\(&parm.\[0-9\]+, 0, 0\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "desc.\[0-9\]+.data = \\(void \\* restrict\\) bb;" 1 "original" } } ! { dg-final { scan-tree-dump-times "__final_m_T2 \\(&desc.\[0-9\]+, 0, 0\\);" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/g77/pr105203.f b/gcc/testsuite/gfortran.dg/g77/pr105203.f new file mode 100644 index 00000000000..3b47210fb40 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/g77/pr105203.f @@ -0,0 +1,20 @@ +C Test case for PR debug/105203 +C Origin: kmccarty@princeton.edu +C +C { dg-do compile } +C { dg-options "-O2 -fcompare-debug -ftracer -w" } +C { dg-additional-options "-fPIC" { target fpic } } + SUBROUTINE FOO (B) + + 10 CALL BAR (A) + ASSIGN 20 TO M + IF (100.LT.A) GOTO 10 + GOTO 40 +C + 20 IF (B.LT.ABS(A)) GOTO 10 + ASSIGN 30 TO M + GOTO 40 +C + 30 ASSIGN 10 TO M + 40 GOTO M,(10,20,30) + END diff --git a/gcc/testsuite/gfortran.dg/goacc/pr104717.f90 b/gcc/testsuite/gfortran.dg/goacc/pr104717.f90 new file mode 100644 index 00000000000..4ef16187c84 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/pr104717.f90 @@ -0,0 +1,22 @@ +! Extracted from 'libgomp.oacc-fortran/privatized-ref-2.f90'. + +! { dg-additional-options "-O1 -fstack-arrays -fipa-pta" } + +program main + implicit none (type, external) + integer :: j + integer, allocatable :: A(:) + + A = [(3*j, j=1, 10)] + call foo (A, size(A)) + deallocate (A) +contains + subroutine foo (array, nn) + integer :: i, nn + integer :: array(nn) + + !$acc parallel copyout(array) + array = [(-i, i = 1, nn)] + !$acc end parallel + end subroutine foo +end diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 index 4dfeb7e07a2..13772c185ce 100644 --- a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 @@ -13,7 +13,7 @@ ! passed to 'incr' may be unset, and in that case, it will be set to [...]", ! so to maintain compatibility with earlier Tcl releases, we manually ! initialize counter variables: -! { dg-line l_dummy[variable c_loop 0] } +! { dg-line l_dummy[variable c_compute 0 c_loop 0] } ! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid ! "WARNING: dg-line var l_dummy defined, but not used". @@ -26,7 +26,7 @@ contains integer, parameter :: c = 3 integer, external :: g - !$acc parallel + !$acc parallel ! { dg-line l_compute[incr c_compute] } !$acc loop collapse(2) private(a) private(x, y) ! { dg-line l_loop[incr c_loop] } do i = 1, 20 do j = 1, 25 @@ -46,6 +46,8 @@ contains y = a end do end do + !$acc end parallel + ! { dg-note {variable 'count\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } ! { dg-note {variable 'count\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } @@ -54,6 +56,5 @@ contains ! { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop } ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop } ! { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } - !$acc end parallel end subroutine f end module m diff --git a/gcc/testsuite/gfortran.dg/gomp/loop-exit.f90 b/gcc/testsuite/gfortran.dg/gomp/loop-exit.f90 new file mode 100644 index 00000000000..81eebcba66a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/loop-exit.f90 @@ -0,0 +1,674 @@ +subroutine sub1 +!$omp do +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub2 +!$omp parallel do +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub3 +!$omp simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub4 +!$omp do simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub5 +!$omp parallel do simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub6 +!$omp distribute simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub7 +!$omp distribute parallel do +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub8 +!$omp distribute parallel do simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub9 +!$omp teams distribute simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub10 +!$omp target teams distribute simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub11 +!$omp teams distribute parallel do +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub12 +!$omp target teams distribute parallel do +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub13 +!$omp teams distribute parallel do simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub14 +!$omp target teams distribute parallel do simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub15 +!$omp target parallel do +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub16 +!$omp target parallel do simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub17 +!$omp target simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub18 +!$omp taskloop simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub19 +!$omp parallel master taskloop simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub20 +!$omp master taskloop simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub21 +!$omp parallel masked taskloop simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub22 +!$omp masked taskloop simd +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub23 +!$omp loop +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub24 +!$omp parallel loop +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub25 +!$omp teams loop +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub26 +!$omp target parallel loop +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub27 +!$omp target teams loop +outer: do i = 1, 5 + inner: do j = 1, 5 + if (k == 5) exit ! ok + if (k == 7) exit inner ! ok + if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do inner +end do outer +end + +subroutine sub28 +!$omp do collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub29 +!$omp parallel do collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub30 +!$omp simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub31 +!$omp do simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub32 +!$omp parallel do simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub33 +!$omp distribute simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub34 +!$omp distribute parallel do collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub35 +!$omp distribute parallel do simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub36 +!$omp teams distribute simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub37 +!$omp target teams distribute simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub38 +!$omp teams distribute parallel do collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub39 +!$omp target teams distribute parallel do collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub40 +!$omp teams distribute parallel do simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub41 +!$omp target teams distribute parallel do simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub42 +!$omp target parallel do collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub43 +!$omp target parallel do simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub44 +!$omp target simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub45 +!$omp taskloop simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub46 +!$omp parallel master taskloop simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub47 +!$omp master taskloop simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub48 +!$omp parallel masked taskloop simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub49 +!$omp masked taskloop simd collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub50 +!$omp loop collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub51 +!$omp parallel loop collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub52 +!$omp teams loop collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub53 +!$omp target parallel loop collapse(3) +do ii = i1, i2 +do jj = j1, j2 +do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end + +subroutine sub54 +!$omp target teams loop collapse(3) +do ii = i1, i2 + do jj = j1, j2 + do kk = k1, k2 + if (kk > 5) then + k = 0 + end if + if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" } + end do + end do +end do +end diff --git a/gcc/testsuite/gfortran.dg/negative_stride_1.f90 b/gcc/testsuite/gfortran.dg/negative_stride_1.f90 new file mode 100644 index 00000000000..45da92a223f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/negative_stride_1.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! +! PR fortran/102043 +! The middle-end used to conclude from array indexing that the index +! should be non-negative and thus that array accesses to reversed arrays +! (i.e. with negative strides) only access the last element of the array, +! as the access involves a pointer to array that is initialized to point +! to the last element in the case of a reversed array. + +program main + implicit none + integer :: a(3, 3) + integer :: i + a = 0 + call s(a(3:1:-1,:)) + if (any(a(:,1) /= (/ 7, 5, 3 /))) stop 1 + if (any(a(:,2) /= (/ 17, 13, 11 /))) stop 2 + if (any(a(:,3) /= (/ 29, 23, 19 /))) stop 3 +contains + subroutine s(b) + implicit none + integer, dimension(:,:) :: b + b = reshape((/ 3, 5, 7, 11, 13, 17, 19, 23, 29 /), (/ 3, 3 /)) + end subroutine s +end program main diff --git a/gcc/testsuite/gfortran.dg/pr70673.f90 b/gcc/testsuite/gfortran.dg/pr70673.f90 index fa4bd2fe02b..6eb9e7fa1b7 100644 --- a/gcc/testsuite/gfortran.dg/pr70673.f90 +++ b/gcc/testsuite/gfortran.dg/pr70673.f90 @@ -9,14 +9,12 @@ contains subroutine s(inp) character(*), intent(in) :: inp character(:), allocatable :: a - a = a ! This used to ICE. a = inp a = a ! This used to ICE too if ((len (a) .ne. 5) .or. (a .ne. "hello")) STOP 1 a = a(2:3) ! Make sure that temporary creation is not broken. if ((len (a) .ne. 2) .or. (a .ne. "el")) STOP 2 deallocate (a) - a = a ! This would ICE too. end subroutine s end module m diff --git a/gcc/testsuite/gfortran.dg/pr70673_2.f90 b/gcc/testsuite/gfortran.dg/pr70673_2.f90 new file mode 100644 index 00000000000..ba2ce2f2a96 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr70673_2.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! +! Test the fix for PR70673 +! +! Contributed by David Kinniburgh <davidgkinniburgh@yahoo.co.uk> +! +module m +contains + subroutine s(inp) + character(*), intent(in) :: inp + character(:), allocatable :: a + a = a ! This used to ICE. + a = inp + a = a ! This used to ICE too + if ((len (a) .ne. 5) .or. (a .ne. "hello")) STOP 1 + a = a(2:3) ! Make sure that temporary creation is not broken. + if ((len (a) .ne. 2) .or. (a .ne. "el")) STOP 2 + deallocate (a) + a = a ! This would ICE too. + end subroutine s +end module m + + use m + call s("hello") +end diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 index 075d6d727e2..00dd2ae1199 100644 --- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_3.f03 @@ -1,4 +1,5 @@ ! { dg-do run } +! { dg-additional-options "-fdump-tree-dse-details" } ! ! Check that pointer assignments allowed by F2003:C717 ! work and check null initialization of CLASS(*) pointers. @@ -7,20 +8,31 @@ ! program main interface - subroutine foo(z) + subroutine foo_bc(z) class(*), pointer, intent(in) :: z - end subroutine foo + end subroutine foo_bc + subroutine foo_sq(z) + class(*), pointer, intent(in) :: z + end subroutine foo_sq end interface + type, bind(c) :: bc + integer :: i + end type bc type sq sequence - integer :: i + integer :: k end type sq + type(bc), target :: w type(sq), target :: x class(*), pointer :: y, z - x%i = 42 + w%i = 23 + y => w + z => y ! unlimited => unlimited allowed + call foo_bc(z) + x%k = 42 y => x z => y ! unlimited => unlimited allowed - call foo (z) + call foo_sq(z) call bar contains subroutine bar @@ -33,21 +45,31 @@ contains end program main - -subroutine foo(tgt) +subroutine foo_bc(tgt) use iso_c_binding class(*), pointer, intent(in) :: tgt - type, bind(c) :: s - integer (c_int) :: k - end type s - type t + type, bind(c) :: bc + integer (c_int) :: i + end type bc + type(bc), pointer :: ptr1 + ptr1 => tgt ! bind(c) => unlimited allowed + if (ptr1%i .ne. 23) STOP 2 +end subroutine foo_bc + +subroutine foo_sq(tgt) + class(*), pointer, intent(in) :: tgt + type sq sequence integer :: k - end type t - type(s), pointer :: ptr1 - type(t), pointer :: ptr2 - ptr1 => tgt ! bind(c) => unlimited allowed - if (ptr1%k .ne. 42) STOP 2 + end type sq + type(sq), pointer :: ptr2 ptr2 => tgt ! sequence type => unlimited allowed if (ptr2%k .ne. 42) STOP 3 -end subroutine foo +end subroutine foo_sq + +! PR fortran/103662 +! We used to produce multiple independant types for the unlimited polymorphic +! descriptors (types for class(*)) which caused stores to them to be seen as +! useless. +! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &w" "dse1" { target __OPTIMIZE__ } } } +! { dg-final { scan-tree-dump-not "Deleted dead store: z._data = &x" "dse1" { target __OPTIMIZE__ } } } diff --git a/gcc/testsuite/gfortran.dg/vector_subscript_8.f90 b/gcc/testsuite/gfortran.dg/vector_subscript_8.f90 new file mode 100644 index 00000000000..e90450b2f1b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vector_subscript_8.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! +! PR fortran/102043 +! The middle-end used to conclude from array indexing that the index +! should be non-negative and thus that array accesses to reversed arrays +! (i.e. with negative strides) only access the last element of the array, +! as the access involves a pointer to array that is initialized to point +! to the last element in the case of a reversed array. + +program main + integer, dimension (4) :: idx, a, b + a = (/ 11, 13, 17, 19 /) + idx = (/ 1, 2, 3, 4 /) + a(idx(4:1:-1)) = idx + if (a(1).ne.4) STOP 1 +end program main diff --git a/gcc/testsuite/gfortran.dg/vector_subscript_9.f90 b/gcc/testsuite/gfortran.dg/vector_subscript_9.f90 new file mode 100644 index 00000000000..d70a773287d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vector_subscript_9.f90 @@ -0,0 +1,21 @@ +! { dg-do run } +! +! PR fortran/102043 +! The middle-end used to conclude from array indexing that the index +! should be non-negative and thus that array accesses to reversed arrays +! (i.e. with negative strides) only access the last element of the array, +! as the access involves a pointer to array that is initialized to point +! to the last element in the case of a reversed array. + +program main + integer, dimension (2) :: idx, a, b + a = (/ 3, 4 /) + idx = (/ 1, 2 /) + call check_values(a(idx(2:1:-1)), (/ 4, 3 /)) +contains + subroutine check_values(values, expected) + integer, dimension(:) :: values, expected + if (size(values) /= size(expected)) stop 1 + if (any(values /= expected)) stop 2 + end subroutine check_values +end program main diff --git a/gcc/testsuite/gnat.dg/concat5.adb b/gcc/testsuite/gnat.dg/concat5.adb new file mode 100644 index 00000000000..fabf24865d6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/concat5.adb @@ -0,0 +1,9 @@ +-- { dg-do run } +-- { dg-options "-O" } + +with Concat5_Pkg1; use Concat5_Pkg1; + +procedure Concat5 is +begin + Scan ("-RTS=none"); +end; diff --git a/gcc/testsuite/gnat.dg/concat5_pkg1.adb b/gcc/testsuite/gnat.dg/concat5_pkg1.adb new file mode 100644 index 00000000000..c32f5af314e --- /dev/null +++ b/gcc/testsuite/gnat.dg/concat5_pkg1.adb @@ -0,0 +1,18 @@ +with Concat5_Pkg2; use Concat5_Pkg2; + +package body Concat5_Pkg1 is + + procedure Make_Failed (S : String); + pragma No_Inline (Make_Failed); + + procedure Make_Failed (S : String) is + begin + Compare (S); + end; + + procedure Scan (S : String) is + begin + Make_Failed ("option " & S & " should start with '--'"); + end; + +end Concat5_Pkg1; diff --git a/gcc/testsuite/gnat.dg/concat5_pkg1.ads b/gcc/testsuite/gnat.dg/concat5_pkg1.ads new file mode 100644 index 00000000000..7f46d87f6e6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/concat5_pkg1.ads @@ -0,0 +1,5 @@ +package Concat5_Pkg1 is + + procedure Scan (S : String); + +end Concat5_Pkg1; diff --git a/gcc/testsuite/gnat.dg/concat5_pkg2.adb b/gcc/testsuite/gnat.dg/concat5_pkg2.adb new file mode 100644 index 00000000000..98bd38826b2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/concat5_pkg2.adb @@ -0,0 +1,10 @@ +package body Concat5_Pkg2 is + + procedure Compare (S : String) is + begin + if S /= "option -RTS=none should start with '--'" then + raise Program_Error; + end if; + end; + +end Concat5_Pkg2; diff --git a/gcc/testsuite/gnat.dg/concat5_pkg2.ads b/gcc/testsuite/gnat.dg/concat5_pkg2.ads new file mode 100644 index 00000000000..2931ffd5d5a --- /dev/null +++ b/gcc/testsuite/gnat.dg/concat5_pkg2.ads @@ -0,0 +1,5 @@ +package Concat5_Pkg2 is + + procedure Compare (S : String); + +end Concat5_Pkg2; diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue10441.go b/gcc/testsuite/go.test/test/fixedbugs/issue10441.go index 9bc4948b15b..7cd26d841b6 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/issue10441.go +++ b/gcc/testsuite/go.test/test/fixedbugs/issue10441.go @@ -1,4 +1,4 @@ -// build +// compile // Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/gcc/testsuite/jit.dg/all-non-failing-tests.h b/gcc/testsuite/jit.dg/all-non-failing-tests.h index 29afe064db6..80606076e78 100644 --- a/gcc/testsuite/jit.dg/all-non-failing-tests.h +++ b/gcc/testsuite/jit.dg/all-non-failing-tests.h @@ -77,6 +77,13 @@ /* test-builtin-unreachable.c: We don't add this one, since it touches the optimization level of the context as a whole. */ +/* test-bitcast.c */ +#define create_code create_code_bitcast +#define verify_code verify_code_bitcast +#include "test-bitcast.c" +#undef create_code +#undef verify_code + /* test-calling-external-function.c */ #define create_code create_code_calling_external_function #define verify_code verify_code_calling_external_function @@ -306,6 +313,12 @@ #undef create_code #undef verify_code +/* test-register-variable.c: This can't be in the testcases array as it + is target-specific. */ + +/* test-setting-alignment.c: This can't be in the testcases array as it + is target-specific. */ + /* test-string-literal.c */ #define create_code create_code_string_literal #define verify_code verify_code_string_literal @@ -400,6 +413,9 @@ const struct testcase testcases[] = { {"builtin-memcpy", create_code_builtin_memcpy, verify_code_builtin_memcpy}, + {"bitcast", + create_code_bitcast, + verify_code_bitcast}, {"calling_external_function", create_code_calling_external_function, verify_code_calling_external_function}, diff --git a/gcc/testsuite/jit.dg/harness.h b/gcc/testsuite/jit.dg/harness.h index 0dc5ed1dad0..7b70ce73dd5 100644 --- a/gcc/testsuite/jit.dg/harness.h +++ b/gcc/testsuite/jit.dg/harness.h @@ -262,6 +262,10 @@ static void set_options (gcc_jit_context *ctxt, const char *argv0) ctxt, GCC_JIT_BOOL_OPTION_DUMP_SUMMARY, 0); + /* Make it easier to compare error messages by disabling colorization, + rather then have them be affected by whether stderr is going to a tty. */ + gcc_jit_context_add_command_line_option + (ctxt, "-fdiagnostics-color=never"); } #endif /* #ifndef TEST_ESCHEWS_SET_OPTIONS */ diff --git a/gcc/testsuite/jit.dg/test-bitcast.c b/gcc/testsuite/jit.dg/test-bitcast.c new file mode 100644 index 00000000000..2f80045293f --- /dev/null +++ b/gcc/testsuite/jit.dg/test-bitcast.c @@ -0,0 +1,61 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <stdint.h> + +#include "libgccjit.h" + +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + /* Let's try to inject the equivalent of: +int32_t +my_bitcast (float x) +{ + return bitcast(x, int32_t); +} + */ + gcc_jit_type *int32 = + gcc_jit_context_get_int_type (ctxt, 4, 1); + gcc_jit_type *float_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_FLOAT); + + gcc_jit_param *x = + gcc_jit_context_new_param ( + ctxt, + NULL, + float_type, "x"); + gcc_jit_param *params[1] = {x}; + gcc_jit_function *func = + gcc_jit_context_new_function (ctxt, + NULL, + GCC_JIT_FUNCTION_EXPORTED, + int32, + "my_bitcast", + 1, params, 0); + + gcc_jit_block *initial = + gcc_jit_function_new_block (func, "initial"); + + gcc_jit_block_end_with_return(initial, NULL, + gcc_jit_context_new_bitcast(ctxt, + NULL, + gcc_jit_param_as_rvalue(x), + int32 + )); +} + +void +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) +{ + typedef int32_t (*my_bitcast_fn_type) (float); + CHECK_NON_NULL (result); + my_bitcast_fn_type my_bitcast = + (my_bitcast_fn_type)gcc_jit_result_get_code (result, "my_bitcast"); + CHECK_NON_NULL (my_bitcast); + int32_t val = my_bitcast (3.1415927f); + note ("my_bitcast returned: 0x%x", val); + CHECK_VALUE (val, 0x40490FDB); +} diff --git a/gcc/testsuite/jit.dg/test-error-bad-bitcast.c b/gcc/testsuite/jit.dg/test-error-bad-bitcast.c new file mode 100644 index 00000000000..642890605ad --- /dev/null +++ b/gcc/testsuite/jit.dg/test-error-bad-bitcast.c @@ -0,0 +1,62 @@ +#include <stdlib.h> +#include <stdio.h> + +#include "libgccjit.h" + +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + /* Let's try to inject the equivalent of: + + int + test_fn () + { + char f[4096]; + return bitcast(f, int); + } + + and verify that the API complains about the bad cast. + */ + gcc_jit_type *int_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_type *char_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CHAR); + + + gcc_jit_type *array_type = + gcc_jit_context_new_array_type (ctxt, NULL, char_type, 4096); + + gcc_jit_function *test_fn = + gcc_jit_context_new_function (ctxt, NULL, + GCC_JIT_FUNCTION_EXPORTED, + int_type, + "test_fn", + 0, NULL, + 0); + gcc_jit_lvalue *f = + gcc_jit_function_new_local ( + test_fn, + NULL, + array_type, "f"); + + gcc_jit_block *block = gcc_jit_function_new_block (test_fn, NULL); + + gcc_jit_block_end_with_return ( + block, NULL, + gcc_jit_context_new_bitcast (ctxt, NULL, + gcc_jit_lvalue_as_rvalue (f), + int_type)); +} + +void +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) +{ + CHECK_VALUE (result, NULL); + + /* Verify that the correct error message was emitted. */ + CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt), + "bitcast with types of different sizes"); +} + diff --git a/gcc/testsuite/jit.dg/test-error-bad-bitcast2.c b/gcc/testsuite/jit.dg/test-error-bad-bitcast2.c new file mode 100644 index 00000000000..602ae407076 --- /dev/null +++ b/gcc/testsuite/jit.dg/test-error-bad-bitcast2.c @@ -0,0 +1,62 @@ +#include <stdlib.h> +#include <stdio.h> + +#include "libgccjit.h" + +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + /* Let's try to inject the equivalent of: + + char[4096] + test_fn () + { + int f; + return bitcast(f, char[4096]); + } + + and verify that the API complains about the bad cast. + */ + gcc_jit_type *int_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_type *char_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CHAR); + + + gcc_jit_type *array_type = + gcc_jit_context_new_array_type (ctxt, NULL, char_type, 4096); + + gcc_jit_function *test_fn = + gcc_jit_context_new_function (ctxt, NULL, + GCC_JIT_FUNCTION_EXPORTED, + array_type, + "test_fn", + 0, NULL, + 0); + gcc_jit_lvalue *f = + gcc_jit_function_new_local ( + test_fn, + NULL, + int_type, "f"); + + gcc_jit_block *block = gcc_jit_function_new_block (test_fn, NULL); + + gcc_jit_block_end_with_return ( + block, NULL, + gcc_jit_context_new_bitcast (ctxt, NULL, + gcc_jit_lvalue_as_rvalue (f), + array_type)); +} + +void +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) +{ + CHECK_VALUE (result, NULL); + + /* Verify that the correct error message was emitted. */ + CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt), + "bitcast with types of different sizes"); +} + diff --git a/gcc/testsuite/jit.dg/test-error-register-variable-bad-name.c b/gcc/testsuite/jit.dg/test-error-register-variable-bad-name.c new file mode 100644 index 00000000000..f2496861eec --- /dev/null +++ b/gcc/testsuite/jit.dg/test-error-register-variable-bad-name.c @@ -0,0 +1,35 @@ +/* + + Test that the proper error is triggered when we build a register variable + with a register name that doesn't exist. + +*/ + +#include <stdlib.h> +#include <stdio.h> + +#include "libgccjit.h" +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + gcc_jit_type *int_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_lvalue *global_variable = + gcc_jit_context_new_global ( + ctxt, NULL, GCC_JIT_GLOBAL_EXPORTED, int_type, "global_variable"); + gcc_jit_lvalue_set_register_name(global_variable, "this_is_not_a_register"); +} + +void +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) +{ + /* Ensure that the bad API usage prevents the API giving a bogus + result back. */ + CHECK_VALUE (result, NULL); + + /* Verify that the correct error message was emitted. */ + CHECK_STRING_VALUE (gcc_jit_context_get_last_error (ctxt), + "invalid register name for 'global_variable'"); +} diff --git a/gcc/testsuite/jit.dg/test-error-register-variable-size-mismatch.c b/gcc/testsuite/jit.dg/test-error-register-variable-size-mismatch.c new file mode 100644 index 00000000000..edea50f8104 --- /dev/null +++ b/gcc/testsuite/jit.dg/test-error-register-variable-size-mismatch.c @@ -0,0 +1,38 @@ +/* + + Test that the proper error is triggered when we build a register variable + with a register name that doesn't exist. + +*/ + +#include <stdlib.h> +#include <stdio.h> + +#include "libgccjit.h" +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + gcc_jit_type *int_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_type *array_type = + gcc_jit_context_new_array_type (ctxt, NULL, int_type, 4096); + gcc_jit_lvalue *global_variable = + gcc_jit_context_new_global ( + ctxt, NULL, GCC_JIT_GLOBAL_EXPORTED, array_type, "global_variable"); + gcc_jit_lvalue_set_register_name(global_variable, "r12"); +} + +void +verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) +{ + /* Ensure that the bad API usage prevents the API giving a bogus + result back. */ + CHECK_VALUE (result, NULL); + + /* Verify that the correct error message was emitted. */ + CHECK_STRING_VALUE + (gcc_jit_context_get_last_error (ctxt), + "data type of 'global_variable' isn't suitable for a register"); +} diff --git a/gcc/testsuite/jit.dg/test-register-variable.c b/gcc/testsuite/jit.dg/test-register-variable.c new file mode 100644 index 00000000000..ce6dcaa9213 --- /dev/null +++ b/gcc/testsuite/jit.dg/test-register-variable.c @@ -0,0 +1,56 @@ +/* { dg-do compile { target x86_64-*-* } } */ + +#include <stdlib.h> +#include <stdio.h> + +#include "libgccjit.h" + +/* We don't want set_options() in harness.h to set -O3 so our little local + is optimized away. */ +#define TEST_ESCHEWS_SET_OPTIONS +static void set_options (gcc_jit_context *ctxt, const char *argv0) +{ +} + +#define TEST_COMPILING_TO_FILE +#define OUTPUT_KIND GCC_JIT_OUTPUT_KIND_ASSEMBLER +#define OUTPUT_FILENAME "output-of-test-link-section-assembler.c.s" +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + /* Let's try to inject the equivalent of: + register int global_variable asm ("r13"); + int main() { + register int variable asm ("r12"); + return 0; + } + */ + gcc_jit_type *int_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_lvalue *global_variable = + gcc_jit_context_new_global ( + ctxt, NULL, GCC_JIT_GLOBAL_EXPORTED, int_type, "global_variable"); + gcc_jit_lvalue_set_register_name(global_variable, "r13"); + + gcc_jit_function *func_main = + gcc_jit_context_new_function (ctxt, NULL, + GCC_JIT_FUNCTION_EXPORTED, + int_type, + "main", + 0, NULL, + 0); + gcc_jit_lvalue *variable = gcc_jit_function_new_local(func_main, NULL, int_type, "variable"); + gcc_jit_lvalue_set_register_name(variable, "r12"); + gcc_jit_rvalue *two = gcc_jit_context_new_rvalue_from_int (ctxt, int_type, 2); + gcc_jit_rvalue *one = gcc_jit_context_one (ctxt, int_type); + gcc_jit_block *block = gcc_jit_function_new_block (func_main, NULL); + gcc_jit_block_add_assignment(block, NULL, variable, one); + gcc_jit_block_add_assignment(block, NULL, global_variable, two); + gcc_jit_block_end_with_return (block, NULL, gcc_jit_lvalue_as_rvalue(variable)); +} + +/* { dg-final { jit-verify-output-file-was-created "" } } */ +/* { dg-final { jit-verify-assembler-output "movl \\\$1, %r12d" } } */ +/* { dg-final { jit-verify-assembler-output "movl \\\$2, %r13d" } } */ diff --git a/gcc/testsuite/jit.dg/test-setting-alignment.c b/gcc/testsuite/jit.dg/test-setting-alignment.c new file mode 100644 index 00000000000..8489df9c6b9 --- /dev/null +++ b/gcc/testsuite/jit.dg/test-setting-alignment.c @@ -0,0 +1,66 @@ +/* { dg-do compile { target x86_64-*-* } } */ + +#include <stdlib.h> +#include <stdio.h> + +#include "libgccjit.h" + +/* We don't want set_options() in harness.h to set -O3 so our little local + is optimized away. */ +#define TEST_ESCHEWS_SET_OPTIONS +static void set_options (gcc_jit_context *ctxt, const char *argv0) +{ +} + +#define TEST_COMPILING_TO_FILE +#define OUTPUT_KIND GCC_JIT_OUTPUT_KIND_ASSEMBLER +#define OUTPUT_FILENAME "output-of-test-setting-alignment.c.s" +#include "harness.h" + +void +create_code (gcc_jit_context *ctxt, void *user_data) +{ + /* Let's try to inject the equivalent of: + int foo __attribute__((aligned (8))); + + int main (void) { + int bar __attribute__((aligned (16))); + } + */ + gcc_jit_type *int_type = + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_lvalue *foo = + gcc_jit_context_new_global ( + ctxt, NULL, GCC_JIT_GLOBAL_EXPORTED, int_type, "foo"); + gcc_jit_lvalue_set_alignment(foo, 8); + + gcc_jit_field *field = gcc_jit_context_new_field (ctxt, + NULL, + int_type, + "a"); + gcc_jit_struct *struct_type = + gcc_jit_context_new_struct_type(ctxt, NULL, "Type", 1, &field); + gcc_jit_function *func_main = + gcc_jit_context_new_function (ctxt, NULL, + GCC_JIT_FUNCTION_EXPORTED, + int_type, + "main", + 0, NULL, + 0); + gcc_jit_lvalue *bar = + gcc_jit_function_new_local ( + func_main, NULL, + gcc_jit_struct_as_type (struct_type), + "bar"); + CHECK_VALUE (gcc_jit_lvalue_get_alignment (bar), 0); + gcc_jit_lvalue_set_alignment (bar, 16); + CHECK_VALUE (gcc_jit_lvalue_get_alignment (bar), 16); + gcc_jit_block *block = gcc_jit_function_new_block (func_main, NULL); + gcc_jit_rvalue *return_value = + gcc_jit_lvalue_as_rvalue (gcc_jit_lvalue_access_field (bar, NULL, field)); + gcc_jit_block_end_with_return (block, NULL, return_value); +} + +/* { dg-final { jit-verify-output-file-was-created "" } } */ +/* { dg-final { jit-verify-assembler-output ".comm foo,4,8" } } */ +/* { dg-final { jit-verify-assembler-output "movl -16\\\(%rbp\\\), %eax" } } */ diff --git a/gcc/testsuite/jit.dg/test-types.c b/gcc/testsuite/jit.dg/test-types.c index 8debcd7eb82..6836597d14e 100644 --- a/gcc/testsuite/jit.dg/test-types.c +++ b/gcc/testsuite/jit.dg/test-types.c @@ -1,3 +1,4 @@ +#include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <stddef.h> @@ -29,6 +30,21 @@ struct zoo long long m_long_long; unsigned long long m_unsigned_long_long; + uint8_t m_u8; + uint16_t m_u16; + uint32_t m_u32; + uint64_t m_u64; + + int8_t m_i8; + int16_t m_i16; + int32_t m_i32; + int64_t m_i64; + +#ifdef __SIZEOF_INT128__ + __uint128_t m_u128; + __int128_t m_i128; +#endif + int m_sized_int_type; float m_float; @@ -101,6 +117,31 @@ create_code (gcc_jit_context *ctxt, void *user_data) gcc_jit_field *field_m_unsigned_long_long = CREATE_FIELD (GCC_JIT_TYPE_UNSIGNED_LONG_LONG, "m_unsigned_long_long"); + gcc_jit_field *field_m_u8 = + CREATE_FIELD (GCC_JIT_TYPE_UINT8_T, "m_u8"); + gcc_jit_field *field_m_u16 = + CREATE_FIELD (GCC_JIT_TYPE_UINT16_T, "m_u16"); + gcc_jit_field *field_m_u32 = + CREATE_FIELD (GCC_JIT_TYPE_UINT32_T, "m_u32"); + gcc_jit_field *field_m_u64 = + CREATE_FIELD (GCC_JIT_TYPE_UINT64_T, "m_u64"); + + gcc_jit_field *field_m_i8 = + CREATE_FIELD (GCC_JIT_TYPE_INT8_T, "m_i8"); + gcc_jit_field *field_m_i16 = + CREATE_FIELD (GCC_JIT_TYPE_INT16_T, "m_i16"); + gcc_jit_field *field_m_i32 = + CREATE_FIELD (GCC_JIT_TYPE_INT32_T, "m_i32"); + gcc_jit_field *field_m_i64 = + CREATE_FIELD (GCC_JIT_TYPE_INT64_T, "m_i64"); + +#ifdef __SIZEOF_INT128__ + gcc_jit_field *field_m_u128 = + CREATE_FIELD (GCC_JIT_TYPE_UINT128_T, "m_u128"); + gcc_jit_field *field_m_i128 = + CREATE_FIELD (GCC_JIT_TYPE_INT128_T, "m_i128"); +#endif + /* Signed int type with sizeof (int): */ gcc_jit_type *sized_int_type = gcc_jit_context_get_int_type (ctxt, sizeof (int), 1); @@ -147,6 +188,21 @@ create_code (gcc_jit_context *ctxt, void *user_data) field_m_long_long, field_m_unsigned_long_long, + field_m_u8, + field_m_u16, + field_m_u32, + field_m_u64, + + field_m_i8, + field_m_i16, + field_m_i32, + field_m_i64, + +#ifdef __SIZEOF_INT128__ + field_m_u128, + field_m_i128, +#endif + field_m_sized_int_type, field_m_float, @@ -266,6 +322,61 @@ create_code (gcc_jit_context *ctxt, void *user_data) gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_UNSIGNED_LONG_LONG), 123456789)) + ASSIGN(field_m_u8, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_UINT8_T), + 123)) + ASSIGN(field_m_u16, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_UINT16_T), + 12345)) + ASSIGN(field_m_u32, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_UINT32_T), + 123456789)) + ASSIGN(field_m_u64, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_UINT64_T), + 123456789)) + + ASSIGN(field_m_i8, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT8_T), + -1)) + ASSIGN(field_m_i16, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT16_T), + -2)) + ASSIGN(field_m_i32, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT32_T), + -3)) + ASSIGN(field_m_i64, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT64_T), + -4)) + +#ifdef __SIZEOF_INT128__ + ASSIGN(field_m_u128, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_UINT128_T), + 123456789)) + ASSIGN(field_m_i128, + gcc_jit_context_new_rvalue_from_int ( + ctxt, + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT128_T), + -5)) +#endif + ASSIGN(field_m_sized_int_type, gcc_jit_context_new_rvalue_from_int ( ctxt, @@ -347,6 +458,21 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) CHECK_VALUE (z.m_long_long, -42); CHECK_VALUE (z.m_unsigned_long_long, 123456789); + CHECK_VALUE (z.m_u8, 123); + CHECK_VALUE (z.m_u16, 12345); + CHECK_VALUE (z.m_u32, 123456789); + CHECK_VALUE (z.m_u64, 123456789); + + CHECK_VALUE (z.m_i8, -1); + CHECK_VALUE (z.m_i16, -2); + CHECK_VALUE (z.m_i32, -3); + CHECK_VALUE (z.m_i64, -4); + +#ifdef __SIZEOF_INT128__ + CHECK_VALUE (z.m_u128, 123456789); + CHECK_VALUE (z.m_i128, -5); +#endif + CHECK_VALUE (z.m_sized_int_type, 500); CHECK_VALUE (z.m_float, 3.141f); @@ -358,4 +484,9 @@ verify_code (gcc_jit_context *ctxt, gcc_jit_result *result) CHECK_VALUE (z.m_size_t, sizeof (struct zoo)); CHECK_VALUE (z.m_FILE_ptr, stderr); + + if (sizeof(long) == 8) + CHECK (gcc_jit_compatible_types ( + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_LONG), + gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT64_T))); } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index ff8edbd3e17..2d5d0539bb4 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2318,8 +2318,9 @@ proc check_ppc_mma_hw_available { } { proc check_ppc_float128_sw_available { } { return [check_cached_effective_target ppc_float128_sw_available { # Some simulators are known to not support VSX/power8/power9 - # instructions. For now, disable on Darwin. - if { [istarget powerpc-*-eabi] + # instructions. For now, disable on Darwin and VxWorks. + if { [istarget *-*-vxworks*] + || [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} { expr 0 @@ -2345,7 +2346,8 @@ proc check_ppc_float128_hw_available { } { return [check_cached_effective_target ppc_float128_hw_available { # Some simulators are known to not support VSX/power8/power9 # instructions. For now, disable on Darwin. - if { [istarget powerpc-*-eabi] + if { [istarget *-*-vxworks*] + || [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} { expr 0 @@ -2370,8 +2372,9 @@ proc check_ppc_float128_hw_available { } { # See if the __ieee128 keyword is understood. proc check_effective_target_ppc_ieee128_ok { } { return [check_cached_effective_target ppc_ieee128_ok { - # disable on AIX. - if { [istarget *-*-aix*] } { + # disable on AIX and VxWorks. + if { [istarget *-*-aix*] + || [istarget *-*-vxworks*]} { expr 0 } else { set options "-mfloat128" @@ -6316,63 +6319,73 @@ proc check_effective_target_powerpc_p9modulo_ok { } { # return 1 if our compiler returns the ARCH_PWR defines with the options # as provided by the test. proc check_effective_target_has_arch_pwr5 { } { - return [check_no_compiler_messages arch_pwr5 assembly { + return [check_no_compiler_messages_nocache arch_pwr5 assembly { #ifndef _ARCH_PWR5 #error does not have power5 support. #else /* "has power5 support" */ #endif - }] + } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr6 { } { - return [check_no_compiler_messages arch_pwr6 assembly { + return [check_no_compiler_messages_nocache arch_pwr6 assembly { #ifndef _ARCH_PWR6 #error does not have power6 support. #else /* "has power6 support" */ #endif - }] + } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr7 { } { - return [check_no_compiler_messages arch_pwr7 assembly { + return [check_no_compiler_messages_nocache arch_pwr7 assembly { #ifndef _ARCH_PWR7 #error does not have power7 support. #else /* "has power7 support" */ #endif - }] + } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr8 { } { - return [check_no_compiler_messages arch_pwr8 assembly { + return [check_no_compiler_messages_nocache arch_pwr8 assembly { #ifndef _ARCH_PWR8 #error does not have power8 support. #else /* "has power8 support" */ #endif - }] + } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr9 { } { - return [check_no_compiler_messages arch_pwr9 assembly { + return [check_no_compiler_messages_nocache arch_pwr9 assembly { #ifndef _ARCH_PWR9 #error does not have power9 support. #else /* "has power9 support" */ #endif - }] + } [current_compiler_flags]] } proc check_effective_target_has_arch_pwr10 { } { - return [check_no_compiler_messages arch_pwr10 assembly { + return [check_no_compiler_messages_nocache arch_pwr10 assembly { #ifndef _ARCH_PWR10 #error does not have power10 support. #else /* "has power10 support" */ #endif - }] + } [current_compiler_flags]] +} + +proc check_effective_target_has_arch_ppc64 { } { + return [check_no_compiler_messages_nocache arch_ppc64 assembly { + #ifndef _ARCH_PPC64 + #error does not have ppc64 support. + #else + /* "has ppc64 support" */ + #endif + } [current_compiler_flags]] } # Return 1 if this is a PowerPC target supporting -mcpu=power10. @@ -11757,6 +11770,8 @@ proc check_effective_target___OPTIMIZE__ {} { #ifndef __OPTIMIZE__ # error nein #endif + /* Avoid pedwarn about empty TU. */ + int dummy; } [current_compiler_flags]] } |