diff options
Diffstat (limited to 'gcc/testsuite')
739 files changed, 19231 insertions, 745 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1146a9e..af49263 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,1646 @@ +2025-04-22 Jan Hubicka <hubicka@ucw.cz> + + * gcc.target/i386/pr89618-2.c: XFAIL. + +2025-04-22 Jakub Jelinek <jakub@redhat.com> + + PR target/119327 + * g++.dg/opt/pr119327.C: New test. + +2025-04-22 Richard Sandiford <richard.sandiford@arm.com> + + * gcc.target/aarch64/pragma_cpp_predefs_4.c: Test + __ARM_FEATURE_FAMINMAX. + +2025-04-22 Spencer Abson <spencer.abson@arm.com> + + * gcc.target/aarch64/_Float16_cmp_1.c: New test. + * gcc.target/aarch64/_Float16_cmp_2.c: New (negative) test. + +2025-04-22 Spencer Abson <spencer.abson@arm.com> + + PR target/117013 + * g++.target/aarch64/spaceship_1.C: New test. + * g++.target/aarch64/spaceship_2.C: New test. + * g++.target/aarch64/spaceship_3.C: New test. + +2025-04-22 Andre Vehreschild <vehre@gcc.gnu.org> + + * gfortran.dg/coarray/coindexed_3.f08: Add minimal test for + get_team(). + * gfortran.dg/team_change_2.f90: Add test for change team with + label and exiting out of it. + * gfortran.dg/team_end_2.f90: Check parsing to labeled team + blocks is correct now. + * gfortran.dg/team_end_3.f90: Check that end_team call is + generated for labeled end_teams, too. + * gfortran.dg/coarray/coindexed_5.f90: New test. + +2025-04-22 Andre Vehreschild <vehre@gcc.gnu.org> + + * gfortran.dg/coarray_49.f90: Adapt to changed error message. + * gfortran.dg/coarray_collectives_12.f90: Adapt to changed + function signature of num_images. + * gfortran.dg/coarray_collectives_16.f90: Same. + * gfortran.dg/coarray_lib_this_image_1.f90: Same. + * gfortran.dg/coarray_lib_this_image_2.f90: Same. + * gfortran.dg/coarray_this_image_1.f90: Adapt tests for + num_images. + * gfortran.dg/coarray_this_image_2.f90: Same. + * gfortran.dg/coarray_this_image_3.f90: Same. + * gfortran.dg/num_images_1.f90: Check that deprecated syntax is + no longer supported. + +2025-04-22 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/87326 + * gfortran.dg/coarray_10.f90: Update error messages. + * gfortran.dg/coarray_lib_this_image_1.f90: Same. + * gfortran.dg/coarray_lib_this_image_2.f90: Same. + * gfortran.dg/coarray_this_image_1.f90: Add more tests and + remove incorrect ones. + * gfortran.dg/coarray_this_image_2.f90: Test more features. + * gfortran.dg/coarray_this_image_3.f90: New test. + +2025-04-22 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/88154 + PR fortran/88960 + PR fortran/97210 + PR fortran/103001 + * gfortran.dg/coarray/image_status_1.f08: Correct check for + team_type. + * gfortran.dg/pr102458.f90: Adapt to multiple errors. + * gfortran.dg/coarray/get_team_1.f90: New test. + * gfortran.dg/team_get_1.f90: New test. + * gfortran.dg/team_number_1.f90: Correct Fortran syntax. + +2025-04-22 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/87326 + PR fortran/87556 + PR fortran/88254 + PR fortran/103796 + * gfortran.dg/team_change_2.f90: New test. + * gfortran.dg/team_change_3.f90: New test. + * gfortran.dg/team_end_2.f90: New test. + * gfortran.dg/team_end_3.f90: New test. + * gfortran.dg/team_form_2.f90: New test. + * gfortran.dg/team_form_3.f90: New test. + * gfortran.dg/team_sync_2.f90: New test. + +2025-04-22 Andre Vehreschild <vehre@gcc.gnu.org> + + PR fortran/87939 + * gfortran.dg/coarray_critical_2.f90: New test. + * gfortran.dg/coarray_critical_3.f90: New test. + * gfortran.dg/team_sync_1.f90: New test. + * gfortran.dg/move_alloc_11.f90: New test. + +2025-04-22 Yixuan Chen <chenyixuan@iscas.ac.cn> + + * gcc.target/riscv/mcpu-xt-c908.c: test -mcpu=xt-c908. + * gcc.target/riscv/mcpu-xt-c910.c: test -mcpu=xt-c910. + * gcc.target/riscv/mcpu-xt-c920v2.c: test -mcpu=xt-c920v2. + * gcc.target/riscv/mcpu-xt-c908v.c: test -mcpu=xt-c908v. + * gcc.target/riscv/mcpu-xt-c910v2.c: test -mcpu=xt-c910v2. + * gcc.target/riscv/mcpu-xt-c920.c: test -mcpu=xt-c920. + +2025-04-22 Christophe Lyon <christophe.lyon@linaro.org> + + * g++.dg/gcov/gcov.exp: Handle GCOV_UNDER_TEST. + * gcc.misc-tests/gcov.exp: Likewise. + * gdc.dg/gcov.exp: Likewise. + * gnat.dg/gcov/gcov.exp: Likewise. + +2025-04-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.misc-tests/gcov-31.c (run_pending_traps): Use sigsetjmp + instead of __sigsetjmp. + +2025-04-22 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119863 + * g++.dg/modules/tpl-friend-18_a.C: New test. + * g++.dg/modules/tpl-friend-18_b.C: New test. + * g++.dg/modules/tpl-friend-18_c.C: New test. + +2025-04-22 Andrew Pinski <quic_apinski@quicinc.com> + + * g++.dg/eh/pr119507.C: Skip for arm eabi. + +2025-04-22 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/powerpc/power11-3.c: Require ifunc support. + +2025-04-21 Jason Merrill <jason@redhat.com> + + PR c++/118775 + * g++.dg/cpp2a/constexpr-new24.C: Adjust diagnostic. + +2025-04-21 Andrew Bennett <andrew.bennett@imgtec.com> + + * gcc.dg/memcpy-4.c: Remove mips specific code. + * gcc.target/mips/memcpy-2.c: New test. + +2025-04-21 Matthew Fortune <matthew.fortune@imgtec.com> + + * gcc.target/mips/clear-cache-1.c: Also allow jrc. + +2025-04-21 Matthew Fortune <matthew.fortune@imgtec.com> + + * gcc.dg/tree-ssa/ssa-dom-cse-2.c: Do not check output for + MIPS lp64 abi. + +2025-04-21 Andrew Pinski <quic_apinski@quicinc.com> + + PR middle-end/119507 + * g++.dg/eh/pr119507.C: New test. + +2025-04-21 hongtao.liu <hongtao.liu@intel.com> + + * gcc.target/i386/recip-vec-divf-fma.c: New test. + +2025-04-20 H.J. Lu <hjl.tools@gmail.com> + + PR target/117863 + * gcc.dg/rtl/i386/vector_eq-2.c: New test. + * gcc.dg/rtl/i386/vector_eq-3.c: Likewise. + +2025-04-19 Thomas Schwinge <tschwinge@baylibre.com> + + PR testsuite/119508 + * rust/compile/nr2/compile.exp: Disable parallel testing. + +2025-04-19 Co-authored-by: Jeff Law <jlaw@ventanamicro.com> + + PR target/118410 + * gcc.target/riscv/pr118410-1.c: New test. + * gcc.target/riscv/pr118410-2.c: Likewise. + +2025-04-19 Andrew Pinski <quic_apinski@quicinc.com> + + * gcc.dg/pr118947-1.c: Use 1025 as the size of the buf. + * gcc.dg/pr78408-3.c: Likewise. + +2025-04-19 Andrew Pinski <quic_apinski@quicinc.com> + + PR rtl-optimization/111949 + * gcc.target/aarch64/bic-1.c: New test. + +2025-04-19 Jiaxun Yang <jiaxun.yang@flygoat.com> + + PR target/111814 + * gcc.target/sh/pr111814.c: New test. + +2025-04-19 Maciej W. Rozycki <macro@orcam.me.uk> + + * gcc.target/alpha/memcpy-nested-offset-long.c: New file. + * gcc.target/alpha/memcpy-nested-offset-quad.c: New file. + +2025-04-19 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/119836 + * gfortran.dg/do_concurrent_all_clauses.f90: Remove invalid + dg-error test. + * gfortran.dg/pr119836_1.f90: New test. + * gfortran.dg/pr119836_2.f90: New test. + * gfortran.dg/pr119836_3.f90: New test. + * gfortran.dg/pr119836_4.f90: New test. + +2025-04-18 Thomas Schwinge <tschwinge@baylibre.com> + + PR cobol/119818 + * cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob: + 'dg-set-target-env-var TZ UTC0'. + +2025-04-18 Jeff Law <jlaw@ventanamicro.com> + + * gcc.target/riscv/bext-ext-2.c: New test + +2025-04-18 Jonathan Yong <10walls@gmail.com> + + * g++.dg/abi/ref-temp1.C: Replicate some test based on + PE expectations. + * lib/target-supports.exp: New check_effective_target_pe. + +2025-04-18 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/87901 + * gcc.dg/tree-ssa/ssa-dse-53.c: New test. + * gcc.dg/tree-ssa/ssa-dse-54.c: New test. + +2025-04-18 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/87901 + * gcc.dg/tree-ssa/ssa-dse-52.c: New test. + +2025-04-18 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/118902 + * gcc.dg/tree-ssa/pr118902-1.c: New test. + +2025-04-18 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/118947 + * gcc.dg/pr118947-1.c: New test. + +2025-04-18 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/78408 + PR tree-optimization/118947 + * gcc.dg/pr78408-3.c: New test. + +2025-04-18 Dimitar Dimitrov <dimitar@dinux.eu> + + * gcc.dg/pr116357.c: Use sizeof(int) instead of alignof(int). + +2025-04-18 Alexey Merzlyakov <alexey.merzlyakov@samsung.com> + + PR middle-end/108016 + * gcc.target/riscv/pr108016.c: New test. + +2025-04-18 kelefth <konstantinos.eleftheriou@vrull.eu> + + PR rtl-optimization/119160 + * gcc.dg/pr119160.c: New test. + +2025-04-18 Xing Li <lixing@loongson.cn> + + * gcc.target/loongarch/vector/loongarch-vector.exp: Change + {dg-do-what-default} save and restore logical. + +2025-04-17 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp2a/constexpr-dtor16.C: Adjust diagnostic. + * g++.dg/cpp2a/constexpr-dynamic10.C: Likewise. + +2025-04-17 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp1y/constexpr-new.C: Adjust diagnostics. + * g++.dg/cpp1z/constexpr-asm-5.C: Likewise. + * g++.dg/cpp26/static_assert1.C: Likewise. + * g++.dg/cpp2a/constexpr-dtor7.C: Likewise. + * g++.dg/cpp2a/constexpr-new26.C: Likewise. + * g++.dg/cpp2a/constexpr-new3.C: Likewise. + * g++.dg/cpp2a/constinit14.C: Likewise. + +2025-04-17 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp26/pack-indexing2.C: Adjust diagnostics. + * g++.dg/ext/type_pack_element2.C: Likewise. + * g++.dg/ext/type_pack_element4.C: Likewise. + +2025-04-17 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/119351 + * gcc.target/aarch64/sve/pr119351.c: New test. + * gcc.target/aarch64/sve/pr119351_run.c: New test. + +2025-04-17 Jakub Jelinek <jakub@redhat.com> + + PR target/119834 + * g++.target/s390/pr119834.C: New test. + +2025-04-17 Iain Buclaw <ibuclaw@gdcproject.org> + + * gdc.test/fail_compilation/test21247.d: New test. + * gdc.test/fail_compilation/test21247b.d: New test. + +2025-04-17 Jason Merrill <jason@redhat.com> + + PR c++/113360 + * g++.dg/cpp23/constexpr-nonlit18.C: Remove redundant message. + * g++.dg/cpp1y/constexpr-diag2.C: New test. + * g++.dg/cpp1y/pr63996.C: Adjust expected errors. + * g++.dg/template/explicit-args6.C: Likewise. + * g++.dg/cpp0x/constexpr-ice21.C: Likewise. + +2025-04-16 Alexandre Oliva <oliva@adacore.com> + + * gcc.dg/ipa/ipa-sra-19.c: Add -Wno-psabi on ppc-elf too. + +2025-04-16 Peter Bergner <bergner@linux.ibm.com> + + PR tree-optimization/112822 + * g++.dg/pr112822.C: Replace altivec vector attribute with a generic + vector attribute. + +2025-04-16 Eric Botcazou <ebotcazou@gcc.gnu.org> + + * gnat.dg/opt105.adb: New test. + * gnat.dg/opt105_pkg.ads, gnat.dg/opt105_pkg.adb: New helper. + +2025-04-16 Jason Merrill <jason@redhat.com> + + PR c++/114772 + PR c++/101180 + * g++.dg/ext/pragma-target2.C: New test. + +2025-04-16 Jason Merrill <jason@redhat.com> + + PR c++/116954 + * g++.dg/warn/Wformat-3.C: New test. + +2025-04-16 Ard Biesheuvel <ardb@kernel.org> + + PR target/119386 + * gcc.target/i386/pr119386-3.c: New test. + +2025-04-16 Ard Biesheuvel <ardb@kernel.org> + + PR target/119386 + * gcc.target/i386/pr119386-1.c: New test. + * gcc.target/i386/pr119386-2.c: New test. + +2025-04-16 Harald Anlauf <anlauf@gmx.de> + + PR fortran/106948 + * gfortran.dg/pure_formal_proc_4.f90: New test. + +2025-04-16 Jan Hubicka <hubicka@ucw.cz> + + * g++.dg/lto/pr119614_0.C: New test. + +2025-04-16 Tamar Christina <tamar.christina@arm.com> + + PR target/119286 + * gcc.dg/vect/vect-early-break_18.c: Force -march=gfx908 for amdgcn. + +2025-04-16 Tamar Christina <tamar.christina@arm.com> + + PR tree-optimization/119351 + * gcc.target/aarch64/sve/peel_ind_10.c: New test. + * gcc.target/aarch64/sve/peel_ind_10_run.c: New test. + * gcc.target/aarch64/sve/peel_ind_5.c: New test. + * gcc.target/aarch64/sve/peel_ind_5_run.c: New test. + * gcc.target/aarch64/sve/peel_ind_6.c: New test. + * gcc.target/aarch64/sve/peel_ind_6_run.c: New test. + * gcc.target/aarch64/sve/peel_ind_7.c: New test. + * gcc.target/aarch64/sve/peel_ind_7_run.c: New test. + * gcc.target/aarch64/sve/peel_ind_8.c: New test. + * gcc.target/aarch64/sve/peel_ind_8_run.c: New test. + * gcc.target/aarch64/sve/peel_ind_9.c: New test. + * gcc.target/aarch64/sve/peel_ind_9_run.c: New test. + +2025-04-16 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/119808 + * gcc.dg/bitint-121.c: New test. + +2025-04-16 Jesse Huang <jesse.huang@sifive.com> + + * gcc.target/riscv/gnu-property-align-rv32.c: New file. + * gcc.target/riscv/gnu-property-align-rv64.c: New file. + +2025-04-16 Kito Cheng <kito.cheng@sifive.com> + + * gcc.target/riscv/jump-table-large-code-model.c: New test. + +2025-04-16 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/116093 + * gcc.dg/bitint-122.c: New test. + +2025-04-16 Alice Carlotti <alice.carlotti@arm.com> + + * gcc.target/aarch64/acle/rwsr-ungated.c: New test. + +2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/119826 + * gdc.dg/debug/imports/pr119826b.d: New test. + * gdc.dg/debug/pr119826.d: New test. + +2025-04-15 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119755 + * g++.dg/modules/lambda-10_a.H: New test. + * g++.dg/modules/lambda-10_b.C: New test. + +2025-04-15 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/completion-2.c: Expect also -flto-partition=default line. + +2025-04-15 Qing Zhao <qing.zhao@oracle.com> + + PR c/119717 + * gcc.dg/pr119717.c: New test. + +2025-04-15 H.J. Lu <hjl.tools@gmail.com> + + PR target/119784 + * gcc.target/i386/apx-interrupt-1.c: Expect 31 .cfi_restore + directives. + +2025-04-15 Vineet Gupta <vineetg@rivosinc.com> + + PR target/119533 + * go.dg/pr119533-riscv.go: New test. + * go.dg/pr119533-riscv-2.go: New test. + +2025-04-15 Robin Dapp <rdapp@ventanamicro.com> + + PR target/119547 + * gcc.target/riscv/rvv/vsetvl/avl_single-68.c: xfail. + * g++.target/riscv/rvv/autovec/pr119547.C: New test. + * g++.target/riscv/rvv/autovec/pr119547-2.C: New test. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c: Adjust. + +2025-04-15 Tobias Burnus <tburnus@baylibre.com> + + * gfortran.dg/gomp/map-alloc-comp-1.f90: Remove dg-error. + * gfortran.dg/gomp/polymorphic-mapping-2.f90: Update warn wording. + * gfortran.dg/gomp/polymorphic-mapping.f90: Change expected + diagnostic; some tests moved to ... + * gfortran.dg/gomp/polymorphic-mapping-1.f90: ... here as new test. + * gfortran.dg/gomp/polymorphic-mapping-3.f90: New test. + * gfortran.dg/gomp/polymorphic-mapping-4.f90: New test. + * gfortran.dg/gomp/polymorphic-mapping-5.f90: New test. + +2025-04-15 Martin Jambor <mjambor@suse.cz> + Jakub Jelinek <jakub@redhat.com> + + PR ipa/119803 + * gcc.dg/ipa/pr119803.c: New test. + +2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/119799 + * gdc.dg/import-c/pr119799.d: New test. + * gdc.dg/import-c/pr119799c.c: New test. + +2025-04-15 Patrick Palka <ppalka@redhat.com> + + PR c++/119807 + PR c++/112288 + * g++.dg/template/friend86.C: New test. + * g++.dg/template/friend87.C: New test. + +2025-04-15 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/119817 + * gdc.dg/debug/imports/m119817/a.d: New test. + * gdc.dg/debug/imports/m119817/b.d: New test. + * gdc.dg/debug/imports/m119817/package.d: New test. + * gdc.dg/debug/pr119817.d: New test. + +2025-04-15 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/119801 + * c-c++-common/tsan/pr119801.c: New test. + +2025-04-15 Jonathan Yong <10walls@gmail.com> + + * gcc.dg/Wbuiltin-declaration-mismatch-4.c: Make diagnostic + accept long long. + +2025-04-15 Jakub Jelinek <jakub@redhat.com> + + PR ipa/119318 + * gcc.dg/ipa/pr119318.c: Remove dg-additional-options, add -w to + dg-options. + +2025-04-15 Jason Merrill <jason@redhat.com> + + PR c++/113835 + * g++.dg/cpp2a/constexpr-vector1.C: New test. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + PR target/118794 + * g++.target/gcn/exceptions-bad_cast-2.C: Set + '-mno-fake-exceptions'. + * g++.target/gcn/exceptions-pr118794-1.C: Likewise. + * g++.target/gcn/exceptions-throw-2.C: Likewise. + * g++.target/nvptx/exceptions-bad_cast-2.C: Likewise. + * g++.target/nvptx/exceptions-pr118794-1.C: Likewise. + * g++.target/nvptx/exceptions-throw-2.C: Likewise. + * g++.target/gcn/exceptions-bad_cast-2_-mfake-exceptions.C: New. + * g++.target/gcn/exceptions-pr118794-1_-mfake-exceptions.C: + Likewise. + * g++.target/gcn/exceptions-throw-2_-mfake-exceptions.C: Likewise. + * g++.target/nvptx/exceptions-bad_cast-2_-mfake-exceptions.C: + Likewise. + * g++.target/nvptx/exceptions-pr118794-1_-mfake-exceptions.C: + Likewise. + * g++.target/nvptx/exceptions-throw-2_-mfake-exceptions.C: + Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * g++.target/gcn/exceptions-throw-3.C: New. + * g++.target/nvptx/exceptions-throw-3.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * g++.target/gcn/exceptions-throw-2.C: New. + * g++.target/nvptx/exceptions-throw-2.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * g++.target/gcn/exceptions-throw-1.C: New. + * g++.target/nvptx/exceptions-throw-1.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * g++.target/gcn/exceptions-bad_cast-3.C: New. + * g++.target/nvptx/exceptions-bad_cast-3.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * g++.target/gcn/exceptions-bad_cast-2.C: New. + * g++.target/nvptx/exceptions-bad_cast-2.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * g++.target/gcn/exceptions-bad_cast-1.C: New. + * g++.target/nvptx/exceptions-bad_cast-1.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + PR target/118794 + * g++.target/gcn/exceptions-pr118794-1.C: New. + * g++.target/nvptx/exceptions-pr118794-1.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + PR c++/119692 + * g++.target/gcn/pr119692-1-1.C: New. + * g++.target/nvptx/pr119692-1-1.C: Likewise. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * g++.target/gcn/gcn.exp: New. + +2025-04-14 Thomas Schwinge <tschwinge@baylibre.com> + + * lib/gcc-dg.exp (${tool}_load): Polish 'dg-output-file' test + logs. + +2025-04-14 Jakub Jelinek <jakub@redhat.com> + + PR ipa/119318 + * gcc.dg/ipa/pr119530.c (d): Change type from char to signed char. + (e): Change argument type from long to long long. + +2025-04-14 beamandala <mandalapubhavesh@gmail.com> + + * rust/compile/track_caller.rs: New test. + +2025-04-14 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/enum_discriminant2.rs: New test. + +2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com> + + * rust/compile/format_args_extra_comma.rs: New test. + +2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com> + + * rust/compile/macros/mbe/macro-issue3709-1.rs: New test. + * rust/compile/macros/mbe/macro-issue3709-2.rs: New test. + * rust/compile/macros/mbe/macro-issue3693.rs: New file. + +2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com> + + * rust/compile/macros/mbe/macro-issue3708.rs: New test. + +2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com> + + * rust/execute/torture/min_specialization2.rs: New test. + * rust/execute/torture/min_specialization3.rs: New test. + +2025-04-14 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/118476 + * gcc.dg/torture/pr118476-1.c: New test. + +2025-04-14 Patrick Palka <ppalka@redhat.com> + + PR c++/99214 + * g++.dg/concepts/diagnostic20.C: New test. + +2025-04-14 H.J. Lu <hjl.tools@gmail.com> + + PR target/119784 + * gcc.target/i386/pr119784a.c: New test. + * gcc.target/i386/pr119784b.c: Likewise. + +2025-04-14 Martin Jambor <mjambor@suse.cz> + + PR ipa/119318 + * gcc.dg/ipa/pr119318.c: New test. + * gcc.dg/ipa/pr119530.c: Likwise. + +2025-04-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119757 + * gcc.dg/vect/pr119757.c: New testcase. + +2025-04-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119778 + * g++.dg/torture/pr119778.C: New testcase. + +2025-04-14 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/119779 + * gm2.dg/doc/examples/pass/doc-examples-pass.exp: New test. + * gm2.dg/doc/examples/pass/exampleadd.mod: New test. + * gm2.dg/doc/examples/pass/exampleadd2.mod: New test. + * gm2.dg/doc/examples/pass/hello.mod: New test. + * gm2.dg/doc/examples/pass/hellopim.mod: New test. + +2025-04-14 Eric Botcazou <ebotcazou@adacore.com> + + PR lto/119792 + * gnat.dg/lto29.adb: New test. + * gnat.dg/lto29_pkg.ads: New helper. + +2025-04-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/119502 + * gfortran.dg/pr119502.f90: New test. + +2025-04-13 Nathaniel Shead <nathanieloshead@gmail.com> + + * g++.dg/modules/noexcept-4_a.H: New test. + * g++.dg/modules/noexcept-4_b.C: New test. + +2025-04-13 Nathaniel Shead <nathanieloshead@gmail.com> + + * g++.dg/modules/lambda-8_b.C: Adjust error. + * g++.dg/modules/leg-merge-4_c.C: Likewise. + +2025-04-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/119669 + * gfortran.dg/interface_59.f90: New test. + +2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/119761 + * gdc.dg/import-c/import-c.exp: New test. + * gdc.dg/import-c/pr119761.d: New test. + * gdc.dg/import-c/pr119761c.c: New test. + +2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/109023 + * gdc.dg/torture/imports/pr109023.d: New test. + * gdc.dg/torture/pr109023.d: New test. + +2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/119758 + * gdc.dg/driver_fonly1.d: New test. + * gdc.dg/driver_fonly2.d: New test. + * gdc.dg/driver_fonly3.d: New test. + * gdc.dg/imports/fonly.d: New test. + +2025-04-12 Andrew Pinski <quic_apinski@quicinc.com> + + PR testsuite/117706 + * gcc.dg/ira-shrinkwrap-prep-1.c: Unxfail for i?68-*-* and x86_64-*-*. + * gcc.dg/ira-shrinkwrap-prep-2.c: Likewise. + +2025-04-12 Patrick Palka <ppalka@redhat.com> + + PR c++/116416 + * g++.dg/cpp1y/constexpr-prvalue1.C: Adjust to instead inspect + the 'original' dump. + * g++.dg/cpp1y/constexpr-prvalue1a.C: New test. + +2025-04-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119722 + * gcc.dg/torture/bitint-77.c: New test. + +2025-04-12 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/renaming17.adb: New test. + +2025-04-12 Bob Dubner <rdubner@symas.com> + + PR cobol/119694 + * cobol.dg/group2/ACCEPT_DATE___DAY_and_intrinsic_functions__2_.cob: GCOBOL_CURRENT_DATE. + * cobol.dg/group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.cob: Likewise + * cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob: Likewise + +2025-04-11 Christophe Lyon <christophe.lyon@linaro.org> + + * lib/target-supports.exp: Rename arm_v8_1_lob_ok into + arm_v8_1m_lob_hw. + Rename arm_thumb2_no_arm_v8_1_lob into + arm_thumb2_no_arm_v8_1m_lob. + Rename arm_thumb2_ok_no_arm_v8_1_lob into + arm_thumb2_ok_no_arm_v8_1m_lob. + * gcc.target/arm/lob1.c: Likewise. + * gcc.target/arm/lob6.c: Likewise. + * gcc.target/arm/ivopts.c: Likewise. + * gcc.target/arm/unsigned-extend-2.c: Likewise. + +2025-04-11 Andrew Pinski <quic_apinski@quicinc.com> + + PR rtl-optimization/118502 + * g++.dg/opt/shrink-wrapping-vector-1.C: New test. + +2025-04-11 Jeff Law <jlaw@ventanamicro.com> + + * gcc.target/riscv/rvv/base/pr115068-run.c: Turn off pedantic diagnostics. + * gcc.target/riscv/rvv/base/pr115068.c: Likewise. + * gcc.target/riscv/rvv/base/vwaddsub-1.c: Likewise. + +2025-04-11 Jason Merrill <jason@redhat.com> + + PR c++/114970 + * g++.dg/opt/is_constant_evaluated4.C: New test. + +2025-04-11 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119707 + * gcc.dg/torture/bitint-76.c: New test. + +2025-04-11 Jennifer Schmitz <jschmitz@nvidia.com> + + PR tree-optimization/119706 + * g++.target/aarch64/sve/pr119706.C: New test. + +2025-04-11 Jonathan Yong <10walls@gmail.com> + + PR target/113633 + * gcc.dg/bf-ms-attrib.c: Fix expected __ms_struct__ layout + size. + +2025-04-11 Jonathan Yong <10walls@gmail.com> + + * c-c++-common/analyzer/realloc-1.c: Make diagnostic accept + long long for __builtin_realloc warning. + +2025-04-10 Jason Merrill <jason@redhat.com> + + PR c++/119345 + * g++.dg/cpp2a/lambda-targ14.C: New test. + +2025-04-10 Patrick Palka <ppalka@redhat.com> + + PR c++/119687 + * g++.dg/cpp23/class-deduction-inherited8.C: New test. + +2025-04-10 Bob Dubner <rdubner@symas.com> + + * cobol.dg/group2/Dynamic_reference_modification.cob: New testcase. + * cobol.dg/group2/Length_overflow__1_.cob: Likewise. + * cobol.dg/group2/Length_overflow__2_.cob: Likewise. + * cobol.dg/group2/Length_overflow_with_offset__1_.cob: Likewise. + * cobol.dg/group2/Length_overflow_with_offset__2_.cob: Likewise. + * cobol.dg/group2/Length_overflow_with_offset__3_.cob: Likewise. + * cobol.dg/group2/Offset_overflow.cob: Likewise. + * cobol.dg/group2/Offset_underflow.cob: Likewise. + * cobol.dg/group2/Refmod__comparisons_inside_numeric-display.cob: Likewise. + * cobol.dg/group2/Refmod_sources_are_figurative_constants.cob: Likewise. + * cobol.dg/group2/Static_reference_modification.cob: Likewise. + * cobol.dg/group2/Dynamic_reference_modification.out: New known-good result. + * cobol.dg/group2/Length_overflow__1_.out: Likewise. + * cobol.dg/group2/Length_overflow__2_.out: Likewise. + * cobol.dg/group2/Length_overflow_with_offset__1_.out: Likewise. + * cobol.dg/group2/Length_overflow_with_offset__2_.out: Likewise. + * cobol.dg/group2/Length_overflow_with_offset__3_.out: Likewise. + * cobol.dg/group2/Offset_overflow.out: Likewise. + * cobol.dg/group2/Offset_underflow.out: Likewise. + * cobol.dg/group2/Refmod__comparisons_inside_numeric-display.out: Likewise. + * cobol.dg/group2/Refmod_sources_are_figurative_constants.out: Likewise. + * cobol.dg/group2/Static_reference_modification.out: Likewise. + +2025-04-10 Jason Merrill <jason@redhat.com> + + PR c++/119175 + * g++.dg/cpp2a/concepts-lambda23.C: New test. + +2025-04-10 Iain Sandoe <iain@sandoe.co.uk> + + * lib/cobol.exp: Add libquadmath paths. + +2025-04-10 Richard Sandiford <richard.sandiford@arm.com> + + PR tree-optimization/119399 + * gcc.dg/vect/pr119399.c: New test. + +2025-04-10 Kito Cheng <kito.cheng@sifive.com> + + * gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c: Include local + riscv_vector.h. + * gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c: Ditto. + * gcc.target/riscv/rvv/base/abi-callee-saved-1-save-restore.c: Ditto. + * gcc.target/riscv/rvv/base/abi-callee-saved-1-zcmp.c: Ditto. + * gcc.target/riscv/rvv/base/abi-callee-saved-1.c: Ditto. + * gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c: Ditto. + * gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c: Ditto. + * gcc.target/riscv/rvv/base/abi-callee-saved-2.c: Ditto. + * gcc.target/riscv/rvv/base/bug-10-2.c: Ditto. + * gcc.target/riscv/rvv/base/bug-10.c: Ditto. + * gcc.target/riscv/rvv/base/bug-7.c: Ditto. + * gcc.target/riscv/rvv/base/bug-8.c: Ditto. + * gcc.target/riscv/rvv/base/bug-9.c: Ditto. + * gcc.target/riscv/rvv/base/pr110943.c: Ditto. + * gcc.target/riscv/rvv/base/pr112431-21.c: Ditto. + * gcc.target/riscv/rvv/base/pr114639-1.c: Ditto. + * gcc.target/riscv/rvv/base/pr115068.c: Ditto. + * gcc.target/riscv/rvv/base/pr117286.c: Ditto. + * gcc.target/riscv/rvv/base/pr117544.c: Ditto. + * gcc.target/riscv/rvv/base/pr117955.c: Ditto. + * gcc.target/riscv/rvv/base/pr118872.c: Ditto. + * gcc.target/riscv/rvv/base/vlmul_ext-1.c: Ditto. + * gcc.target/riscv/rvv/base/vssubu-1.c: Ditto. + * gcc.target/riscv/rvv/base/vssubu-2.c: Ditto. + * gcc.target/riscv/rvv/base/vwaddsub-1.c: Ditto. + * gcc.target/riscv/rvv/vsetvl/pr111234.c: Ditto. + * gcc.target/riscv/rvv/vsetvl/pr115214.c: Ditto. + * gcc.target/riscv/rvv/vsetvl/vsetvl-24.c: Ditto. + * gcc.target/riscv/rvv/vsetvl/vsetvl_bug-3.c: Ditto. + * gcc.target/riscv/rvv/vsetvl/vsetvl_bug-4.c: Ditto. + * gcc.target/riscv/rvv/xtheadvector/pr116591.c: Ditto. + * gcc.target/riscv/rvv/xtheadvector/pr116592.c: Ditto. + * gcc.target/riscv/rvv/xtheadvector/pr118357.c: Ditto. + * gcc.target/riscv/rvv/xtheadvector/vsext.c: Ditto. + * gcc.target/riscv/rvv/xtheadvector/vzext.c: Ditto. + +2025-04-09 Patrick Palka <ppalka@redhat.com> + + PR c++/119574 + * g++.dg/cpp2a/lambda-targ13.C: New test. + * g++.dg/cpp2a/lambda-targ13a.C: New test. + * g++.dg/cpp2a/lambda-targ13b.C: New test. + +2025-04-09 Jakub Jelinek <jakub@redhat.com> + + PR target/119664 + * gcc.dg/pr119664.c: New test. + +2025-04-09 Andrew Pinski <quic_apinski@quicinc.com> + + PR middle-end/116595 + * g++.target/aarch64/sve/pr116595.C: New test. + +2025-04-09 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/118309 + * gdc.dg/debug/dwarf2/pr118309.d: New test. + +2025-04-09 Harald Anlauf <anlauf@gmx.de> + + PR fortran/119656 + * gfortran.dg/optional_absent_13.f90: New test. + +2025-04-09 Jeff Law <jlaw@ventanamicro.com> + + * gcc.target/riscv/sat/sat_s_sub-1-i64.c: Update expected output. + * gcc.target/riscv/sat/sat_s_sub-2-i64.c: Likewise. + * gcc.target/riscv/sat/sat_s_sub-3-i64.c: Likewise. + * gcc.target/riscv/sat/sat_s_sub-4-i64.c: Likewise. + +2025-04-09 Uros Bizjak <ubizjak@gmail.com> + + * gcc.target/i386/pr67215-1.c: Correctly escape + asterisk in scan-assembler dirctive. + * gcc.target/i386/pr67215-2.c: Ditto. + +2025-04-09 Jonathan Yong <10walls@gmail.com> + + PR analyzer/113253 + * gcc.dg/analyzer/deref-before-check-pr113253.c: + (ptrdiff_t): use stddef.h type. + (uintptr_t): ditto. + (EMACS_INT): ditto. + (set_marker_internal): Add dummy 0 to suppress -Wreturn-type. + +2025-04-09 Jeff Law <jlaw@ventanamicro.com> + + * gcc.target/riscv/rvv/autovec/pr117722.c: Adjust expected output. + +2025-04-09 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/119689 + PR rtl-optimization/115568 + * g++.target/i386/pr119689.C: New testcase. + +2025-04-09 Pan Li <pan2.li@intel.com> + + Revert: + 2025-03-15 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.c: Removed. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f16.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f32.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i16.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i32.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i8.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u16.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u32.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u8.c: New test. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.h: New test. + +2025-04-09 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/118674 + * gcc.dg/cpp/pr118674.c: New test. + +2025-04-09 Robin Dapp <rdapp@ventanamicro.com> + + * g++.target/riscv/rvv/autovec/pr116595.C: Add -mabi. + +2025-04-09 Robin Dapp <rdapp@ventanamicro.com> + + PR middle-end/116595 + * g++.target/riscv/rvv/autovec/pr116595.C: New test. + +2025-04-09 Paul Thomas <pault@gcc.gnu.org> + and Harald Anlauf <anlauf@gcc.gnu.org> + + PR fortran/119460 + * gfortran.dg/reduce_2.f90: Add test to check that deferred len + characters cannot slip through. + * gfortran.dg/reduce_3.f90: New test + * gfortran.dg/reduce_4.f90: New test + +2025-04-09 Tobias Burnus <tburnus@baylibre.com> + + PR fortran/101602 + * gfortran.dg/do_concurrent_8_f2023.f90: Update for removed 'sorry, + unimplemented'. + * gfortran.dg/do_concurrent_9.f90: Likewise. + * gfortran.dg/do_concurrent_all_clauses.f90: Likewise. + * gfortran.dg/do_concurrent_local_init.f90: Likewise. + * gfortran.dg/do_concurrent_locality_specs.f90: Likewise. + * gfortran.dg/do_concurrent_11.f90: New test. + * gfortran.dg/do_concurrent_12.f90: New test. + * gfortran.dg/do_concurrent_13.f90: New test. + * gfortran.dg/do_concurrent_14.f90: New test. + * gfortran.dg/do_concurrent_15.f90: New test. + +2025-04-09 Jason Merrill <jason@redhat.com> + + PR c++/118698 + * g++.dg/cpp2a/concepts-lambda22.C: New test. + +2025-04-08 Richard Sandiford <richard.sandiford@arm.com> + + * gcc.dg/guality/pr36728-3.c: Update XFAILs for aarch64. + * gcc.dg/guality/pr41353-1.c: Likewise. + * gcc.dg/guality/pr54693-2.c: Likewise. + * gcc.dg/guality/pr68860-1.c: Likewise. + * gcc.dg/guality/pr68860-2.c: Likewise. + * gcc.dg/guality/sra-1.c: Likewise. + * gcc.dg/guality/vla-1.c: Likewise. + +2025-04-08 Richard Sandiford <richard.sandiford@arm.com> + + * gcc.dg/vect/pr99102.c: Force SVE when forcing the vector length. + +2025-04-08 Martin Uecker <uecker@tugraz.at> + + PR c/119612 + * gcc.dg/gnu23-tag-6.c: New test. + * gcc.dg/pr119612.c: New test. + +2025-04-08 Tobias Burnus <tburnus@baylibre.com> + + PR middle-end/119662 + * c-c++-common/gomp/append-args-interop.c: Update for fixed + GOMP_interop call. + * g++.dg/gomp/append-args-8.C: Likewise. + * gfortran.dg/gomp/append-args-interop.f90: Likewise. + +2025-04-08 Jason Merrill <jason@redhat.com> + + PR c++/117530 + * g++.dg/cpp2a/lambda-uneval27.C: New test. + +2025-04-08 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/119594 + * gcc.dg/pr119594.c: New test. + +2025-04-08 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/macros/mbe/macro6.rs: Remove call of undefined + function. + * rust/compile/nr2/exclude: Remove macros/mbe/macro6.rs. + +2025-04-08 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/issue-2812.rs: Avoid multiple definition error. + * rust/compile/nr2/exclude: Remove issue-2812.rs. + +2025-04-08 Matty Kuhn <matty.kuhn.1@gmail.com> + + * rust/compile/feature.rs: add an invalid empty feature to produce an error + +2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/invalid_label_name.rs: Adapt test to nr2. + +2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/nr2/exclude: Remove test. + +2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/undeclared_label.rs: Change test + expected string. + +2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/nr2/exclude: Remove test from exclusion list. + +2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/nr2/exclude: Remove passing test. + +2025-04-08 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/nr2/compile.exp: Avoid absolute paths in output, + adjust phrasing of output, and avoid false XPASS output when + tests are run in parallel. + +2025-04-08 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/nr2/exclude: Remove entry. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3647.rs: New test. + +2025-04-08 Arthur Cohen <arthur.cohen@embecosm.com> + + * rust/compile/min_specialization1.rs: New test. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/nr2/exclude: nr2 is missing type path error + * rust/compile/issue-3643.rs: New test. + * rust/compile/issue-3646.rs: New test. + * rust/compile/issue-3654.rs: New test. + * rust/compile/issue-3663.rs: New test. + * rust/compile/issue-3671.rs: New test. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3667.rs: New test. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3656.rs: New test. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3625.rs: New test. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3648.rs: New test. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3657.rs: New test. + +2025-04-08 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3665.rs: New test. + +2025-04-08 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/nr2/exclude: Remove entries. + +2025-04-08 Ryutaro Okada <1015ryu88@gmail.com> + + * rust/compile/enum_discriminant1.rs: New test. + +2025-04-08 Tejas Belagod <tejas.belagod@arm.com> + + * gcc.target/aarch64/sve/gomp/gomp.exp: Test driver. + * gcc.target/aarch64/sve/gomp/target-device.c: New test. + * gcc.target/aarch64/sve/gomp/target-link.c: Likewise. + * gcc.target/aarch64/sve/gomp/target.c: Likewise. + +2025-04-08 Jin Ma <jinma@linux.alibaba.com> + + * gcc.target/riscv/rvv/xtheadvector/vsext.c: New test. + * gcc.target/riscv/rvv/xtheadvector/vzext.c: New test. + +2025-04-07 Jason Merrill <jason@redhat.com> + + PR c++/119652 + * g++.dg/cpp2a/constinit20.C: New test. + +2025-04-07 Thomas Schwinge <tschwinge@baylibre.com> + + * gcc.target/nvptx/alloca-2-O0_-mfake-ptx-alloca.c: Adjust. + +2025-04-07 Martin Jambor <mjambor@suse.cz> + + PR tree-optimization/118924 + * g++.dg/tree-ssa/pr118924.C: New test. + +2025-04-07 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119640 + * gcc.dg/vect/pr119640.c: New testcase. + +2025-04-07 Christophe Lyon <christophe.lyon@linaro.org> + + PR target/119556 + * gcc.target/arm/short-vfp-1.c: Improve dg directives. + +2025-04-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119614 + * g++.dg/opt/pr119613.C: Change { c || c++11 } in obviously C++ only + test to just c++11. + * g++.dg/opt/pr119614.C: New test. + +2025-04-07 Richard Sandiford <richard.sandiford@arm.com> + Richard Biener <rguenther@suse.de> + + * gcc.target/aarch64/popcnt-le-1.c: Account for commutativity of TST. + * gcc.target/aarch64/popcnt-le-3.c: Likewise AND. + * gcc.target/aarch64/pr100056.c: Revert previous patch. + * gcc.target/aarch64/sve/pred-not-gen-1.c: Likewise. + * gcc.target/aarch64/sve/pred-not-gen-4.c: Likewise. + * gcc.target/aarch64/sve/var_stride_2.c: Likewise. + * gcc.target/aarch64/sve/var_stride_4.c: Likewise. + +2025-04-06 Iain Sandoe <iain@sandoe.co.uk> + + * lib/cobol.exp: Simplify the setting of COBOL_UNDER_TEST. + +2025-04-06 Patrick Palka <ppalka@redhat.com> + + PR c++/118626 + * g++.dg/cpp2a/class-deduction-alias25a.C: New test. + +2025-04-06 Patrick Palka <ppalka@redhat.com> + + PR c++/118626 + * g++.dg/cpp2a/class-deduction-alias25.C: New test. + +2025-04-05 Patrick Palka <ppalka@redhat.com> + + PR c++/118249 + * g++.dg/cpp0x/constexpr-reinterpret2.C: Expect error at + call site of the non-constexpr functions. + * g++.dg/cpp23/constexpr-nonlit12.C: Likewise. + * g++.dg/cpp0x/constexpr-ref14.C: New test. + +2025-04-05 Iain Sandoe <iain@sandoe.co.uk> + + * lib/cobol.exp: Conditionally add a path for libgcobol.spec. + +2025-04-05 Jason Merrill <jason@redhat.com> + + PR c++/118629 + * g++.dg/cpp0x/lambda/lambda-__func__3.C: New test. + +2025-04-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119564 + * g++.dg/modules/gc-3_a.C: New test. + * g++.dg/modules/gc-3_b.C: New test. + +2025-04-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119608 + * g++.dg/modules/pr119608_a.C: New test. + * g++.dg/modules/pr119608_b.C: New test. + +2025-04-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119462 + * g++.dg/modules/noexcept-3_a.C: New test. + * g++.dg/modules/noexcept-3_b.C: New test. + * g++.dg/modules/noexcept-3_c.C: New test. + +2025-04-04 Bob Dubner <rdubner@symas.com> + + * cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob: New testcase. + * cobol.dg/group2/FUNCTION_ABS.cob: Likewise. + * cobol.dg/group2/FUNCTION_ACOS.cob: Likewise. + * cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob: Likewise. + * cobol.dg/group2/FUNCTION_ANNUITY.cob: Likewise. + * cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob: Likewise. + * cobol.dg/group2/FUNCTION_ASIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_ATAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob: Likewise. + * cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob: Likewise. + * cobol.dg/group2/FUNCTION_CHAR.cob: Likewise. + * cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_COS.cob: Likewise. + * cobol.dg/group2/FUNCTION_CURRENT-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob: Likewise. + * cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob: Likewise. + * cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob: Likewise. + * cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob: Likewise. + * cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob: Likewise. + * cobol.dg/group2/FUNCTION_E.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXP10.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXP.cob: Likewise. + * cobol.dg/group2/FUNCTION_FACTORIAL.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_FRACTION-PART.cob: Likewise. + * cobol.dg/group2/FUNCTION_HEX-OF.cob: Likewise. + * cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-PART.cob: Likewise. + * cobol.dg/group2/FUNCTION_LENGTH__1_.cob: Likewise. + * cobol.dg/group2/FUNCTION_LENGTH__2_.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOG10.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOG.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOWER-CASE.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob: Likewise. + * cobol.dg/group2/FUNCTION_MAX.cob: Likewise. + * cobol.dg/group2/FUNCTION_MEAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_MEDIAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_MIDRANGE.cob: Likewise. + * cobol.dg/group2/FUNCTION_MIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_MOD__invalid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_MODULE-NAME.cob: Likewise. + * cobol.dg/group2/FUNCTION_MOD__valid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-C.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-F.cob: Likewise. + * cobol.dg/group2/FUNCTION_ORD.cob: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MAX.cob: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_PI.cob: Likewise. + * cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob: Likewise. + * cobol.dg/group2/FUNCTION_RANDOM.cob: Likewise. + * cobol.dg/group2/FUNCTION_RANGE.cob: Likewise. + * cobol.dg/group2/FUNCTION_REM__invalid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_REM__valid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_REVERSE.cob: Likewise. + * cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob: Likewise. + * cobol.dg/group2/FUNCTION_SIGN.cob: Likewise. + * cobol.dg/group2/FUNCTION_SIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_SQRT.cob: Likewise. + * cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUM.cob: Likewise. + * cobol.dg/group2/FUNCTION_TAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob: Likewise. + * cobol.dg/group2/FUNCTION_TRIM.cob: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_zero_length.cob: Likewise. + * cobol.dg/group2/FUNCTION_UPPER-CASE.cob: Likewise. + * cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_VARIANCE.cob: Likewise. + * cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob: Likewise. + * cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob: Likewise. + * cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob: Likewise. + * cobol.dg/group2/Program-to-program_parameters_and_retvals.cob: Likewise. + * cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob: Likewise. + * cobol.dg/group2/Repository_functions_clause.cob: Likewise. + * cobol.dg/group2/UDF_fibonacci_recursion.cob: Likewise. + * cobol.dg/group2/UDF_in_COMPUTE.cob: Likewise. + * cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob: Likewise. + * cobol.dg/group2/UDF_with_recursion.cob: Likewise. + * cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out: New known-good file. + * cobol.dg/group2/FUNCTION_ABS.out: Likewise. + * cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out: Likewise. + * cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER.out: Likewise. + * cobol.dg/group2/FUNCTION_BYTE-LENGTH.out: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out: Likewise. + * cobol.dg/group2/FUNCTION_HEX-OF.out: Likewise. + * cobol.dg/group2/FUNCTION_LENGTH__2_.out: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-DATE.out: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME.out: Likewise. + * cobol.dg/group2/FUNCTION_MAX.out: Likewise. + * cobol.dg/group2/FUNCTION_MEAN.out: Likewise. + * cobol.dg/group2/FUNCTION_MEDIAN.out: Likewise. + * cobol.dg/group2/FUNCTION_MIDRANGE.out: Likewise. + * cobol.dg/group2/FUNCTION_MIN.out: Likewise. + * cobol.dg/group2/FUNCTION_MODULE-NAME.out: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-F.out: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MAX.out: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MIN.out: Likewise. + * cobol.dg/group2/FUNCTION_ORD.out: Likewise. + * cobol.dg/group2/FUNCTION_PRESENT-VALUE.out: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE.out: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out: Likewise. + * cobol.dg/group2/FUNCTION_TRIM.out: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_zero_length.out: Likewise. + * cobol.dg/group2/Program-to-program_parameters_and_retvals.out: Likewise. + * cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out: Likewise. + * cobol.dg/group2/Repository_functions_clause.out: Likewise. + * cobol.dg/group2/UDF_fibonacci_recursion.out: Likewise. + * cobol.dg/group2/UDF_in_COMPUTE.out: Likewise. + * cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out: Likewise. + * cobol.dg/group2/UDF_with_recursion.out: Likewise. + +2025-04-04 Jason Merrill <jason@redhat.com> + + PR c++/99546 + PR c++/113925 + PR c++/106976 + PR c++/109961 + PR c++/117336 + * g++.dg/cpp2a/lambda-requires2.C: New test. + * g++.dg/cpp2a/lambda-requires3.C: New test. + * g++.dg/cpp2a/lambda-requires4.C: New test. + * g++.dg/cpp2a/lambda-requires5.C: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR gcov-profile/119618 + * c-c++-common/pr119618.c: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119616 + * c-c++-common/pr119616.c: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/119613 + * g++.dg/opt/pr119613.C: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR target/115910 + * gcc.target/i386/pr115910.c: New test. + +2025-04-04 Patrick Palka <ppalka@redhat.com> + + PR c++/117849 + * g++.dg/cpp2a/concepts-requires41.C: New test. + +2025-04-04 Andrew Pinski <quic_apinski@quicinc.com> + + PR ipa/119599 + * gcc.dg/torture/pr119599-1.c: New test. + * gcc.dg/builtin-apply5.c: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/119391 + * g++.dg/cpp/pr119391.C: New test. + +2025-04-04 Richard Earnshaw <rearnsha@arm.com> + + * gcc.target/arm/mve/mve.exp: Save dg-do-what-default before + changing it. Restore it once done. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119614 + * c-c++-common/pr119614-1.c: New test. + * c-c++-common/pr119614-2.c: New test. + * c-c++-common/pr119614-3.c: New test. + +2025-04-03 Thomas Schwinge <tschwinge@baylibre.com> + + PR target/119573 + * gcc.c-torture/compile/pr46534.c: Don't 'dg-skip-if' nvptx. + * gcc.target/nvptx/decl.c: Adjust. + +2025-04-03 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp2a/spaceship-rewrite6.C: New test. + +2025-04-03 Victor Do Nascimento <victor.donascimento@arm.com> + + PR testsuite/118597 + * gcc.dg/vect/vect-fncall-mask.c: Update test directives. + +2025-04-03 Bob Dubner <rdubner@symas.com> + + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob: New testcase. + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_NULL.cob: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_1.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_2.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_3.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_4.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-f.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-r.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_6.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_7.cob: Likewise. + * cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob: Likewise. + * cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob: Likewise. + * cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_AFTER.cob: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob: Likewise. + * cobol.dg/group2/INSPECT_TRAILING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out: New known-good result. + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_1.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_2.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_3.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_4.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-f.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-r.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_6.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_7.out: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out: Likewise. + * cobol.dg/group2/INSPECT_TRAILING.out: Likewise. + +2025-04-03 Andrew Pinski <quic_apinski@quicinc.com> + Jakub Jelinek <jakub@redhat.com> + + PR c++/119563 + * g++.dg/cpp0x/pr119563.C: New test. + * g++.dg/cpp/embed-26.C: New test. + +2025-04-03 Christophe Lyon <christophe.lyon@linaro.org> + + * gcc.dg/guality/pr90074.c: Remove xfail for aarch64. + * gcc.dg/guality/pr90716.c: Likewise. + +2025-04-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.target/i386/pr111673.c (dg-options): Add + -fasynchronous-unwind-tables -fdwarf2-cfi-asm. + * gcc.target/i386/pr82142a.c: Likewise. + * gcc.target/i386/pr82142b.c (dg-options): Add -mno-stackrealign + -fasynchronous-unwind-tables -fdwarf2-cfi-asm. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/riscv/rvv/base/vwaddsub-1.c: Require rv64. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/riscv/mcpu-xiangshan-nanhu.c: Skip on non-rv64. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + PR tree-optimization/113281 + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c: XFAIL. + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c: Likewise. + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c: Likewise. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + * gcc.dg/tree-ssa/ssa-dom-cse-2.c: XFAIL on riscv lp64. + +2025-04-03 Hongyu Wang <hongyu.wang@intel.com> + + PR target/119539 + * gcc.target/i386/apx-nf-pr119539.c: New test. + +2025-04-02 Jin Ma <jinma@linux.alibaba.com> + + * gcc.target/riscv/zba-shNadd-09.c: New test. + * gcc.target/riscv/zba-shNadd-10.c: New test. + +2025-04-02 John David Anglin <danglin@gcc.gnu.org> + + * g++.dg/modules/pr98893_b.C: xfail __tcf_ZL1b + assembler check on hppa*-*-hpux*. + +2025-04-02 John David Anglin <danglin@gcc.gnu.org> + + * g++.dg/abi/abi-tag18a.C: Skip on hppa*-*-hpux*. + +2025-04-02 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119491 + * g++.dg/opt/musttail3.C: New test. + * g++.dg/opt/musttail4.C: New test. + * g++.dg/opt/musttail5.C: New test. + +2025-04-02 Jakub Jelinek <jakub@redhat.com> + + PR c/119582 + * gcc.dg/asan/pr119582.c: New test. + +2025-04-02 Sandra Loosemore <sloosemore@baylibre.com> + + PR middle-end/118965 + * c-c++-common/gomp/append-args-1.c: Add target/targetsync + modifiers so tests do what they were previously supposed to do. + Adjust expected output. + * c-c++-common/gomp/append-args-7.c: Likewise. + * c-c++-common/gomp/append-args-8.c: Likewise. + * c-c++-common/gomp/append-args-9.c: Likewise. + * c-c++-common/gomp/interop-1.c: Likewise. + * c-c++-common/gomp/interop-2.c: Likewise. + * c-c++-common/gomp/interop-3.c: Likewise. + * c-c++-common/gomp/interop-4.c: Likewise. + * c-c++-common/gomp/pr118965-1.c: New. + * c-c++-common/gomp/pr118965-2.c: New. + * g++.dg/gomp/append-args-1.C: Add target/targetsync modifiers + and adjust expected output. + * g++.dg/gomp/append-args-2.C: Likewise. + * g++.dg/gomp/append-args-6.C: Likewise. + * g++.dg/gomp/append-args-7.C: Likewise. + * g++.dg/gomp/append-args-8.C: Likewise. + * g++.dg/gomp/interop-5.C: Likewise. + * gfortran.dg/gomp/append_args-1.f90: Add target/targetsync + modifiers and adjust expected output. + * gfortran.dg/gomp/append_args-2.f90: Likewise. + * gfortran.dg/gomp/append_args-3.f90: Likewise. + * gfortran.dg/gomp/append_args-4.f90: Likewise. + * gfortran.dg/gomp/interop-1.f90: Likewise. + * gfortran.dg/gomp/interop-2.f90: Likewise. + * gfortran.dg/gomp/interop-3.f90: Likewise. + * gfortran.dg/gomp/interop-4.f90: Likewise. + * gfortran.dg/gomp/pr118965-1.f90: New. + * gfortran.dg/gomp/pr118965-2.f90: New. + +2025-04-02 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119586 + * gcc.dg/vect/pr119586.c: New testcase. + +2025-04-02 Jonathan Yong <10walls@gmail.com> + + * gcc.dg/analyzer/torture/switch-3.c: Fix llp64 warnings. + +2025-04-02 Jakub Jelinek <jakub@redhat.com> + + PR ipa/119376 + * c-c++-common/musttail8.c: Expect a warning rather than error in one + case. + (f4): Add int * argument. + * c-c++-common/musttail15.c: Don't disallow for C++98. + * c-c++-common/musttail16.c: Likewise. + * c-c++-common/musttail17.c: Likewise. + * c-c++-common/musttail18.c: Likewise. + * c-c++-common/musttail19.c: Likewise. Expect a warning rather than + error in one case. + (f4): Add int * argument. + * c-c++-common/musttail20.c: Don't disallow for C++98. + * c-c++-common/musttail21.c: Likewise. + * c-c++-common/musttail28.c: New test. + * c-c++-common/musttail29.c: New test. + * c-c++-common/musttail30.c: New test. + * c-c++-common/musttail31.c: New test. + * g++.dg/ext/musttail1.C: New test. + * g++.dg/ext/musttail2.C: New test. + * g++.dg/ext/musttail3.C: New test. + +2025-04-02 Christophe Lyon <christophe.lyon@linaro.org> + + PR target/119556 + * gcc.target/arm/short-vfp-1.c: Add missing spaces. + 2025-04-01 Nathaniel Shead <nathanieloshead@gmail.com> PR c++/119551 diff --git a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c index 04925cf..0bb846c 100644 --- a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c +++ b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c @@ -92,5 +92,5 @@ void test_9 (void *p) void test_10 (char *s, int n) { __builtin_realloc(s, n); /* { dg-warning "ignoring return value of '__builtin_realloc' declared with attribute 'warn_unused_result'" "" { target c } } */ - /* { dg-warning "ignoring return value of 'void\\* __builtin_realloc\\(void\\*, (long )?unsigned int\\)' declared with attribute 'warn_unused_result'" "" { target c++ } .-1 } */ + /* { dg-warning "ignoring return value of 'void\\* __builtin_realloc\\(void\\*, (long )*unsigned int\\)' declared with attribute 'warn_unused_result'" "" { target c++ } .-1 } */ } /* { dg-warning "leak" } */ diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-1.c b/gcc/testsuite/c-c++-common/gomp/append-args-1.c index e03b8de..e8561a57 100644 --- a/gcc/testsuite/c-c++-common/gomp/append-args-1.c +++ b/gcc/testsuite/c-c++-common/gomp/append-args-1.c @@ -27,12 +27,12 @@ float base1(); void repl2(int *, int *, omp_interop_t, omp_interop_t); #pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ append_args(interop(target, targetsync, prefer_type(1)), \ - interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) + interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) void base2(int *x, int *y); void repl3(int, omp_interop_t, ...); #pragma omp declare variant(repl3) match(construct={dispatch}) \ - append_args(interop(prefer_type("cuda", "hsa"))) + append_args(interop(target, prefer_type("cuda", "hsa"))) void base3(int, ...); /* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-2 } */ /* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-3 } */ diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-7.c b/gcc/testsuite/c-c++-common/gomp/append-args-7.c index b7dff8a..d8a853e 100644 --- a/gcc/testsuite/c-c++-common/gomp/append-args-7.c +++ b/gcc/testsuite/c-c++-common/gomp/append-args-7.c @@ -20,14 +20,14 @@ void g1(...) { } void f2(...) { } /* { dg-error "argument 1 of 'f2' must be of 'omp_interop_t'" "" { target c } .-1 } */ /* { dg-error "argument 1 of 'void f2\\(\\.\\.\\.\\)' must be of 'omp_interop_t'" "" { target c++ } .-2 } */ -#pragma omp declare variant(f2) append_args(interop(target), interop(prefer_type("cuda"))) \ +#pragma omp declare variant(f2) append_args(interop(target), interop(target, prefer_type("cuda"))) \ match(construct={dispatch}) void g2(...) { } /* { dg-note "'append_args' specified here" "" { target *-*-* } .-3 } */ void f3(omp_interop_t, omp_interop_t, ...) { } -#pragma omp declare variant(f3) append_args(interop(target), interop(prefer_type("cuda"))) \ +#pragma omp declare variant(f3) append_args(interop(target), interop(target, prefer_type("cuda"))) \ match(construct={dispatch}) void g3(...) { } diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-8.c b/gcc/testsuite/c-c++-common/gomp/append-args-8.c index fb442db..d47faa2 100644 --- a/gcc/testsuite/c-c++-common/gomp/append-args-8.c +++ b/gcc/testsuite/c-c++-common/gomp/append-args-8.c @@ -14,14 +14,15 @@ typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM void f1(omp_interop_t) { } #pragma omp declare variant(f1) match(construct={dispatch}) \ - append_args(interop(prefer_type({attr("ompx_fun")}))) + append_args(interop(target, prefer_type({attr("ompx_fun")}))) void g1(void); int f2(omp_interop_t, omp_interop_t); -#pragma omp declare variant(f2) append_args(interop(prefer_type("cuda")), \ - interop(prefer_type({fr("hsa")}),target)) \ - match(construct={dispatch}) +#pragma omp declare variant(f2) \ + append_args(interop(target, prefer_type("cuda")), \ + interop(prefer_type({fr("hsa")}),target)) \ + match(construct={dispatch}) int g2(void) { return 5; } int foo (omp_interop_t obj1) diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-9.c b/gcc/testsuite/c-c++-common/gomp/append-args-9.c index b8586e0..810ab36 100644 --- a/gcc/testsuite/c-c++-common/gomp/append-args-9.c +++ b/gcc/testsuite/c-c++-common/gomp/append-args-9.c @@ -14,14 +14,15 @@ void f1(omp_interop_t *) { } /* { dg-error "argument 1 of 'f1' must be of 'omp_interop_t'" "" { target c } .-1 } */ /* { dg-note "initializing argument 1 of 'void f1\\(omp_interop_t\\*\\)'" "" { target c++ } .-2 } */ #pragma omp declare variant(f1) match(construct={dispatch}) \ - append_args(interop(prefer_type({attr("ompx_fun")}))) + append_args(interop(targetsync, prefer_type({attr("ompx_fun")}))) void g1(void); /* { dg-note "'append_args' specified here" "" { target c } .-2 } */ /* { dg-error "cannot convert 'omp_interop_t' to 'omp_interop_t\\*'" "" { target c++ } .-4 } */ int f2(omp_interop_t); -#pragma omp declare variant(f2) append_args(interop(prefer_type("cuda"))) \ - match(construct={dispatch}) +#pragma omp declare variant(f2) \ + append_args(interop(targetsync, prefer_type("cuda"))) \ + match(construct={dispatch}) int g2(void) { return 5; } int foo (omp_interop_t *obj1) diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-interop.c b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c index 1211450..e9b1ed4 100644 --- a/gcc/testsuite/c-c++-common/gomp/append-args-interop.c +++ b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c @@ -39,6 +39,6 @@ test (int *a, int *b) return x; } -/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, interopobjs\.\[0-9\]+, tgt_tgtsync\.\[0-9\]+," "gimple" } } */ -/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, interopobjs\.\[0-9\]+," "gimple" } } */ +/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+," "gimple" } } */ +/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, &interopobjs\.\[0-9\]+," "gimple" } } */ /* { dg-final { scan-tree-dump "repl1 \\(obj1, interop\.\[0-9\]+, interop\.\[0-9\]+\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/interop-1.c b/gcc/testsuite/c-c++-common/gomp/interop-1.c index d68611b..2a81d4b 100644 --- a/gcc/testsuite/c-c++-common/gomp/interop-1.c +++ b/gcc/testsuite/c-c++-common/gomp/interop-1.c @@ -40,12 +40,12 @@ void f() omp_interop_t obj1, obj2, obj3, obj4, obj5; int x; - #pragma omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait // OK - #pragma omp interop init(obj1) init (targetsync : obj2, obj3) nowait // OK - #pragma omp interop init(obj1) init (targetsync , target : obj2, obj3) nowait // OK + #pragma omp interop init(targetsync: obj1) init(target,targetsync : obj2, obj3) nowait // OK + #pragma omp interop init(target: obj1) init (targetsync : obj2, obj3) nowait // OK + #pragma omp interop init(target: obj1) init (targetsync , target : obj2, obj3) nowait // OK - #pragma omp interop init(obj1) init(target,targetsync,target: obj2, obj3) nowait // { dg-error "duplicate 'target' modifier" } - #pragma omp interop init(obj1) init(target,targetsync, targetsync : obj2, obj3) nowait // { dg-error "duplicate 'targetsync' modifier" } + #pragma omp interop init(target: obj1) init(target,targetsync,target: obj2, obj3) nowait // { dg-error "duplicate 'target' modifier" } + #pragma omp interop init(target: obj1) init(target,targetsync, targetsync : obj2, obj3) nowait // { dg-error "duplicate 'targetsync' modifier" } #pragma omp interop init(prefer_type("cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) \ destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0) @@ -54,10 +54,10 @@ void f() #pragma omp assume contains(interop) { - #pragma omp interop init(prefer_type("cuða") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu\[^'\]*a'" } + #pragma omp interop init(target, prefer_type("cuða") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu\[^'\]*a'" } } - #pragma omp interop init(prefer_type("cu\0da") : obj3) // { dg-error "string literal must not contain '\\\\0'" } +#pragma omp interop init(target, prefer_type("cu\0da") : obj3) // { dg-error "string literal must not contain '\\\\0'" } #pragma omp interop depend(inout: x) , use(obj2), destroy(obj3) // OK, use or destroy might have 'targetsync' @@ -69,49 +69,47 @@ void f() #pragma omp interop init ( target , prefer_type( { fr("hsa"), attr("ompx_nothing") , fr("hsa" ) }) :obj1) // { dg-error "duplicated 'fr' preference selector before '\\(' token" } - #pragma omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" } - #pragma omp interop init ( prefer_type( __builtin_sin(3.3) : obj1) - // { dg-error "'prefer_type' undeclared \\(first use in this function\\)" "" { target c } .-1 } - // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-2 } - // { dg-error "expected '\\)' before '\\(' token" "" { target *-*-* } .-3 } - - #pragma omp interop init ( prefer_type( __builtin_sin(3.3) ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } - #pragma omp interop init ( prefer_type( {fr(4 ) }) : obj1) // OK - #pragma omp interop init ( prefer_type( {fr("cu\0da" ) }) : obj1) // { dg-error "string literal must not contain '\\\\0'" } - #pragma omp interop init ( prefer_type( {fr("cuda\0") }) : obj1) // { dg-error "string literal must not contain '\\\\0'" } - #pragma omp interop init ( prefer_type( {fr("cuda" ) }) : obj1) // OK - #pragma omp interop init ( prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) // OK - #pragma omp interop init ( prefer_type( {fr("cuda", "cuda_driver") }) : obj1) // { dg-error "53: expected '\\)' before ',' token" } - #pragma omp interop init ( prefer_type( {fr(my_string) }) : obj1) // { dg-error "56: expected string literal or constant integer expression before '\\)' token" } - #pragma omp interop init ( prefer_type( {fr("hello" }) : obj1) // { dg-error "expected '\\)' before '\\(' token" } - // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-1 } - #pragma omp interop init ( prefer_type( {fr("hello") }) : obj1) + #pragma omp interop init (target, prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" } + #pragma omp interop init (prefer_type( __builtin_sin(3.3), target : obj1) + // { dg-error "expected string literal or constant integer expression" "" { target *-*-* } .-1 } + +#pragma omp interop init (prefer_type( __builtin_sin(3.3)), target : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } + #pragma omp interop init (target, prefer_type( {fr(4 ) }) : obj1) // OK + #pragma omp interop init (target, prefer_type( {fr("cu\0da" ) }) : obj1) // { dg-error "string literal must not contain '\\\\0'" } + #pragma omp interop init (target, prefer_type( {fr("cuda\0") }) : obj1) // { dg-error "string literal must not contain '\\\\0'" } + #pragma omp interop init (target, prefer_type( {fr("cuda" ) }) : obj1) // OK + #pragma omp interop init (target, prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) // OK + #pragma omp interop init (target, prefer_type( {fr("cuda", "cuda_driver") }) : obj1) // { dg-error "60: expected '\\)' before ',' token" } + #pragma omp interop init (target, prefer_type( {fr(my_string) }) : obj1) // { dg-error "63: expected string literal or constant integer expression before '\\)' token" } + #pragma omp interop init (target, prefer_type( {fr("hello" }) : obj1) // { dg-error "expected '\\)' before '\}' token" } + /* { dg-warning "unknown foreign runtime identifier 'hello' \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */ + #pragma omp interop init (target, prefer_type( {fr("hello") }) : obj1) /* { dg-warning "unknown foreign runtime identifier 'hello' \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } */ - #pragma omp interop init ( prefer_type( {fr(x) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } + #pragma omp interop init (target, prefer_type( {fr(x) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } - #pragma omp interop init ( prefer_type( {fr(ifr_scalar ) }) : obj1) // OK - #pragma omp interop init ( prefer_type( {fr(ifr_array ) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } + #pragma omp interop init (target, prefer_type( {fr(ifr_scalar ) }) : obj1) // OK + #pragma omp interop init (target, prefer_type( {fr(ifr_array ) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } // OK in C++, for C: constexpr arrays are not part of C23; however, they are/were under consideration for C2y. - #pragma omp interop init ( prefer_type( {fr(ifr_array[0] ) }) : obj1) + #pragma omp interop init (target, prefer_type( {fr(ifr_array[0] ) }) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" "" { target c } .-1 } - #pragma omp interop init ( prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) // OK - #pragma omp interop init ( prefer_type( omp_ifr_level_zero +1 ) : obj1) // OK - #pragma omp interop init ( prefer_type( x ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } + #pragma omp interop init (target, prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) // OK + #pragma omp interop init (target, prefer_type( omp_ifr_level_zero +1 ) : obj1) // OK + #pragma omp interop init (target, prefer_type( x ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } - #pragma omp interop init ( prefer_type( ifr_scalar ) : obj1) // OK - #pragma omp interop init ( prefer_type( ifr_array ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } + #pragma omp interop init (target, prefer_type( ifr_scalar ) : obj1) // OK + #pragma omp interop init (target, prefer_type( ifr_array ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" } // OK in C++, for C: constexpr arrays are not part of C23; however, they are/were under consideration for C2y. - #pragma omp interop init ( prefer_type( ifr_array[1] ) : obj1) + #pragma omp interop init (target, prefer_type( ifr_array[1] ) : obj1) // { dg-error "expected string literal or constant integer expression before '\\)' token" "" { target c } .-1 } - #pragma omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" } - #pragma omp interop init ( prefer_type( 4, 1, 3) : obj1) + #pragma omp interop init (target, prefer_type( 4, omp_ifr_hip*4) : obj1) // { dg-warning "unknown foreign runtime identifier '20'" } + #pragma omp interop init (target, prefer_type( 4, 1, 3) : obj1) - #pragma omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) - #pragma omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "73: expected '\\)' before ',' token" } - #pragma omp interop init ( prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "53: expected '\\)' before ',' token" } - #pragma omp interop init ( prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1) - #pragma omp interop init ( prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1) + #pragma omp interop init (target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) + #pragma omp interop init (target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "80: expected '\\)' before ',' token" } + #pragma omp interop init (target, prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) // { dg-error "60: expected '\\)' before ',' token" } + #pragma omp interop init (target, prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1) + #pragma omp interop init (target, prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1) } diff --git a/gcc/testsuite/c-c++-common/gomp/interop-2.c b/gcc/testsuite/c-c++-common/gomp/interop-2.c index af81cc6..3e6ed81 100644 --- a/gcc/testsuite/c-c++-common/gomp/interop-2.c +++ b/gcc/testsuite/c-c++-common/gomp/interop-2.c @@ -41,18 +41,18 @@ void f(const omp_interop_t ocp) short o2; float of; - #pragma omp interop init (ocp) // { dg-error "'ocp' shall not be const" } - #pragma omp interop init (oce) // { dg-error "'oce' shall not be const" } - #pragma omp interop init (occ) // { dg-error "'occ' shall not be const" } - #pragma omp interop init (od) // { dg-error "'od' must be of 'omp_interop_t'" } - #pragma omp interop init (od[1])// { dg-error "expected '\\)' before '\\\[' token" } + #pragma omp interop init (targetsync: ocp) // { dg-error "'ocp' shall not be const" } + #pragma omp interop init (targetsync: oce) // { dg-error "'oce' shall not be const" } + #pragma omp interop init (targetsync: occ) // { dg-error "'occ' shall not be const" } + #pragma omp interop init (targetsync: od) // { dg-error "'od' must be of 'omp_interop_t'" } + #pragma omp interop init (targetsync: od[1])// { dg-error "expected '\\)' before '\\\[' token" } // { dg-error "'od' must be of 'omp_interop_t'" "" { target *-*-* } .-1 } - #pragma omp interop init (op) // { dg-error "'op' must be of 'omp_interop_t'" } - #pragma omp interop init (*op) + #pragma omp interop init (targetsync: op) // { dg-error "'op' must be of 'omp_interop_t'" } + #pragma omp interop init (targetsync: *op) // { dg-error "expected identifier before '\\*' token" "" { target c } .-1 } // { dg-error "expected unqualified-id before '\\*' token" "" { target c++ } .-2 } - #pragma omp interop init (o2) // { dg-error "'o2' must be of 'omp_interop_t'" } - #pragma omp interop init (of) // { dg-error "'of' must be of 'omp_interop_t'" } + #pragma omp interop init (targetsync: o2) // { dg-error "'o2' must be of 'omp_interop_t'" } + #pragma omp interop init (targetsync: of) // { dg-error "'of' must be of 'omp_interop_t'" } #pragma omp interop use (ocp) // OK #pragma omp interop use (oce) // odd but okay @@ -86,40 +86,26 @@ void g() omp_interop_t obj1, obj2, obj3, obj4, obj5; int x; - #pragma omp interop init ( prefer_type( {fr("") }) : obj1) // { dg-error "non-empty string literal expected before '\\)' token" } - #pragma omp interop init ( prefer_type( {fr("hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "expected string literal before 'omp_ifr_cuda'" } + #pragma omp interop init (target, prefer_type( {fr("") }) : obj1) // { dg-error "non-empty string literal expected before '\\)' token" } + #pragma omp interop init (target, prefer_type( {fr("hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "expected string literal before 'omp_ifr_cuda'" } - #pragma omp interop init ( prefer_type( {fr("hip") , attr("myooption") }) : obj1) // { dg-error "'attr' string literal must start with 'ompx_'" } - #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") , attr("ompx_") } ) : obj1) - #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1) - #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) // { dg-error "expected '\\)' or ',' before '\{' token" } - #pragma omp interop init ( prefer_type( {fr("hip") , attr("ompx_option") ) : obj1) - // { dg-error "expected ',' or '\}' before '\\)' token" "" { target c } .-1 } - // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 } - // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 } + #pragma omp interop init (target, prefer_type( {fr("hip") , attr("myooption") }) : obj1) // { dg-error "'attr' string literal must start with 'ompx_'" } + #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") , attr("ompx_") } ) : obj1) + #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1) + #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) // { dg-error "expected '\\)' or ',' before '\{' token" } + #pragma omp interop init (target, prefer_type( {fr("hip") , attr("ompx_option") ) : obj1) // { dg-error "expected ',' or '\}' before '\\)' token" } - #pragma omp interop init ( prefer_type( {fr("hip") attr("ompx_option") ) : obj1) - // { dg-error "expected ',' or '\}' before 'attr'" "" { target c } .-1 } - // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 } - // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 } - #pragma omp interop init ( prefer_type( {fr("hip")}), prefer_type("cuda") : obj1) // { dg-error "duplicate 'prefer_type' modifier" } + #pragma omp interop init (target, prefer_type( {fr("hip") attr("ompx_option") ) : obj1) // { dg-error "expected ',' or '\}' before 'attr'" } + #pragma omp interop init (target, prefer_type( {fr("hip")}), prefer_type("cuda") : obj1) // { dg-error "duplicate 'prefer_type' modifier" } - #pragma omp interop init ( prefer_type( {attr("ompx_option1,ompx_option2") } ) : obj1) // { dg-error "'attr' string literal must not contain a comma" } + #pragma omp interop init (target, prefer_type( {attr("ompx_option1,ompx_option2") } ) : obj1) // { dg-error "'attr' string literal must not contain a comma" } - #pragma omp interop init ( prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1) - // { dg-error "'attr' string literal must not contain a comma" "" { target c } .-1 } - // { dg-error "prefer_type' has not been declared" "" { target c++ } .-2 } - // { dg-error "expected '\\)' before '\\(' token" "" { target c++ } .-3 } + #pragma omp interop init (target, prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1) // { dg-error "'attr' string literal must not contain a comma" } #pragma omp interop init ( targetsync other ) : obj1) - // { dg-error "'targetsync' undeclared \\(first use in this function\\)" "" { target c } .-1 } - // { dg-error "'targetsync' has not been declared" "" { target c++ } .-2 } - // { dg-error "expected '\\)' before 'other'" "" { target *-*-* } .-3 } - // { dg-error "expected an OpenMP clause before ':' token" "" { target *-*-* } .-4 } - - #pragma omp interop init ( prefer_type( {fr("cuda") } ), other : obj1) // { dg-error "'init' clause with modifier other than 'prefer_type', 'target' or 'targetsync' before 'other'" } - #pragma omp interop init ( prefer_type( {fr("cuda") } ), obj1) - // { dg-error "'prefer_type' undeclared \\(first use in this function\\)" "" { target c } .-1 } - // { dg-error "'prefer_type' has not been declared" "" { target c++ } .-2 } - // { dg-error "expected '\\)' before '\\(' token" "" { target *-*-* } .-3 } + // { dg-error "expected an OpenMP clause before ':' token" "" { target *-*-* } .-1 } + // { dg-error "expected ':' before 'other'" "" { target *-*-* } .-2 } + + #pragma omp interop init (target, prefer_type( {fr("cuda") } ), other : obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } + #pragma omp interop init (prefer_type( {fr("cuda") } ), obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } } diff --git a/gcc/testsuite/c-c++-common/gomp/interop-3.c b/gcc/testsuite/c-c++-common/gomp/interop-3.c index 51d26dd..38d7f65 100644 --- a/gcc/testsuite/c-c++-common/gomp/interop-3.c +++ b/gcc/testsuite/c-c++-common/gomp/interop-3.c @@ -34,17 +34,17 @@ void f() omp_interop_t target, targetsync, prefer_type; int x; - #pragma omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait +#pragma omp interop init(target: obj1) init(target,targetsync : obj2, obj3) nowait #pragma omp interop init(prefer_type("cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) \ destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0) #pragma omp assume contains(interop) { - #pragma omp interop init(prefer_type("cu da") : obj3) // { dg-warning "unknown foreign runtime identifier 'cu da'" } + #pragma omp interop init(prefer_type("cu da"), targetsync : obj3) // { dg-warning "unknown foreign runtime identifier 'cu da'" } } - #pragma omp interop init(obj1, obj2, obj1), use(obj4) destroy(obj4) + #pragma omp interop init(target: obj1, obj2, obj1), use(obj4) destroy(obj4) // { dg-error "'obj4' appears more than once in action clauses" "" { target *-*-* } .-1 } // { dg-error "'obj1' appears more than once in action clauses" "" { target *-*-* } .-2 } @@ -54,27 +54,21 @@ void f() #pragma omp interop depend(inout: x) use(obj2), destroy(obj3) // Likewise - #pragma omp interop depend(inout: x) use(obj2), destroy(obj3) init(obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" } + #pragma omp interop depend(inout: x) use(obj2), destroy(obj3) init(target: obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" } // { dg-note "69: 'init' clause lacks the 'targetsync' modifier" "" { target c } .-1 } - // { dg-note "70: 'init' clause lacks the 'targetsync' modifier" "" { target c++ } .-2 } + // { dg-note "78: 'init' clause lacks the 'targetsync' modifier" "" { target c++ } .-2 } - #pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" } + #pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(target : obj4) // { dg-error "'depend' clause requires action clauses with 'targetsync' interop-type" } // { dg-note "'init' clause lacks the 'targetsync' modifier" "" { target *-*-* } .-1 } #pragma omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(prefer_type("cuda"), targetsync : obj4) // OK - #pragma omp interop init(target, targetsync, prefer_type, obj1) - #pragma omp interop init(prefer_type, obj1, target, targetsync) + #pragma omp interop init(target, targetsync, prefer_type, obj1) // { dg-error "59: expected '\\(' before ',' token" } + #pragma omp interop init(prefer_type, obj1, target, targetsync) // { dg-error "39: expected '\\(' before ',' token" } // Duplicated variable name or duplicated modifier: #pragma omp interop init(target, targetsync,target : obj1) // { dg-error "duplicate 'target' modifier" } - #pragma omp interop init(target, targetsync,target) // { dg-error "'target' appears more than once in action clauses" } +#pragma omp interop init(target, targetsync,target: obj1) // { dg-error "duplicate 'target' modifier" } #pragma omp interop init(target : target, targetsync,target) // { dg-error "'target' appears more than once in action clauses" } - #pragma omp interop init(target, targetsync,targetsync : obj1) // { dg-error "duplicate 'targetsync' modifier" } - #pragma omp interop init(target, targetsync,targetsync) // { dg-error "targetsync' appears more than once in action clause" } - #pragma omp interop init(target : target, targetsync,targetsync) // { dg-error "targetsync' appears more than once in action clause" } - - #pragma omp interop init(, targetsync, prefer_type, obj1, target) - // { dg-error "expected identifier before ',' token" "" { target c } .-1 } - // { dg-error "expected unqualified-id before ',' token" "" { target c++ } .-2 } + #pragma omp interop init(, targetsync, prefer_type, obj1, target) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } } diff --git a/gcc/testsuite/c-c++-common/gomp/interop-4.c b/gcc/testsuite/c-c++-common/gomp/interop-4.c index bb0bf31..a6449f1 100644 --- a/gcc/testsuite/c-c++-common/gomp/interop-4.c +++ b/gcc/testsuite/c-c++-common/gomp/interop-4.c @@ -33,14 +33,14 @@ f() omp_interop_t obj1, obj2, obj3, obj4, obj5, obj6, obj7; int x[6]; - #pragma omp interop init ( obj1, obj2) use (obj3) destroy(obj4) init(obj5) destroy(obj6) use(obj7) - /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 1 "original" } } */ +#pragma omp interop init (target: obj1, obj2) use (obj3) destroy(obj4) init(targetsync: obj5) destroy(obj6) use(obj7) + /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 1 "original" } } */ #pragma omp interop nowait init (targetsync : obj1, obj2) use (obj3) destroy(obj4) init(target, targetsync : obj5) destroy(obj6) use(obj7) depend(inout: x) /* { dg-final { scan-tree-dump-times "#pragma omp interop depend\\(inout:x\\) use\\(obj7\\) destroy\\(obj6\\) init\\(target, targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(targetsync: obj2\\) init\\(targetsync: obj1\\) nowait\[\r\n\]" 1 "original" } } */ - #pragma omp interop init ( obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5) - /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 1 "original" } } */ +#pragma omp interop init (target: obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5) + /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 1 "original" } } */ /* -------------------------------------------- */ diff --git a/gcc/testsuite/c-c++-common/gomp/pr118965-1.c b/gcc/testsuite/c-c++-common/gomp/pr118965-1.c new file mode 100644 index 0000000..2014b94 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr118965-1.c @@ -0,0 +1,57 @@ +/* { dg-do compile } */ + +/* At least one of the target and/or targetsync modifiers must be provided. + This implies that there are always modifiers required, and the parser + should reject e.g. "init (var1, var2)"; the first thing in the list is + always an init_modifier in valid code. */ + +/* The following definitions are in omp_lib, which cannot be included + in gcc/testsuite/ */ + +#if __cplusplus >= 201103L +# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ +#else +# define __GOMP_UINTPTR_T_ENUM +#endif + +typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM +{ + omp_interop_none = 0, + __omp_interop_t_max__ = __UINTPTR_MAX__ +} omp_interop_t; + +typedef enum omp_interop_fr_t +{ + omp_ifr_cuda = 1, + omp_ifr_cuda_driver = 2, + omp_ifr_opencl = 3, + omp_ifr_sycl = 4, + omp_ifr_hip = 5, + omp_ifr_level_zero = 6, + omp_ifr_hsa = 7, + omp_ifr_last = omp_ifr_hsa +} omp_interop_fr_t; + +// --------------------------------- + +void f() +{ + omp_interop_t obj1, obj2; + + #pragma omp interop init (obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } + #pragma omp interop init (obj1, obj2) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } + #pragma omp interop init (obj1, target) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } + #pragma omp interop init (target, obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } + #pragma omp interop init (obj1, targetsync) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } + #pragma omp interop init (targetsync, obj1) // { dg-error "expected 'prefer_type', 'target', or 'targetsync'" } + #pragma omp interop init (targetsync, target) // { dg-error "expected ':' before '\\)' token" } + + #pragma omp interop init (target, prefer_type( {fr(4 ) }) : obj1) // OK + #pragma omp interop init (targetsync, prefer_type( {fr(4 ) }) : obj1) // OK + #pragma omp interop init (prefer_type( {fr(4 ) }), target : obj1) // OK + + #pragma omp interop init (prefer_type( {fr(4 ) }) : obj1) // { dg-error "missing required 'target' and/or 'targetsync' modifier" } + #pragma omp interop init (prefer_type( {fr(4 ) }) : foobar) // { dg-error "missing required 'target' and/or 'targetsync' modifier" } + // { dg-error "'foobar' undeclared" "" { target c } .-1 } + // { dg-error "'foobar' has not been declared" "" { target c++ } .-2 } +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr118965-2.c b/gcc/testsuite/c-c++-common/gomp/pr118965-2.c new file mode 100644 index 0000000..6e27179 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr118965-2.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ + +/* At least one of the target and/or targetsync modifiers must be provided. */ + +#if __cplusplus >= 201103L +# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ +#else +# define __GOMP_UINTPTR_T_ENUM +#endif + +typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM +{ + omp_interop_none = 0, + __omp_interop_t_max__ = __UINTPTR_MAX__ +} omp_interop_t; + +void f1(omp_interop_t) { } +#pragma omp declare variant(f1) match(construct={dispatch}) \ + append_args(interop(prefer_type({attr("ompx_fun")}))) +// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-1 } +void g1(void); + + +int f2(omp_interop_t, omp_interop_t); +#pragma omp declare variant(f2) \ + append_args(interop(prefer_type("cuda")), \ + interop(prefer_type({fr("hsa")}))) \ + match(construct={dispatch}) +// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-3 } +// { dg-error "missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-3 } +int g2(void) { return 5; } diff --git a/gcc/testsuite/c-c++-common/musttail15.c b/gcc/testsuite/c-c++-common/musttail15.c index 2addc97..b8223d7 100644 --- a/gcc/testsuite/c-c++-common/musttail15.c +++ b/gcc/testsuite/c-c++-common/musttail15.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-do compile { target musttail } } */ /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */ int __attribute__((noinline,noclone,noipa)) diff --git a/gcc/testsuite/c-c++-common/musttail16.c b/gcc/testsuite/c-c++-common/musttail16.c index b1e2ff3..f27a279 100644 --- a/gcc/testsuite/c-c++-common/musttail16.c +++ b/gcc/testsuite/c-c++-common/musttail16.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-do compile { target musttail } } */ struct box { char field[256]; int i; }; diff --git a/gcc/testsuite/c-c++-common/musttail17.c b/gcc/testsuite/c-c++-common/musttail17.c index 490f3c3..58fab84 100644 --- a/gcc/testsuite/c-c++-common/musttail17.c +++ b/gcc/testsuite/c-c++-common/musttail17.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-do compile { target musttail } } */ struct box { char field[64]; int i; }; diff --git a/gcc/testsuite/c-c++-common/musttail18.c b/gcc/testsuite/c-c++-common/musttail18.c index 4f34a8d..ab60887 100644 --- a/gcc/testsuite/c-c++-common/musttail18.c +++ b/gcc/testsuite/c-c++-common/musttail18.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-do compile { target musttail } } */ /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */ void __attribute__((noipa)) f() {} diff --git a/gcc/testsuite/c-c++-common/musttail19.c b/gcc/testsuite/c-c++-common/musttail19.c index 70f9eaf..a592b69 100644 --- a/gcc/testsuite/c-c++-common/musttail19.c +++ b/gcc/testsuite/c-c++-common/musttail19.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-do compile { target musttail } } */ float f1(void); @@ -10,8 +10,9 @@ int f2(void) int f3(int *); -int f4(void) +int f4(int *p) { int x; - __attribute__((musttail)) return f3(&x); /* { dg-error "\(refers to locals|other reasons\)" } */ + (void) p; + __attribute__((musttail)) return f3(&x); /* { dg-warning "address of automatic variable 'x' passed to 'musttail' call argument" } */ } diff --git a/gcc/testsuite/c-c++-common/musttail20.c b/gcc/testsuite/c-c++-common/musttail20.c index 70f14ff..1931f2c 100644 --- a/gcc/testsuite/c-c++-common/musttail20.c +++ b/gcc/testsuite/c-c++-common/musttail20.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { struct_musttail && { c || c++11 } } } } */ +/* { dg-do compile { target struct_musttail } } */ /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */ struct str diff --git a/gcc/testsuite/c-c++-common/musttail21.c b/gcc/testsuite/c-c++-common/musttail21.c index 954209d..1a109e1 100644 --- a/gcc/testsuite/c-c++-common/musttail21.c +++ b/gcc/testsuite/c-c++-common/musttail21.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { c || c++11 } } } */ +/* { dg-do compile { target musttail } } */ void f(void) { __attribute__((musttail)) return; /* { dg-error "cannot tail-call.*return value must be a call" } */ diff --git a/gcc/testsuite/c-c++-common/musttail28.c b/gcc/testsuite/c-c++-common/musttail28.c new file mode 100644 index 0000000..d84658a --- /dev/null +++ b/gcc/testsuite/c-c++-common/musttail28.c @@ -0,0 +1,108 @@ +/* { dg-do compile { target { musttail && { c || c++11 } } } } */ + +int foo (int, void *); +int bar (int, int *); +struct S { int a, b, c; }; +struct T { int d; struct S e; }; + +int +baz (int x, void *y) +{ + [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */ +} + +int +qux (int x, void *y) +{ + __label__ lab; + lab:; + if (*(int *) y == 1) + [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */ + if (x == 1) + [[gnu::musttail]] return foo (3, 0); + else if (x == 2) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return bar (5, 0); + } + else if (x == 3) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return bar (6, 0); + } + else if (x == 4) + { + int a = 42; + [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 5) + { + struct T b; + [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 6) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return bar (10, 0); + } + else if (x == 7) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return bar (11, 0); + } + else if (x == 8) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return foo (12, 0); + } + else if (x == 9) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return foo (13, 0); + } + else if (x == 10) + { + int a = 42; + [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 11) + { + struct T b; + [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 12) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return foo (16, 0); + } + else if (x == 13) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return foo (17, 0); + } + return 0; +} + +int +corge (int x, void *y) +{ + if (*(int *) y == 1) + bar (18, &x); + [[gnu::musttail]] return bar (2, 0); +} diff --git a/gcc/testsuite/c-c++-common/musttail29.c b/gcc/testsuite/c-c++-common/musttail29.c new file mode 100644 index 0000000..f6b3d76 --- /dev/null +++ b/gcc/testsuite/c-c++-common/musttail29.c @@ -0,0 +1,109 @@ +/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-options "-O2 -Wmusttail-local-addr" } */ + +int foo (int, void *); +int bar (int, int *); +struct S { int a, b, c; }; +struct T { int d; struct S e; }; + +int +baz (int x, void *y) +{ + [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */ +} + +int +qux (int x, void *y) +{ + __label__ lab; + lab:; + if (*(int *) y == 1) + [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */ + if (x == 1) + [[gnu::musttail]] return foo (3, 0); + else if (x == 2) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return bar (5, 0); + } + else if (x == 3) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return bar (6, 0); + } + else if (x == 4) + { + int a = 42; + [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 5) + { + struct T b; + [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 6) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return bar (10, 0); + } + else if (x == 7) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return bar (11, 0); + } + else if (x == 8) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return foo (12, 0); + } + else if (x == 9) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return foo (13, 0); + } + else if (x == 10) + { + int a = 42; + [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 11) + { + struct T b; + [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 12) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return foo (16, 0); + } + else if (x == 13) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return foo (17, 0); + } + return 0; +} + +int +corge (int x, void *y) +{ + if (*(int *) y == 1) + bar (18, &x); + [[gnu::musttail]] return bar (2, 0); +} diff --git a/gcc/testsuite/c-c++-common/musttail30.c b/gcc/testsuite/c-c++-common/musttail30.c new file mode 100644 index 0000000..be1c3da --- /dev/null +++ b/gcc/testsuite/c-c++-common/musttail30.c @@ -0,0 +1,109 @@ +/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-options "-Wextra" } */ + +int foo (int, void *); +int bar (int, int *); +struct S { int a, b, c; }; +struct T { int d; struct S e; }; + +int +baz (int x, void *y) +{ + [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */ +} + +int +qux (int x, void *y) +{ + __label__ lab; + lab:; + if (*(int *) y == 1) + [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */ + if (x == 1) + [[gnu::musttail]] return foo (3, 0); + else if (x == 2) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return bar (5, 0); + } + else if (x == 3) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return bar (6, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */ + } + else if (x == 4) + { + int a = 42; + [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 5) + { + struct T b; + [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 6) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return bar (10, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */ + } + else if (x == 7) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return bar (11, 0); + } + else if (x == 8) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return foo (12, 0); + } + else if (x == 9) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return foo (13, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */ + } + else if (x == 10) + { + int a = 42; + [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 11) + { + struct T b; + [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 12) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return foo (16, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */ + } + else if (x == 13) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return foo (17, 0); + } + return 0; +} + +int +corge (int x, void *y) +{ + if (*(int *) y == 1) + bar (18, &x); + [[gnu::musttail]] return bar (2, 0); /* { dg-warning "address of parameter 'x' can escape to 'musttail' call" } */ +} diff --git a/gcc/testsuite/c-c++-common/musttail31.c b/gcc/testsuite/c-c++-common/musttail31.c new file mode 100644 index 0000000..f44ada4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/musttail31.c @@ -0,0 +1,109 @@ +/* { dg-do compile { target { musttail && { c || c++11 } } } } */ +/* { dg-options "-O2 -Wmaybe-musttail-local-addr" } */ + +int foo (int, void *); +int bar (int, int *); +struct S { int a, b, c; }; +struct T { int d; struct S e; }; + +int +baz (int x, void *y) +{ + [[gnu::musttail]] return bar (2, &x); /* { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } */ +} + +int +qux (int x, void *y) +{ + __label__ lab; + lab:; + if (*(int *) y == 1) + [[gnu::musttail]] return foo (1, &&lab); /* { dg-warning "address of label passed to 'musttail' call argument" } */ + if (x == 1) + [[gnu::musttail]] return foo (3, 0); + else if (x == 2) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return bar (5, 0); + } + else if (x == 3) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return bar (6, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */ + } + else if (x == 4) + { + int a = 42; + [[gnu::musttail]] return bar (7, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 5) + { + struct T b; + [[gnu::musttail]] return bar (8, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 6) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return bar (10, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */ + } + else if (x == 7) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return bar (11, 0); + } + else if (x == 8) + { + { + int a = 42; + bar (4, &a); + } + [[gnu::musttail]] return foo (12, 0); + } + else if (x == 9) + { + int a = 42; + bar (4, &a); + [[gnu::musttail]] return foo (13, 0); /* { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } */ + } + else if (x == 10) + { + int a = 42; + [[gnu::musttail]] return foo (14, &a); /* { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } */ + } + else if (x == 11) + { + struct T b; + [[gnu::musttail]] return foo (15, &b.e.b); /* { dg-warning "address of automatic variable 'b' passed to 'musttail' call argument" } */ + } + else if (x == 12) + { + struct T b; + bar (9, &b.e.a); + [[gnu::musttail]] return foo (16, 0); /* { dg-warning "address of automatic variable 'b' can escape to 'musttail' call" } */ + } + else if (x == 13) + { + { + struct T b; + bar (9, &b.e.a); + } + [[gnu::musttail]] return foo (17, 0); + } + return 0; +} + +int +corge (int x, void *y) +{ + if (*(int *) y == 1) + bar (18, &x); + [[gnu::musttail]] return bar (2, 0); /* { dg-warning "address of parameter 'x' can escape to 'musttail' call" } */ +} diff --git a/gcc/testsuite/c-c++-common/musttail8.c b/gcc/testsuite/c-c++-common/musttail8.c index 50ca1ac..9a29030 100644 --- a/gcc/testsuite/c-c++-common/musttail8.c +++ b/gcc/testsuite/c-c++-common/musttail8.c @@ -10,8 +10,9 @@ int f2(void) int f3(int *); -int f4(void) +int f4(int *p) { int x; - [[gnu::musttail]] return f3(&x); /* { dg-error "\(refers to locals|other reasons\)" } */ + (void) p; + [[gnu::musttail]] return f3(&x); /* { dg-warning "address of automatic variable 'x' passed to 'musttail' call argument" } */ } diff --git a/gcc/testsuite/c-c++-common/pr119614-1.c b/gcc/testsuite/c-c++-common/pr119614-1.c new file mode 100644 index 0000000..89105a3 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119614-1.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/119614 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2" } */ + +volatile int v; + +[[gnu::noinline]] const char * +foo (int x) +{ + v += x; + return 0; +} + +const char * +bar (int x) +{ + if (x == 42) + [[gnu::musttail]] return foo (42); + [[gnu::musttail]] return foo (32); +} + +const char * +baz (int x) +{ + if (x == 5) + return foo (42); + return foo (32); +} diff --git a/gcc/testsuite/c-c++-common/pr119614-2.c b/gcc/testsuite/c-c++-common/pr119614-2.c new file mode 100644 index 0000000..8833eee --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119614-2.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/119614 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2" } */ + +volatile int v; + +[[gnu::noinline]] const char * +foo (int x) +{ + v += x; + return (const char *) -42; +} + +const char * +bar (int x) +{ + if (x == 42) + [[gnu::musttail]] return foo (42); + [[gnu::musttail]] return foo (32); +} + +const char * +baz (int x) +{ + if (x == 5) + return foo (42); + return foo (32); +} diff --git a/gcc/testsuite/c-c++-common/pr119614-3.c b/gcc/testsuite/c-c++-common/pr119614-3.c new file mode 100644 index 0000000..59ed36b --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119614-3.c @@ -0,0 +1,28 @@ +/* PR tree-optimization/119614 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2" } */ + +volatile int v; + +[[gnu::noinline]] double +foo (int x) +{ + v += x; + return 0.5; +} + +double +bar (int x) +{ + if (x == 42) + [[gnu::musttail]] return foo (42); + [[gnu::musttail]] return foo (32); +} + +double +baz (int x) +{ + if (x == 5) + return foo (42); + return foo (32); +} diff --git a/gcc/testsuite/c-c++-common/pr119616.c b/gcc/testsuite/c-c++-common/pr119616.c new file mode 100644 index 0000000..5ffdb8c --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119616.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/119616 */ +/* { dg-do compile { target external_musttail } } */ +/* { dg-options "-O2" } */ + +int foo (int *); +int bar (int); + +int +baz (int x) +{ + if (!x) + [[gnu::musttail]] return bar (x); + return foo (&x); +} + +int +qux (int x) +{ + if (!x) + [[gnu::musttail]] return bar (x); + foo (&x); + return 1; +} diff --git a/gcc/testsuite/c-c++-common/pr119618.c b/gcc/testsuite/c-c++-common/pr119618.c new file mode 100644 index 0000000..a56e669 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119618.c @@ -0,0 +1,21 @@ +/* PR gcov-profile/119618 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-fcompare-debug -fprofile-generate -O1" } */ +/* { dg-require-profiling "-fprofile-generate" } */ + +struct S { char s; }; +int foo (void); +int *(*fn) (void); + +int * +bar (void) +{ + if (foo ()) + return 0; + { + struct S s; + do + [[gnu::musttail]] return fn (); + while (0); + } +} diff --git a/gcc/testsuite/c-c++-common/tsan/pr119801.c b/gcc/testsuite/c-c++-common/tsan/pr119801.c new file mode 100644 index 0000000..d3a6bb4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/tsan/pr119801.c @@ -0,0 +1,24 @@ +/* PR sanitizer/119801 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=thread" } */ + +[[gnu::noipa]] int +bar (int *p) +{ + return ++*p; +} + +int +foo (int *p) +{ + ++*p; + [[gnu::musttail]] return bar (p); +} + +[[gnu::noinline]] int +baz (int x) +{ + if (x < 10) + return x; + [[gnu::musttail]] return baz (x - 2); +} diff --git a/gcc/testsuite/cobol.dg/group2/ACCEPT_DATE___DAY_and_intrinsic_functions__2_.cob b/gcc/testsuite/cobol.dg/group2/ACCEPT_DATE___DAY_and_intrinsic_functions__2_.cob index 7a404fd..be58878 100644 --- a/gcc/testsuite/cobol.dg/group2/ACCEPT_DATE___DAY_and_intrinsic_functions__2_.cob +++ b/gcc/testsuite/cobol.dg/group2/ACCEPT_DATE___DAY_and_intrinsic_functions__2_.cob @@ -1,5 +1,5 @@ *> { dg-do run } - *> { dg-set-target-env-var COB_CURRENT_DATE "2020/06/12 18:45:22" } + *> { dg-set-target-env-var GCOBOL_CURRENT_DATE "2020/06/12 18:45:22" } IDENTIFICATION DIVISION. PROGRAM-ID. prog. diff --git a/gcc/testsuite/cobol.dg/group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.cob b/gcc/testsuite/cobol.dg/group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.cob index 6014220..665787d 100644 --- a/gcc/testsuite/cobol.dg/group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.cob +++ b/gcc/testsuite/cobol.dg/group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.cob @@ -1,5 +1,5 @@ *> { dg-do run } - *> { dg-set-target-env-var COB_CURRENT_DATE "2015/04/05 18:45:22" } + *> { dg-set-target-env-var GCOBOL_CURRENT_DATE "2015/04/05 18:45:22" } *> { dg-output-file "group2/ACCEPT_FROM_TIME___DATE___DAY___DAY-OF-WEEK__2_.out" } IDENTIFICATION DIVISION. diff --git a/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.cob b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.cob new file mode 100644 index 0000000..99690da --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + *> { dg-output-file "group2/Dynamic_reference_modification.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + 01 I PIC 9. + PROCEDURE DIVISION. + MOVE 1 TO I. + DISPLAY X(I:1) + END-DISPLAY. + MOVE 4 TO I. + DISPLAY X(I:1) + END-DISPLAY. + MOVE 1 TO I. + DISPLAY X(1:I) + END-DISPLAY. + MOVE 4 TO I. + DISPLAY X(1:I) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.out b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.out new file mode 100644 index 0000000..42a4b69 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Dynamic_reference_modification.out @@ -0,0 +1,5 @@ +a +d +a +abcd + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.cob new file mode 100644 index 0000000..3f4049b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ABS.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.2345. + PROCEDURE DIVISION. + COMPUTE X = FUNCTION ABS( X ) + DISPLAY X + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.out new file mode 100644 index 0000000..ab39cfe --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.out @@ -0,0 +1,2 @@ ++0001.2345 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ACOS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ACOS.cob new file mode 100644 index 0000000..73e192f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ACOS.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ACOS ( -0.2345 ) TO Z. + IF Z NOT = 1.807500521108243435101500438523210 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob new file mode 100644 index 0000000..276c33f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ALL_INTRINSIC_simple_test.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. phase0. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION ALL INTRINSIC. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 work-string pic X(80) VALUE " ABC ". + PROCEDURE DIVISION. + DISPLAY """" TRIM(work-string) """" + goback. + end program phase0. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out new file mode 100644 index 0000000..7b9bc93 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out @@ -0,0 +1,2 @@ +"ABC" + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ANNUITY.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ANNUITY.cob new file mode 100644 index 0000000..29049dd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ANNUITY.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ANNUITY ( 3, 5 ) TO Z. + IF Z NOT = 3.002932551319648093841642228739003 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ASIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ASIN.cob new file mode 100644 index 0000000..b364a40 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ASIN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ASIN ( -0.2345 ) TO Y. + IF Y NOT = -0.236704194313346815870178746883458 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ATAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ATAN.cob new file mode 100644 index 0000000..1f884ce --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ATAN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ATAN ( 1 ) TO Y. + IF Y NOT = 0.785398163397448309615660845819875 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob new file mode 100644 index 0000000..70b40ba --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob @@ -0,0 +1,40 @@ + *> { dg-do run } + *> { dg-options "-dialect ibm" } + *> { dg-output-file "group2/FUNCTION_BIGGER-POINTER.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 N PIC S9(8) COMP-5 value 0. + 01 P REDEFINES N POINTER. + 01 FILLER. + 05 X PIC A(4) VALUE "ABC". + 05 E REDEFINES X PIC A(1) OCCURS 4. + LINKAGE SECTION. + 77 B PIC A. + + PROCEDURE DIVISION. + set P to address of E(1). + + display FUNCTION trim(x) '.' + + set address of B to p. + perform until B = SPACE + display B no advancing + set p up by 1 + set address of B to p + end-perform + display '.' + + set P to address of E(1) + set address of B to p + perform until B = SPACES + display B no advancing + add 1 to N + set address of B to p + end-perform + display '.' + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.out new file mode 100644 index 0000000..d31e83b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.out @@ -0,0 +1,4 @@ +ABC. +ABC. +ABC. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob new file mode 100644 index 0000000..d6d04d1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + *> { dg-options "-dialect ibm" } + *> { dg-output-file "group2/FUNCTION_BIGGER-POINTER__2_.out" } + + identification division. + program-id. prog. + data division. + working-storage section. + 01 n4 pic s9(8) comp-5 value 0. + 01 p4 redefines n4 pointer. + 01 n8 pic s9(16) comp-5 value 0. + 01 p8 redefines n8 pointer. + procedure division. + move -1 to n8 + set p4 to p8 + display "P4 and P8 before: " p4 space p8 + display "Increment N4 and N8" + add 1 to n4 n8 + display "P4 and P8 after: " p4 space p8 + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out new file mode 100644 index 0000000..b15a754 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out @@ -0,0 +1,4 @@ +P4 and P8 before: 0xffffffffffffffff 0xffffffffffffffff +Increment N4 and N8 +P4 and P8 after: 0x0000000000000000 0x0000000000000000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob new file mode 100644 index 0000000..9a5f384 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob @@ -0,0 +1,20 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_BYTE-LENGTH.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4). + 01 TEST-FLD PIC S9(04)V9(08). + PROCEDURE DIVISION. + MOVE FUNCTION BYTE-LENGTH ( TEST-FLD ) TO TEST-FLD. + DISPLAY "BYTE-LENGTH of PIC S9(04)V9(08) is " TEST-FLD + MOVE FUNCTION BYTE-LENGTH ( X ) TO TEST-FLD. + DISPLAY "BYTE-LENGTH of PIC X(4) is " TEST-FLD + MOVE FUNCTION BYTE-LENGTH ( '00128' ) TO TEST-FLD + DISPLAY "BYTE-LENGTH of PIC '00128' is " TEST-FLD + MOVE FUNCTION BYTE-LENGTH ( x'a0' ) TO TEST-FLD + DISPLAY "BYTE-LENGTH of PIC x'a0' is " TEST-FLD + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.out new file mode 100644 index 0000000..64ad515 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.out @@ -0,0 +1,5 @@ +BYTE-LENGTH of PIC S9(04)V9(08) is +0012.00000000 +BYTE-LENGTH of PIC X(4) is +0004.00000000 +BYTE-LENGTH of PIC '00128' is +0005.00000000 +BYTE-LENGTH of PIC x'a0' is +0001.00000000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CHAR.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CHAR.cob new file mode 100644 index 0000000..955cc51 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CHAR.cob @@ -0,0 +1,29 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE 108. + 01 TEST-FLD. + 05 TEST-DATA PIC X(01). + 88 VALID-DATA VALUE 'k'. + 05 TEST-UNSET PIC X VALUE '_'. + 88 VALID-UNSET VALUE '_'. + PROCEDURE DIVISION. + STRING FUNCTION CHAR ( X ) + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING. + EVALUATE TRUE + WHEN NOT VALID-UNSET + DISPLAY "FUNCTION result too long" + END-DISPLAY + WHEN VALID-DATA + CONTINUE + WHEN OTHER + DISPLAY TEST-DATA + END-DISPLAY + END-EVALUATE. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob new file mode 100644 index 0000000..3f9c6e1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(04)V9(08). + PROCEDURE DIVISION. + MOVE FUNCTION COMBINED-DATETIME ( 987, 345.6 ) + TO TEST-FLD. + IF TEST-FLD NOT = 987.003456 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob new file mode 100644 index 0000000..d982432 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob @@ -0,0 +1,36 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(4). + 01 TEST-FLD. + 05 TEST-DATA PIC X(14). + 88 VALID-DATA VALUE 'defxabczz55666'. + 05 TEST-UNSET PIC X VALUE '_'. + 88 VALID-UNSET VALUE '_'. + PROCEDURE DIVISION. + MOVE "defx" TO Y. + STRING FUNCTION CONCAT ( Y "abc" "zz" "55" "666" ) + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING. + EVALUATE TRUE + WHEN NOT VALID-UNSET + DISPLAY "FUNCTION result too long" + END-DISPLAY + WHEN TEST-DATA + <> FUNCTION CONCAT ( Y "abc" "zz" "55" "666" ) + DISPLAY "CONCAT issue, '" TEST-DATA + "' vs. '" + FUNCTION CONCAT ( Y "abc" "zz" "55" "666" ) "'" + END-DISPLAY + WHEN VALID-DATA + CONTINUE + WHEN OTHER + DISPLAY TEST-DATA + END-DISPLAY + END-EVALUATE. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob new file mode 100644 index 0000000..98f21c3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(4). + 01 TEST-FLD PIC X(9) VALUE SPACES. + PROCEDURE DIVISION. + MOVE 'defx' TO Y. + MOVE FUNCTION CONCAT + ( Y "abc" "zz" "55" "666" ) (2 : 9) + TO TEST-FLD. + IF TEST-FLD NOT = 'efxabczz5' + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_COS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_COS.cob new file mode 100644 index 0000000..6651b9d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_COS.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION COS ( -0.2345 ) TO Y. + IF Y NOT = 0.972630641256258184713416962414561 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CURRENT-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CURRENT-DATE.cob new file mode 100644 index 0000000..429f247 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CURRENT-DATE.cob @@ -0,0 +1,62 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD. + 02 WS-YEAR PIC 9(04). + 88 VALID-YEAR VALUE 1980 THRU 9999. + 02 WS-MONTH PIC 9(02). + 88 VALID-MONTH VALUE 01 THRU 12. + 02 WS-DAY PIC 9(02). + 88 VALID-DAY VALUE 01 THRU 31. + 02 WS-HOUR PIC 9(02). + 88 VALID-HOUR VALUE 00 THRU 23. + 02 WS-MIN PIC 9(02). + 88 VALID-MIN VALUE 00 THRU 59. + 02 WS-SEVALIDD PIC 9(02). + 88 VALID-SEC VALUE 00 THRU 59. + 02 WS-HUNDSEC PIC 9(02). + 88 VALID-HUNDSEC VALUE 00 THRU 99. + 02 WS-GREENW PIC X. + 88 VALID-GREENW VALUE "-", "+", "0". + 88 ZERO-GREENW VALUE "0". + 02 WS-OFFSET PIC 9(02). + 88 VALID-OFFSET VALUE 00 THRU 13. + 88 ZERO-OFFSET VALUE 00. + 02 WS-OFFSET2 PIC 9(02). + 88 VALID-OFFSET2 VALUE 00 THRU 59. + 88 ZERO-OFFSET2 VALUE 00. + 02 WS-UNSET PIC X VALUE '_'. + 88 VALID-UNSET VALUE '_'. + PROCEDURE DIVISION. + STRING FUNCTION CURRENT-DATE + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING. + EVALUATE TRUE + WHEN NOT VALID-UNSET + DISPLAY "FUNCTION result too long" + END-DISPLAY + WHEN VALID-YEAR AND + VALID-MONTH AND + VALID-DAY AND + VALID-HOUR AND + VALID-MIN AND + VALID-SEC AND + VALID-HUNDSEC AND + VALID-GREENW AND + VALID-OFFSET AND + VALID-OFFSET2 AND + VALID-UNSET AND + ((NOT ZERO-GREENW) OR (ZERO-OFFSET AND ZERO-OFFSET2)) + CONTINUE + WHEN OTHER + DISPLAY "CURRENT-DATE with wrong format: " + TEST-FLD (01:21) + END-DISPLAY + END-EVALUATE. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob new file mode 100644 index 0000000..708aa96 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DATE-OF-INTEGER ( 146000 ) + TO TEST-FLD. + IF TEST-FLD NOT = 20000925 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob new file mode 100644 index 0000000..5b2bd43 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DATE-TO-YYYYMMDD ( 981002, -10, 1994 ) + TO TEST-FLD. + IF TEST-FLD NOT = 018981002 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob new file mode 100644 index 0000000..88b1b84 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob @@ -0,0 +1,335 @@ + *> { dg-do run } + *> { dg-set-target-env-var TZ UTC0 } + + identification division. + program-id. test. + *> Tests all the DATE and TIME functions + *> + *> The various functions are used to test each other. + *> + *> COMBINED-DATETIME OK + *> CURRENT_DATE OK + *> DATE-OF-INTEGER OK + *> DATE-TO-YYYYMMDD OK + *> DAY-OF-INTEGER OK + *> DAY-TO-YYYYDDD OK + *> FORMATTED-CURRENT-DATE OK + *> FORMATTED-DATE OK + *> FORMATTED-DATETIME OK + *> FORMATTED-TIME OK + *> INTEGER-OF-DATE OK + *> INTEGER-OF-DAY OK + *> INTEGER-OF-FORMATTED-DATE OK + *> SECONDS-FROM-FORMATTED-TIME OK + *> SECONDS-PAST-MIDNIGHT OK + *> TEST-DATE-YYYYMMDD OK + *> TEST-DAY-YYYYDDD OK + *> TEST-FORMATTED-DATETIME OK + *> + data division. + working-storage section. + + 01 checking pic x(80). + 01 should-be pic x(32). + 01 but-is pic x(32). + 01 but-is-n redefines but-is pic 99999999.999999. + 01 but-is-integer_part pic 99999. + + 01 jd1601 pic 9(7). + 01 jd9999 pic 9(7). + 01 jd pic s9(7). + + 01 integer-date pic s9(7). + 01 integer-result pic 99. + 01 standard-date-form pic 9(8). + 01 julian-date-form PIC 9(8). + + 01 date1. + 02 YYYY pic 9999. + 02 MM pic 99. + 02 DD pic 99. + 01 date2. + 02 YYYY pic 9999. + 02 filler pic x value "-". + 02 MM pic 99. + 02 filler pic x value "-". + 02 DD pic 99. + 01 date3. + 02 YYYY pic 9999. + 02 DDD pic 999. + 01 date4. + 02 YYYY pic 9999. + 02 filler pic x value "-". + 02 DDD pic 999. + 01 date5. + 02 YYYY pic 9999. + 02 filler pic x value "W". + 02 ww pic 99. + 02 d pic 9. + 01 date6. + 02 YYYY pic 9999. + 02 filler pic xx value "-W". + 02 ww pic 99. + 02 filler pic x value "-". + 02 d pic 9. + + 01 yymmdd. + 02 YY pic 99. + 02 MM pic 99. + 02 DD pic 99. + + 01 minus10 pic s99 value -10. + + 01 forced_date_n pic X(64) VALUE Z"GCOBOL_CURRENT_DATE". + 01 forced_date_v pic X(64) VALUE Z"1945/06/01 12:34:56". + + procedure division. + CALL "setenv" using forced_date_n, forced_date_v + + move "SECONDS-PAST-MIDNIGHT" to checking + move "45296" to should-be + MOVE FUNCTION SECONDS-PAST-MIDNIGHT to but-is-integer_part + move but-is-integer_part to but-is + perform checkit + + *> Establish the initial date integer + move "integer-of-date" to checking + move function integer-of-date(19000101) to jd1601 + move "integer-of-date(19000101)" to checking + move 0109208 to should-be + move jd1601 to but-is + perform checkit + + *> Establish the final date integer + move "integer-of-date" to checking + move function integer-of-date(21011231) to jd9999 + move "integer-of-date(21001231)" to checking + move 0182986 to should-be + move jd9999 to but-is + perform checkit + + *> We are going to do the following tests over all valid dates: + perform varying jd from jd1601 by 1 until jd > jd9999 + + *> Convert JD to all six DATE types: + move FUNCTION FORMATTED-DATE("YYYYMMDD" jd) TO date1 + move FUNCTION FORMATTED-DATE("YYYY-MM-DD" jd) TO date2 + move FUNCTION FORMATTED-DATE("YYYYDDD" jd) TO date3 + move FUNCTION FORMATTED-DATE("YYYY-DDD" jd) TO date4 + move FUNCTION FORMATTED-DATE("YYYYWwwD" jd) TO date5 + move FUNCTION FORMATTED-DATE("YYYY-Www-D" jd) TO date6 + + *> Test the routines that check DATE types + move zero to should-be + move FUNCTION TEST-FORMATTED-DATETIME("YYYYMMDD" date1) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYYMMDD"" date1)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYY-MM-DD" date2) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYY-MM-DD"" date2)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYYDDD" date3) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYYDDD"" date3)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYY-DDD" date4) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYY-DDD"" date4)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYYWwwD" date5) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYYWwwD"" date5)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYY-Www-D" date6) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYY-Www-D"" date6)" to checking + perform checkit + + *> Test the routines that extract the integer date + + move function INTEGER-OF-FORMATTED-DATE("YYYYMMDD" date1) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYYMMDD"" date1)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYY-MM-DD" date2) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYY-MM-DD"" date2)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYYDDD" date3) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYYDDD"" date3)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYY-DDD" date4) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYY-DDD"" date4)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYYWwwD" date5) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYYWwwD"" date5)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYY-Www-D" date6) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYY-Www-D"" date6)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function DATE-OF-INTEGER(jd) to standard-date-form + move function INTEGER-OF-DATE(standard-date-form) to integer-date + move "DATE-OF-INTEGER and INTEGER-OF-DATE" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function TEST-DATE-YYYYMMDD(standard-date-form) to integer-result + move "TEST-DATE-YYYYMMDD" to checking + move zero to should-be + move integer-result to but-is + perform checkit + + move function DAY-OF-INTEGER(jd) to julian-date-form + move function INTEGER-OF-DAY(julian-date-form) to integer-date + move "DAY-OF-INTEGER and INTEGER-OF-DAY" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function TEST-DAY-YYYYDDD(julian-date-form) to integer-result + move "TEST-DAY-YYYYDDD" to checking + move zero to should-be + move integer-result to but-is + perform checkit + end-perform. + + move function integer-of-date(19980101) to jd1601 + move function integer-of-date(19981231) to jd9999 + perform varying jd from jd1601 by 1 until jd > jd9999 + move FUNCTION FORMATTED-DATE("YYYYMMDD" jd) TO date1 + move FUNCTION FORMATTED-DATE("YYYYDDD" jd) TO date3 + + move FUNCTION MOD( YYYY of date1 100) to yy of yymmdd + move MM of date1 to MM of yymmdd + move DD of date1 to DD of yymmdd + + move FUNCTION DATE-TO-YYYYMMDD(yymmdd, minus10, 1994) + to standard-date-form + move "DATE-TO-YYYYMMDD" to checking + move "18" to date1(1:2) + move date1 to should-be + move standard-date-form to but-is + perform checkit + end-perform. + + move "DAY-TO-YYYYDDD" to checking + MOVE 1910004 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(10004 -20 2002) TO but-is + perform checkit + MOVE 1810004 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(10004 -120 2002) TO but-is + perform checkit + MOVE 2010004 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(10004 20 2002) TO but-is + perform checkit + MOVE 1995005 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(95005 -10 2013) TO but-is + perform checkit + + move "COMBINED-DATETIME" to checking + MOVE "19450601.123456" TO should-be + MOVE FUNCTION COMBINED-DATETIME(19450601 123456) TO but-is-n + perform checkit + + move "CURRENT_DATE" to checking + MOVE "1945060112345600+0000" TO should-be + MOVE FUNCTION CURRENT-DATE TO but-is + move "+0000" to but-is(17:5) + perform checkit + + move "FORMATTED-CURRENT-DATE (1)" to checking + MOVE "1945-06-01T12:34:56" TO should-be + MOVE FUNCTION FORMATTED-CURRENT-DATE("YYYY-MM-DDThh:mm:ss") TO but-is + perform blot-zulu + perform checkit + + move "FORMATTED-CURRENT-DATE (2)" to checking + MOVE "1945-06-01T12:34:56Z" TO should-be + MOVE FUNCTION FORMATTED-CURRENT-DATE("YYYY-MM-DDThh:mm:ssZ") TO but-is + perform blot-zulu + perform checkit + + move "FORMATTED-CURRENT-DATE (3)" to checking + MOVE "1945-06-01T12:34:56-05:00" TO should-be + MOVE FUNCTION FORMATTED-CURRENT-DATE("YYYY-MM-DDThh:mm:ss+hh:mm") TO but-is + perform blot-zulu + perform checkit + + move "formatted-time" to checking + move "01:12:34Z" to should-be + MOVE FUNCTION formatted-time("hh:mm:ssZ" 754 -60 ) to but-is + perform checkit. + + move "00:12:34Z" to should-be + MOVE FUNCTION formatted-time("hh:mm:ssZ" 754 0 ) to but-is + perform checkit. + + move "23:12:34Z" to should-be + MOVE FUNCTION formatted-time("hh:mm:ssZ" 754 60 ) to but-is + perform checkit. + + move "formatted-datetime" to checking + MOVE "1900-01-01T00:00:00-01:00" TO SHOULD-BE + MOVE FUNCTION formatted-datetime("YYYY-MM-DDThh:mm:ss+hh:mm" 0109208 0 -60 ) TO but-is + perform checkit. + + MOVE "1900-01-01T00:00:00+00:00" TO SHOULD-BE + MOVE FUNCTION formatted-datetime("YYYY-MM-DDThh:mm:ss+hh:mm" 0109208 0 -0 ) TO but-is + perform checkit. + + MOVE "1900-01-01T00:00:00+01:00" TO SHOULD-BE + MOVE FUNCTION formatted-datetime("YYYY-MM-DDThh:mm:ss+hh:mm" 0109208 0 +60 ) TO but-is + perform checkit. + + move "SECONDS-FROM-FORMATTED-TIME" to checking + MOVE "00043200.000000" TO SHOULD-BE + MOVE SPACE TO but-is + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME("hh:mm:ss" "12:00:00") TO but-is-n + perform checkit. + + stop run. + + checkit. + *> display "checkit " """" should-be """" space """" but-is """" + if FUNCTION TRIM(should-be) IS NUMERIC AND FUNCTION TRIM(but-is) IS NUMERIC + if FUNCTION NUMVAL(should-be) + not equal to FUNCTION NUMVAL(but-is) + and should-be not equal to but-is + then + display function trim (checking) ":" + " should be " """" function trim (should-be) """" + " but is " """" function trim (but-is) """" + move 1 to return-code + end-if + else + if should-be not equal to but-is + and should-be not equal to but-is + then + display function trim (checking) ":" + " should be " """" function trim (should-be) """" + " but is " """" function trim (but-is) """" + move 1 to return-code + end-if + . + blot-zulu. + move "hh:mm" TO but-is(12:5) + move "hh:mm" TO should-be(12:5) + if but-is(21:1) not equal to space + move "+hh:mm" TO but-is(20:6) + move "+hh:mm" TO should-be(20:6) + end-if + . + end program test. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob new file mode 100644 index 0000000..df70a82 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DAY-OF-INTEGER ( 146000 ) + TO TEST-FLD. + IF TEST-FLD NOT = 2000269 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob new file mode 100644 index 0000000..5316a70 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DAY-TO-YYYYDDD ( 95005, -10, 2013 ) + TO TEST-FLD. + IF TEST-FLD NOT = 001995005 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_E.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_E.cob new file mode 100644 index 0000000..e07edf0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_E.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION E TO Y. + IF Y NOT = 2.718281828459045235360287471352662 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob new file mode 100644 index 0000000..e822708 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob @@ -0,0 +1,26 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_EXCEPTION-FILE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "NOTEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + DISPLAY FUNCTION EXCEPTION-FILE '|' + NO ADVANCING + END-DISPLAY. + OPEN INPUT TEST-FILE. + DISPLAY FUNCTION EXCEPTION-FILE + NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out new file mode 100644 index 0000000..ece5467 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out @@ -0,0 +1 @@ +00|35TEST-FILE diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob new file mode 100644 index 0000000..d68261d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_EXCEPTION-STATEMENT.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "NOTEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + DISPLAY "EXCEPTION-STATEMENT before bad OPEN: " + """" FUNCTION EXCEPTION-STATEMENT """" + OPEN INPUT TEST-FILE. + DISPLAY "EXCEPTION-STATEMENT after bad OPEN: " + """" FUNCTION EXCEPTION-STATEMENT """" + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out new file mode 100644 index 0000000..5656102 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out @@ -0,0 +1,3 @@ +EXCEPTION-STATEMENT before bad OPEN: " " +EXCEPTION-STATEMENT after bad OPEN: "OPEN" + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob new file mode 100644 index 0000000..1ffa366 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_EXCEPTION-STATUS.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "NOTEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + DISPLAY "EXCEPTION STATUS before bad open: " + """" FUNCTION EXCEPTION-STATUS """" + OPEN INPUT TEST-FILE. + DISPLAY "EXCEPTION STATUS after bad open: " + """" FUNCTION EXCEPTION-STATUS """" + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out new file mode 100644 index 0000000..02b4f84 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out @@ -0,0 +1,3 @@ +EXCEPTION STATUS before bad open: " " +EXCEPTION STATUS after bad open: "EC-I-O-PERMANENT-ERROR" + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP.cob new file mode 100644 index 0000000..756612c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S99V9(31). + PROCEDURE DIVISION. + MOVE FUNCTION EXP ( 3 ) TO Y. + IF Y NOT = 20.0855369231876677409285296545817 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP10.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP10.cob new file mode 100644 index 0000000..a76fcfb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP10.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION EXP10 ( 4 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000010000 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FACTORIAL.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FACTORIAL.cob new file mode 100644 index 0000000..969663c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FACTORIAL.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION FACTORIAL ( 6 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000000720 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob new file mode 100644 index 0000000..cde5644 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob @@ -0,0 +1,54 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(10). + PROCEDURE DIVISION. + *> Test normal inputs. + MOVE FUNCTION FORMATTED-DATE ( "YYYYMMDD", 1 ) TO str + IF str <> "16010101" + DISPLAY "Test 1 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYY-MM-DD", 1 ) TO str + IF str <> "1601-01-01" + DISPLAY "Test 2 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYYDDD", 1 ) TO str + IF str <> "1601001" + DISPLAY "Test 3 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYY-DDD", 1 ) TO str + IF str <> "1601-001" + DISPLAY "Test 4 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYYWwwD", 1 ) TO str + IF str <> "1601W011" + DISPLAY "Test 5 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYY-Www-D", 1 ) TO str + IF str <> "1601-W01-1" + DISPLAY "Test 6 failed: " str END-DISPLAY + END-IF + + *> Test week number edge cases. + *> For 2012-01-01. + MOVE FUNCTION FORMATTED-DATE ( "YYYYWwwD", 150115 ) TO str + IF str <> "2011W527" + DISPLAY "Test 7 failed: " str END-DISPLAY + END-IF + + *> and for 2013-12-30. + MOVE FUNCTION FORMATTED-DATE ( "YYYYWwwD", 150844 ) TO str + IF str <> "2014W011" + DISPLAY "Test 8 failed: " str END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob new file mode 100644 index 0000000..47654cb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob @@ -0,0 +1,48 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(40). + PROCEDURE DIVISION. + *> Test normal inputs. + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYMMDDThhmmss", 1, 45296) + TO str + IF str <> "16010101T123456" + DISPLAY "Test 1 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATETIME + ("YYYY-MM-DDThh:mm:ss", 1, 45296) + TO str + IF str <> "1601-01-01T12:34:56" + DISPLAY "Test 2 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYDDDThhmmss+hhmm", 1, 45296, -754) + TO str + IF str <> "1601001T123456-1234" + DISPLAY "Test 3 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYDDDThhmmss+hhmm", 1, 45296) + TO str + IF str <> "1601001T123456+0000" + DISPLAY "Test 4 failed: " str END-DISPLAY + END-IF + + *> Test underflow to next day due to offset + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYDDDThhmmss.sssssssssZ", 150846, 0, + 1) + TO str + IF str <> "2013365T235900.000000000Z" + DISPLAY "Test 5 failed: " str END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob new file mode 100644 index 0000000..c440755 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(04). + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYMMDDThhmmss", 1, 1) (3:4) + TO STR + IF STR NOT = '0101' + DISPLAY STR + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob new file mode 100644 index 0000000..c495e0d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob @@ -0,0 +1,69 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. datetime. + PROCEDURE DIVISION. + DISPLAY "FUNCTION FORMATTED-DATETIME - valid format strings" + DISPLAY " FORMATTED-DATE Basic" + DISPLAY FUNCTION FORMATTED-DATE("YYYYMMDD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYYDDD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYYWwwD" 128623). + DISPLAY " FORMATTED-DATE Extended" + DISPLAY FUNCTION FORMATTED-DATE("YYYY-MM-DD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYY-DDD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYY-Www-D" 128623). + DISPLAY " FORMATTED-TIME Basic" + DISPLAY FUNCTION FORMATTED-TIME("hhmmss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss+hhmm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss.ssss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss.ssss+hhmm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss.ssssZ" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmssZ" 45296.987654321 -300). + DISPLAY " FORMATTED-TIME Extended" + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss+hh:mm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss.ssss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss.ssss+hh:mm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss.ssssZ" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ssZ" 45296.987654321 -300). + DISPLAY " FORMATTED-DATETIME Basic" + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss.ssss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss.ssss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss.ssss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmssZ" 128623 45296.987654321 -300). + DISPLAY " FORMATTED-DATETIME Extended" + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss.ssss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss.ssss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss.ssss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ssZ" 128623 45296.987654321 -300). + END PROGRAM datetime. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out new file mode 100644 index 0000000..5395f4e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out @@ -0,0 +1,62 @@ +FUNCTION FORMATTED-DATETIME - valid format strings + FORMATTED-DATE Basic +19530227 +1953058 +1953W095 + FORMATTED-DATE Extended +1953-02-27 +1953-058 +1953-W09-5 + FORMATTED-TIME Basic +123456 +123456-0500 +123456.9876 +123456.9876-0500 +173456.0000Z +173456Z + FORMATTED-TIME Extended +12:34:56 +12:34:56-05:00 +12:34:56.9876 +12:34:56.9876-05:00 +17:34:56.0000Z +17:34:56Z + FORMATTED-DATETIME Basic +19530227T123456 +19530227T123456-0500 +19530227T123456.9876 +19530227T123456.9876-0500 +19530227T173456.0000Z +19530227T173456Z +1953058T123456 +1953058T123456-0500 +1953058T123456.9876 +1953058T123456.9876-0500 +1953058T173456.0000Z +1953058T173456Z +1953W095T123456 +1953W095T123456-0500 +1953W095T123456.9876 +1953W095T123456.9876-0500 +1953W095T173456.0000Z +1953W095T173456Z + FORMATTED-DATETIME Extended +1953-02-27T12:34:56 +1953-02-27T12:34:56-05:00 +1953-02-27T12:34:56.9876 +1953-02-27T12:34:56.9876-05:00 +1953-02-27T17:34:56.0000Z +1953-02-27T17:34:56Z +1953-058T12:34:56 +1953-058T12:34:56-05:00 +1953-058T12:34:56.9876 +1953-058T12:34:56.9876-05:00 +1953-058T17:34:56.0000Z +1953-058T17:34:56Z +1953-W09-5T12:34:56 +1953-W09-5T12:34:56-05:00 +1953-W09-5T12:34:56.9876 +1953-W09-5T12:34:56.9876-05:00 +1953-W09-5T17:34:56.0000Z +1953-W09-5T17:34:56Z + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob new file mode 100644 index 0000000..ac5c828 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(04). + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-DATE ("YYYYMMDD", 1) (3:4) + TO STR + IF STR NOT = '0101' + DISPLAY STR + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob new file mode 100644 index 0000000..1abd625 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(11). + + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-TIME ("hh:mm:ss,ss", 45296) TO str + IF str <> "12:34:56,00" + DISPLAY "Test 1 failed: " str END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob new file mode 100644 index 0000000..cfcf0c7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(04). + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-TIME ("hhmmss", 45296) (3:4) + TO STR + IF STR NOT = '3456' + DISPLAY STR + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FRACTION-PART.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FRACTION-PART.cob new file mode 100644 index 0000000..65f341b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FRACTION-PART.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(04)V9(04). + PROCEDURE DIVISION. + MOVE FUNCTION FRACTION-PART ( 3.12345 ) + TO TEST-FLD. + IF TEST-FLD NOT = +0000.1234 + DISPLAY 'FRACTION-PART ( +3.12345 ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION FRACTION-PART ( -3.12345 ) + TO TEST-FLD. + IF TEST-FLD NOT = -0000.1234 + DISPLAY 'FRACTION-PART ( -3.12345 ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.cob new file mode 100644 index 0000000..ed31eb6 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.cob @@ -0,0 +1,13 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_HEX-OF.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 PAC PIC 9(5) COMP-3 VALUE 12345. + PROCEDURE DIVISION. + DISPLAY FUNCTION HEX-OF('Hello, world!') + DISPLAY FUNCTION HEX-OF(PAC). + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.out new file mode 100644 index 0000000..40892ac --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.out @@ -0,0 +1,3 @@ +48656C6C6F2C20776F726C6421 +12345F + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob new file mode 100644 index 0000000..2e59df3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob @@ -0,0 +1,76 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 F1 PIC S999. + 01 F2 PIC S9(4) BINARY. + 01 F3 PIC 99V9(3). + 01 F4 PIC $**,**9.99BCR. + 01 F5 PIC $**,**9.99. + 01 F6 USAGE BINARY-CHAR SIGNED. + 01 F7 USAGE BINARY-CHAR UNSIGNED. + 01 F8 PIC 999PPP. + 01 F9 PIC P99. + 01 TEST-FLD PIC S9(08)V9(04). + PROCEDURE DIVISION. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F1) + TO TEST-FLD. + IF TEST-FLD NOT = 999 + DISPLAY "Test 1 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F2) + TO TEST-FLD. + IF TEST-FLD NOT = 9999 + DISPLAY "Test 2 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F3) + TO TEST-FLD. + IF TEST-FLD NOT = 99.999 + DISPLAY "Test 3 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F4) + TO TEST-FLD. + IF TEST-FLD NOT = 99999.99 + DISPLAY "Test 4 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F5) + TO TEST-FLD. + IF TEST-FLD NOT = 99999.99 + DISPLAY "Test 5 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F6) + TO TEST-FLD. + IF TEST-FLD NOT = 127 + DISPLAY "Test 6 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F7) + TO TEST-FLD. + IF TEST-FLD NOT = 255 + DISPLAY "Test 7 fail: " TEST-FLD + END-DISPLAY + END-IF. + + MOVE FUNCTION HIGHEST-ALGEBRAIC (F8) + TO TEST-FLD. + IF TEST-FLD NOT = 999000 + DISPLAY "Test 7 fail: " TEST-FLD + END-DISPLAY + END-IF. + + MOVE FUNCTION HIGHEST-ALGEBRAIC (F9) + TO TEST-FLD. + IF TEST-FLD NOT = 0.099 + DISPLAY "Test 7 fail: " TEST-FLD + END-DISPLAY + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob new file mode 100644 index 0000000..4632864 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER-OF-DATE ( 20000925 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000146000 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob new file mode 100644 index 0000000..38162bf --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER-OF-DAY ( 2000269 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000146000 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob new file mode 100644 index 0000000..d580ea8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob @@ -0,0 +1,41 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 day-int PIC 9(9). + + PROCEDURE DIVISION. + *> The date 2013-12-30 is used as it can also be used to + *> check the conversion of dates in week form. + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-MM-DD", "2013-12-30") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 1 failed: " day-int END-DISPLAY + END-IF + + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-DDD", "2013-364") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 2 failed: " day-int END-DISPLAY + END-IF + + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-Www-D", "2014-W01-1") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 3 failed: " day-int END-DISPLAY + END-IF + + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-MM-DDThh:mm:ss", "2013-12-30T12:34:56") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 4 failed: " day-int END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-PART.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-PART.cob new file mode 100644 index 0000000..cc97765 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-PART.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.5. + 01 TEST-FLD PIC S9(04)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER-PART ( X ) + TO TEST-FLD. + IF TEST-FLD NOT = -1 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER.cob new file mode 100644 index 0000000..d43dd08 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.5. + 01 Y PIC 9(12) VALUE 600851475143. + 01 TEST-FLD PIC S9(14)V9(08). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER ( X ) + TO TEST-FLD. + IF TEST-FLD NOT = -2 + DISPLAY 'INTEGER ( X ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION INTEGER ( Y / 71 ) + TO TEST-FLD. + IF TEST-FLD NOT = 8462696833 + DISPLAY 'INTEGER ( Y / 71 ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__1_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__1_.cob new file mode 100644 index 0000000..8bbf689 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__1_.cob @@ -0,0 +1,38 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.5. + 01 TEST-FLD PIC S9(04)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION LENGTH ( X ) TO TEST-FLD + IF TEST-FLD NOT = 8 + DISPLAY 'LENGTH "00128" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + MOVE FUNCTION LENGTH ( '00128' ) + TO TEST-FLD + IF TEST-FLD NOT = 5 + DISPLAY 'LENGTH "00128" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + MOVE FUNCTION LENGTH ( x'a0' ) + TO TEST-FLD + IF TEST-FLD NOT = 1 + DISPLAY 'LENGTH x"a0" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + MOVE FUNCTION LENGTH ( z'a0' ) + TO TEST-FLD + IF TEST-FLD NOT = 3 + DISPLAY 'LENGTH z"a0" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.cob new file mode 100644 index 0000000..9416ca0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.cob @@ -0,0 +1,139 @@ + *> { dg-do run } + *> { dg-options "-dialect ibm" } + *> { dg-output-file "group2/FUNCTION_LENGTH__2_.out" } + program-id. prog. + data division. + working-storage section. + 01 desc1. + 05 desc1-entry pic x(5) occurs 10. + + 01 desc2. + 05 desc2-table occurs 10 times. + 10 desc2-entry pic x(5). + + 01 desc3. + 05 desc3-outer occurs 1 to 5 times depending on desc3-lim. + 10 desc3-outer-txt pic x(7). + 10 desc3-inner occurs 11 times. + 15 desc3-inner-text pic x(13). + 77 desc3-lim binary-long. + + 77 msg pic x(64). + 77 should-be pic zzzz9. + 77 but-is pic zzzz9. + + procedure division. + + display "using FUNCTION LENGTH" + + move "function length(desc1)" to msg + move 50 to should-be + move function length(desc1) to but-is + perform result-is + + move "function length(desc1-entry)" to msg + move 50 to should-be + move function length(desc1-entry) to but-is + perform result-is + + move "function length(desc1-entry(1))" to msg + move 5 to should-be + move function length(desc1-entry(1)) to but-is + perform result-is + + move "function length(desc2)" to msg + move 50 to should-be + move function length(desc2) to but-is + perform result-is + + move "function length(desc2-table)" to msg + move 50 to should-be + move function length(desc2-table) to but-is + perform result-is + + move "function length(desc2-entry)" to msg + move 5 to should-be + move function length(desc2-entry) to but-is + perform result-is + + move "function length(desc2-entry(1))" to msg + move 5 to should-be + move function length(desc2-entry(1)) to but-is + perform result-is + + move 5 to desc3-lim + + move "function length(desc3)" to msg + move 750 to should-be + move function length(desc3) to but-is + perform result-is + + move "function length(desc3-outer)" to msg + move 750 to should-be + move function length(desc3-outer) to but-is + perform result-is + + move "function length(desc3-outer(1))" to msg + move 150 to should-be + move function length(desc3-outer(1)) to but-is + perform result-is + + move "function length(desc3-outer-txt)" to msg + move 7 to should-be + move function length(desc3-outer-txt) to but-is + perform result-is + + move "function length(desc3-inner)" to msg + move 143 to should-be + move function length(desc3-inner) to but-is + perform result-is + + move "function length(desc3-inner(1))" to msg + move 13 to should-be + move function length(desc3-inner(1)) to but-is + perform result-is + + display "After changing desc3-lim from 5 to 3..." + move 3 to desc3-lim + + move "function length(desc3)" to msg + move 450 to should-be + move function length(desc3) to but-is + perform result-is + + move "function length(desc3-outer)" to msg + move 450 to should-be + move function length(desc3-outer) to but-is + perform result-is + + move "function length(desc3-outer(1))" to msg + move 150 to should-be + move function length(desc3-outer(1)) to but-is + perform result-is + + move "function length(desc3-outer-txt)" to msg + move 7 to should-be + move function length(desc3-outer-txt) to but-is + perform result-is + + move "function length(desc3-inner)" to msg + move 143 to should-be + move function length(desc3-inner) to but-is + perform result-is + + move "function length(desc3-inner(1))" to msg + move 13 to should-be + move function length(desc3-inner(1)) to but-is + perform result-is + + goback. + result-is. + display function trim(msg) ": " with no advancing + if but-is equal to should-be + display function trim(but-is) + else + display "should be " function trim(should-be) + " but is " function trim(but-is) + end-if. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.out new file mode 100644 index 0000000..9d90261 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.out @@ -0,0 +1,22 @@ +using FUNCTION LENGTH +function length(desc1): 50 +function length(desc1-entry): 50 +function length(desc1-entry(1)): 5 +function length(desc2): 50 +function length(desc2-table): 50 +function length(desc2-entry): 5 +function length(desc2-entry(1)): 5 +function length(desc3): 750 +function length(desc3-outer): 750 +function length(desc3-outer(1)): 150 +function length(desc3-outer-txt): 7 +function length(desc3-inner): 143 +function length(desc3-inner(1)): 13 +After changing desc3-lim from 5 to 3... +function length(desc3): 450 +function length(desc3-outer): 450 +function length(desc3-outer(1)): 150 +function length(desc3-outer-txt): 7 +function length(desc3-inner): 143 +function length(desc3-inner(1)): 13 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob new file mode 100644 index 0000000..cb6d783 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob @@ -0,0 +1,21 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION LOCALE-COMPARE ("A", "B") NOT = "<" + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOCALE-COMPARE ("B", "A") NOT = ">" + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOCALE-COMPARE ("A", "A") NOT = "=" + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.cob new file mode 100644 index 0000000..35e0729 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_LOCALE-DATE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(32) VALUE SPACES. + PROCEDURE DIVISION. + MOVE FUNCTION LOCALE-DATE ( "19630302" ) TO X. + IF X NOT = SPACES + DISPLAY "OK" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob new file mode 100644 index 0000000..d04e7a9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(32) VALUE SPACES. + PROCEDURE DIVISION. + MOVE FUNCTION LOCALE-TIME-FROM-SECONDS ( 33012 ) TO X. + IF X NOT = SPACES + DISPLAY "OK" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.cob new file mode 100644 index 0000000..aeba184 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_LOCALE-TIME.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(32) VALUE SPACES. + PROCEDURE DIVISION. + MOVE FUNCTION LOCALE-TIME ( "233012" ) TO X. + IF X NOT = SPACES + DISPLAY "OK" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG.cob new file mode 100644 index 0000000..f0ab0e7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION LOG ( 1.5 ) TO Y. + IF Y NOT = 0.405465108108164381978013115464349 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG10.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG10.cob new file mode 100644 index 0000000..e37210b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG10.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION LOG10 ( 1.5 ) TO Y. + IF Y NOT = 0.176091259055681242081289008530622 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE.cob new file mode 100644 index 0000000..4cf24d5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 TEST-FLD PIC X(12) VALUE ALL '_'. + PROCEDURE DIVISION. + STRING FUNCTION LOWER-CASE ( X ) + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING + IF TEST-FLD NOT = 'a#b.c%d+e$__' + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob new file mode 100644 index 0000000..eb53ca4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 TEST-FLD PIC X(03). + PROCEDURE DIVISION. + MOVE FUNCTION LOWER-CASE ( X ) (1 : 3) + TO TEST-FLD + IF TEST-FLD NOT = 'a#b' + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob new file mode 100644 index 0000000..4750c7e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob @@ -0,0 +1,55 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 F1 PIC S999. + 01 F2 PIC S9(4) BINARY. + 01 F3 PIC 99V9(3). + 01 F4 PIC $**,**9.99BCR. + 01 F5 PIC $**,**9.99. + 01 F6 USAGE BINARY-CHAR SIGNED. + 01 F7 USAGE BINARY-CHAR UNSIGNED. + 01 F8 PIC S999PPP. + 01 F9 PIC SP99. + PROCEDURE DIVISION. + IF FUNCTION LOWEST-ALGEBRAIC (F1) NOT = -999 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F2) NOT = -9999 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F3) NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F4) NOT = -99999.99 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F5) NOT = 0 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F6) NOT = -128 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F7) NOT = 0 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F8) NOT = -999000 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F9) NOT = -0.099 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.cob new file mode 100644 index 0000000..99971a9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.cob @@ -0,0 +1,12 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MAX.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + DISPLAY FUNCTION MAX ( 3 -14 0 8 -3 ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.out new file mode 100644 index 0000000..2f95459 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.out @@ -0,0 +1,2 @@ +8 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.cob new file mode 100644 index 0000000..007f235 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MEAN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 result PIC S999V999. + PROCEDURE DIVISION. + COMPUTE result = FUNCTION MEAN ( 3 -14 0 8 -3 ) + DISPLAY result + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.out new file mode 100644 index 0000000..7f05c89 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.out @@ -0,0 +1,2 @@ +-001.200 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.cob new file mode 100644 index 0000000..ac2515d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.cob @@ -0,0 +1,12 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MEDIAN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + DISPLAY FUNCTION MEDIAN ( 3 -14 0 8 -3 ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.out new file mode 100644 index 0000000..77ac542 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.out @@ -0,0 +1,2 @@ +0 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.cob new file mode 100644 index 0000000..601cbc7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MIDRANGE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC S999V999. + PROCEDURE DIVISION. + COMPUTE RESULT = FUNCTION MIDRANGE ( 3 -14 0 8 -3 ) + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.out new file mode 100644 index 0000000..6945d25 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.out @@ -0,0 +1,2 @@ +-003.000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.cob new file mode 100644 index 0000000..85ef141 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.cob @@ -0,0 +1,12 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MIN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + DISPLAY FUNCTION MIN ( 3 -14 0 8 -3 ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.out new file mode 100644 index 0000000..1bd872a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.out @@ -0,0 +1,2 @@ +-14 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.cob new file mode 100644 index 0000000..cbb445f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.cob @@ -0,0 +1,110 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MODULE-NAME.out" } + + identification division. + program-id. level-1. + data division. + working-storage section. + procedure division. + display "From level-1:" + perform reportt. + call "level-2" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + end program level-1. + + identification division. + program-id. level-2. + data division. + working-storage section. + procedure division. + display "From level-2:" + perform reportt. + call "level-3" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + end program level-2. + + identification division. + program-id. level-3. + data division. + working-storage section. + procedure division. + display "From level-3:" + perform reportt. + call "level-3a" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + + identification division. + program-id. level-3a. + data division. + working-storage section. + procedure division. + display "From level-3a:" + perform reportt. + call "level-3b" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + + identification division. + program-id. level-3b. + data division. + working-storage section. + procedure division. + display "From level-3b:" + perform reportt. + call "level-3c" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + + identification division. + program-id. level-3c. + data division. + working-storage section. + procedure division. + display "From level-3c:" + perform reportt. + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + end program level-3c. + end program level-3b. + end program level-3a. + end program level-3. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.out new file mode 100644 index 0000000..7be80f0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.out @@ -0,0 +1,37 @@ +From level-1: + top-level: "level-1" + current: "level-1" + activating: " " + nested: "level-1" + stack: "level-1; " +From level-2: + top-level: "level-1" + current: "level-2" + activating: "level-1" + nested: "level-2" + stack: "level-2;level-1; " +From level-3: + top-level: "level-1" + current: "level-3" + activating: "level-2" + nested: "level-3" + stack: "level-3;level-2;level-1; " +From level-3a: + top-level: "level-1" + current: "level-3" + activating: "level-3" + nested: "level-3a" + stack: "level-3a;level-3;level-2;level-1; " +From level-3b: + top-level: "level-1" + current: "level-3" + activating: "level-3a" + nested: "level-3b" + stack: "level-3b;level-3a;level-3;level-2;level-1; " +From level-3c: + top-level: "level-1" + current: "level-3" + activating: "level-3b" + nested: "level-3c" + stack: "level-3c;level-3b;level-3a;level-3;level-2;level-1; " + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__invalid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__invalid_.cob new file mode 100644 index 0000000..56ecbcd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__invalid_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC 9 VALUE 0. + 01 R PIC S9(4)V9(4) VALUE 1. + PROCEDURE DIVISION. + MOVE FUNCTION MOD ( -11 Z ) TO R + IF FUNCTION EXCEPTION-STATUS + NOT = 'EC-ARGUMENT-FUNCTION' + DISPLAY 'Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + IF R NOT = 0 + DISPLAY 'result is not zero: ' R + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__valid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__valid_.cob new file mode 100644 index 0000000..0db8679 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__valid_.cob @@ -0,0 +1,21 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9(12) VALUE 600851475143. + 01 R PIC S9(4)V9(4) VALUE 0. + PROCEDURE DIVISION. + MOVE FUNCTION MOD ( -11 5 ) TO R + IF R NOT = 4 + DISPLAY 'first one wrong: ' R + END-DISPLAY + END-IF + MOVE FUNCTION MOD ( Y, 71 ) TO R + IF R NOT = 0 + DISPLAY 'second one wrong: ' R + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C.cob new file mode 100644 index 0000000..2eb8eb9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X1 PIC X(14) VALUE " -% 9876.1234 ". + 01 X2 PIC X(20) VALUE " % 19,876.1234 DB". + 01 N PIC s9(5)v9(5). + PROCEDURE DIVISION. + MOVE FUNCTION NUMVAL-C ( X1 , "%" ) TO N + IF N NOT = -9876.1234 + DISPLAY N + END-DISPLAY + END-IF + MOVE FUNCTION NUMVAL-C ( X2 , "%" ) TO N + IF N NOT = -19876.1234 + DISPLAY N + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob new file mode 100644 index 0000000..bd57463 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob @@ -0,0 +1,21 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA + . + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X1 PIC X(20) VALUE " % 19.876,1234 DB". + 01 N PIC s9(5)v9(5). + PROCEDURE DIVISION. + MOVE FUNCTION NUMVAL-C ( X1 , "%" ) TO N + IF N NOT = -19876,1234 + DISPLAY N + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.cob new file mode 100644 index 0000000..522f810 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.cob @@ -0,0 +1,30 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_NUMVAL-F.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 result PIC S9(8)V9(9) COMP-5. + 01 vector. + 05 vd. + 10 FILLER PIC X(32) VALUE " - 123.456 E + 2 ". + 10 FILLER PIC X(32) VALUE "123". + 10 FILLER PIC X(32) VALUE ".456". + 10 FILLER PIC X(32) VALUE "123.456". + 10 FILLER PIC X(32) VALUE "-123.456". + 10 FILLER PIC X(32) VALUE "123.456E2". + 10 FILLER PIC X(32) VALUE "-123.456E-2". + 10 FILLER PIC X(32) VALUE "DONE". + 10 FILLER PIC X(32) OCCURS 100 TIMES. + 05 datat REDEFINES vd PIC X(32) OCCURS 100 TIMES INDEXED BY I. + PROCEDURE DIVISION. + SET I TO 1 + PERFORM UNTIL datat(I) EQUALS "DONE" + DISPLAY """"datat(I)"""" SPACE WITH NO ADVANCING + MOVE FUNCTION NUMVAL-F(datat(I)) TO result + DISPLAY result + ADD 1 TO I + END-PERFORM. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.out new file mode 100644 index 0000000..6d27dd2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.out @@ -0,0 +1,8 @@ +" - 123.456 E + 2 " -00012345.600000000 +"123 " +00000123.000000000 +".456 " +00000000.456000000 +"123.456 " +00000123.456000000 +"-123.456 " -00000123.456000000 +"123.456E2 " +00012345.600000000 +"-123.456E-2 " -00000001.234560000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL.cob new file mode 100644 index 0000000..9288331 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X1 PIC X(12) VALUE " -9876.1234 ". + 01 X2 PIC X(18) VALUE " 19876.1234 CR". + 01 N PIC s9(5)v9(5). + PROCEDURE DIVISION. + MOVE FUNCTION NUMVAL ( X1 ) TO N + IF N NOT = -9876.1234 + DISPLAY N + END-DISPLAY + END-IF + MOVE FUNCTION NUMVAL ( X2 ) TO N + IF N NOT = -19876.1234 + DISPLAY N + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.cob new file mode 100644 index 0000000..0dd1053 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ORD-MAX.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION ORD-MAX ( 3 -14 0 8 -3 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.out new file mode 100644 index 0000000..c9ce4ea --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.out @@ -0,0 +1,2 @@ +004 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.cob new file mode 100644 index 0000000..fd55396 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ORD-MIN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION ORD-MIN ( 3 -14 0 8 -3 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.out new file mode 100644 index 0000000..4119821 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.out @@ -0,0 +1,2 @@ +002 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.cob new file mode 100644 index 0000000..fe5e290 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ORD.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION ORD ( "k" ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.out new file mode 100644 index 0000000..e55677a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.out @@ -0,0 +1,2 @@ +108 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_PI.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_PI.cob new file mode 100644 index 0000000..9792e03 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_PI.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9V9(32). + PROCEDURE DIVISION. + MOVE FUNCTION PI TO Y. + IF Y NOT = 3.14159265358979323846264338327950 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob new file mode 100644 index 0000000..5883abd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_PRESENT-VALUE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 9(5)V9(4). + PROCEDURE DIVISION. + MOVE FUNCTION PRESENT-VALUE ( 3 2 1 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.out new file mode 100644 index 0000000..52ce840 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.out @@ -0,0 +1,2 @@ +00000.5625 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_RANDOM.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANDOM.cob new file mode 100644 index 0000000..0a3e151 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANDOM.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S99V99 COMP VALUE -1.0. + PROCEDURE DIVISION. + MOVE FUNCTION RANDOM ( ) TO Y. + IF Y < 0 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_RANGE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANGE.cob new file mode 100644 index 0000000..48a9511 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANGE.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9(4)V9(4) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION RANGE ( 3 -14 0 8 -3 ) TO Z. + IF Z NOT = 22 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__invalid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__invalid_.cob new file mode 100644 index 0000000..38298a8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__invalid_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 R PIC S9(4)V9(4) COMP-5 VALUE 4.1. + 01 Z PIC 9 COMP-5 VALUE 0. + PROCEDURE DIVISION. + MOVE FUNCTION REM ( -11 Z ) TO R + IF FUNCTION EXCEPTION-STATUS + NOT = 'EC-ARGUMENT-FUNCTION' + DISPLAY 'Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + IF R NOT = 0 + DISPLAY 'result is not zero: ' R + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__valid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__valid_.cob new file mode 100644 index 0000000..7ace4a2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__valid_.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 R PIC S9(4)V9(4) COMP-5 VALUE 0. + PROCEDURE DIVISION. + MOVE FUNCTION REM ( -11 5 ) TO R + IF R NOT = -1 + DISPLAY R END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE.cob new file mode 100644 index 0000000..b1b1690 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 Z PIC X(10). + PROCEDURE DIVISION. + MOVE FUNCTION REVERSE ( X ) TO Z. + IF Z NOT = "$E+D%C.B#A" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob new file mode 100644 index 0000000..98c28ad --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 Z PIC X(10). + PROCEDURE DIVISION. + MOVE FUNCTION REVERSE ( X ) (1 : 4) TO Z. + IF Z NOT = "$E+D " + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob new file mode 100644 index 0000000..2641e08 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob @@ -0,0 +1,58 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 result PIC 9(8)V9(9) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmss", "010203") + TO result. + IF result NOT = 3723 + DISPLAY "Test 1 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hh:mm:ss", "01:02:03") + TO result. + IF result NOT = 3723 + DISPLAY "Test 2 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmss.ssssssss", "010203.04050607") + TO result. + IF result NOT = 3723.04050607 + DISPLAY "Test 3 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmssZ", "010203Z") + TO result. + IF result NOT = 3723 + DISPLAY "Test 4 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmss+hhmm", "010203+0405") + TO result. + IF result NOT = 3723 + DISPLAY "Test 5 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("YYYYMMDDThhmmss", "16010101T010203") + TO result. + IF result NOT = 3723 + DISPLAY "Test 6 failed: " result + END-DISPLAY + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob new file mode 100644 index 0000000..b229ac3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9(8) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION SECONDS-PAST-MIDNIGHT TO Y. + IF Y NOT < 86402 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SIGN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIGN.cob new file mode 100644 index 0000000..f698d97 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIGN.cob @@ -0,0 +1,30 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z USAGE BINARY-LONG SIGNED. + PROCEDURE DIVISION. + MOVE FUNCTION SIGN ( 3.12345 ) TO Z. + IF Z NOT = 1 + DISPLAY "Sign 1 " Z + END-DISPLAY + END-IF. + MOVE FUNCTION SIGN ( -0.0 ) TO Z. + IF Z NOT = 0 + DISPLAY "Sign 2 " Z + END-DISPLAY + END-IF. + MOVE FUNCTION SIGN ( 0.0 ) TO Z. + IF Z NOT = 0 + DISPLAY "Sign 3 " Z + END-DISPLAY + END-IF. + MOVE FUNCTION SIGN ( -3.12345 ) TO Z. + IF Z NOT = -1 + DISPLAY "Sign 4 " Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIN.cob new file mode 100644 index 0000000..a72df35 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION SIN ( 1.5 ) TO Y. + IF Y NOT = 0.997494986604054430941723371141487 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT.cob new file mode 100644 index 0000000..ddf36da --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION SQRT ( 1.5 ) TO Y. + IF Y NOT = 1.224744871391589049098642037352945 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob new file mode 100644 index 0000000..8deadc7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(32). + PROCEDURE DIVISION. + MOVE FUNCTION STANDARD-DEVIATION ( 3 -14 0 8 -3 ) TO Y. + IF Y NOT = 7.35934779718963954877237043574538 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob new file mode 100644 index 0000000..850f1da --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(20). + 01 Z PIC X(20). + PROCEDURE DIVISION. + MOVE "ABC111444555defxxabc" TO Y. + MOVE FUNCTION SUBSTITUTE (Y anycase "abc" "zz" + anycase "55" "666") + TO Z. + IF Z NOT = "zz1114446665defxxzz" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob new file mode 100644 index 0000000..24ed1b8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob @@ -0,0 +1,20 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(20). + 01 Z PIC X(20). + PROCEDURE DIVISION. + MOVE "abc111444555defxxabc" TO Y. + MOVE FUNCTION SUBSTITUTE + ( Y anycase "ABC" "zz" + anycase "55" "666" ) (2 : 9) + TO Z. + IF Z NOT = "z11144466" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.cob new file mode 100644 index 0000000..072c159 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_SUBSTITUTE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(24). + PROCEDURE DIVISION. + MOVE "abc111444555defxxabc" TO Y + DISPLAY FUNCTION TRIM (FUNCTION SUBSTITUTE ( Y "abc" "zz" "55" "666" )) + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y "bob" "FILLER" "jim" "Z") + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y FIRST "bob" "FILLER" "jim" "Z") + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y LAST "bob" "FILLER" "jim" "Z") + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y ANYCASE "bob" "FILLER" ANYCASE "jim" "Z") + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.out new file mode 100644 index 0000000..4f5f7a0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.out @@ -0,0 +1,6 @@ +zz1114446665defxxzz +FILLERBobZJimFILLERBobZJim +FILLERBobZJimbobBobZJim +bobBobZJimFILLERBobZJim +FILLERFILLERZZFILLERFILLERZZ + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob new file mode 100644 index 0000000..7894915 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(20). + 01 Z PIC X(20). + PROCEDURE DIVISION. + MOVE "abc111444555defxxabc" TO Y. + MOVE FUNCTION SUBSTITUTE + ( Y "abc" "zz" "55" "666" ) (2 : 9) + TO Z. + IF Z NOT = "z11144466" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUM.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUM.cob new file mode 100644 index 0000000..228e996 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUM.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z USAGE BINARY-LONG. + PROCEDURE DIVISION. + MOVE FUNCTION SUM ( 3 -14 0 8 -3 ) TO Z. + IF Z NOT = -6 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TAN.cob new file mode 100644 index 0000000..f932157 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TAN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S99V9(31). + PROCEDURE DIVISION. + MOVE FUNCTION TAN ( 1.5 ) TO Y. + IF Y NOT = 14.1014199471717193876460836519877 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob new file mode 100644 index 0000000..8841f5a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TEST-DATE-YYYYMMDD.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION TEST-DATE-YYYYMMDD ( 20020231 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out new file mode 100644 index 0000000..56fa706 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out @@ -0,0 +1,2 @@ +003 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob new file mode 100644 index 0000000..71fbdb9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION TEST-DAY-YYYYDDD ( 2002400 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out new file mode 100644 index 0000000..4119821 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out @@ -0,0 +1,2 @@ +002 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob new file mode 100644 index 0000000..24893ab --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob @@ -0,0 +1,170 @@ + *> { dg-do run } + + identification division. + program-id. test. + data division. + working-storage section. + 01 datev pic 99999999. + 01 should_be pic 9999. + 01 result pic 9999. + procedure division. + move function test-day-yyyyddd(1945123) to result + move zero to should_be + if result not equal to should_be then + display "test-day-yyyyddd(1945123) should have been " + should_be " but was " result + move 1 to return-code + end-if. + move function test-day-yyyyddd(10000000) to result + move 1 to should_be + if result not equal to should_be then + display "test-day-yyyyddd(100000000) should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601000 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601001 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601364 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601366 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2000365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2000366 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2000367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2100365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2100366 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2100367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988366 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1989365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1989366 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1989367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + end program test. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob new file mode 100644 index 0000000..b825198 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob @@ -0,0 +1,32 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss,ss", "000000,00") <> 0 + DISPLAY "Test 1 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss,ss", "16010101T000000,00") <> 0 + DISPLAY "Test 2 failed" END-DISPLAY + END-IF + + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss,ss", "000000.00") <> 7 + DISPLAY "Test 3 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss,ss", "16010101T000000.00") <> 16 + DISPLAY "Test 4 failed" END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob new file mode 100644 index 0000000..e782647 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob @@ -0,0 +1,173 @@ + *> { dg-do run } + + identification division. + program-id. test. + data division. + working-storage section. + 01 datev pic 99999999. + 01 should_be pic 9999. + 01 result pic 9999. + 01 date-integer PIC 999999. + 01 i PIC 999. + 01 datex PIC X(8). + 01 xone PIC X. + 01 yyyydddv . + 02 yyyy PIC 9999. + 02 filler PIC X VALUE "-". + 02 ddd PIC 999. + procedure division. + *> TESTING YYYYMMDD + move "19000229" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + *> Test an entire year of YYYYMMDD: + move function integer-of-date(19880101) to date-integer + perform until date-integer >= function integer-of-date(19890101) + move function date-of-integer(date-integer) to datev + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datev) to RESULT + move zero to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + datev + ") should have been " + should_be " but was " result + move 1 to return-code + end-if + add 1 to date-integer + end-perform. + *> Make sure foreign characters trigger the correct gazinga in YYYYMMDD + move "19530227" to datex + perform varying i from 1 by 1 until i > 8 + move datex(i:1) to xone + move 'X' to datex(i:1) + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move i to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if + move xone to datex(i:1) + end-perform. + move "19000229" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "20000229" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 0 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "20007029" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 5 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + *> TESTING YYYY-DDD + move "1988" to yyyy of yyyydddv + move "000" to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "1988" to yyyy of yyyydddv + move "367" to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "1988" to yyyy of yyyydddv + move "399" to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 7 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988 to yyyy of yyyydddv + move 400 to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 6 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988 to yyyy of yyyydddv + perform varying i from 1 by 1 until i > 366 + move i to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move zero to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYY-DDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if + add 1 to date-integer + end-perform. + end program test. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob new file mode 100644 index 0000000..1b571f9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob @@ -0,0 +1,118 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16010101") <> 0 + DISPLAY "Test 1 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-MM-DD", "1601-01-01") <> 0 + DISPLAY "Test 2 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601001") <> 0 + DISPLAY "Test 3 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-DDD", "1601-001") <> 0 + DISPLAY "Test 4 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W011") <> 0 + DISPLAY "Test 5 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-Www-D", "1601-W01-1") <> 0 + DISPLAY "Test 6 failed" END-DISPLAY + END-IF + + + *> How will this work with zero-length items? + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "1") <> 2 + DISPLAY "Test 7 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "160A0101") <> 4 + DISPLAY "Test 8 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "00000101") <> 1 + DISPLAY "Test 9 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16000101") <> 4 + DISPLAY "Test 10 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16010001") <> 6 + DISPLAY "Test 11 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16011301") <> 6 + DISPLAY "Test 12 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16010190") <> 7 + DISPLAY "Test 13 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "18000229") <> 8 + DISPLAY "Test 14 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-MM-DD", "1601 01 01") <> 5 + DISPLAY "Test 15 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "160101010") <> 9 + DISPLAY "Test 16 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601A011") <> 5 + DISPLAY "Test 17 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W531") <> 7 + DISPLAY "Test 18 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W601") <> 6 + DISPLAY "Test 19 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "2009W531") <> 0 + DISPLAY "Test 20 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W018") <> 8 + DISPLAY "Test 21 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601366") <> 7 + DISPLAY "Test 22 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601370") <> 6 + DISPLAY "Test 23 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601400") <> 5 + DISPLAY "Test 24 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "01") <> 1 + DISPLAY "Test 25 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "1601010") <> 8 + DISPLAY "Test 26 failed" END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob new file mode 100644 index 0000000..5591fbb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob @@ -0,0 +1,44 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 RESULT PIC 9(02). + PROCEDURE DIVISION. + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", "16010101T000000") + TO RESULT + IF RESULT <> 0 + DISPLAY "Test 1 failed: " RESULT END-DISPLAY + END-IF + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-MM-DDThh:mm:ss.sssssssss+hh:mm", + "1601-01-01T00:00:00.000000000+00:00") + TO RESULT + IF RESULT <> 0 + DISPLAY "Test 2 failed: " RESULT END-DISPLAY + END-IF + + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", "16010101 000000") + TO RESULT + IF RESULT <> 9 + DISPLAY "Test 3 failed: " RESULT END-DISPLAY + END-IF + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", SPACE) + TO RESULT + IF RESULT <> 1 + DISPLAY "Test 4 failed: " RESULT END-DISPLAY + END-IF + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", "16010101T ") + TO RESULT + IF RESULT <> 10 + DISPLAY "Test 5 failed: " RESULT END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob new file mode 100644 index 0000000..ded9551 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob @@ -0,0 +1,72 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss.sssssssssZ", "000000.000000000Z") <> 0 + DISPLAY "Test 1 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hh:mm:ss.sssssssssZ", "00:00:00.000000000Z") <> 0 + DISPLAY "Test 2 failed" END-DISPLAY + END-IF + *> 0 instead of +/- valid in sending fields with offset of zero. + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss.sssssssss+hhmm", "000000.00000000000000") + <> 0 + DISPLAY "Test 3 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hh:mm:ss.sssssssss+hh:mm", + "00:00:00.000000000+00:00") + <> 0 + DISPLAY "Test 4 failed" END-DISPLAY + END-IF + + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "300000") <> 1 + DISPLAY "Test 5 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "250000") <> 2 + DISPLAY "Test 6 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "006000") <> 3 + DISPLAY "Test 7 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "000060") <> 5 + DISPLAY "Test 8 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hh:mm:ss", "00-00-00") <> 3 + DISPLAY "Test 9 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss.ss", "000000,00") <> 7 + DISPLAY "Test 10 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss+hhmm", "000000 0000") <> 7 + DISPLAY "Test 11 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss+hhmm", "00000000001") <> 11 + DISPLAY "Test 12 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmssZ", "000000A") <> 7 + DISPLAY "Test 13 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", SPACE) <> 1 + DISPLAY "Test 14 failed" END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob new file mode 100644 index 0000000..e458f4a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob @@ -0,0 +1,89 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-NUMVAL-C ("+ 1") NOT = 0 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C (" + 1") NOT = 0 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- 1") NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C (" - 1") NOT = 0 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+- 1") NOT = 2 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 +") NOT = 0 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 -") NOT = 0 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 +-") NOT = 4 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 -+") NOT = 4 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+ 1.1") NOT = 0 + DISPLAY "Test 10 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- 1.1") NOT = 0 + DISPLAY "Test 11 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 +") NOT = 0 + DISPLAY "Test 12 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 -") NOT = 0 + DISPLAY "Test 13 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 CR") NOT = 0 + DISPLAY "Test 14 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 DB") NOT = 0 + DISPLAY "Test 15 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 -CR") NOT = 6 + DISPLAY "Test 16 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+ $1.1 ") NOT = 0 + DISPLAY "Test 17 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- $1.1 ") NOT = 0 + DISPLAY "Test 18 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+ X1.1 ", "X") NOT = 0 + DISPLAY "Test 19 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- X1.1 ", "X") NOT = 0 + DISPLAY "Test 20 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob new file mode 100644 index 0000000..3fcec0e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob @@ -0,0 +1,89 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-NUMVAL-F ("+ 1") NOT = 0 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F (" + 1") NOT = 0 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("- 1") NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F (" - 1") NOT = 0 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("+- 1") NOT = 2 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 +") NOT = 3 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 -") NOT = 3 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 +-") NOT = 3 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 -+") NOT = 3 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("+ 1.1") NOT = 0 + DISPLAY "Test 10 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("- 1.1") NOT = 0 + DISPLAY "Test 11 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 +") NOT = 5 + DISPLAY "Test 12 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 -") NOT = 5 + DISPLAY "Test 13 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 ") NOT = 0 + DISPLAY "Test 14 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 ") NOT = 0 + DISPLAY "Test 15 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 -CR") NOT = 5 + DISPLAY "Test 16 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 E+1") NOT = 0 + DISPLAY "Test 17 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 E -1") NOT = 0 + DISPLAY "Test 18 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 EE") NOT = 6 + DISPLAY "Test 19 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("+1.1 E+01") NOT = 0 + DISPLAY "Test 20 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob new file mode 100644 index 0000000..bc38b4e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob @@ -0,0 +1,89 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-NUMVAL ("+ 1") NOT = 0 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL (" + 1") NOT = 0 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("- 1") NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL (" - 1") NOT = 0 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+- 1") NOT = 2 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 +") NOT = 0 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 -") NOT = 0 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 +-") NOT = 4 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 -+") NOT = 4 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+ 1.1") NOT = 0 + DISPLAY "Test 10 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("- 1.1") NOT = 0 + DISPLAY "Test 11 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 +") NOT = 0 + DISPLAY "Test 12 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 -") NOT = 0 + DISPLAY "Test 13 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 CR") NOT = 0 + DISPLAY "Test 14 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 DB") NOT = 0 + DISPLAY "Test 15 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 -CR") NOT = 6 + DISPLAY "Test 16 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 +DB") NOT = 6 + DISPLAY "Test 17 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 CDB") NOT = 6 + DISPLAY "Test 18 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+1.1 CR") NOT = 6 + DISPLAY "Test 19 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+ ") NOT = 8 + DISPLAY "Test 20 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.cob new file mode 100644 index 0000000..054b14a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TRIM.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(12) VALUE " a#b.c%d+e$ ". + PROCEDURE DIVISION. + DISPLAY FUNCTION TRIM ( X ) + END-DISPLAY. + DISPLAY FUNCTION TRIM ( X TRAILING ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.out new file mode 100644 index 0000000..b0e4a72 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.out @@ -0,0 +1,3 @@ +a#b.c%d+e$ + a#b.c%d+e$ + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob new file mode 100644 index 0000000..f14f0fa --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TRIM_with_reference_modding.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(12) VALUE " a#b.c%d+e$ ". + PROCEDURE DIVISION. + DISPLAY FUNCTION TRIM ( X ) (2 : 3) + END-DISPLAY. + DISPLAY FUNCTION TRIM ( X TRAILING ) (2 : 3) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out new file mode 100644 index 0000000..f716581 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out @@ -0,0 +1,3 @@ +#b. +a#b + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.cob new file mode 100644 index 0000000..d92a490 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TRIM_zero_length.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 A2 PIC X(2) VALUE " ". + 01 A3 PIC X(3) VALUE " ". + 01 X PIC X(4) VALUE "NOOK". + PROCEDURE DIVISION. + MOVE FUNCTION TRIM ( A2 ) TO X. + DISPLAY ">" X "<" + END-DISPLAY. + DISPLAY ">" FUNCTION TRIM ( A3 ) "<" + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.out new file mode 100644 index 0000000..9aa7900 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.out @@ -0,0 +1,3 @@ +> < +>< + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE.cob new file mode 100644 index 0000000..9bf6a6b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "a#b.c%d+e$". + 01 Z PIC X(10). + PROCEDURE DIVISION. + MOVE FUNCTION UPPER-CASE ( X ) TO Z. + IF Z NOT = "A#B.C%D+E$" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob new file mode 100644 index 0000000..2f96446 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "a#b.c%d+e$". + 01 Z PIC X(4). + PROCEDURE DIVISION. + MOVE FUNCTION UPPER-CASE ( X ) (1 : 3) TO Z. + IF Z NOT = "A#B " + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_VARIANCE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_VARIANCE.cob new file mode 100644 index 0000000..0a08f5a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_VARIANCE.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9(4)V9(4) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION VARIANCE ( 3 -14 0 8 -3 ) TO Z. + IF Z NOT = 54.16 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob new file mode 100644 index 0000000..d47967b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob @@ -0,0 +1,45 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 compiled-datetime. + 03 compiled-date. + 05 millennium PIC X. + 05 FILLER PIC X(15). + 03 timezone PIC X(5). + PROCEDURE DIVISION. + *> Check millennium. + MOVE FUNCTION WHEN-COMPILED TO compiled-datetime. + IF millennium NOT = "2" + DISPLAY "Millennium NOT OK: " millennium + END-DISPLAY + END-IF. + + *> Check timezone. + IF timezone NOT = FUNCTION CURRENT-DATE (17:5) + DISPLAY "Timezone NOT OK: " timezone + END-DISPLAY + END-IF. + + *> Check date format. + INSPECT compiled-date CONVERTING "0123456789" + TO "9999999999". + IF compiled-date NOT = ALL "9" + DISPLAY "Date format NOT OK: " compiled-date + END-DISPLAY + END-IF. + + *> Check timezone format. + IF timezone NOT = "00000" + INSPECT timezone CONVERTING "0123456789" + TO "9999999999" + IF timezone NOT = "+9999" AND "-9999" + DISPLAY "Timezone format NOT OK: " timezone + END-DISPLAY + END-IF + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob new file mode 100644 index 0000000..ece8151 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z USAGE BINARY-LONG. + PROCEDURE DIVISION. + MOVE FUNCTION YEAR-TO-YYYY ( 50 ) TO Z. + IF Z NOT = 2050 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob new file mode 100644 index 0000000..e25ac8b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + PROCEDURE DIVISION. + PROG-MAIN. + CALL "subprog" USING BY CONTENT + FUNCTION CONCAT("Abc" "D") + STOP RUN. + + *> ***************************** + IDENTIFICATION DIVISION. + PROGRAM-ID. subprog. + + DATA DIVISION. + LINKAGE SECTION. + 01 TESTING PIC X ANY LENGTH. + + PROCEDURE DIVISION USING TESTING. + SUBPROG-MAIN. + DISPLAY TESTING + GOBACK. + END PROGRAM subprog. + END PROGRAM prog. *> bzzt + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out new file mode 100644 index 0000000..11f0477 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out @@ -0,0 +1,2 @@ +AbcD + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob new file mode 100644 index 0000000..bfe4b67 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob @@ -0,0 +1,43 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_BACKWARD_REPLACING_LEADING.out" } + identification division. + program-id. caller. + data division. + working-storage section. + 77 str pic x(19) value "AAAAsomeABthingBBBB". + procedure division. + display "Starting with " """" str """" "..." + + initialize str all value. + inspect str replacing all "A" by "X" + display "After inspect replacing ALL A by X: " """" str """" + + initialize str all value. + inspect str replacing leading "A" by "X" + display "After inspect replacing LEADING A by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "A" by "X" + display "After inspect backward replacing ALL A by X: " """" str """" + + initialize str all value. + inspect backward str replacing leading "A" by "X" + display "After inspect backward replacing LEADING A by X: " """" str """" + + initialize str all value. + inspect str replacing all "B" by "X" + display "After inspect replacing ALL B by X: " """" str """" + + initialize str all value. + inspect str replacing leading "B" by "X" + display "After inspect replacing LEADING B by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "B" by "X" + display "After inspect backward replacing ALL B by X: " """" str """" + + initialize str all value. + inspect backward str replacing leading "B" by "X" + display "After inspect backward replacing LEADING B by X: " """" str """" + goback. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out new file mode 100644 index 0000000..3e9c3c3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out @@ -0,0 +1,10 @@ +Starting with "AAAAsomeABthingBBBB"... +After inspect replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect replacing LEADING A by X: "XXXXsomeABthingBBBB" +After inspect backward replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect backward replacing LEADING A by X: "AAAAsomeABthingBBBB" +After inspect replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect replacing LEADING B by X: "AAAAsomeABthingBBBB" +After inspect backward replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect backward replacing LEADING B by X: "AAAAsomeABthingXXXX" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob new file mode 100644 index 0000000..c2e6a09 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob @@ -0,0 +1,44 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_REPLACING_TRAILING.out" } + identification division. + program-id. caller. + data division. + working-storage section. + 77 str pic x(19) value "AAAAsomeABthingBBBB". + procedure division. + display "Starting with " """" str """" "..." + + initialize str all value. + inspect str replacing all "A" by "X" + display "After inspect replacing ALL A by X: " """" str """" + + initialize str all value. + inspect str replacing trailing "A" by "X" + display "After inspect replacing TRAILING A by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "A" by "X" + display "After inspect backward replacing ALL A by X: " """" str """" + + initialize str all value. + inspect backward str replacing trailing "A" by "X" + display "After inspect backward replacing TRAILING A by X: " """" str """" + + initialize str all value. + inspect str replacing all "B" by "X" + display "After inspect replacing ALL B by X: " """" str """" + + initialize str all value. + inspect str replacing trailing "B" by "X" + display "After inspect replacing TRAILING B by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "B" by "X" + display "After inspect backward replacing ALL B by X: " """" str """" + + initialize str all value. + inspect backward str replacing trailing "B" by "X" + display "After inspect backward replacing TRAILING B by X: " """" str """" + goback. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out new file mode 100644 index 0000000..c8f492d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out @@ -0,0 +1,10 @@ +Starting with "AAAAsomeABthingBBBB"... +After inspect replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect replacing TRAILING A by X: "AAAAsomeABthingBBBB" +After inspect backward replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect backward replacing TRAILING A by X: "XXXXsomeABthingBBBB" +After inspect replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect replacing TRAILING B by X: "AAAAsomeABthingXXXX" +After inspect backward replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect backward replacing TRAILING B by X: "AAAAsomeABthingBBBB" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob new file mode 100644 index 0000000..fbf9e09d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob @@ -0,0 +1,105 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_simple_CONVERTING.out" } + + program-id. prog. + data division. + working-storage section. + 01 item pic x(64). + 01 should-be pic x(64). + procedure division. + display "Forward:" + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "jumps" + move "THE QUICK BROWN FOX jumps over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "nothing" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" + move "the quick brown fox JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" before "over" + move "the quick brown fox JUMPS over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" before "xyzzy" + move "the quick brown fox JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + display "Reverse:" + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "jumps" + move "the quick brown fox jumps OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "nothing" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" + move "THE QUICK BROWN fox jumps over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "fox" after "over" + move "the quick brown fox JUMPS over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "xyzzy" after "over" + move "THE QUICK BROWN FOX JUMPS over the lazy dog" to should-be + perform reportt + + goback. + reportt. + display " " function trim(item) + if item not equal to should-be + display "should have been " function trim(should-be) + end-if. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out new file mode 100644 index 0000000..0675c63 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out @@ -0,0 +1,15 @@ +Forward: + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + THE QUICK BROWN FOX jumps over the lazy dog + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + the quick brown fox JUMPS OVER THE LAZY DOG + the quick brown fox JUMPS over the lazy dog + the quick brown fox JUMPS OVER THE LAZY DOG +Reverse: + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + the quick brown fox jumps OVER THE LAZY DOG + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + THE QUICK BROWN fox jumps over the lazy dog + the quick brown fox JUMPS over the lazy dog + THE QUICK BROWN FOX JUMPS over the lazy dog + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob new file mode 100644 index 0000000..4714e5e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob @@ -0,0 +1,29 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_simple_REPLACING.out" } + + program-id. prog. + data division. + working-storage section. + 01 item pic x(64). + procedure division. + + move "AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc" to item + display function trim(item) + inspect backward item replacing all "Abc" by "Qrs" + display function trim(item) + + move "AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc" to item + display function trim(item) + inspect backward item replacing trailing "Abc" by "Qrs" + display function trim(item) + + move "AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc" to item + display function trim(item) + inspect backward item replacing all "Abc" by "Qrs" + after "Z" before "Y" + display function trim(item) + + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out new file mode 100644 index 0000000..230ab91 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out @@ -0,0 +1,7 @@ +AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +QrsQrsXQrsQrsQrsYQrsQrsQrsQrsZQrsQrsQrsQrsQrs +AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +QrsQrsXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +AbcAbcXAbcAbcAbcYQrsQrsQrsQrsZAbcAbcAbcAbcAbc + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob new file mode 100644 index 0000000..7cd284f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob @@ -0,0 +1,78 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_simple_TALLYING.out" } + + program-id. prog. + data division. + working-storage section. + 01 item pic x(64). + 01 counter pic 999. + procedure division. + + move "AAXAAAYAAAAZAAAAA" to item + display function trim(item) + display "Forward:" + + move zero to counter + inspect item tallying + counter for all "A" + display "FOR ALL A " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect item tallying + counter for all "A" after "X" + display "FOR ALL A after X " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect item tallying + counter for all "A" before "Z" + display "FOR ALL A before Z " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect item tallying + counter for all "A" after "X" before "Z" + display "FOR ALL A after X before Z " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" to item + inspect item tallying + counter for trailing "A" + display "FOR TRAILING A " counter + + + display "Backward:" + move zero to counter + inspect backward item tallying + counter for all "A" + display "FOR ALL A " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for all "A" after "X" + display "FOR ALL A after X " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for all "A" before "Z" + display "FOR ALL A before Z " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for all "A" after "Z" before "X" + display "FOR ALL A after Z before X " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for trailing "A" + display "FOR TRAILING A " counter + + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out new file mode 100644 index 0000000..73d9006 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out @@ -0,0 +1,14 @@ +AAXAAAYAAAAZAAAAA +Forward: +FOR ALL A 014 +FOR ALL A after X 012 +FOR ALL A before Z 009 +FOR ALL A after X before Z 007 +FOR TRAILING A 052 +Backward: +FOR ALL A 061 +FOR ALL A after X 002 +FOR ALL A before Z 005 +FOR ALL A after Z before X 007 +FOR TRAILING A 002 + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_NULL.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_NULL.cob new file mode 100644 index 0000000..26a760c1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_NULL.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE LOW-VALUES. + PROCEDURE DIVISION. + INSPECT X CONVERTING NULL TO "A". + IF X NOT = "AAA" + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob new file mode 100644 index 0000000..fe1605e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE "BCA". + PROCEDURE DIVISION. + INSPECT X CONVERTING "ABC" TO SPACES. + IF X NOT = SPACES + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob new file mode 100644 index 0000000..2983cce --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_CONVERTING_TO_figurative_constants.out" } + + identification division. + program-id. clouseau. + data division. + working-storage section. + 01 item pic x(12). + procedure division. + move all "abcd" to item + inspect item converting "abcd" to low-values + display "low-values " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to spaces + display "spaces " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to zeros + display "zeros " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to quotes + display "quotes " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to high-values + display "high-values" space """" item """" + goback. + end program clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out new file mode 100644 index 0000000..7de6e48 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out @@ -0,0 +1,6 @@ +low-values "" +spaces " " +zeros "000000000000" +quotes """""""""""""" +high-values "ÿÿÿÿÿÿÿÿÿÿÿÿ" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob new file mode 100644 index 0000000..1bbdea4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob @@ -0,0 +1,83 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_1.out" } + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + 01 counts pic 99 value 5. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 5 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' EFABDBCGABEFGG 0301010005TUXYXVWRXYZZPZ' to row(1). + Move ' BABABC 0200000101SXYXYZ' to row(3). + Move ' BBBC 0001000200SSVW' to row(5). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 C2 C3 C4 OUTPUT' + Display ' -------------------- -- -- -- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB", ALL "D" + COUNT(counter + 1 2) FOR ALL "BC" + COUNT(counter + 1 3) FOR LEADING "EF" + COUNT(counter + 1 4) FOR LEADING "B" + COUNT(counter + 1 5) FOR CHARACTERS + INSPECT OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim (output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim (output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.out new file mode 100644 index 0000000..b3b354c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.out @@ -0,0 +1,9 @@ + INPUT C0 C1 C2 C3 C4 OUTPUT + -------------------- -- -- -- -- -- ---------------- + EFABDBCGABEFGG 03 01 01 00 05 TUXYXVWRXYZZPZ +* EFABDBCGABEFGG 03 01 01 00 05 TUXYXVWRXYZZPZ + BABABC 02 00 00 01 01 SXYXYZ +* BABABC 02 00 00 01 01 SXYXYZ + BBBC 00 01 00 02 00 SSVW +* BBBC 00 01 00 02 00 SSVW + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob new file mode 100644 index 0000000..a464101 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob @@ -0,0 +1,75 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_2.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 2. + 01 counts pic 99 value 2. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 4 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 2 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' BBB 0300ZZZ' to row(1). + Move ' ABA 0300ZZZ' to row(3). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 OUTPUT' + Display ' -------------------- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR CHARACTERS + COUNT(counter + 1 2) FOR ALL "A"; + INSPECT OUTPUT(COUNTER + 1)(1:len) REPLACING + CHARACTERS BY "Z" + ALL "A" BY "X" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.out new file mode 100644 index 0000000..65eb71c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.out @@ -0,0 +1,7 @@ + INPUT C0 C1 OUTPUT + -------------------- -- -- ---------------- + BBB 03 00 ZZZ +* BBB 03 00 ZZZ + ABA 03 00 ZZZ +* ABA 03 00 ZZZ + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob new file mode 100644 index 0000000..7111e9c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob @@ -0,0 +1,68 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_3.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 inputs. + 05 row occurs 10 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 3 times. + 10 output PIC X(20). + 77 len PIC 9(8). + + Procedure Division. + Move ' BBEABDABABBCABE 030002BBEXYZXYXYZCABV' to row(1). + Move ' ADDDDC 000004AZZZZC' to row(3). + Move ' ADDDDA 000005AZZZZZ' to row(5). + Move ' CDDDDC 000000CDDDDC' to row(7). + Move ' BDBBBDB 000300BDWWWDB' to row(9). +` + Display ' INPUT C0 C1 C2 OUTPUT' + Display ' -------------------- -- -- -- --------------------' + Perform Example-3 with test after + varying counter from 1 by 2 until counter = 9. + + Goback. + + Inspection Section. + Example-3. + Move row(counter) to row(counter + 1) + Move input(counter) to output(counter) + Move Zero to count(counter 1) + Move Zero to count(counter 2) + Move Zero to count(counter 3) + + Move function length( function trim(input(counter)) ) to len. + INSPECT OUTPUT(COUNTER)(1:len) TALLYING + COUNT(counter 1) FOR ALL "AB" BEFORE "BC" + COUNT(counter 2) FOR LEADING "B" AFTER "D" + COUNT(counter 3) FOR CHARACTERS AFTER "A" BEFORE "C"; + INSPECT OUTPUT(COUNTER)(1:len) REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "W" AFTER "D" + FIRST "E" BY "V" AFTER "D" + CHARACTERS BY "Z" AFTER "A" BEFORE "C" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' + count(counter 1) ' ' + count(counter 2) ' ' + count(counter 3) ' ' + function trim(output(counter)) + Display star(1 + counter) ' ' + input(1 + counter) ' ' + count(1 + counter 1) ' ' + count(1 + counter 2) ' ' + count(1 + counter 3) ' ' + function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.out new file mode 100644 index 0000000..268fa3e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.out @@ -0,0 +1,13 @@ + INPUT C0 C1 C2 OUTPUT + -------------------- -- -- -- -------------------- + BBEABDABABBCABE 03 00 02 BBEXYZXYXYZCABV +* BBEABDABABBCABE 03 00 02 BBEXYZXYXYZCABV + ADDDDC 00 00 04 AZZZZC +* ADDDDC 00 00 04 AZZZZC + ADDDDA 00 00 05 AZZZZZ +* ADDDDA 00 00 05 AZZZZZ + CDDDDC 00 00 00 CDDDDC +* CDDDDC 00 00 00 CDDDDC + BDBBBDB 00 03 00 BDWWWDB +* BDBBBDB 00 03 00 BDWWWDB + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob new file mode 100644 index 0000000..192e1a8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob @@ -0,0 +1,71 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_4.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 1. + 01 counts pic 99 value 1. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 2 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 1 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' ABABABABC 01ABABXYABC' to row(1). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 OUTPUT' + Display ' -------------------- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB" AFTER "BA" BEFORE "BC"; + INSPECT OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY" AFTER "BA" BEFORE "BC" + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.out new file mode 100644 index 0000000..a2ae6e5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.out @@ -0,0 +1,5 @@ + INPUT C0 C1 OUTPUT + -------------------- -- -- ---------------- + ABABABABC 01 ABABXYABC +* ABABABABC 01 ABABXYABC + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob new file mode 100644 index 0000000..0923720 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob @@ -0,0 +1,81 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_5-f.out" } + + Identification Division. + Program-Id. Clouseau. + *> Note: Although modeled on Example-5 in Appendix D of the ISO 2023 + *> specification, all three of the samples are incorrect. This code + *> modifies the problem to make it somewhat more interesting, and, of + *> course, changes the answers so that they are correct for the problem. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + 01 counts pic 99 value 3. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 3 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' ABABBCAB 000106ABABBCXY' to row(1). + Move ' ABDBABC 000001AVDBABC' to row(3). + Move ' BCABCABD 010000BCABCAVD' to row(5). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 C2 OUTPUT' + Display ' -------------------- -- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT BACKWARD INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB" BEFORE "BC" + COUNT(counter + 1 2) FOR LEADING "B" + COUNT(counter + 1 3) FOR CHARACTERS AFTER "A" BEFORE "D" + INSPECT BACKWARD OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.out new file mode 100644 index 0000000..dbfef10 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.out @@ -0,0 +1,9 @@ + INPUT C0 C1 C2 OUTPUT + -------------------- -- -- -- ---------------- + ABABBCAB 00 01 06 ABABBCXY +* ABABBCAB 00 01 06 ABABBCXY + ABDBABC 00 00 01 AVDBABC +* ABDBABC 00 00 01 AVDBABC + BCABCABD 01 00 00 BCABCAVD +* BCABCABD 01 00 00 BCABCAVD + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.cob new file mode 100644 index 0000000..bf9299a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.cob @@ -0,0 +1,77 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_5-r.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + 01 counts pic 99 value 3. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 3 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' BACBBABA 000004BACBBXYA' to row(1). + Move ' CBABDBA 000005CBAVDBA' to row(3). + Move ' DBACBACB 000100DBACBACB' to row(5). + + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 C2 C3 C4 OUTPUT' + Display ' -------------------- -- -- -- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT BACKWARD INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB" BEFORE "BC" + COUNT(counter + 1 2) FOR LEADING "B" + COUNT(counter + 1 3) FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.out new file mode 100644 index 0000000..02e8d67 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.out @@ -0,0 +1,9 @@ + INPUT C0 C1 C2 C3 C4 OUTPUT + -------------------- -- -- -- -- -- ---------------- + BACBBABA 00 00 04 BACBBXYA +* BACBBABA 00 00 04 BACBBXYA + CBABDBA 00 00 05 CBAVDBA +* CBABDBA 00 00 05 CBAVDBA + DBACBACB 00 01 00 DBACBACB +* DBACBACB 00 01 00 DBACBACB + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.cob new file mode 100644 index 0000000..016777b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.cob @@ -0,0 +1,90 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_5.out" } + Identification Division. + Program-Id. Clouseau. + *> Note: Although modeled on Example-5 in Appendix D of the ISO 2023 + *> specification, all six of the samples are incorrect. + *> This code executes the examples as written, and the test suite checks + *> For the answers believed to be correct + Data Division. + Working-Storage Section. + 01 item-1 pic x(8) value "ABABBCAB". + 01 item-2 pic x(7) value "ABDBABC". + 01 item-3 pic x(8) value "BCABCABD". + 01 count-0 pic 9 value zero. + 01 count-1 pic 9 value zero. + 01 count-2 pic 9 value zero. + Procedure Division. + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + display item-1 " " with no advancing + INSPECT BACKWARD ITEM-1 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-1 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-1 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + display item-2 " " with no advancing + INSPECT BACKWARD ITEM-2 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-2 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-2 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + display item-3 " " with no advancing + INSPECT BACKWARD ITEM-3 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-3 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-3 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + MOVE FUNCTION REVERSE (ITEM-1) TO ITEM-1 + display item-1 " " with no advancing + INSPECT ITEM-1 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-1 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-1 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + MOVE FUNCTION REVERSE (ITEM-2) TO ITEM-2 + display item-2 " " with no advancing + INSPECT ITEM-2 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-2 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-2 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + MOVE FUNCTION REVERSE (ITEM-3) TO ITEM-3 + display item-3 " " with no advancing + INSPECT ITEM-3 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-3 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-3 + + goback. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.out new file mode 100644 index 0000000..afcfb72 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.out @@ -0,0 +1,7 @@ +ABABBCAB 0 1 0 ABABBCXY +ABDBABC 0 0 0 AVDBABC +BCABCABD 1 0 0 BCABCAVD +BACBBABA 1 1 0 BACBBXYA +CBABDBA 1 0 0 CBAVDBA +DBACBACB 0 0 0 DBACBACB + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob new file mode 100644 index 0000000..75917a2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob @@ -0,0 +1,58 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_6.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 1. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' AC"AEBDFBCD#AB"D AC"XEYXFYZX#AB"D' to row(1). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT OUTPUT' + Display ' -------------------- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT OUTPUT(COUNTER + 1)(1:len) CONVERTING + "ABCD" TO "XYZX" AFTER QUOTE BEFORE "#". + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.out new file mode 100644 index 0000000..dfe5f4b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.out @@ -0,0 +1,5 @@ + INPUT OUTPUT + -------------------- ---------------- + AC"AEBDFBCD#AB"D AC"XEYXFYZX#AB"D +* AC"AEBDFBCD#AB"D AC"XEYXFYZX#AB"D + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob new file mode 100644 index 0000000..ca2ae71 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob @@ -0,0 +1,65 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_7.out" } + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 output PIC X(20). + 77 len PIC 9(8). + + Linkage Section. + 77 result PIC 9(8) Value 0. + + Procedure Division returning result. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' 415-245-1212 415-245-1212' to row(1). + Move ' 415-CH5-1212 415-??5-1212' to row(3). + Move ' 20%Numeric 20%???????' to row(5). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT OUTPUT' + Display ' -------------------- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT OUTPUT(COUNTER + 1)(1:len) CONVERTING + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + TO ALL "?" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move 1 to result + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.out new file mode 100644 index 0000000..2418c36 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.out @@ -0,0 +1,9 @@ + INPUT OUTPUT + -------------------- ---------------- + 415-245-1212 415-245-1212 +* 415-245-1212 415-245-1212 + 415-CH5-1212 415-??5-1212 +* 415-CH5-1212 415-??5-1212 + 20%Numeric 20%??????? +* 20%Numeric 20%??????? + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob new file mode 100644 index 0000000..358a1da --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE "BCA". + 01 Y PIC X(6) VALUE " BCA". + PROCEDURE DIVISION. + INSPECT X CONVERTING "ABC" TO "BCD". + IF X NOT = "CDB" + DISPLAY "X: " X. + INSPECT Y CONVERTING "ABC" TO "BCD". + IF Y NOT = " CDB" + DISPLAY "Y: " Y. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob new file mode 100644 index 0000000..d710292 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob @@ -0,0 +1,13 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "0001". + PROCEDURE DIVISION. + INSPECT X REPLACING LEADING ZEROS BY SPACES. + IF X NOT = " 1" + DISPLAY "Should be ' 1' but is '" X "'". + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob new file mode 100644 index 0000000..5d706eb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE "BCA". + PROCEDURE DIVISION. + INSPECT X REPLACING ALL "BC" BY SPACE. + IF X NOT = " A" + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_AFTER.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_AFTER.cob new file mode 100644 index 0000000..c8cd95e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_AFTER.cob @@ -0,0 +1,26 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "ABC ". + 01 TAL PIC 999 VALUE 0. + PROCEDURE DIVISION. + MOVE 0 TO TAL. + INSPECT X TALLYING TAL FOR CHARACTERS + AFTER INITIAL " ". + IF TAL NOT = 0 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + MOVE 0 TO TAL. + MOVE " ABC" TO X. + INSPECT X TALLYING TAL FOR CHARACTERS + AFTER INITIAL " ". + IF TAL NOT = 3 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob new file mode 100644 index 0000000..5640ff5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob @@ -0,0 +1,26 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "ABC ". + 01 TAL PIC 999 VALUE 0. + PROCEDURE DIVISION. + MOVE 0 TO TAL. + INSPECT X TALLYING TAL FOR CHARACTERS + BEFORE INITIAL " ". + IF TAL NOT = 3 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + MOVE 0 TO TAL. + MOVE " ABC" TO X. + INSPECT X TALLYING TAL FOR CHARACTERS + BEFORE INITIAL " ". + IF TAL NOT = 0 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob new file mode 100644 index 0000000..ab1a4118 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob @@ -0,0 +1,142 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_TALLYING_REPLACING_ISO_Example.out" } + + *> Example from ISO/IEC 2023 page 1151 + IDENTIFICATION DIVISION. + PROGRAM-ID. tests. + PROCEDURE DIVISION. + CALL "test1" + CALL "test2" + CALL "test3" + goback. + end program tests. + + IDENTIFICATION DIVISION. + PROGRAM-ID. test1. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ITEM PIC X(14) VALUE "EFABDBCGABEFGG". + 01 COUNT-0 PIC 99 VALUE 0. + 01 COUNT-1 PIC 99 VALUE 0. + 01 COUNT-2 PIC 99 VALUE 0. + 01 COUNT-3 PIC 99 VALUE 0. + 01 COUNT-4 PIC 99 VALUE 0. + PROCEDURE DIVISION. + INSPECT ITEM TALLYING + COUNT-0 FOR ALL "AB", ALL "D" + COUNT-1 FOR ALL "BC" + COUNT-2 FOR LEADING "EF" + COUNT-3 FOR LEADING "B" + COUNT-4 FOR CHARACTERS; + INSPECT ITEM REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + DISPLAY "Counts are: " + COUNT-0 SPACE + COUNT-1 SPACE + COUNT-2 SPACE + COUNT-3 SPACE + COUNT-4 + DISPLAY "Should be: " + "03" SPACE + "01" SPACE + "01" SPACE + "00" SPACE + "05" + DISPLAY "Result is " """" ITEM """" + MOVE "TUXYXVWRXYZZPZ" TO ITEM + DISPLAY "Should be " """" ITEM """" + GOBACK. + END PROGRAM test1. + + IDENTIFICATION DIVISION. + PROGRAM-ID. test2. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ITEM PIC X(6) VALUE "BABABC". + 01 COUNT-0 PIC 99 VALUE 0. + 01 COUNT-1 PIC 99 VALUE 0. + 01 COUNT-2 PIC 99 VALUE 0. + 01 COUNT-3 PIC 99 VALUE 0. + 01 COUNT-4 PIC 99 VALUE 0. + PROCEDURE DIVISION. + INSPECT ITEM TALLYING + COUNT-0 FOR ALL "AB", ALL "D" + COUNT-1 FOR ALL "BC" + COUNT-2 FOR LEADING "EF" + COUNT-3 FOR LEADING "B" + COUNT-4 FOR CHARACTERS; + INSPECT ITEM REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + DISPLAY "Counts are: " + COUNT-0 SPACE + COUNT-1 SPACE + COUNT-2 SPACE + COUNT-3 SPACE + COUNT-4 + DISPLAY "Should be: " + "02" SPACE + "00" SPACE + "00" SPACE + "01" SPACE + "01" + DISPLAY "Result is " """" ITEM """" + MOVE "SXYXYZ" TO ITEM + DISPLAY "Should be " """" ITEM """" + GOBACK. + END PROGRAM test2. + + IDENTIFICATION DIVISION. + PROGRAM-ID. test3. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ITEM PIC X(4) VALUE "BBBC". + 01 COUNT-0 PIC 99 VALUE 0. + 01 COUNT-1 PIC 99 VALUE 0. + 01 COUNT-2 PIC 99 VALUE 0. + 01 COUNT-3 PIC 99 VALUE 0. + 01 COUNT-4 PIC 99 VALUE 0. + PROCEDURE DIVISION. + INSPECT ITEM TALLYING + COUNT-0 FOR ALL "AB", ALL "D" + COUNT-1 FOR ALL "BC" + COUNT-2 FOR LEADING "EF" + COUNT-3 FOR LEADING "B" + COUNT-4 FOR CHARACTERS; + INSPECT ITEM REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + DISPLAY "Counts are: " + COUNT-0 SPACE + COUNT-1 SPACE + COUNT-2 SPACE + COUNT-3 SPACE + COUNT-4 + DISPLAY "Should be: " + "00" SPACE + "01" SPACE + "00" SPACE + "02" SPACE + "00" + DISPLAY "Result is " """" ITEM """" + MOVE "SSVW" TO ITEM + DISPLAY "Should be " """" ITEM """" + GOBACK. + END PROGRAM test3. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out new file mode 100644 index 0000000..58f40fe --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out @@ -0,0 +1,13 @@ +Counts are: 03 01 01 00 05 +Should be: 03 01 01 00 05 +Result is "TUXYXVWRXYZZPZ" +Should be "TUXYXVWRXYZZPZ" +Counts are: 02 00 00 01 01 +Should be: 02 00 00 01 01 +Result is "SXYXYZ" +Should be "SXYXYZ" +Counts are: 00 01 00 02 00 +Should be: 00 01 00 02 00 +Result is "SSVW" +Should be "SSVW" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.cob new file mode 100644 index 0000000..231913c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.cob @@ -0,0 +1,58 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_TRAILING.out" } + + identification division. + program-id. prog. + data division. + working-storage section. + 01 the-text pic x(30) value " middle". + 01 counter pic 9999. + 01 expected pic 9999. + 01 should-be pic zzz9. + 01 but-is pic zzz9. + 01 msg pic x(100). + procedure division. + + move "inspect for leading spaces" to msg + move zero to counter + inspect the-text tallying counter for leading spaces + move 4 to expected + perform result. + + move "inspect for trailing spaces with reverse" to msg + move zero to counter + inspect function reverse(the-text) tallying counter for leading spaces + move 20 to expected + perform result. + + move "inspect for trailing spaces with reversed variable" to msg + move function reverse(the-text) to the-text + move zero to counter + inspect the-text tallying counter for leading spaces + move 20 to expected + perform result. + + move "inspect for trailing spaces with INSPECT TRAILING extension" to msg + move function reverse(the-text) to the-text + move zero to counter + inspect the-text tallying counter for trailing spaces + move 20 to expected + perform result. + + inspect the-text replacing trailing space by "X" + display the-text + + stop run. + + result. + display function trim(msg) ": " with no advancing + move expected to should-be + if counter equal to expected + display function trim(should-be) + else + move counter to but-is + display "should be " function trim(should-be) + " but is " function trim(but-is) + end-if. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.out new file mode 100644 index 0000000..e55c3e9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.out @@ -0,0 +1,6 @@ +inspect for leading spaces: 4 +inspect for trailing spaces with reverse: 20 +inspect for trailing spaces with reversed variable: 20 +inspect for trailing spaces with INSPECT TRAILING extension: 20 + middleXXXXXXXXXXXXXXXXXXXX + diff --git a/gcc/testsuite/cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob b/gcc/testsuite/cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob new file mode 100644 index 0000000..b94adf5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION PI + FUNCTION E. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC 99V99. + PROCEDURE DIVISION. + MOVE PI TO Z. + MOVE E TO Z. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.cob b/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.cob new file mode 100644 index 0000000..6475356 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + *> { dg-output-file "group2/Length_overflow__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + 01 I PIC 9 VALUE 5. + PROCEDURE DIVISION. + >>TURN EC-ALL CHECKING ON + DISPLAY X(1:I) NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.out b/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.out new file mode 100644 index 0000000..78981922 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow__1_.out @@ -0,0 +1 @@ +a diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow__2_.cob b/gcc/testsuite/cobol.dg/group2/Length_overflow__2_.cob new file mode 100644 index 0000000..351c9df --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow__2_.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + *> { dg-output-file "group2/Length_overflow__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog2. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + 01 I PIC 9 VALUE 5. + PROCEDURE DIVISION. + >>TURN EC-ALL CHECKING ON + DISPLAY X(3:I) NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow__2_.out b/gcc/testsuite/cobol.dg/group2/Length_overflow__2_.out new file mode 100644 index 0000000..f2ad6c7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow__2_.out @@ -0,0 +1 @@ +c diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__1_.cob b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__1_.cob new file mode 100644 index 0000000..9f7fa83 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__1_.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + *> { dg-output-file "group2/Length_overflow_with_offset__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + 01 I PIC 9 VALUE 3. + PROCEDURE DIVISION. + >>TURN EC-ALL CHECKING ON + DISPLAY X(3:I) NO ADVANCING. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__1_.out b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__1_.out new file mode 100644 index 0000000..f2ad6c7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__1_.out @@ -0,0 +1 @@ +c diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__2_.cob b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__2_.cob new file mode 100644 index 0000000..d077373 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__2_.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + *> { dg-output-file "group2/Length_overflow_with_offset__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + 01 I PIC 9 VALUE 3. + PROCEDURE DIVISION. + >>TURN EC-ALL CHECKING ON + IF X(3:I) <> SPACES + DISPLAY X(3:I) NO ADVANCING. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__2_.out b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__2_.out new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__2_.out @@ -0,0 +1 @@ + diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__3_.cob b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__3_.cob new file mode 100644 index 0000000..7fa9843 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__3_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + *> { dg-output-file "group2/Length_overflow_with_offset__3_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + 01 I PIC 9 VALUE 3. + PROCEDURE DIVISION. + >>TURN EC-ALL CHECKING ON + EVALUATE TRUE + WHEN I < 2 + AND X(3:I) <> SPACES + DISPLAY "1-" X(3:I) NO ADVANCING + WHEN I < 2 + WHEN X(3:I) <> SPACES + DISPLAY "2-" X(3:I) NO ADVANCING + END-EVALUATE + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__3_.out b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__3_.out new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Length_overflow_with_offset__3_.out @@ -0,0 +1 @@ + diff --git a/gcc/testsuite/cobol.dg/group2/Offset_overflow.cob b/gcc/testsuite/cobol.dg/group2/Offset_overflow.cob new file mode 100644 index 0000000..8fd5421 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Offset_overflow.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + *> { dg-output-file "group2/Offset_overflow.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01. + 03 X PIC X(4) VALUE "abcd". + 03 I PIC 9 VALUE 5. + PROCEDURE DIVISION. + >>TURN EC-ALL CHECKING ON + DISPLAY X(I:1) NO ADVANCING. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Offset_overflow.out b/gcc/testsuite/cobol.dg/group2/Offset_overflow.out new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Offset_overflow.out @@ -0,0 +1 @@ +5 diff --git a/gcc/testsuite/cobol.dg/group2/Offset_underflow.cob b/gcc/testsuite/cobol.dg/group2/Offset_underflow.cob new file mode 100644 index 0000000..51100a8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Offset_underflow.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + *> { dg-output-file "group2/Offset_underflow.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + 01 I PIC 9 VALUE 0. + PROCEDURE DIVISION. + >>TURN EC-ALL CHECKING ON + DISPLAY X(I:1) NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Offset_underflow.out b/gcc/testsuite/cobol.dg/group2/Offset_underflow.out new file mode 100644 index 0000000..78981922 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Offset_underflow.out @@ -0,0 +1 @@ +a diff --git a/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.cob b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.cob new file mode 100644 index 0000000..6e0443d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.cob @@ -0,0 +1,237 @@ + *> { dg-do run } + *> { dg-output-file "group2/Program-to-program_parameters_and_retvals.out" } + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 var1 pic 9 VALUE 1. + 01 var2 BINARY-CHAR VALUE 22. + 01 var3 pic s999 COMP-3 VALUE -333. + 01 var4 pic 9999 BINARY VALUE 4444. + 01 var5 pic 99.99 VALUE "12.34". + 01 var6 pic s999V999 COMP-5 VALUE -123.456. + 01 var7 float-short VALUE 1.23E10. + 01 var8 float-long VALUE -1.23E20. + 01 var9 float-extended VALUE 1.23E40. + 01 var64 pic 9(15) VALUE 987654321098765. + 01 var128 pic s9(30) VALUE -987654321098765432109876543210. + 01 filler. + 02 varpd pic 9(18) comp-5 value 1250999747361. + 02 varp redefines varpd pointer. + 01 varg. + 02 varg1 pic x(7) VALUE "That's". + 02 varg2 pic x(5) VALUE "all," . + 02 varg3 pic x(7) VALUE "folks!". + + 01 var1r pic 9 . + 01 var2r BINARY-CHAR . + 01 var3r pic s999 COMP-3 . + 01 var4r pic 9999 BINARY . + 01 var5r pic 99.99 . + 01 var6r pic s999V999 COMP-5 . + 01 var7r float-short . + 01 var8r float-long . + 01 var9r float-extended . + 01 var64r pic 9(15) . + 01 var128r pic s9(30) . + 01 varpr pointer. + 01 vargr. + 02 varg1 pic x(7). + 02 varg2 pic x(5). + 02 varg3 pic x(7). + + PROCEDURE DIVISION. + display var1 + call "rvar1" USING by value var1 RETURNING var1r + display var1r + + display var2 + call "rvar2" USING by reference var2 RETURNING var2r + display var2r + + display var3 + call "rvar3" USING by content var3 RETURNING var3r + display var3r + + display var4 + call "rvar4" USING by value var4 RETURNING var4r + display var4r + + display var5 + call "rvar5" USING by reference var5 RETURNING var5r + display var5r + + display var6 + call "rvar6" USING by content var6 RETURNING var6r + display var6r + + display var7 + call "rvar7" USING by reference var7 RETURNING var7r + display var7r + + display var8 + call "rvar8" USING by value var8 RETURNING var8r + display var8r + + display var9 + call "rvar9" USING by content var9 RETURNING var9r + display var9r + + display var64 + call "rvar64" USING by value var64 RETURNING var64r + display var64r + + display var128 + call "rvar128" USING by reference var128 RETURNING var128r + display var128r + + display varp + call "rvarp" USING by reference varp RETURNING varpr + display varpr + + display """"varg"""" + call "rvarg" USING by reference varg RETURNING vargr + display """"vargr"""" + + GOBACK. + END PROGRAM prog. + + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar1. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 9 . + 01 varr pic 9 . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar1. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar2. + DATA DIVISION. + LINKAGE SECTION. + 01 var BINARY-CHAR . + 01 varr BINARY-CHAR . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar2. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar3. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic s999 COMP-3 . + 01 varr pic s999 COMP-3 . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar3. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar4. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 9999 BINARY . + 01 varr pic 9999 BINARY . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar4. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar5. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 99.99 . + 01 varr pic 99.99 . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar5. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar6. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic s999V999 COMP-5 . + 01 varr pic s999V999 COMP-5 . + PROCEDURE DIVISION USING reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar6. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar7. + DATA DIVISION. + LINKAGE SECTION. + 01 var float-short . + 01 varr float-short . + PROCEDURE DIVISION USING by reference VAR RETURNING varr. + MOVE var TO varr. + GOBACK. + END PROGRAM rvar7. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar8. + DATA DIVISION. + LINKAGE SECTION. + 01 var float-long . + 01 varr float-long . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar8. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar9. + DATA DIVISION. + LINKAGE SECTION. + 01 var float-extended . + 01 varr float-extended . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar9. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar64. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 9(15) . + 01 varr pic 9(15) . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar64. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar128. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic s9(30) . + 01 varr pic s9(30) . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar128. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvarp. + DATA DIVISION. + LINKAGE SECTION. + 01 var pointer . + 01 varr pointer . + PROCEDURE DIVISION USING by reference var RETURNING varr. + SET varr TO var. + END PROGRAM rvarp. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvarg. + DATA DIVISION. + LINKAGE SECTION. + 01 var. + 02 varg1 pic x(7). + 02 varg2 pic x(5). + 02 varg3 pic x(7). + 01 varr. + 02 varg1 pic x(7). + 02 varg2 pic x(5). + 02 varg3 pic x(7). + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvarg. + diff --git a/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.out b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.out new file mode 100644 index 0000000..ce543df --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.out @@ -0,0 +1,27 @@ +1 +1 ++022 ++022 +-333 +-333 +4444 +4444 +12.34 +12.34 +-123.456 +-123.456 +1.230000026E+10 +1.230000026E+10 +-1.23E+20 +-1.23E+20 +1.23E+40 +1.23E+40 +987654321098765 +987654321098765 +-987654321098765432109876543210 +-987654321098765432109876543210 +0x0000012345654321 +0x0000012345654321 +"That's all, folks! " +"That's all, folks! " + diff --git a/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob new file mode 100644 index 0000000..122aab7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob @@ -0,0 +1,38 @@ + *> { dg-do run } + *> { dg-output-file "group2/Recursive_FUNCTION_with_local-storage.out" } + IDENTIFICATION DIVISION. + FUNCTION-ID. callee. + DATA DIVISION. + LOCAL-STORAGE SECTION. + 01 LCL-X PIC 999 . + LINKAGE SECTION. + 01 parm PIC 999. + 01 retval PIC 999. + PROCEDURE DIVISION USING parm RETURNING retval. + display "On entry, parm is: " parm + move parm to lcl-x + move parm to retval + subtract 1 from parm + if parm > 0 + display "A The function returns " function callee(parm). + if lcl-x not equal to retval + display "On exit, lcl-s and retval are: " lcl-x " and " retval + display "But they should be equal to each other" + end-if + goback. + end function callee. + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 val PIC 999 VALUE 5. + PROCEDURE DIVISION. + DISPLAY "Starting value is: " val + display "B The function returns " function callee(val). + STOP RUN. + end program caller. + diff --git a/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out new file mode 100644 index 0000000..3ccd69a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out @@ -0,0 +1,12 @@ +Starting value is: 005 +On entry, parm is: 005 +On entry, parm is: 004 +On entry, parm is: 003 +On entry, parm is: 002 +On entry, parm is: 001 +A The function returns 001 +A The function returns 002 +A The function returns 003 +A The function returns 004 +B The function returns 005 + diff --git a/gcc/testsuite/cobol.dg/group2/Refmod__comparisons_inside_numeric-display.cob b/gcc/testsuite/cobol.dg/group2/Refmod__comparisons_inside_numeric-display.cob new file mode 100644 index 0000000..6fb70f4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Refmod__comparisons_inside_numeric-display.cob @@ -0,0 +1,20 @@ + *> { dg-do run } + *> { dg-output-file "group2/Refmod__comparisons_inside_numeric-display.out" } + identification division. + program-id. prog. + data division. + working-storage section. + 01 n pic 9(9). + 01 i pic 99. + procedure division. + perform varying i from 1 by 1 until i > 8 + move 88888888 to n + move "12" to n(i:2) + display n + if n(i:2) not equal to "12" + display "Equality is flawed" + end-if + end-perform. + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/Refmod__comparisons_inside_numeric-display.out b/gcc/testsuite/cobol.dg/group2/Refmod__comparisons_inside_numeric-display.out new file mode 100644 index 0000000..ac48dc8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Refmod__comparisons_inside_numeric-display.out @@ -0,0 +1,9 @@ +128888888 +012888888 +081288888 +088128888 +088812888 +088881288 +088888128 +088888812 + diff --git a/gcc/testsuite/cobol.dg/group2/Refmod_sources_are_figurative_constants.cob b/gcc/testsuite/cobol.dg/group2/Refmod_sources_are_figurative_constants.cob new file mode 100644 index 0000000..c4af57d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Refmod_sources_are_figurative_constants.cob @@ -0,0 +1,29 @@ + *> { dg-do run } + *> { dg-output-file "group2/Refmod_sources_are_figurative_constants.out" } + + id division. + program-id. prog. + data division. + working-storage section. + 01 varx pic x(8) VALUE '""""""""'. + 01 varp redefines varx pointer. + procedure division. + move "12345678" to varx + display """" varx """" + move "999" to varx(4:3) + display """" varx """" + move LOW-VALUE to varx(4:3). + display """" varx """" + move ZERO to varx(4:3). + display """" varx """" + move SPACE to varx(4:3). + display """" varx """" + move QUOTE to varx(4:3). + display """" varx """" + move HIGH-VALUE to varx(4:3). + display varp + initialize varx all to value + display """" varx """" + . + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/Refmod_sources_are_figurative_constants.out b/gcc/testsuite/cobol.dg/group2/Refmod_sources_are_figurative_constants.out new file mode 100644 index 0000000..2f5dadc --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Refmod_sources_are_figurative_constants.out @@ -0,0 +1,9 @@ +"12345678" +"12399978" +"123" +"12300078" +"123 78" +"123"""78" +0x3837ffffff333231 +"""""""""" + diff --git a/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.cob b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.cob new file mode 100644 index 0000000..cc306b4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/Repository_functions_clause.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SOURCE-COMPUTER. a. + OBJECT-COMPUTER. a. + REPOSITORY. + FUNCTION ALL INTRINSIC. + PROCEDURE DIVISION. + DISPLAY "OK". + diff --git a/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.out b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/Static_reference_modification.cob b/gcc/testsuite/cobol.dg/group2/Static_reference_modification.cob new file mode 100644 index 0000000..919ddb3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Static_reference_modification.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + *> { dg-output-file "group2/Static_reference_modification.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "abcd". + PROCEDURE DIVISION. + DISPLAY X(1:1) ":" X(1:2) ":" X(1:3) ":" X(1:4) ":" X(1:) + END-DISPLAY. + DISPLAY X(2:1) ":" X(2:2) ":" X(2:3) ":" X(2:) + END-DISPLAY. + DISPLAY X(3:1) ":" X(3:2) ":" X(3:) + END-DISPLAY. + DISPLAY X(4:1) ":" X(4:) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Static_reference_modification.out b/gcc/testsuite/cobol.dg/group2/Static_reference_modification.out new file mode 100644 index 0000000..fe51165 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Static_reference_modification.out @@ -0,0 +1,5 @@ +a:ab:abc:abcd:abcd +b:bc:bcd:bcd +c:cd:cd +d:d + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob new file mode 100644 index 0000000..d4df058 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob @@ -0,0 +1,51 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_RETURNING_group_and_PIC_9_5_.out" } + + IDENTIFICATION DIVISION. + FUNCTION-ID. COPYPAR. + DATA DIVISION. + LINKAGE SECTION. + 01 PARSA. + 02 PAR1 PICTURE X(32). + 02 PAR2 PICTURE X(32). + 01 PARSB. + 02 PAR1 PICTURE X(32). + 02 PAR2 PICTURE X(32). + PROCEDURE DIVISION USING PARSA RETURNING PARSB. + MOVE PARSA TO PARSB + DISPLAY """" PARSB """" + GOBACK. + END FUNCTION COPYPAR. + IDENTIFICATION DIVISION. + FUNCTION-ID. COPYPAR2. + DATA DIVISION. + LINKAGE SECTION. + 01 PARSB PIC 99999. + 01 PAR5 PIC 99999. + PROCEDURE DIVISION USING PAR5 RETURNING PARSB. + MOVE PAR5 TO PARSB + DISPLAY PARSB + GOBACK. + END FUNCTION COPYPAR2. + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION COPYPAR, COPYPAR2. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 PARS1. + 02 PAR1 PICTURE X(32) VALUE "Santa". + 02 PAR2 PICTURE X(32) VALUE "Claus". + 01 PARS2. + 02 PAR1 PICTURE X(32). + 02 PAR2 PICTURE X(32). + 01 PAR5 PICTURE 99999 VALUE 54321. + PROCEDURE DIVISION. + MOVE COPYPAR(PARS1) TO PARS2 + DISPLAY """" PARS2 """". + DISPLAY COPYPAR2(PAR5) + STOP RUN. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out new file mode 100644 index 0000000..1361e9a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out @@ -0,0 +1,5 @@ +"Santa Claus " +"Santa Claus " +54321 +54321 + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.cob b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.cob new file mode 100644 index 0000000..71ef09b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.cob @@ -0,0 +1,39 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_fibonacci_recursion.out" } + + identification division. + function-id. fib-func. + data division. + working-storage section. + 01 instance pic 9999 value 0. + linkage section. + 01 n binary-char unsigned. + 01 f-n binary-long unsigned. + procedure division using n returning f-n. + evaluate true + when n = 0 + move 0 to f-n + when n = 1 + move 1 to f-n + when other + compute f-n = fib-func(n - 1) + fib-func(n - 2) + end-evaluate + goback . + end function fib-func. + + identification division. + program-id. pmain. + environment division. + configuration section. + repository. + function fib-func. + data division. + working-storage section. + 01 n binary-char unsigned. + procedure division. + perform varying n from 1 by 1 until n > 16 + display "fibonacci(" n "): " fib-func(n) + end-perform + stop run. + end program pmain. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.out b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.out new file mode 100644 index 0000000..34dabfb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.out @@ -0,0 +1,17 @@ +fibonacci(001): 1 +fibonacci(002): 1 +fibonacci(003): 2 +fibonacci(004): 3 +fibonacci(005): 5 +fibonacci(006): 8 +fibonacci(007): 13 +fibonacci(008): 21 +fibonacci(009): 34 +fibonacci(010): 55 +fibonacci(011): 89 +fibonacci(012): 144 +fibonacci(013): 233 +fibonacci(014): 377 +fibonacci(015): 610 +fibonacci(016): 987 + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.cob b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.cob new file mode 100644 index 0000000..74576b6 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.cob @@ -0,0 +1,33 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_in_COMPUTE.out" } + + IDENTIFICATION DIVISION. + FUNCTION-ID. func. + + DATA DIVISION. + LINKAGE SECTION. + 01 num PIC 999. + + PROCEDURE DIVISION RETURNING num. + MOVE 100 TO num + . + END FUNCTION func. + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION func. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 x PIC 999. + + PROCEDURE DIVISION. + COMPUTE x = 101 + FUNCTION func + DISPLAY x + . + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.out b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.out new file mode 100644 index 0000000..d757a46 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.out @@ -0,0 +1,2 @@ +201 + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.cob b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.cob new file mode 100644 index 0000000..1e9b378 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.cob @@ -0,0 +1,49 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_with_recursion.out" } + + IDENTIFICATION DIVISION. + FUNCTION-ID. foo. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ttl PIC 9 VALUE 1. + + LOCAL-STORAGE SECTION. + 01 num PIC 9. + + LINKAGE SECTION. + 01 arg PIC 9. + 01 ret PIC 9. + + PROCEDURE DIVISION USING arg RETURNING ret. + IF arg < 5 + ADD 1 TO arg GIVING num END-ADD + MOVE FUNCTION foo (num) TO ret + ELSE + MOVE arg TO ret + END-IF + DISPLAY "Step: " ttl ", Arg: " arg ", Return: " ret + END-DISPLAY + ADD 1 to ttl END-ADD + GOBACK. + END FUNCTION foo. + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION foo. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 num PIC 9 VALUE 1. + + PROCEDURE DIVISION. + DISPLAY "Return value '" FUNCTION foo (num) "'" + WITH NO ADVANCING + END-DISPLAY + GOBACK. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.out b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.out new file mode 100644 index 0000000..13bd1e9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.out @@ -0,0 +1,6 @@ +Step: 1, Arg: 5, Return: 5 +Step: 2, Arg: 4, Return: 5 +Step: 3, Arg: 3, Return: 5 +Step: 4, Arg: 2, Return: 5 +Step: 5, Arg: 1, Return: 5 +Return value '5' diff --git a/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob new file mode 100644 index 0000000..3753e7a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob @@ -0,0 +1,36 @@ + *> { dg-do run } + *> { dg-output-file "group2/call_subprogram_using_pointer__passing_pointer.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 varp program-pointer. + PROCEDURE DIVISION. + SET varp TO ENTRY "ref". + CALL "sub" USING BY VALUE varp. + end program prog. + + IDENTIFICATION DIVISION. + PROGRAM-ID. sub. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 param pic x(12) value "hi". + LINKAGE SECTION. + 77 varp program-pointer. + PROCEDURE DIVISION USING BY VALUE varp. + DISPLAY "About to call 'ref hi' directly" + CALL "ref" USING param. + DISPLAY "About to call 'ref hi' indirectly" + CALL varp USING param. + end program sub. + + IDENTIFICATION DIVISION. + PROGRAM-ID. ref. + DATA DIVISION. + LINKAGE SECTION. + 77 greeting pic x(12). + PROCEDURE DIVISION using greeting. + DISPLAY """" greeting """". + end program ref. + diff --git a/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out new file mode 100644 index 0000000..7a12ec1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out @@ -0,0 +1,5 @@ +About to call 'ref hi' directly +"hi " +About to call 'ref hi' indirectly +"hi " + diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18a.C b/gcc/testsuite/g++.dg/abi/abi-tag18a.C index c6fb160..392abf7 100644 --- a/gcc/testsuite/g++.dg/abi/abi-tag18a.C +++ b/gcc/testsuite/g++.dg/abi/abi-tag18a.C @@ -1,4 +1,4 @@ -// { dg-skip-if "PR 70349" { hppa*-*-hpux* && { ! lp64 } } } +// { dg-skip-if "PR 70349" { hppa*-*-hpux* } } // { dg-options "-fabi-version=9 -fno-implicit-constexpr" } // { dg-final { scan-assembler "_Z1fB7__test1v" } } // { dg-final { scan-assembler "_ZZ1fB7__test1vEN1T1gB7__test2Ev" } } diff --git a/gcc/testsuite/g++.dg/abi/ref-temp1.C b/gcc/testsuite/g++.dg/abi/ref-temp1.C index 70c9a7a..b02dcf6 100644 --- a/gcc/testsuite/g++.dg/abi/ref-temp1.C +++ b/gcc/testsuite/g++.dg/abi/ref-temp1.C @@ -7,11 +7,16 @@ struct B { const A (&x)[2]; }; template <typename T> B &&b = { { { { 1, 2, 3 } }, { { 4, 5, 6 } } } }; B &temp = b<void>; -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" } } -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" } } -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" } } -// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" { target { ! pe } } } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" { target { ! pe } } } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" { target { ! pe } } } } +// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" { target { ! pe } } } } +// { dg-final { scan-assembler "\.section\t\.data\\\$_ZGR1bIvE_,\"w\"\n\t\.linkonce same_size" { target pe } } } +// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE0_,\"dr\"\n\t\.linkonce same_size" { target pe } } } +// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE1_,\"dr\"\n\t\.linkonce same_size" { target pe } } } +// { dg-final { scan-assembler "\.section\t\.rdata\\\$_ZGR1bIvE2_,\"dr\"\n\t\.linkonce same_size" { target pe } } } +// // { dg-final { scan-assembler "_ZGR1bIvE_:\n\[^\n]+_ZGR1bIvE0_" } } // { dg-final { scan-assembler "_ZGR1bIvE0_:\n\[^\n]+_ZGR1bIvE1_" } } // { dg-final { scan-assembler "_ZGR1bIvE1_:\n\[^\n]+\[ \t\]1" } } diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic20.C b/gcc/testsuite/g++.dg/concepts/diagnostic20.C new file mode 100644 index 0000000..2bb01db --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/diagnostic20.C @@ -0,0 +1,13 @@ +// PR c++/99214 +// { dg-do compile { target c++20 } } + +template <class T> +struct A { + template <class U> static void f() requires requires { T::fail; }; +}; + +int main() { + A<int>::f<char>(); // { dg-error "no match" } +} + +// { dg-message "In substitution of '\[^\r\n\]* \\\[with U = char\\\]'" "" { target *-*-* } 0 } diff --git a/gcc/testsuite/g++.dg/cpp/embed-26.C b/gcc/testsuite/g++.dg/cpp/embed-26.C new file mode 100644 index 0000000..ad3f9de --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/embed-26.C @@ -0,0 +1,63 @@ +// PR c++/119563 +// { dg-do run { target c++11 } } +// { dg-options "-O2" } + +namespace std { +template <typename T> +struct initializer_list { +private: + T *_M_array; + decltype (sizeof 0) _M_len; +public: + constexpr decltype (sizeof 0) + size () const noexcept { return _M_len; } + constexpr const T * + begin () const noexcept { return _M_array; } + constexpr const T * + end () const noexcept { return begin () + size (); } +}; +} + +struct A {} a; + +struct B { + constexpr B (int x) : B (a, x) {} + template <typename... T> + constexpr B (A, T... x) : b(x...) {} + int b; +}; + +struct C { + C (std::initializer_list<B> x) + { + unsigned char buf[] = { +#embed __FILE__ + }; + if (x.size () != 2 * sizeof (buf) + 1024) + __builtin_abort (); + unsigned int i = 0; + for (auto a = x.begin (); a < x.end (); ++a, ++i) + if (a->b != (i < sizeof (buf) ? buf[i] + : i < sizeof (buf) + 1024 ? ((i - sizeof (buf)) & 7) + 1 + : buf[i - sizeof (buf) - 1024])) + __builtin_abort (); + c = true; + } + bool c; +}; + +#define D 1 + 0, 2 + 0, 3 + 0, 4 + 0, 5 + 0, 6 + 0, 7 + 0, 8 + 0 +#define E D, D, D, D, D, D, D, D, D, D, D, D, D, D, D, D + +C c { +#embed __FILE__ suffix (,) + E, E, E, E, E, E, E, E, +#embed __FILE__ +}; + +int +main () +{ + if (!c.c) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp/pr119391.C b/gcc/testsuite/g++.dg/cpp/pr119391.C new file mode 100644 index 0000000..6e70efc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp/pr119391.C @@ -0,0 +1,15 @@ +// PR preprocessor/119391 +// { dg-do preprocess } +// { dg-options "" } + +#if (1 << 63) != -9223372036854775807 - 1 // { dg-warning "integer overflow in preprocessor expression" "" { target c++98_only } } +#warning "Unexpected value" +#endif +#if (3 << 62) != -4611686018427387904 // { dg-warning "integer overflow in preprocessor expression" "" { target c++98_only } } +#warning "Unexpected value" +#endif +#if 1 << 64 // { dg-warning "integer overflow in preprocessor expression" } +#endif +#if (3 << 63) != -9223372036854775807 - 1 // { dg-warning "integer overflow in preprocessor expression" "" { target c++17_down } } +#warning "Unexpected value" +#endif diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C index 4627365..dcc4044 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice21.C @@ -3,7 +3,7 @@ struct NoMut1 { int a, b; }; struct NoMut3 : virtual NoMut1 { - constexpr NoMut3(int a, int b) // { dg-error "virtual base" "" { target c++23 } } + constexpr NoMut3(int a, int b) : NoMut1{a, b} {} // { dg-error "virtual base" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ref14.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref14.C new file mode 100644 index 0000000..f201afb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref14.C @@ -0,0 +1,21 @@ +// PR c++/118249 +// { dg-do compile { target c++11 } } + +template <int I> +void f() { } + +template <int N> +struct array { + constexpr int size() const { return N; } +}; + +extern array<10>& outer; + +struct C { + array<10> inner; + + void g() { + f<outer.size()>(); // OK + f<inner.size()>(); // was error: use of 'this' in a constant expression + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret2.C index 1bc2a8f..52328bc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret2.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret2.C @@ -17,5 +17,5 @@ bar () return ((void **) &s)[0]; // { dg-error "reinterpret_cast" } } -constexpr auto x = foo (); -constexpr auto y = bar (); +constexpr auto x = foo (); // { dg-error "called in a constant expression" } +constexpr auto y = bar (); // { dg-error "called in a constant expression" } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__3.C new file mode 100644 index 0000000..50ad6e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__3.C @@ -0,0 +1,6 @@ +// PR c++/118629 +// { dg-do compile { target c++11 } } + +void foo() { + []() -> decltype(+__FUNCTION__) { return nullptr; }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr119563.C b/gcc/testsuite/g++.dg/cpp0x/pr119563.C new file mode 100644 index 0000000..9363a09 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr119563.C @@ -0,0 +1,79 @@ +// PR c++/119563 +// { dg-do run { target c++11 } } +// { dg-options "-O2" } + +namespace std { +template <typename T> +struct initializer_list { +private: + T *_M_array; + decltype (sizeof 0) _M_len; +public: + constexpr decltype (sizeof 0) + size () const noexcept { return _M_len; } + constexpr const T * + begin () const noexcept { return _M_array; } + constexpr const T * + end () const noexcept { return begin () + size (); } +}; +} + +struct A {} a; + +struct B { + constexpr B (int x) : B (a, x) {} + template <typename... T> + constexpr B (A, T... x) : b(x...) {} + int b; +}; + +struct C { + C (std::initializer_list<B> x) + { + if (x.size () != 130 + 1024 + 130) + __builtin_abort (); + unsigned int i = 1, j = 0; + for (auto a = x.begin (); a < x.end (); ++a) + if (a->b != i) + __builtin_abort (); + else + { + if (j == 129 || j == 129 + 1024) + i = 0; + i = (i & 15) + 1; + ++j; + } + c = true; + } + bool c; +}; + +#define D 1 + 0, 2 + 0, 3 + 0, 4 + 0, 5 + 0, 6 + 0, 7 + 0, 8 + 0, \ + 9 + 0, 10 + 0, 11 + 0, 12 + 0, 13 + 0, 14 + 0, 15 + 0, 16 + 0 +#define E D, D, D, D, D, D, D, D + +C c { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, E, E, E, E, E, E, E, E, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2 }; + +int +main () +{ + if (!c.c) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-diag2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-diag2.C new file mode 100644 index 0000000..93f3f10 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-diag2.C @@ -0,0 +1,12 @@ +// PR c++/113360 +// { dg-do compile { target c++14 } } + +constexpr bool init_list() // { dg-bogus "because" } +{ + int total{}; + for (int x : {1, 2, 3}) // { dg-error "initializer list" } + total += x; + return total == 6; +} + +static_assert(init_list(), ""); // { dg-error "constant" } diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C index d0ca0b7..f4c6d2e 100644 --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C @@ -6,7 +6,9 @@ constexpr int *f4(bool b) { return nullptr; } else { return new int{42}; // { dg-error "call to non-.constexpr." "" { target c++17_down } } - } // { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target c++2a } .-1 } + // { dg-message "allocated here" "" { target c++20 } .-1 } + } } static_assert(f4(true) == nullptr, ""); -static_assert(f4(false) == nullptr, ""); // { dg-error "non-.constant. condition|" } +static_assert(f4(false) == nullptr, ""); // { dg-error "non-constant condition" } +// { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-prvalue1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-prvalue1.C index ad31e30..6ad2ec8 100644 --- a/gcc/testsuite/g++.dg/cpp1y/constexpr-prvalue1.C +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-prvalue1.C @@ -1,6 +1,6 @@ // PR c++/116416 // { dg-do compile { target c++14 } } -// { dg-options "-O" } +// { dg-options "-O -fdump-tree-original" } struct Str { constexpr Str() {} @@ -17,14 +17,16 @@ extern void callback(Str str); void func1() { - callback(Str{"Test"}); + callback(Str{"Test1"}); } void func2() { - Str str{"Test"}; + Str str{"Test2"}; callback(str); } -// Check that we don't call Str::Str(char const*) -// { dg-final { scan-assembler-not "_ZN3StrC1EPKc" } } +// Check that the front end folds both the temporary initializer and +// that of 'str'. +// { dg-final { scan-tree-dump "{.str=\\(const char \\*\\) \"Test1\", .length=5}" "original" } } +// { dg-final { scan-tree-dump "{.str=\\(const char \\*\\) \"Test2\", .length=5}" "original" } } diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-prvalue1a.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-prvalue1a.C new file mode 100644 index 0000000..54176bf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-prvalue1a.C @@ -0,0 +1,33 @@ +// PR c++/116416 +// A version of constexpr-prvalue1.C that calls __builtin_is_constant_evaluated. +// { dg-do compile { target c++14 } } +// { dg-options "-O -fdump-tree-original" } + +struct Str { + constexpr Str() {} + constexpr Str(const char *instr) { + str = instr; length = 0; + for (auto index = 0; instr[index]; ++index) { + length += __builtin_is_constant_evaluated() ? 1 : 1; + } + } + const char *str = nullptr; + int length = 0; +}; +extern void callback(Str str); +void +func1() +{ + callback(Str{"Test1"}); +} +void +func2() +{ + Str str{"Test2"}; + callback(str); +} + +// Check that the front end folds both the temporary initializer and +// that of 'str'. +// { dg-final { scan-tree-dump "{.str=\\(const char \\*\\) \"Test1\", .length=5}" "original" } } +// { dg-final { scan-tree-dump "{.str=\\(const char \\*\\) \"Test2\", .length=5}" "original" } } diff --git a/gcc/testsuite/g++.dg/cpp1y/pr63996.C b/gcc/testsuite/g++.dg/cpp1y/pr63996.C index 8eee2e0..347c86c 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr63996.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr63996.C @@ -1,5 +1,4 @@ // { dg-do compile { target c++14 } } -// { dg-additional-options "-Wno-return-type" } constexpr int foo (int i) @@ -8,4 +7,4 @@ foo (int i) if (i == 23) return 0; } -constexpr int j = foo (1); // { dg-error "flows off the end|in .constexpr. expansion of" } +constexpr int j = foo (1); diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C index bcecea9..35beb27 100644 --- a/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-asm-5.C @@ -28,7 +28,7 @@ struct M { constexpr K size () const { return {}; } constexpr L data () const { return {}; } }; #if __cpp_constexpr_dynamic_alloc >= 201907L struct N { constexpr int size () const { return 3; } - constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } } + constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; #endif constexpr const char a[] = { 't', 'e', 's', 't' }; struct O { constexpr int size () const { return 4; } @@ -117,6 +117,7 @@ foo () asm ((M {})); #if __cpp_constexpr_dynamic_alloc >= 201907L asm ((N {})); // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } } + // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 } #endif asm ((O {})); asm ((P (0))); @@ -190,6 +191,7 @@ bar () asm ((M {})); #if __cpp_constexpr_dynamic_alloc >= 201907L asm ((N {})); // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } } + // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-1 } #endif asm ((O {})); asm ((P (0))); diff --git a/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C new file mode 100644 index 0000000..4494c70 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/class-deduction-inherited8.C @@ -0,0 +1,21 @@ +// PR c++/119687 +// { dg-do compile { target c++17 } } + +template <typename> class QFlagsStorage{}; + +template <typename Enum> struct QFlagsStorageHelper : QFlagsStorage<Enum> { + using QFlagsStorage<Enum>::QFlagsStorage; + +public: + QFlagsStorageHelper(Enum); +}; + +template <typename Enum> struct QFlags : public QFlagsStorageHelper<Enum> { + using Base = QFlagsStorageHelper<Enum>; + using Base::Base; + QFlags(Enum); +}; + +void f(int flag) { + QFlags{int{}}; +} diff --git a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit12.C b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit12.C index 8f003b8..b104b16 100644 --- a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit12.C +++ b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit12.C @@ -19,6 +19,6 @@ void g () { constexpr int i = 42; - constexpr auto a1 = fn0 (&i); + constexpr auto a1 = fn0 (&i); // { dg-error "called in a constant expression" } constexpr auto a2 = fn1 (i); // { dg-error "called in a constant expression" } } diff --git a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C index 8e230ef..f891814 100644 --- a/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C +++ b/gcc/testsuite/g++.dg/cpp23/constexpr-nonlit18.C @@ -24,7 +24,7 @@ f3 () } constexpr int -f4 () // { dg-message "declared here" "" { target c++20_down } } +f4 () { // { dg-message "is not usable as a 'constexpr' function because:" "" { target c++23 } .-1 } static const int a = f1 (1); // { dg-error "'a' defined 'static' in 'constexpr' function only available with" "" { target c++20_down } } return 0; // { dg-error "'a' defined 'static' in 'constexpr' context" "" { target c++23 } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C b/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C index fdc8320..4a7e494 100644 --- a/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C +++ b/gcc/testsuite/g++.dg/cpp26/pack-indexing2.C @@ -49,7 +49,7 @@ template<int N> int getT2 (auto... Ts) { - return Ts...[N]; // { dg-error "pack index is negative" } + return Ts...[N]; // { dg-error "pack index '-1' is negative" } } template<auto N, typename... Ts> @@ -63,7 +63,7 @@ template<auto N, typename... Ts> void badtype2 () { - Ts...[N] t; // { dg-error "pack index is out of range" } + Ts...[N] t; // { dg-error "pack index '1' is out of range for pack of length '1'" } } template<auto N, typename... Ts> @@ -77,7 +77,7 @@ template<auto N, typename... Ts> void badtype4 () { - Ts...[N] t; // { dg-error "pack index is negative" } + Ts...[N] t; // { dg-error "pack index '-1' is negative" } } int nonconst () { return 42; } diff --git a/gcc/testsuite/g++.dg/cpp26/static_assert1.C b/gcc/testsuite/g++.dg/cpp26/static_assert1.C index f9ac831..1d0e6f2 100644 --- a/gcc/testsuite/g++.dg/cpp26/static_assert1.C +++ b/gcc/testsuite/g++.dg/cpp26/static_assert1.C @@ -69,10 +69,11 @@ static_assert (false, M {}); // { dg-warning "'static_assert' with non-string me // { dg-error "static assertion failed: test" "" { target *-*-* } .-1 } #if __cpp_constexpr_dynamic_alloc >= 201907L struct N { constexpr int size () const { return 3; } - constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } } + constexpr const char *data () const { return new char[3] { 'b', 'a', 'd' }; } }; static_assert (true, N {}); // { dg-warning "'static_assert' with non-string message only available with" "" { target { c++20 && c++23_down } } } static_assert (false, N {}); // { dg-warning "'static_assert' with non-string message only available with" "" { target { c++20 && c++23_down } } } // { dg-error "constexpr string 'data\\\(\\\)\\\[0\\\]' must be a constant expression" "" { target c++20 } .-1 } + // { dg-error "'\\\* N\\\(\\\).N::data\\\(\\\)' is not a constant expression because allocated storage has not been deallocated" "" { target c++20 } .-2 } #endif constexpr const char a[] = { 't', 'e', 's', 't' }; struct O { constexpr int size () const { return 4; } diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25.C new file mode 100644 index 0000000..37ab932 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25.C @@ -0,0 +1,19 @@ +// PR c++/118626 +// { dg-do compile { target c++20 } } + +template<long> struct _Nth_type; + +template<class _Up> +struct variant { + template<class _Tp> static constexpr long __accepted_index = 0; + template<long _Np> using __to_type = _Nth_type<_Np>; + template<class _Tp> using __accepted_type = __to_type<__accepted_index<_Tp>>; + template<class = __accepted_type<_Up>> variant(_Up); +}; + +template<class _Tp> +struct Node { Node(_Tp); }; + +template<class R> using Tree = variant<Node<R>>; +using type = decltype(Tree{Node{42}}); +using type = Tree<int>; diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25a.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25a.C new file mode 100644 index 0000000..74ef1e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias25a.C @@ -0,0 +1,19 @@ +// PR c++/118626 +// { dg-do compile { target c++20 } } + +template<long> struct _Nth_type { using type = _Nth_type; }; + +template<class _Up> +struct variant { + template<class _Tp> static constexpr long __accepted_index = 0; + template<long _Np> using __to_type = typename _Nth_type<_Np>::type; + template<class _Tp, int = sizeof(_Tp)> using __accepted_type = __to_type<__accepted_index<_Tp>>; + template<class = __accepted_type<_Up>> variant(_Up); +}; + +template<class _Tp> +struct Node { Node(_Tp); }; + +template<class R> using Tree = variant<Node<R>>; +using type = decltype(Tree{Node{42}}); +using type = Tree<int>; diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda22.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda22.C new file mode 100644 index 0000000..2437b7e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda22.C @@ -0,0 +1,21 @@ +// PR c++/118698 +// { dg-do compile { target c++20 } } + +template <typename T> struct foo {}; +template <typename T> struct bar {}; + +template <class T> T&& declval (); + +template <typename T, typename U> +concept callable = requires { declval<T>()(declval<U>()); }; + +template <typename T, template <typename...> typename U> +concept is_specialization_of = callable<decltype([]<typename... Args>( U<Args...> const& ) { }),T>; + +static_assert( is_specialization_of<foo<int>,foo> == true ); +static_assert( is_specialization_of<foo<int>,bar> == false ); + +template <typename T> concept is_foo = is_specialization_of<T,foo>; + +static_assert( is_foo<foo<int>> ); +static_assert( is_foo<bar<int>> == false ); diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C new file mode 100644 index 0000000..f442120 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda23.C @@ -0,0 +1,12 @@ +// PR c++/119175 +// { dg-do compile { target c++20 } } + +template<int = 0> +static void from() requires requires { + []<int> requires requires { [] {}; } {}; +} +{} + +int main() { + from(); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires41.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires41.C new file mode 100644 index 0000000..28c9761 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires41.C @@ -0,0 +1,25 @@ +// PR c++/117849 +// { dg-do compile { target c++20 } } + +template<int N> +struct array { + constexpr int size() const { return N; } +}; + +struct vector { + int _size = 3; + constexpr int size() const { return _size; } +}; + +template<int N> +struct integral_constant { + constexpr operator int() const { return N; } +}; + +template<class T> +concept StaticSize = requires (T& t) { + typename integral_constant<t.size()>; +}; + +static_assert(StaticSize<array<5>>); +static_assert(!StaticSize<vector>); diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C index b84aaf9..99d1307 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor16.C @@ -3,5 +3,5 @@ struct A { virtual ~A (); }; struct B : virtual A { constexpr ~B () {} }; -// { dg-error "'struct B' has virtual base classes" "" { target c++20 } .-1 } +// { dg-error "'constexpr' destructor in 'struct B' that has virtual base classes" "" { target c++20 } .-1 } // { dg-error "'constexpr' destructors only available with" "" { target c++17_down } .-2 } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C index 463eaca..f4546c1 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C @@ -3,7 +3,7 @@ struct S { int *s; - constexpr S () : s(new int) {} // { dg-error "is not a constant expression because allocated storage has not been deallocated" } + constexpr S () : s(new int) {} S (const S &) = delete; S &operator= (const S &) = delete; constexpr ~S () { delete s; } @@ -17,3 +17,4 @@ foo (S v) } static_assert (foo (S ())); // { dg-error "non-constant condition for static assertion" } +// { dg-error "is not a constant expression because allocated storage has not been deallocated" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C index f9f8223..e543ce4 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dynamic10.C @@ -5,7 +5,7 @@ struct C { virtual void a(); }; struct B { virtual void b(); }; -struct A : virtual B, C { virtual void c(); }; // { dg-error ".struct A. has virtual base classes" } +struct A : virtual B, C { virtual void c(); }; // { dg-error "virtual base classes" } constexpr A a; // { dg-error "call" } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C index ee62f18..17c9f54 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new24.C @@ -6,14 +6,14 @@ int a; constexpr char * f1 () { - constexpr auto p = new char[(long int) &a]; // { dg-error "size not constant" } + constexpr auto p = new char[(long int) &a]; // { dg-error "conversion from pointer" } return p; } constexpr char * f2 () { - auto p = new char[(long int) &a]; // { dg-error "size not constant" } + auto p = new char[(long int) &a]; // { dg-error "conversion from pointer" } return p; } diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C index c82bd43..d8e53b2 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new26.C @@ -4,7 +4,7 @@ constexpr int * f7 () { - int *p = new int (2); // { dg-error "is not a constant expression because it refers to a result of" } + int *p = new int (2); // { dg-message "allocated here" } delete p; return p; } @@ -12,6 +12,5 @@ f7 () void g () { - constexpr auto v7 = f7 (); + constexpr auto v7 = f7 (); // { dg-error "is not a constant expression because it refers to a result of" } } - diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C index 5d9f1925..30e453e 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new3.C @@ -5,19 +5,19 @@ constexpr int * f1 () { - return new int (2); // { dg-error "is not a constant expression because it refers to a result of" } + return new int (2); // { dg-message "allocated here" } } -constexpr auto v1 = f1 (); +constexpr auto v1 = f1 (); // { dg-error "is not a constant expression because it refers to a result of" } constexpr bool f2 () { - int *p = new int (3); // { dg-error "is not a constant expression because allocated storage has not been deallocated" } + int *p = new int (3); // { dg-message "allocated here" } return false; } -constexpr auto v2 = f2 (); +constexpr auto v2 = f2 (); // { dg-error "is not a constant expression because allocated storage has not been deallocated" } constexpr bool f3 () @@ -64,12 +64,12 @@ constexpr auto v6 = f6 (); // { dg-message "in 'constexpr' expansion of" } constexpr int * f7 () { - int *p = new int (2); // { dg-error "is not a constant expression because it refers to a result of" } + int *p = new int (2); // { dg-message "allocated here" } delete p; return p; } -constexpr auto v7 = f7 (); +constexpr auto v7 = f7 (); // { dg-error "is not a constant expression because it refers to a result of" } constexpr bool f8_impl (int *p) diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-vector1.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-vector1.C new file mode 100644 index 0000000..196c6ec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-vector1.C @@ -0,0 +1,8 @@ +// PR c++/113835 +// { dg-timeout-factor 0.05 } +// { dg-do compile { target c++20_only } } + +#include <vector> +const std::size_t N = 1'000'000; +std::vector<int> x(N); +int main() {} diff --git a/gcc/testsuite/g++.dg/cpp2a/constinit14.C b/gcc/testsuite/g++.dg/cpp2a/constinit14.C index 06c4cb4..26d82fe67 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constinit14.C +++ b/gcc/testsuite/g++.dg/cpp2a/constinit14.C @@ -2,12 +2,13 @@ // { dg-do compile { target c++20 } } struct Value { - Value() : v{new int{42}} {} // { dg-error "result of 'operator new'" "" { target implicit_constexpr } } + Value() : v{new int{42}} {} int* v; }; struct S { static constinit inline Value v{}; // { dg-error "variable .S::v. does not have a constant initializer|call to non-.constexpr. function" } + // { dg-error "result of 'operator new'" "" { target implicit_constexpr } .-1 } }; int main() { return *S::v.v; } diff --git a/gcc/testsuite/g++.dg/cpp2a/constinit20.C b/gcc/testsuite/g++.dg/cpp2a/constinit20.C new file mode 100644 index 0000000..9b04391 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constinit20.C @@ -0,0 +1,18 @@ +// PR c++/119652 +// { dg-do compile { target c++20 } } + +struct __shared_count { + constexpr __shared_count() {} + ~__shared_count(); + int _M_pi = 0; +}; +struct shared_ptr { + __shared_count _M_refcount; +}; +struct A { + A() = default; + shared_ptr m; +}; +constinit A a; +constinit A b {}; +constinit A c = {}; diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires2.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires2.C new file mode 100644 index 0000000..be5a71a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires2.C @@ -0,0 +1,8 @@ +// PR c++/99546 +// { dg-do compile { target c++20 } } + +int main() { + constexpr auto b = requires { []{}; }; + static_assert(b); + static_assert(!b); // { dg-error "assertion failed" } +} diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires3.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires3.C new file mode 100644 index 0000000..8c4ef06 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires3.C @@ -0,0 +1,6 @@ +// PR c++/113925 +// { dg-do compile { target c++20 } } + +template<bool B> +struct b{}; +static_assert(requires { b<([]()consteval{ return true; }())>{}; }); diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires4.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires4.C new file mode 100644 index 0000000..f3bb041 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires4.C @@ -0,0 +1,6 @@ +// PR c++/106976 +// { dg-do compile { target c++20 } } + +struct S{ + constexpr static auto s = requires { []; }; // { dg-error "expected '\{'" } +}; diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires5.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires5.C new file mode 100644 index 0000000..c818313 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires5.C @@ -0,0 +1,10 @@ +// PR c++/109961 +// { dg-do compile { target c++20 } } + +auto a = requires{ + []( int b ) consteval { + if( b ) { + throw b; + } + }( 0 ); +}; diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ13.C b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13.C new file mode 100644 index 0000000..8fd0a31 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13.C @@ -0,0 +1,7 @@ +// PR c++/119574 +// { dg-do compile { target c++20 } } + +template <class F = decltype([] <auto G = [] {}> () {})> +void f(F op = {}) { op(); } + +int main() { f(); } diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ13a.C b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13a.C new file mode 100644 index 0000000..8aaefd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13a.C @@ -0,0 +1,8 @@ +// PR c++/119574 +// A version of lambda-targ13.C with extra template parameters. +// { dg-do compile { target c++20 } } + +template <int = 0, class F = decltype([] <int = 1, auto G = [] {}> () {})> +void f(F op = {}) { op(); } + +int main() { f(); } diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ13b.C b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13b.C new file mode 100644 index 0000000..7f541c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ13b.C @@ -0,0 +1,8 @@ +// PR c++/119574 +// A version of lambda-targ13.C where the inner lambda returns non-void. +// { dg-do compile { target c++20 } } + +template <class F = decltype([] <auto G = [] { return 42; }> () { return G(); })> +constexpr int f(F op = {}) { return op(); } + +static_assert(f() == 42); diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C b/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C new file mode 100644 index 0000000..debb15e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ14.C @@ -0,0 +1,12 @@ +// PR c++/119345 +// { dg-do compile { target c++20 } } + +void f(auto... args) { + [args...]<int... i> { + (..., [args...] { i; }); + }.template operator()<0>(); +} + +int main() { + f(); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval27.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval27.C new file mode 100644 index 0000000..941fe63 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval27.C @@ -0,0 +1,10 @@ +// PR c++/117530 +// { dg-do compile { target c++20 } } + +template <class> struct A; +template <class T> using B = decltype([]() -> A<T>::X { return 0; }); +template <class T> struct A { + typedef int X; + typedef B<T> U; +}; +B<short> b; diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite6.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite6.C new file mode 100644 index 0000000..0ec74e8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite6.C @@ -0,0 +1,33 @@ +// { dg-do compile { target c++20 } } + +// We wrongly considered D to be ne_comparable because we were looking for a +// corresponding op!= for N::op== in ::, because ::op== happened to be the +// first thing in the lookup set. + +template<bool, typename _Tp = void> +struct enable_if; + +template<typename _Tp> +struct enable_if<true, _Tp> +{ typedef _Tp type; }; + +template <class T, class U> struct A { }; + +namespace N { + struct X { }; + template <class T> auto operator== (const A<T,X>&, const A<T,X>&) + -> typename enable_if<sizeof(T() == T()), bool>::type; + template <class T> auto operator!= (const A<T,X>&, const A<T,X>&) + -> typename enable_if<sizeof(T() != T()), bool>::type; +} + +template<typename T, typename U = T> +concept ne_comparable += requires (const A<T,N::X>& t, const A<U,N::X>& u) { + t != u; +}; + +struct D { }; +int operator==(D, D); +bool operator!=(D, D) = delete; +static_assert( ! ne_comparable<D> ); diff --git a/gcc/testsuite/g++.dg/eh/pr119507.C b/gcc/testsuite/g++.dg/eh/pr119507.C new file mode 100644 index 0000000..168779b --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/pr119507.C @@ -0,0 +1,21 @@ +// { dg-do compile { target comdat_group } } +// ARM EABI has its own exception handling data handling and does not use gcc_except_table +// { dg-skip-if "!TARGET_EXCEPTION_DATA" { arm_eabi } } +// Solaris/SPARC as uses a widely different COMDAT section syntax. +// { dg-skip-if "Solaris/SPARC as syntax" { sparc*-*-solaris2* && { ! gas } } } +// Force off function sections +// Force on exceptions +// { dg-options "-fno-function-sections -fexceptions" } +// PR middle-end/119507 + + +inline int comdat() { try { throw 1; } catch (int) { return 1; } return 0; } +int another_func_with_exception() { try { throw 1; } catch (int) { return 1; } return 0; } +inline int comdat1() { try { throw 1; } catch (int) { return 1; } return 0; } +int foo() { return comdat() + comdat1(); } + +// Make sure the gcc puts the exception table for both comdat and comdat1 in their own section +// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z6comdatv" 1 } } +// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z7comdat1v" 1 } } +// There should be 3 exception tables, +// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table" 3 } } diff --git a/gcc/testsuite/g++.dg/ext/musttail1.C b/gcc/testsuite/g++.dg/ext/musttail1.C new file mode 100644 index 0000000..fd9b386 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/musttail1.C @@ -0,0 +1,38 @@ +// PR ipa/119376 +// { dg-do compile { target { musttail && c++11 } } } +// { dg-options "-Wmaybe-musttail-local-addr" } + +int foo (int &); +int bar (int &&); +int corge (int *); + +int +baz (int &x) +{ + if (x == 1) + [[gnu::musttail]] return foo (x); + if (x == 2) + { + int a = 42; + [[gnu::musttail]] return foo (a); // { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } + } + if (x == 3) + { + int a = 42; + foo (a); + [[gnu::musttail]] return foo (x); // { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } + } + return 0; +} + +int +qux (int &&x) +{ + [[gnu::musttail]] return bar (x + 1); // { dg-warning "address of local variable passed to 'musttail' call argument" } +} + +int +freddy (int x) +{ + [[gnu::musttail]] return foo (x); // { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } +} diff --git a/gcc/testsuite/g++.dg/ext/musttail2.C b/gcc/testsuite/g++.dg/ext/musttail2.C new file mode 100644 index 0000000..ac99aaf --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/musttail2.C @@ -0,0 +1,38 @@ +// PR ipa/119376 +// { dg-do compile { target { musttail && c++11 } } } +// { dg-options "-Wextra" } + +int foo (int &); +int bar (int &&); +int corge (int *); + +int +baz (int &x) +{ + if (x == 1) + [[clang::musttail]] return foo (x); + if (x == 2) + { + int a = 42; + [[clang::musttail]] return foo (a); // { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } + } + if (x == 3) + { + int a = 42; + foo (a); + [[clang::musttail]] return foo (x); // { dg-warning "address of automatic variable 'a' can escape to 'musttail' call" } + } + return 0; +} + +int +qux (int &&x) +{ + [[clang::musttail]] return bar (x + 1); // { dg-warning "address of local variable passed to 'musttail' call argument" } +} + +int +freddy (int x) +{ + [[clang::musttail]] return foo (x); // { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } +} diff --git a/gcc/testsuite/g++.dg/ext/musttail3.C b/gcc/testsuite/g++.dg/ext/musttail3.C new file mode 100644 index 0000000..1c4b939 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/musttail3.C @@ -0,0 +1,37 @@ +// PR ipa/119376 +// { dg-do compile { target { musttail && c++11 } } } + +int foo (int &); +int bar (int &&); +int corge (int *); + +int +baz (int &x) +{ + if (x == 1) + [[gnu::musttail]] return foo (x); + if (x == 2) + { + int a = 42; + [[gnu::musttail]] return foo (a); // { dg-warning "address of automatic variable 'a' passed to 'musttail' call argument" } + } + if (x == 3) + { + int a = 42; + foo (a); + [[gnu::musttail]] return foo (x); + } + return 0; +} + +int +qux (int &&x) +{ + [[gnu::musttail]] return bar (x + 1); // { dg-warning "address of local variable passed to 'musttail' call argument" } +} + +int +freddy (int x) +{ + [[gnu::musttail]] return foo (x); // { dg-warning "address of parameter 'x' passed to 'musttail' call argument" } +} diff --git a/gcc/testsuite/g++.dg/ext/pragma-target2.C b/gcc/testsuite/g++.dg/ext/pragma-target2.C new file mode 100644 index 0000000..53eb7dd --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pragma-target2.C @@ -0,0 +1,18 @@ +// PR c++/114772 +// { dg-do compile { target x86_64-*-* } } + +template<typename V, bool STREAMING> +inline __attribute__((always_inline)) +__attribute__((warn_unused_result)) +int walk_document(V visitor) {return 0;} + +template<bool STREAMING> +void parse_document() { + int r = walk_document<bool, STREAMING>(false); +} + +void stage2_next() { + parse_document<true>(); +} + +#pragma GCC target("pclmul") diff --git a/gcc/testsuite/g++.dg/ext/type_pack_element2.C b/gcc/testsuite/g++.dg/ext/type_pack_element2.C index 1bf7753..1b07673 100644 --- a/gcc/testsuite/g++.dg/ext/type_pack_element2.C +++ b/gcc/testsuite/g++.dg/ext/type_pack_element2.C @@ -2,7 +2,7 @@ int p; -using type = __type_pack_element<&p, int>; // { dg-error "not an integral constant" } +using type = __type_pack_element<&p, int>; // { dg-error "non-integral type" } using type = __type_pack_element<1, int>; // { dg-error "out of range" } using type = __type_pack_element<2, int, char>; // { dg-error "out of range" } using type = __type_pack_element<-1, int>; // { dg-error "negative" } diff --git a/gcc/testsuite/g++.dg/ext/type_pack_element4.C b/gcc/testsuite/g++.dg/ext/type_pack_element4.C index aa508c7..5a39194 100644 --- a/gcc/testsuite/g++.dg/ext/type_pack_element4.C +++ b/gcc/testsuite/g++.dg/ext/type_pack_element4.C @@ -3,7 +3,7 @@ template <typename... _Elements> class tuple{}; template <unsigned long __i, typename... _Elements> -__type_pack_element<__i, _Elements...> &get(tuple<_Elements...> &__t) noexcept; // { dg-error "index is out of range" } +__type_pack_element<__i, _Elements...> &get(tuple<_Elements...> &__t) noexcept; // { dg-error "out of range" } tuple<int,int> data; template <unsigned long Level> unsigned take_impl(unsigned idx) { diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp index 50f60c4..04c7c95 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov.exp +++ b/gcc/testsuite/g++.dg/gcov/gcov.exp @@ -21,12 +21,19 @@ load_lib g++-dg.exp load_lib gcov.exp global GXX_UNDER_TEST +global GCOV_UNDER_TEST -# Find gcov in the same directory as $GXX_UNDER_TEST. -if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] +# Find gcov in the same directory as $GXX_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] + } else { + set GCOV [gcc-transform-out-of-tree gcov] + } } else { - set GCOV [gcc-transform-out-of-tree gcov] + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/g++.dg/gomp/append-args-1.C b/gcc/testsuite/g++.dg/gomp/append-args-1.C index 4e13905..70952e0 100644 --- a/gcc/testsuite/g++.dg/gomp/append-args-1.C +++ b/gcc/testsuite/g++.dg/gomp/append-args-1.C @@ -49,7 +49,7 @@ template<typename T, typename T2, typename T3> void repl2(T, T2, T3, T3); #pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ append_args(interop(target, targetsync, prefer_type(1)), \ - interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) + interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) template<typename T, typename T2> void base2(T x, T2 y); @@ -58,7 +58,7 @@ template<typename T,typename T3> void tooFewRepl(T, T, T3); #pragma omp declare variant(tooFewRepl) match(construct={dispatch}) \ append_args(interop(target, targetsync, prefer_type(1)), \ - interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) + interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) template<typename T, typename T2> void tooFewBase(T x, T2 y); @@ -72,7 +72,7 @@ void tooFewBase(T x, T2 y); template<typename T, typename T2> void repl3(T, T2, ...); #pragma omp declare variant(repl3) match(construct={dispatch}) \ - append_args(interop(prefer_type("cuda", "hsa"))) + append_args(interop(target, prefer_type("cuda", "hsa"))) template<typename T> void base3(T, ...); diff --git a/gcc/testsuite/g++.dg/gomp/append-args-2.C b/gcc/testsuite/g++.dg/gomp/append-args-2.C index 33cd268..62f0177 100644 --- a/gcc/testsuite/g++.dg/gomp/append-args-2.C +++ b/gcc/testsuite/g++.dg/gomp/append-args-2.C @@ -30,7 +30,7 @@ template<typename T, typename T2, typename T3> void repl2(T, T2, T3, T3); /* { dg-error "argument 3 of 'repl2' must be of 'omp_interop_t'" } */ #pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ append_args(interop(target, targetsync, prefer_type(1)), /* { dg-note "'append_args' specified here" } */ \ - interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) + interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) template<typename T, typename T2> void base2(T x, T2 y); @@ -39,7 +39,7 @@ template<typename T,typename T3> void tooFewRepl(T, T, T3); /* { dg-error "argument 3 of 'tooFewRepl' must be of 'omp_interop_t'" } */ #pragma omp declare variant(tooFewRepl) match(construct={dispatch}) \ append_args(interop(target, targetsync, prefer_type(1)), /* { dg-note "'append_args' specified here" } */ \ - interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) + interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) template<typename T, typename T2> void tooFewBase(T x, T2 y); @@ -48,6 +48,6 @@ void tooFewBase(T x, T2 y); template<typename T, typename T2> void repl3(T, T2, ...); /* { dg-error "argument 2 of 'repl3' must be of 'omp_interop_t'" } */ #pragma omp declare variant(repl3) match(construct={dispatch}) \ - append_args(interop(prefer_type("cuda", "hsa"))) /* { dg-note "'append_args' specified here" } */ + append_args(interop(target, prefer_type("cuda", "hsa"))) /* { dg-note "'append_args' specified here" } */ template<typename T> void base3(T, ...); diff --git a/gcc/testsuite/g++.dg/gomp/append-args-6.C b/gcc/testsuite/g++.dg/gomp/append-args-6.C index 039d9fa..a97a015 100644 --- a/gcc/testsuite/g++.dg/gomp/append-args-6.C +++ b/gcc/testsuite/g++.dg/gomp/append-args-6.C @@ -14,13 +14,13 @@ void f1(omp_interop_t &) { } /* { dg-error "argument 1 of 'f1' must be of 'omp_interop_t'" "" { target c } .-1 } */ /* { dg-note "initializing argument 1 of 'void f1\\(omp_interop_t&\\)'" "" { target c++ } .-2 } */ #pragma omp declare variant(f1) match(construct={dispatch}) \ - append_args(interop(prefer_type({attr("ompx_fun")}))) + append_args(interop(targetsync, prefer_type({attr("ompx_fun")}))) void g1(void); /* { dg-note "'append_args' specified here" "" { target c } .-2 } */ /* { dg-error "cannot bind non-const lvalue reference of type 'omp_interop_t&' to an rvalue of type 'omp_interop_t'" "" { target c++ } .-4 } */ int f2(omp_interop_t); -#pragma omp declare variant(f2) append_args(interop(prefer_type("cuda"))) \ +#pragma omp declare variant(f2) append_args(interop(targetsync, prefer_type("cuda"))) \ match(construct={dispatch}) int g2(void) { return 5; } diff --git a/gcc/testsuite/g++.dg/gomp/append-args-7.C b/gcc/testsuite/g++.dg/gomp/append-args-7.C index 97df32e..7c70731 100644 --- a/gcc/testsuite/g++.dg/gomp/append-args-7.C +++ b/gcc/testsuite/g++.dg/gomp/append-args-7.C @@ -64,7 +64,7 @@ template<typename T, typename T2, typename T3> void repl2(T, T2, T3, T3); #pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ append_args(interop(target, targetsync, prefer_type(1)), \ - interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) + interop(target, targetsync, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) template<typename T, typename T2> void base2(T x, T2 y); diff --git a/gcc/testsuite/g++.dg/gomp/append-args-8.C b/gcc/testsuite/g++.dg/gomp/append-args-8.C index 786a2b3..3052c5b 100644 --- a/gcc/testsuite/g++.dg/gomp/append-args-8.C +++ b/gcc/testsuite/g++.dg/gomp/append-args-8.C @@ -20,7 +20,7 @@ template<typename T, typename T2, typename T3> void repl2(T, T2, T3, T3); #pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ append_args(interop(target, targetsync, prefer_type(1)), \ - interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) + interop(target, prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) template<typename T, typename T2> void base2(T x, T2 y); @@ -31,7 +31,7 @@ void repl3(T, T2, T2, T2, ...); #pragma omp declare variant(repl3) match(construct={dispatch}) \ append_args( interop(target, prefer_type("cuda", "hsa")), \ interop(targetsync), \ - interop(prefer_type({attr("ompx_nop")})) ) + interop(target, prefer_type({attr("ompx_nop")})) ) template<typename T> void base3(T, ...); @@ -68,10 +68,9 @@ test (int *a, int *b) /* { dg-final { scan-tree-dump-times "interopobjs.\[0-9\]+\\\[0\\\] = &interop\\.\[0-9\]+;" 2 "gimple" } } */ /* { dg-final { scan-tree-dump-times "interopobjs.\[0-9\]+\\\[1\\\] = &interop\\.\[0-9\]+;" 1 "gimple" } } */ /* { dg-final { scan-tree-dump-times "interopobjs.\[0-9\]+\\\[2\\\] = &interop\\.\[0-9\]+;" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[0\\\] = 0;" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[0\\\] = 1;" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[0\\\] = 1;" 2 "gimple" } } */ /* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[1\\\] = 2;" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[2\\\] = 0;" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "tgt_tgtsync.\[0-9\]+\\\[2\\\] = 1;" 1 "gimple" } } */ /* { dg-final { scan-tree-dump-times "pref_type.\[0-9\]+\\\[0\\\] = \"\\\\x80\\\\x03\\\\x80ompx_nop\\\\x00\\\\x00\\\\x80\\\\x02\\\\x80\\\\x00\\\\x80\\\\x80ompx_all\\\\x00\\\\x00\";" 1 "gimple" } } */ /* { dg-final { scan-tree-dump-times "pref_type.\[0-9\]+\\\[0\\\] = \"\\\\x80\\\\x01\\\\x80\\\\x00\\\\x80\\\\x07\\\\x80\\\\x00\";" 1 "gimple" } } */ /* { dg-final { scan-tree-dump-times "pref_type.\[0-9\]+\\\[1\\\] = 0B;" 1 "gimple" } } */ @@ -83,11 +82,11 @@ test (int *a, int *b) /* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(D\.\[0-9\]+\\);" 2 "gimple" } } */ /* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(a, D\.\[0-9\]+\\);" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(D\.\[0-9\]+, 1, interopobjs\.\[0-9\], tgt_tgtsync\.\[0-9\]+, pref_type.2, 0, 0B, 0, 0B, 0, 0B\\);" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(D\.\[0-9\]+, 1, &interopobjs\.\[0-9\], &tgt_tgtsync\.\[0-9\]+, &pref_type.2, 0, 0B, 0, 0B, 0, 0B\\);" 1 "gimple" } } */ /* { dg-final { scan-tree-dump-times "repl2<int\\*, int\\*, omp_interop_t> \\(b, D\.\[0-9\]+, obj1, interop\.\[0-9\]+\\);" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 1, interopobjs\.\[0-9\]+, 0, 0B\\);" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 1, &interopobjs\.\[0-9\]+, 0, 0B\\);" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(-5, 0, 0B, 0B, 0B, 0, 0B, 3, interopobjs\.\[0-9\]+, 0, 0B\\);" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(-5, 0, 0B, 0B, 0B, 0, 0B, 3, &interopobjs\.\[0-9\]+, 0, 0B\\);" 1 "gimple" } } */ /* { dg-final { scan-tree-dump-times "repl3<int\\*, omp_interop_t> \\(a, interop\.\[0-9\]+, interop\.\[0-9\]+, interop\.\[0-9\]+, 1, 2, \"abc\"\\);" 1 "gimple" } } */ -/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(-5, 3, interopobjs\.\[0-9\]+, tgt_tgtsync\.\[0-9\]+, pref_type\.\[0-9\]+, 0, 0B, 0, 0B, 0, 0B\\);" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "__builtin_GOMP_interop \\(-5, 3, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+, &pref_type\.\[0-9\]+, 0, 0B, 0, 0B, 0, 0B\\);" 1 "gimple" } } */ diff --git a/gcc/testsuite/g++.dg/gomp/interop-5.C b/gcc/testsuite/g++.dg/gomp/interop-5.C index 89396cf..0c65f83 100644 --- a/gcc/testsuite/g++.dg/gomp/interop-5.C +++ b/gcc/testsuite/g++.dg/gomp/interop-5.C @@ -41,14 +41,14 @@ f () constexpr T3 ifr_level_zero = (T3) (omp_ifr_sycl + 2); constexpr T3 ifr_invalid = (T3) 99; - #pragma omp interop init ( obj1, obj2) use (obj3) destroy(obj4) init(obj5) destroy(obj6) use(obj7) - /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 2 "original" } } */ +#pragma omp interop init (target: obj1, obj2) use (obj3) destroy(obj4) init(targetsync:obj5) destroy(obj6) use(obj7) + /* { dg-final { scan-tree-dump-times "#pragma omp interop use\\(obj7\\) destroy\\(obj6\\) init\\(targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 2 "original" } } */ #pragma omp interop nowait init (targetsync : obj1, obj2) use (obj3) destroy(obj4) init(target, targetsync : obj5) destroy(obj6) use(obj7) depend(inout: x) /* { dg-final { scan-tree-dump-times "#pragma omp interop depend\\(inout:x\\) use\\(obj7\\) destroy\\(obj6\\) init\\(target, targetsync: obj5\\) destroy\\(obj4\\) use\\(obj3\\) init\\(targetsync: obj2\\) init\\(targetsync: obj1\\) nowait\[\r\n\]" 2 "original" } } */ - #pragma omp interop init ( obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5) - /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(obj2\\) init\\(obj1\\)\[\r\n\]" 2 "original" } } */ +#pragma omp interop init (target: obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5) + /* { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target, targetsync: obj5\\) init\\(targetsync: obj4\\) init\\(target: obj3\\) init\\(target: obj2\\) init\\(target: obj1\\)\[\r\n\]" 2 "original" } } */ /* -------------------------------------------- */ diff --git a/gcc/testsuite/g++.dg/lto/pr119614_0.C b/gcc/testsuite/g++.dg/lto/pr119614_0.C new file mode 100644 index 0000000..09c07fb --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr119614_0.C @@ -0,0 +1,34 @@ +// PR tree-optimization/119614 +// { dg-lto-do link } +// { dg-lto-options { { -O2 -fPIC -flto -flto-partition=max } } } +// { dg-require-effective-target shared } +// { dg-require-effective-target fpic } +// { dg-require-effective-target musttail } +// { dg-extra-ld-options "-shared" } + +struct S {} b; +char *foo (); +int e, g; +void bar (); +void corge (S); + +[[gnu::noinline]] static char * +baz () +{ + bar (); + return 0; +} + +const char * +qux () +{ + if (e) + { + S a = b; + corge (a); + if (g) + return 0; + [[gnu::musttail]] return baz (); + } + return foo (); +} diff --git a/gcc/testsuite/g++.dg/modules/gc-3_a.C b/gcc/testsuite/g++.dg/modules/gc-3_a.C new file mode 100644 index 0000000..b4adb2a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/gc-3_a.C @@ -0,0 +1,7 @@ +// PR c++/119564 +// { dg-additional-options "-fmodules -Wtemplate-names-tu-local" } +// { dg-module-cmi M } + +export module M; +static void foo() {}; // { dg-message "declared" } +template <typename> void bar() { foo(); } // { dg-warning "TU-local" } diff --git a/gcc/testsuite/g++.dg/modules/gc-3_b.C b/gcc/testsuite/g++.dg/modules/gc-3_b.C new file mode 100644 index 0000000..1d1dc87 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/gc-3_b.C @@ -0,0 +1,4 @@ +// PR c++/119564 +// { dg-additional-options "-fmodules -fno-module-lazy --param=ggc-min-expand=0 --param=ggc-min-heapsize=0" } + +import M; diff --git a/gcc/testsuite/g++.dg/modules/lambda-10_a.H b/gcc/testsuite/g++.dg/modules/lambda-10_a.H new file mode 100644 index 0000000..1ad1a80 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-10_a.H @@ -0,0 +1,17 @@ +// PR c++/119755 +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } + +template <typename _Out> void format(_Out) { + constexpr int __term = 1; + [&] { __term; }; + [&] { const int outer = __term; { __term; } }; + [&]() noexcept { __term; }; + [&]() noexcept { const int outer = __term; { __term; } }; + [&](auto) { int n[__term]; }(0); + [&](auto) noexcept { int n[__term]; }(0); +} + +inline void vformat() { + format(0); +} diff --git a/gcc/testsuite/g++.dg/modules/lambda-10_b.C b/gcc/testsuite/g++.dg/modules/lambda-10_b.C new file mode 100644 index 0000000..3556bce --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-10_b.C @@ -0,0 +1,7 @@ +// PR c++/119755 +// { dg-additional-options "-fmodules" } + +import "lambda-10_a.H"; +int main() { + vformat(); +} diff --git a/gcc/testsuite/g++.dg/modules/lambda-8_b.C b/gcc/testsuite/g++.dg/modules/lambda-8_b.C index 7ace494..96578ba 100644 --- a/gcc/testsuite/g++.dg/modules/lambda-8_b.C +++ b/gcc/testsuite/g++.dg/modules/lambda-8_b.C @@ -4,4 +4,4 @@ #include "lambda-8.h" import "lambda-8_a.H"; -// { dg-error "conflicting global module declaration" "" { target *-*-* } 0 } +// { dg-error "conflicting imported declaration" "" { target *-*-* } 0 } diff --git a/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C b/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C index f1b1aeb..5756057 100644 --- a/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C +++ b/gcc/testsuite/g++.dg/modules/leg-merge-4_c.C @@ -11,8 +11,8 @@ void foo () X *p; } -// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:4:\[0-9]*: error: conflicting global module declaration 'float bob'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:4:\[0-9]*: note: existing declaration 'int bob'\n\[^\n]*leg-merge-4_c.C:9:\[0-9]*: note: during load of binding '::bob'$" } +// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:4:\[0-9]*: error: conflicting type for imported declaration 'float bob'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:4:\[0-9]*: note: existing declaration 'int bob'\n\[^\n]*leg-merge-4_c.C:9:\[0-9]*: note: during load of binding '::bob'$" } -// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:5:\[0-9]*: error: conflicting global module declaration 'int frob\\(\\)'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:5:\[0-9]*: note: existing declaration 'void frob\\(\\)'\n\[^\n]*leg-merge-4_c.C:10:\[0-9]*: note: during load of binding '::frob'$" } +// { dg-regexp "\nIn module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:5:\[0-9]*: error: conflicting type for imported declaration 'int frob\\(\\)'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:5:\[0-9]*: note: existing declaration 'void frob\\(\\)'\n\[^\n]*leg-merge-4_c.C:10:\[0-9]*: note: during load of binding '::frob'$" } -// { dg-regexp "In module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:6:\[0-9]*: error: conflicting global module declaration 'union X'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:6:\[0-9]*: note: existing declaration 'class X'\n\[^\n]*leg-merge-4_c.C:11:\[0-9]*: note: during load of binding '::X'$" } +// { dg-regexp "In module \[^\n]*leg-merge-4_b.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_b.H:6:\[0-9]*: error: conflicting type for imported declaration 'union X'\nIn module \[^\n]*leg-merge-4_a.H, imported at \[^\n]*leg-merge-4_c.C:\[0-9]*:\n\[^\n]*leg-merge-4_a.H:6:\[0-9]*: note: existing declaration 'class X'\n\[^\n]*leg-merge-4_c.C:11:\[0-9]*: note: during load of binding '::X'$" } diff --git a/gcc/testsuite/g++.dg/modules/noexcept-3_a.C b/gcc/testsuite/g++.dg/modules/noexcept-3_a.C new file mode 100644 index 0000000..00494d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-3_a.C @@ -0,0 +1,14 @@ +// PR c++/119462 +// { dg-additional-options "-fmodules -std=c++20 -Wno-global-module" } +// { dg-module-cmi M:part } + +module; +struct exception_ptr { + // implicitly noexcept and constexpr + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; +export module M:part; +export template <typename = int> void enqueue() { + exception_ptr e; + e == e; +} diff --git a/gcc/testsuite/g++.dg/modules/noexcept-3_b.C b/gcc/testsuite/g++.dg/modules/noexcept-3_b.C new file mode 100644 index 0000000..f26f8f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-3_b.C @@ -0,0 +1,12 @@ +// PR c++/119462 +// { dg-additional-options "-fmodules -std=c++20 -Wno-global-module" } +// { dg-module-cmi M } + +module; +struct exception_ptr { + // implicitly noexcept and constexpr, but this isn't known yet + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; +export module M; +export import :part; +export using ::exception_ptr; diff --git a/gcc/testsuite/g++.dg/modules/noexcept-3_c.C b/gcc/testsuite/g++.dg/modules/noexcept-3_c.C new file mode 100644 index 0000000..a1e98a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-3_c.C @@ -0,0 +1,11 @@ +// PR c++/119462 +// { dg-additional-options "-fmodules -std=c++20" } + +import M; +int main() { + enqueue(); + + constexpr exception_ptr e; + static_assert(e == e); + static_assert(noexcept(e == e)); +} diff --git a/gcc/testsuite/g++.dg/modules/noexcept-4_a.H b/gcc/testsuite/g++.dg/modules/noexcept-4_a.H new file mode 100644 index 0000000..b888a1b --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-4_a.H @@ -0,0 +1,6 @@ +// { dg-additional-options "-fmodule-header -std=c++20" } +// { dg-module-cmi {} } + +struct exception_ptr { + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; diff --git a/gcc/testsuite/g++.dg/modules/noexcept-4_b.C b/gcc/testsuite/g++.dg/modules/noexcept-4_b.C new file mode 100644 index 0000000..7cc5531 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-4_b.C @@ -0,0 +1,18 @@ +// { dg-additional-options "-fmodules -std=c++20" } + +struct exception_ptr { + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; + +void enqueue() { + exception_ptr e; + e == e; +} + +import "noexcept-4_a.H"; + +int main() { + constexpr exception_ptr e; + static_assert(e == e); + static_assert(noexcept(e == e)); +} diff --git a/gcc/testsuite/g++.dg/modules/pr119608_a.C b/gcc/testsuite/g++.dg/modules/pr119608_a.C new file mode 100644 index 0000000..4e7b359 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr119608_a.C @@ -0,0 +1,16 @@ +// PR c++/119608 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi repro } + +export module repro; + +export template<class Visitor> +auto +visit( + Visitor v +) -> decltype( + v); + +export template<class Visitor> auto visit(Visitor v) -> decltype(v) { + return {}; +} diff --git a/gcc/testsuite/g++.dg/modules/pr119608_b.C b/gcc/testsuite/g++.dg/modules/pr119608_b.C new file mode 100644 index 0000000..023d20a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr119608_b.C @@ -0,0 +1,8 @@ +// PR c++/119608 +// { dg-additional-options "-fmodules" } + +import repro; + +int main() { + visit(123); +} diff --git a/gcc/testsuite/g++.dg/modules/pr98893_b.C b/gcc/testsuite/g++.dg/modules/pr98893_b.C index 9065589..692eafb 100644 --- a/gcc/testsuite/g++.dg/modules/pr98893_b.C +++ b/gcc/testsuite/g++.dg/modules/pr98893_b.C @@ -7,4 +7,4 @@ int main() { } // { dg-final { scan-assembler {__tcf_ZZ3foovE1a:} } } -// { dg-final { scan-assembler {__tcf_ZL1b:} } } +// { dg-final { scan-assembler {__tcf_ZL1b:} { xfail hppa*-*-hpux* } } } diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C b/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C new file mode 100644 index 0000000..333c976 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-friend-18_a.C @@ -0,0 +1,25 @@ +// PR c++/119863 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi A } + +export module A; + +template<typename> +class T; + +template<typename> +class U +{ + template<typename> + friend class T; +}; + +template<typename V> +class T +{ + U<V> x = {}; +}; + +export +template<typename V> +T<V> f(V) { return {}; } diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C b/gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C new file mode 100644 index 0000000..2e537ed --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-friend-18_b.C @@ -0,0 +1,9 @@ +// PR c++/119863 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi B } + +export module B; + +// this should not be considered conflicting +template <typename> +class T; diff --git a/gcc/testsuite/g++.dg/modules/tpl-friend-18_c.C b/gcc/testsuite/g++.dg/modules/tpl-friend-18_c.C new file mode 100644 index 0000000..6c8d85b --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-friend-18_c.C @@ -0,0 +1,10 @@ +// PR c++/119863 +// { dg-additional-options "-fmodules" } + +import A; +import B; + +int main() +{ + auto const x = f(1); +} diff --git a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C index 147c2b7..b858d70 100644 --- a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C +++ b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C @@ -6,6 +6,7 @@ /* { dg-additional-options "-fno-PIE" { target ia32 } } */ /* { dg-do compile { target { ! hppa*-*-* } } } */ +/* { dg-require-effective-target fstack_protector } */ int __attribute__((no_stack_protector)) foo() { diff --git a/gcc/testsuite/g++.dg/opt/is_constant_evaluated4.C b/gcc/testsuite/g++.dg/opt/is_constant_evaluated4.C new file mode 100644 index 0000000..9650004 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/is_constant_evaluated4.C @@ -0,0 +1,20 @@ +// PR c++/114970 +// { dg-do compile { target c++17 } } +// { dg-additional-options "-O -Wunused-value" } + +struct sv +{ + const char* str; + unsigned len; + + constexpr sv(const char *p): str(p), len(0) + { + if (__builtin_is_constant_evaluated ()) { len = 42; } + } +}; + +int main() +{ + sv s ("foo"); + return s.len; +} diff --git a/gcc/testsuite/g++.dg/opt/musttail3.C b/gcc/testsuite/g++.dg/opt/musttail3.C new file mode 100644 index 0000000..1c4e549 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/musttail3.C @@ -0,0 +1,41 @@ +// PR tree-optimization/119491 +// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-options "-O2" } + +struct A { + struct B {}; + A () {} +}; +void qux (); +unsigned char v; +A w; +void foo (A); + +template <typename T> +[[gnu::always_inline]] static inline void +bar (int &) +{ +} + +[[gnu::always_inline]] static inline void +baz (int *) +{ + int r = 0; + bar<int> (r); +} + +[[gnu::always_inline]] inline void +corge (A) +{ + if (v) + qux (); + [[gnu::musttail]] return foo (w); +} + +void +freddy (A) +{ + int t; + baz (&t); + [[gnu::musttail]] return corge (A{}); +} diff --git a/gcc/testsuite/g++.dg/opt/musttail4.C b/gcc/testsuite/g++.dg/opt/musttail4.C new file mode 100644 index 0000000..ede2959 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/musttail4.C @@ -0,0 +1,35 @@ +// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-options "-O2 -fexceptions" } + +struct S { ~S (); }; +volatile int v; +struct T { ~T () { v = v + 1; } }; +struct U { ~U () {} }; +int foo (); + +int +bar () noexcept +{ + [[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: call may throw exception that does not propagate" } +} + +int +baz () +{ + S s; + [[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: other reasons" } +} + +int +qux () +{ + T t; + [[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: other reasons" } +} + +int +corge () +{ + U u; + [[gnu::musttail]] return foo (); +} diff --git a/gcc/testsuite/g++.dg/opt/musttail5.C b/gcc/testsuite/g++.dg/opt/musttail5.C new file mode 100644 index 0000000..604dd69 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/musttail5.C @@ -0,0 +1,41 @@ +// PR tree-optimization/119491 +// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-options "-O2" } + +struct A { + struct B {}; + A () {} +}; +void qux (); +unsigned char v; +A w; +[[noreturn]] void foo (A); + +template <typename T> +[[gnu::always_inline]] static inline void +bar (int &) +{ +} + +[[gnu::always_inline]] static inline void +baz (int *) +{ + int r = 0; + bar<int> (r); +} + +[[gnu::always_inline]] inline void +corge (A) +{ + if (v) + qux (); + [[gnu::musttail]] return foo (w); +} + +void +freddy (A) +{ + int t; + baz (&t); + [[gnu::musttail]] return corge (A{}); +} diff --git a/gcc/testsuite/g++.dg/opt/pr119327.C b/gcc/testsuite/g++.dg/opt/pr119327.C new file mode 100644 index 0000000..598ae1c --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr119327.C @@ -0,0 +1,16 @@ +// PR target/119327 +// { dg-do compile { target c++11 } } +// { dg-options "-Os" } + +#pragma GCC optimize "fp-contract=off" + +template <class T> +void +foo (T f) +{ + f (); +} + +struct S { + S () { [] {}; foo ([] __attribute__((always_inline)) {}); } +} s; diff --git a/gcc/testsuite/g++.dg/opt/pr119613.C b/gcc/testsuite/g++.dg/opt/pr119613.C new file mode 100644 index 0000000..2ced2e8 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr119613.C @@ -0,0 +1,22 @@ +// PR middle-end/119613 +// { dg-do compile { target { musttail && c++11 } } } +// { dg-options "-O0" } + +struct S { S () {} }; +char *foo (S); +void bar (int); + +[[gnu::always_inline]] inline char * +baz (S x) +{ + unsigned i; + &i; + bar (i); + [[gnu::musttail]] return foo (x); +} + +char * +qux (S) +{ + [[gnu::musttail]] return baz (S {}); +} diff --git a/gcc/testsuite/g++.dg/opt/pr119614.C b/gcc/testsuite/g++.dg/opt/pr119614.C new file mode 100644 index 0000000..cb73fc3 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr119614.C @@ -0,0 +1,30 @@ +// PR tree-optimization/119614 +// { dg-do compile { target musttail } } +// { dg-options "-O2" } + +struct S {} b; +char *foo (); +int e, g; +void bar (); +void corge (S); + +[[gnu::noinline]] char * +baz () +{ + bar (); + return 0; +} + +const char * +qux () +{ + if (e) + { + S a = b; + corge (a); + if (g) + return 0; + [[gnu::musttail]] return baz (); + } + return foo (); +} diff --git a/gcc/testsuite/g++.dg/opt/shrink-wrapping-vector-1.C b/gcc/testsuite/g++.dg/opt/shrink-wrapping-vector-1.C new file mode 100644 index 0000000..8b1ad53 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/shrink-wrapping-vector-1.C @@ -0,0 +1,17 @@ +// { dg-do compile { target { { { i?86-*-* x86_64-*-* } && { ! ia32 } } || { powerpc*-*-* aarch64*-*-* riscv*-*-* } } } } +// { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } +// { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } } + +// PR rtl-optimization/118502 + +// The shrink-wrapping should happen around the slow path of vector<int>::push_back, +// The fast path is just checking if there is enough space and doing a few stores. +// We want to verify that shrink wrapping always happens. + +#include <vector> + +void push_back(std::vector<int>& xs, unsigned char x) { + xs.push_back(x); +} + +/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */ diff --git a/gcc/testsuite/g++.dg/pr112822.C b/gcc/testsuite/g++.dg/pr112822.C index a855752..f88bd83 100644 --- a/gcc/testsuite/g++.dg/pr112822.C +++ b/gcc/testsuite/g++.dg/pr112822.C @@ -89,7 +89,7 @@ template <typename aj, typename cm> struct cg<aj, cm> { typedef aj cn; }; namespace ai { template <typename cj, int> cj cp; template <typename bu, typename cj, int> void cl(bu *cr, cj cs) { ct(cr, cs); } -typedef __attribute__((altivec(vector__))) double co; +typedef double co __attribute__ ((vector_size (16))); void ct(double *cr, co cs) { *(co *)cr = cs; } struct cq { co q; diff --git a/gcc/testsuite/g++.dg/template/explicit-args6.C b/gcc/testsuite/g++.dg/template/explicit-args6.C index 18663d7b..0d9718c 100644 --- a/gcc/testsuite/g++.dg/template/explicit-args6.C +++ b/gcc/testsuite/g++.dg/template/explicit-args6.C @@ -24,10 +24,12 @@ frob() // narrowing check, reject negative values return unsigned{N}; // { dg-prune-output "narrowing" } -} // { dg-prune-output "flows off the end" } -// { dg-prune-output "not a return-statement" } +} -template<int N> void get_n(tuple& t) { get<frob<N>()>(t); } // { dg-error "" } +// This complains about calling frob only in C++11 because +// maybe_save_constexpr_fundef fails; in later standards it succeeds, +// and the evaluation failure is silent due to the earlier errors. +template<int N> void get_n(tuple& t) { get<frob<N>()>(t); } // { dg-error "" "" { target c++11_only } } int main() { diff --git a/gcc/testsuite/g++.dg/template/friend86.C b/gcc/testsuite/g++.dg/template/friend86.C new file mode 100644 index 0000000..9e2c1af --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend86.C @@ -0,0 +1,25 @@ +// PR c++/119807 +// { dg-do run } + +template<int N> +struct A { + template<class T> friend int f(A<N>, T); +}; + +template struct A<0>; +template struct A<1>; + +int main() { + A<0> x; + A<1> y; + if (f(x, true) != 0) __builtin_abort(); + if (f(y, true) != 1) __builtin_abort(); +} + +template<int N> +struct B { + template<class T> friend int f(A<N>, T) { return N; } +}; + +template struct B<0>; +template struct B<1>; diff --git a/gcc/testsuite/g++.dg/template/friend87.C b/gcc/testsuite/g++.dg/template/friend87.C new file mode 100644 index 0000000..94c0dfc --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend87.C @@ -0,0 +1,42 @@ +// PR c++/119807 +// { dg-do compile { target c++20 } } + +using size_t = decltype(sizeof(0)); + +template<auto tag, size_t current> +struct CounterReader { + template<typename> + friend auto counterFlag(CounterReader<tag, current>) noexcept; +}; + +template<auto tag, size_t current> +struct CounterWriter { + static constexpr size_t value = current; + + template<typename> + friend auto counterFlag(CounterReader<tag, current>) noexcept {} +}; + +template<auto tag, auto unique, size_t current = 0, size_t mask = size_t(1) << (sizeof(size_t) * 8 - 1)> +[[nodiscard]] constexpr size_t counterAdvance() noexcept { + if constexpr (!mask) { + return CounterWriter<tag, current + 1>::value; + } else if constexpr (requires { counterFlag<void>(CounterReader<tag, current | mask>()); }) { + return counterAdvance<tag, unique, current | mask, (mask >> 1)>(); + } + else { + return counterAdvance<tag, unique, current, (mask >> 1)>(); + } +} + +constexpr auto defaultCounterTag = [] {}; + +template<auto tag = defaultCounterTag, auto unique = [] {}> +constexpr size_t counter() noexcept { + return counterAdvance<tag, unique>(); +} + +int main() { + static_assert(counter() == 1); + static_assert(counter() == 2); +} diff --git a/gcc/testsuite/g++.dg/torture/pr119610.C b/gcc/testsuite/g++.dg/torture/pr119610.C new file mode 100644 index 0000000..9998026 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr119610.C @@ -0,0 +1,18 @@ +// { dg-do run } +// { dg-additional-options "-fstack-protector-strong" { target fstack_protector } } +// { dg-additional-options "-fstack-clash-protection" { target supports_stack_clash_protection } } + +int *ptr; +void foo() { + int c[1024*128]; + ptr = c; + throw 1; +} +int main() +{ + try { + foo(); + } catch(int x) { + return 0; + } +} diff --git a/gcc/testsuite/g++.dg/torture/pr119778.C b/gcc/testsuite/g++.dg/torture/pr119778.C new file mode 100644 index 0000000..4948056 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr119778.C @@ -0,0 +1,20 @@ +// { dg-do compile } +// { dg-additional-options "-Wall" } + +struct jmp_buf { long l[16]; }; +extern "C" int setjmp (jmp_buf *); +struct S { + void foo () { bar (); } + virtual char bar () { return 0; } +}; +void baz (); +jmp_buf *a; + +void +qux (bool x, S *y) +{ + if (x) + setjmp (a); + y->foo (); + baz (); +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr118924.C b/gcc/testsuite/g++.dg/tree-ssa/pr118924.C new file mode 100644 index 0000000..c95eaca --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr118924.C @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-std=c++17 -O2" } */ + +template <int Size> struct Vector { + int m_data[Size]; + Vector(int, int, int) {} +}; +enum class E { POINTS, LINES, TRIANGLES }; + +__attribute__((noipa)) +void getName(E type) { + static E check = E::POINTS; + if (type == check) + check = (E)((int)check + 1); + else + __builtin_abort (); +} + +int main() { + int arr[]{0, 1, 2}; + for (auto dim : arr) { + Vector<3> localInvs(1, 1, 1); + localInvs.m_data[dim] = 8; + } + E types[] = {E::POINTS, E::LINES, E::TRIANGLES}; + for (auto primType : types) + getName(primType); + return 0; +} diff --git a/gcc/testsuite/g++.dg/warn/Wformat-3.C b/gcc/testsuite/g++.dg/warn/Wformat-3.C new file mode 100644 index 0000000..e308530 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wformat-3.C @@ -0,0 +1,19 @@ +// PR c++/116954 +// { dg-additional-options -Wformat } + +#ifndef WORKS +template<int N> +int fn(char (&buf)[N], const char fmt[], ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +#endif + +template<int N> +__attribute__ ((__format__ (__printf__, 2, 3))) +int fn(char (&)[N], const char [], ...) +{ return 0; } + +int main() +{ + char buf[20]; + return fn(buf, "%s", 42); /* { dg-warning "Wformat" } */ +} diff --git a/gcc/testsuite/g++.target/aarch64/spaceship_1.C b/gcc/testsuite/g++.target/aarch64/spaceship_1.C new file mode 100644 index 0000000..e6daf62 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/spaceship_1.C @@ -0,0 +1,192 @@ +// PR117013 +/* { dg-do run } */ +/* { dg-options "-O2 -std=c++20 -save-temps -fno-schedule-insns2" } */ +/* { dg-final { check-function-bodies "**" "" ""} } */ + +#include <compare> +#include <stdint.h> + +/* Some implementation-defined value (other than 2) to represent + partial_ordering::unordered (that for libc++ in this case). */ +#define IMP_UN -127 + +#define SPACESHIP_FN(TYPE) \ + [[gnu::noipa]] \ + auto ss_##TYPE (TYPE a, TYPE b) \ + { return a <=> b; } \ + +#define SPACESHIP_FN_NN(TYPE) \ + [[gnu::noipa, gnu::optimize ("-ffinite-math-only")]] \ + auto ss_##TYPE##_no_nans (TYPE a, TYPE b) \ + { return a <=> b; } \ + +/* <=> implementation for floating-point operands. */ +#define SPACESHIP_FP_IDIOM(TYPE) \ + [[gnu::noipa]] \ + int ss_##TYPE##_idiom (TYPE a, TYPE b) \ + { return ((a) == (b) ? 0 : (a) < (b) ? -1 : (a) > (b) ? 1 : IMP_UN); } \ + +#define RUN_TEST(TYPE, ARGA, ARGB, EXPECT, SUFF) \ + if (ss_##TYPE##SUFF ((ARGA), (ARGB)) != (EXPECT)) \ + __builtin_abort(); \ + +/* +** _Z8ss_floatff: +** fcmpe s0, s1 +** csinv (w[0-9]+), wzr, wzr, pl +** cset (w[0-9]+), vs +** csinc w0, \1, \2, ls +** ret +*/ +SPACESHIP_FN(float); + +/* +** _Z16ss_float_no_nansff: +** fcmpe s0, s1 +** csinv (w[0-9]+), wzr, wzr, pl +** csinc w0, \1, wzr, ls +** ret +*/ +SPACESHIP_FN_NN(float); + +/* +** _Z9ss_doubledd: +** fcmpe d0, d1 +** csinv (w[0-9]+), wzr, wzr, pl +** cset (w[0-9]+), vs +** csinc w0, \1, \2, ls +** ret +*/ +SPACESHIP_FN(double); + +/* +** _Z17ss_double_no_nansdd: +** fcmpe d0, d1 +** csinv (w[0-9]+), wzr, wzr, pl +** csinc w0, \1, wzr, ls +** ret +*/ +SPACESHIP_FN_NN(double); + +/* +** _Z14ss_float_idiomff: +** fcmpe s0, s1 +** csinv (w[0-9]+), wzr, wzr, pl +** mov (w[0-9]+), -128 +** csel (w[0-9]+), \2, wzr, vs +** csinc w0, \1, \3, ls +** ret +*/ +SPACESHIP_FP_IDIOM(float); + +/* +** _Z15ss_double_idiomdd: +** fcmpe d0, d1 +** csinv (w[0-9]+), wzr, wzr, pl +** mov (w[0-9]+), -128 +** csel (w[0-9]+), \2, wzr, vs +** csinc w0, \1, \3, ls +** ret +*/ +SPACESHIP_FP_IDIOM(double); + +/* +** _Z10ss_int32_tii: +** cmp w0, w1 +** cset (w[0-9]+), gt +** csinv w0, \1, wzr, ge +** ret +*/ +SPACESHIP_FN(int32_t); + +/* +** _Z10ss_int64_tll: +** cmp x0, x1 +** cset (w[0-9]+), gt +** csinv w0, \1, wzr, ge +** ret +*/ +SPACESHIP_FN(int64_t); + +/* +** _Z11ss_uint32_tjj: +** cmp w0, w1 +** cset (w[0-9]+), hi +** csinv w0, \1, wzr, cs +** ret +*/ +SPACESHIP_FN(uint32_t); + +/* +** _Z11ss_uint64_tmm: +** cmp x0, x1 +** cset (w[0-9]+), hi +** csinv w0, \1, wzr, cs +** ret +*/ +SPACESHIP_FN(uint64_t); + + +int +main() +{ + /* Single precision floating point. */ + RUN_TEST (float, -1.0f, 1.0f, std::partial_ordering::less,); + RUN_TEST (float, -1.0f, 1.0f, -1, _idiom); + + RUN_TEST (float, 1.0f, -1.0f, std::partial_ordering::greater,); + RUN_TEST (float, 1.0f, -1.0f, 1, _idiom); + + RUN_TEST (float, -1.0f, -1.0f, std::partial_ordering::equivalent,); + RUN_TEST (float, -1.0f, -1.0f, 0, _idiom); + + RUN_TEST (float, __builtin_nanf(""), 1.0f, std::partial_ordering::unordered,); + RUN_TEST (float, __builtin_nanf(""), 1.0f, IMP_UN, _idiom); + RUN_TEST (float, 1.0f ,__builtin_nanf(""), std::partial_ordering::unordered,); + RUN_TEST (float, 1.0f, __builtin_nanf(""), IMP_UN, _idiom); + + /* No-NaNs. */ + RUN_TEST (float, -1.0f, 1.0f, std::partial_ordering::less, _no_nans); + RUN_TEST (float, 1.0f, -1.0f, std::partial_ordering::greater, _no_nans); + RUN_TEST (float, -1.0f, -1.0f, std::partial_ordering::equivalent, _no_nans); + + /* Double precision floating point. */ + RUN_TEST (double, -1.0f, 1.0f, std::partial_ordering::less,); + RUN_TEST (double, -1.0f, 1.0f, -1, _idiom); + + RUN_TEST (double, 1.0f, -1.0f, std::partial_ordering::greater,); + RUN_TEST (double, 1.0f, -1.0f, 1, _idiom); + + RUN_TEST (double, -1.0f, -1.0f, std::partial_ordering::equivalent,); + RUN_TEST (double, -1.0f, -1.0f, 0, _idiom); + + RUN_TEST (double, __builtin_nanf(""), 1.0f, std::partial_ordering::unordered,); + RUN_TEST (double, __builtin_nanf(""), 1.0f, IMP_UN, _idiom); + RUN_TEST (double, 1.0f, __builtin_nanf(""), std::partial_ordering::unordered,); + RUN_TEST (double, 1.0f, __builtin_nanf(""), IMP_UN, _idiom); + + /* No-NaNs. */ + RUN_TEST (double, -1.0f, 1.0f, std::partial_ordering::less, _no_nans); + RUN_TEST (double, 1.0f, -1.0f, std::partial_ordering::greater, _no_nans); + RUN_TEST (double, -1.0f, -1.0f, std::partial_ordering::equivalent, _no_nans); + + /* Single integer. */ + RUN_TEST (int32_t, -42, 0, std::strong_ordering::less,); + RUN_TEST (int32_t, 0, -42, std::strong_ordering::greater,); + RUN_TEST (int32_t, 42, 42, std::strong_ordering::equal,); + + RUN_TEST (uint32_t, 0, 42, std::strong_ordering::less,); + RUN_TEST (uint32_t, 42, 0, std::strong_ordering::greater,); + RUN_TEST (uint32_t, 42, 42, std::strong_ordering::equal,); + + /* Double integer. */ + RUN_TEST (int64_t, -42, 0, std::strong_ordering::less,); + RUN_TEST (int64_t, 42, 0, std::strong_ordering::greater,); + RUN_TEST (int64_t, 42, 42, std::strong_ordering::equal,); + + RUN_TEST (uint64_t, 0, 42, std::strong_ordering::less,); + RUN_TEST (uint64_t, 42, 0, std::strong_ordering::greater,); + RUN_TEST (uint64_t, 42, 42, std::strong_ordering::equal,); + + return 0; +}
\ No newline at end of file diff --git a/gcc/testsuite/g++.target/aarch64/spaceship_2.C b/gcc/testsuite/g++.target/aarch64/spaceship_2.C new file mode 100644 index 0000000..c1d3900 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/spaceship_2.C @@ -0,0 +1,72 @@ +// PR117013 +/* { dg-do run } */ +// { dg-options "-O2 -std=c++20 -save-temps" } + +#include <compare> + +#ifndef fp_type +#define fp_type float +#endif + +#define TEST_SS_IDIOM(ARGA, ARGB, EXPECT) \ + if (spaceship_idiom ((ARGA), (ARGB)) != (EXPECT)) \ + __builtin_abort(); \ + +#define TEST_BR_ON_SS(ARGA, ARGB, EXPECT) \ + if(branch_on_spaceship ((ARGA), (ARGB)) != (EXPECT)) \ + __builtin_abort(); \ + + +#define RUN_TEST(ARGA, ARGB, EXPECT) \ + TEST_SS_IDIOM(ARGA, ARGB, EXPECT) \ + TEST_BR_ON_SS(ARGA, ARGB, EXPECT) \ + +/* Test when .SPACESHIP prompts the back end to implement <=> with + conditional branches (only applies to floating-point operands). */ + +[[gnu::noipa]] auto +equiv() { return std::partial_ordering::equivalent; } +[[gnu::noipa]] auto +less() { return std::partial_ordering::less; } +[[gnu::noipa]] auto +greater() { return std::partial_ordering::greater; } +[[gnu::noipa]] auto +unordered() { return std::partial_ordering::unordered; } + +auto +spaceship_idiom(fp_type a, fp_type b) +{ + if (a == b) + return equiv(); + if (a < b) + return less(); + if (a > b) + return greater(); + return unordered(); +} + +auto +branch_on_spaceship(fp_type a, fp_type b) +{ + auto res = a <=> b; + if (res == 0) + return equiv(); + else if (res < 0) + return less(); + else if (res > 0) + return greater(); + return unordered(); +} + +int +main() +{ + RUN_TEST (-1.0f, 1.0f, std::partial_ordering::less); + RUN_TEST (1.0f, -1.0f, std::partial_ordering::greater); + RUN_TEST (1.0f, 1.0f, std::partial_ordering::equivalent); + RUN_TEST (1.0f, __builtin_nanf(""), std::partial_ordering::unordered); + RUN_TEST (__builtin_nanf(""), 1.0f, std::partial_ordering::unordered); +} + +/* { dg-final { scan-assembler-not "\tfcmp\t" } } */ +/* { dg-final { scan-assembler-times "\tfcmpe\t" 2 } } */
\ No newline at end of file diff --git a/gcc/testsuite/g++.target/aarch64/spaceship_3.C b/gcc/testsuite/g++.target/aarch64/spaceship_3.C new file mode 100644 index 0000000..f58b084 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/spaceship_3.C @@ -0,0 +1,9 @@ +// PR117013 +/* { dg-do run } */ +// { dg-options "-O2 -std=c++20 -save-temps" } + +#define fp_type double +#include "spaceship_2.C" + +/* { dg-final { scan-assembler-not "\tfcmp\t" } } */ +/* { dg-final { scan-assembler-times "\tfcmpe\t" 2 } } */
\ No newline at end of file diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr116595.C b/gcc/testsuite/g++.target/aarch64/sve/pr116595.C new file mode 100644 index 0000000..49874dd --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr116595.C @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +#include <arm_sve.h> + +void transpose4x4_ps() +{ + svfloat32x4_t _r = svfloat32x4_t(); +} diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr119610-sve.C b/gcc/testsuite/g++.target/aarch64/sve/pr119610-sve.C new file mode 100644 index 0000000..0044e51 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr119610-sve.C @@ -0,0 +1,20 @@ +// { dg-do run { target aarch64_sve_hw } } +// { dg-additional-options "-fstack-protector-strong" { target fstack_protector } } +// { dg-additional-options "-fstack-clash-protection" { target supports_stack_clash_protection } } + +void *a_ptr, *b_ptr; +void foo() { + __SVInt32_t a; + int b[1024*128]; + a_ptr = &a; + b_ptr = b; + throw 1; +} +int main() +{ + try { + foo(); + } catch(int x) { + return 0; + } +} diff --git a/gcc/testsuite/g++.target/aarch64/sve/pr119706.C b/gcc/testsuite/g++.target/aarch64/sve/pr119706.C new file mode 100644 index 0000000..40fefe5 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/pr119706.C @@ -0,0 +1,178 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -mcpu=neoverse-v2 --param=aarch64-autovec-preference=sve-only -w" } */ + +namespace a { +typedef long unsigned b; +typedef int c; +template <bool, typename d> struct e { using f = d; }; +template <bool g, typename d = void> using h = typename e<g, d>::f; +template <typename aa, typename, template <typename> class> struct i { + using f = aa; +}; +template <typename aa, template <typename> class j> using k = i<aa, void, j>; +template <typename aa, template <typename> class j> +using l = typename k<aa, j>::f; +} // namespace a +inline void *operator new(a::b, void *ab) { return ab; } +namespace a { +template <typename> class ac { +public: + typedef b m; + template <typename ad, typename... n> void ae(ad *ab, n... w) { + new (ab) ad(w...); + } +}; +template <typename d> using x = ac<d>; +template <typename d> class af : public x<d> { +public: + typedef d o; + template <typename> struct ag { typedef af ah; }; +}; +struct ai {}; +struct aj : ai {}; +struct ak : aj {}; +template <typename> struct al; +template <typename d> struct al<d *> { + typedef ak an; + typedef c ao; + typedef d ap; +}; +template <typename aq> typename aq ::an ar(aq) { return typename aq ::an(); } +template <typename as> typename as ::ao at(as au, as av, ak) { return av - au; } +template <typename aw> typename aw ::ao ax(aw au, aw av) { + return at(au, av, ar(au)); +} +template <typename> struct ay { typedef c ao; }; +} // namespace a +namespace az { +template <typename am, typename> class ba { + am bb; + typedef a::al<am> bc; + +public: + typedef typename bc::an an; + typedef typename bc::ao ao; + typedef typename bc::ap ap; + ba(am bd) : bb(bd) {} + ap operator*() { return *bb; } + ba operator++() { + ++bb; + return *this; + } + am base() { return bb; } +}; +template <typename be, typename bf, typename bg> +bool operator!=(ba<be, bg> bh, ba<bf, bg> p) { + return bh.base() != p.base(); +} +template <typename be, typename bf, typename bg> +auto operator-(ba<be, bg> bh, ba<bf, bg> p) { + return bh.base() - p.base(); +} +} // namespace az +namespace a { +struct bi { + template <typename d, typename> struct bj { + using f = typename d::ag<d>::ah; + }; + template <typename> using bk = b; + template <typename...> static constexpr bool bl = false; + template <typename, typename> static constexpr bool bm = bl<>; + template <typename d, typename... n> static constexpr bool bn = bm<d, n...>; +}; +template <typename bo, typename ad> using bp = typename bi::bj<bo, ad>::f; +template <typename bo> struct bq : bi { + typedef typename bo::o o; + using br = l<o *, bk>; + template <typename, typename bs> struct bt { using f = typename ay<bs>::ao; }; + template <typename bu, typename> struct bv { using f = typename bu::m; }; + using ao = typename bt<bo, c>::f; + using m = typename bv<bo, ao>::f; + template <typename d> using bw = bp<bo, d>; + static br allocate(bo, m); + template <typename d, typename... n> + static h<bn<bo, d>> ae(bo ci, d ab, n... w) { + ci.ae(ab, w...); + } +}; +template <typename d> struct bx { + static bool by(d &bz) try { d(bz.begin(), bz.ca(), bz.cb()); } catch (...) { + } +}; +} // namespace a +namespace az { +template <typename bo> struct cc : a::bq<bo> { + typedef a::bq<bo> q; + template <typename d> struct ag { typedef typename q::bw<d> ah; }; +}; +} // namespace az +enum cd {}; +using ce = double; +namespace a { +template <typename aw, typename cf, typename cg, typename ch> +cg cj(aw au, cf av, cg ck, ch cl) { + typedef az::cc<ch> cx; + for (; au != av; ++au, ++ck) + cx::ae(cl, ck, *au); +} +template <typename d, typename bo> struct cm { + typedef typename az::cc<bo>::ag<d>::ah cn; + typedef typename az::cc<cn>::br br; + struct co { + br db; + br cp; + }; + struct cq : cn, co { + cq(cn) {} + } typedef cr; + cn cs(); + cr cb() noexcept; + cm(cr ci) : ct(ci) {} + cq ct; + br cu(b cv) { + typedef az::cc<cn> cw; + return cv ? cw::allocate(ct, cv) : c(); + } +}; +template <typename d, typename bo = af<d>> class cy : cm<d, bo> { + typedef cm<d, bo> cz; + +public: + typedef typename cz::br br; + typedef az::ba<br, cy> da; + typedef b m; + typedef bo cr; + cz::cs; + template <typename aw> cy(aw au, aw av, cr ci) : cz(ci) { + dg(au, av, ar(au)); + } + cz::cb; + da begin() { return this->ct.db; } + da ca() { return this->ct.cp; } + void r() { s(); } + void clear() { t(this->ct.db); } + template <typename cg> void dg(cg au, cg av, ai) { y(au, av, ax(au, av)); } + template <typename am, typename cf> void y(am au, cf av, m cv) { + br z = this->cu(dc(cv, cs())); + cj(au, av, z, cs()); + } + bool s(); + m dc(m cv, cr) { return cv; } + void t(br dd) { + if (this->ct.cp - dd) + this->ct.cp = dd; + } +}; +template <typename d, typename bo> bool cy<d, bo>::s() { bx<cy>::by(*this); } +namespace basic { +class u { + using de = ce; + void v(cd, b); + cy<de> df; +}; +void u::v(cd, b) { + df.clear(); + df.r(); +} +} // namespace basic +} // namespace a
\ No newline at end of file diff --git a/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-1.C b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-1.C new file mode 100644 index 0000000..f3e3099 --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-1.C @@ -0,0 +1,15 @@ +/* 'std::bad_cast' exception. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } + We don't print anything, but just 'abort'. + + { dg-shouldfail {'std::bad_cast' exception} } */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-2.C b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-2.C new file mode 100644 index 0000000..b047cbed --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-2.C @@ -0,0 +1,13 @@ +/* 'std::bad_cast' exception, caught. */ + +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mno-fake-exceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } + Compilation fails: + { dg-regexp {[^\r\n]+: In function 'int main\(\)':[\r\n]+(?:[^\r\n]+: sorry, unimplemented: exception handling not supported[\r\n]+)+} } + (Note, using 'dg-regexp' instead of 'dg-message', as the former runs before the auto-mark-UNSUPPORTED.) */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-2_-mfake-exceptions.C b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-2_-mfake-exceptions.C new file mode 100644 index 0000000..2904188 --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-2_-mfake-exceptions.C @@ -0,0 +1,18 @@ +/* 'std::bad_cast' exception, caught, '-mfake-exceptions'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mfake-exceptions } + { dg-bogus {sorry, unimplemented: exception handling not supported} {} { target *-*-* } 0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "exceptions-bad_cast-2.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } + We don't print anything, but just 'abort'. + + There is no 'catch'ing; any exception is fatal. + { dg-shouldfail {'std::bad_cast' exception} } */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-3.C b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-3.C new file mode 100644 index 0000000..3d0118c --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-bad_cast-3.C @@ -0,0 +1,10 @@ +/* 'std::bad_cast' exception, dead code. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-3.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-pr118794-1.C b/gcc/testsuite/g++.target/gcn/exceptions-pr118794-1.C new file mode 100644 index 0000000..20f9d49 --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-pr118794-1.C @@ -0,0 +1,17 @@ +/* Exception handling constructs in dead code. */ + +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mno-fake-exceptions } */ +/* { dg-additional-options -O0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1.C" + +/* In this specific C++ arrangement, distilled from PR118794, GCC synthesizes + '__builtin_eh_pointer', '__builtin_unwind_resume' calls as dead code in 'f': + { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 1 optimized } } + Given '-O0', compilation fails: + { dg-regexp {[^\r\n]+: In function 'void f\(\)':[\r\n]+(?:[^\r\n]+: sorry, unimplemented: exception handling not supported[\r\n]+)+} } + (Note, using 'dg-regexp' instead of 'dg-message', as the former runs before the auto-mark-UNSUPPORTED.) */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-pr118794-1_-mfake-exceptions.C b/gcc/testsuite/g++.target/gcn/exceptions-pr118794-1_-mfake-exceptions.C new file mode 100644 index 0000000..a5f0da2 --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-pr118794-1_-mfake-exceptions.C @@ -0,0 +1,16 @@ +/* Exception handling constructs in dead code, '-mfake-exceptions'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mfake-exceptions } + { dg-bogus {sorry, unimplemented: exception handling not supported} {} { target *-*-* } 0 } */ +/* { dg-additional-options -O0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "exceptions-pr118794-1.C" + +/* In this specific C++ arrangement, distilled from PR118794, GCC synthesizes + '__builtin_eh_pointer', '__builtin_unwind_resume' calls as dead code in 'f': + { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 1 optimized } } */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-throw-1.C b/gcc/testsuite/g++.target/gcn/exceptions-throw-1.C new file mode 100644 index 0000000..6cadf58 --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-throw-1.C @@ -0,0 +1,16 @@ +/* 'throw'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-throw-1.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } + We don't print anything, but just 'abort'. + + { dg-shouldfail {'MyException' exception} } */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-throw-2.C b/gcc/testsuite/g++.target/gcn/exceptions-throw-2.C new file mode 100644 index 0000000..671c810 --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-throw-2.C @@ -0,0 +1,14 @@ +/* 'throw', caught. */ + +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mno-fake-exceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-throw-2.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } + Compilation fails: + { dg-regexp {[^\r\n]+: In function 'int main\(\)':[\r\n]+(?:[^\r\n]+: sorry, unimplemented: exception handling not supported[\r\n]+)+} } + (Note, using 'dg-regexp' instead of 'dg-message', as the former runs before the auto-mark-UNSUPPORTED.) */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-throw-2_-mfake-exceptions.C b/gcc/testsuite/g++.target/gcn/exceptions-throw-2_-mfake-exceptions.C new file mode 100644 index 0000000..f1fd505 --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-throw-2_-mfake-exceptions.C @@ -0,0 +1,19 @@ +/* 'throw', caught, '-mfake-exceptions'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mfake-exceptions } + { dg-bogus {sorry, unimplemented: exception handling not supported} {} { target *-*-* } 0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "exceptions-throw-2.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } + We don't print anything, but just 'abort'. + + There is no 'catch'ing; any exception is fatal. + { dg-shouldfail {'MyException' exception} } */ diff --git a/gcc/testsuite/g++.target/gcn/exceptions-throw-3.C b/gcc/testsuite/g++.target/gcn/exceptions-throw-3.C new file mode 100644 index 0000000..5c1ad7a --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/exceptions-throw-3.C @@ -0,0 +1,11 @@ +/* 'throw', dead code. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-throw-3.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } */ diff --git a/gcc/testsuite/g++.target/gcn/gcn.exp b/gcc/testsuite/g++.target/gcn/gcn.exp new file mode 100644 index 0000000..a3bd75f --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/gcn.exp @@ -0,0 +1,56 @@ +# Specific regression driver for GCN. +# Copyright (C) 2000-2025 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# G++ testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't a GCN target. +if ![istarget amdgcn*-*-*] then { + return +} + +# Load support procs. +load_lib g++-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CXXFLAGS +if ![info exists DEFAULT_CXXFLAGS] then { + set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long" +} + +# Initialize `dg'. +dg-init + +# Recursively find files in $dir and subdirs, do not walk into subdirs +# that contain their own .exp file. +proc find-cxx-tests { dir suffix } { + set tests [lsort [glob -nocomplain -directory $dir "*.$suffix" ]] + foreach subdir [lsort [glob -nocomplain -type d -directory $dir *]] { + if { [glob -nocomplain -directory $subdir *.exp] eq "" } { + eval lappend tests [find-cxx-tests $subdir $suffix] + } + } + return $tests +} + +set tests [find-cxx-tests $srcdir/$subdir {C}] + +# Main loop. +g++-dg-runtest $tests "" $DEFAULT_CXXFLAGS + + +# All done. +dg-finish diff --git a/gcc/testsuite/g++.target/gcn/pr119692-1-1.C b/gcc/testsuite/g++.target/gcn/pr119692-1-1.C new file mode 100644 index 0000000..b44b08d --- /dev/null +++ b/gcc/testsuite/g++.target/gcn/pr119692-1-1.C @@ -0,0 +1,6 @@ +/* PR119692 "C++ 'typeinfo', 'vtable' vs. OpenACC, OpenMP 'target' offloading" */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/pr119692-1-1.C" diff --git a/gcc/testsuite/g++.target/i386/pr119689.C b/gcc/testsuite/g++.target/i386/pr119689.C new file mode 100644 index 0000000..cdc6d2d --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr119689.C @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-options "-O2 -fcompare-debug" } +// { dg-additional-options "-march=i586 -mtune=generic" { target ia32 } } +// { dg-additional-options "-fPIC" { target { fpic } } } + +enum gimple_code { GIMPLE_ASSIGN, GIMPLE_RETURN }; +bool is_gimple_call(); +int m_sig, m_exp, sreal_new_exp; +struct sreal { + sreal(long long sig) { + long long __trans_tmp_6 = sig >= 0 ? sig : -(unsigned long long)sig; + sig = __trans_tmp_6 <<= sreal_new_exp -= m_exp = __trans_tmp_6; + m_sig = sig; + } + void operator/(sreal); +}; +struct ipa_predicate { + ipa_predicate(bool = true); + void operator&=(ipa_predicate); + void operator&(ipa_predicate); +}; +void add_condition(); +gimple_code eliminated_by_inlining_prob_code; +static int eliminated_by_inlining_prob() { + switch (eliminated_by_inlining_prob_code) { + case GIMPLE_RETURN: + return 2; + case GIMPLE_ASSIGN: + return 1; + } + return 0; +} +void fp_expression_p() { + ipa_predicate bb_predicate; + for (;;) { + int prob = eliminated_by_inlining_prob(); + ipa_predicate sra_predicate; + sra_predicate &= add_condition; + if (is_gimple_call()) + sreal(prob) / 2; + if (prob != 2) + bb_predicate & sra_predicate; + } +} diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-1.C b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-1.C new file mode 100644 index 0000000..f3e3099 --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-1.C @@ -0,0 +1,15 @@ +/* 'std::bad_cast' exception. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } + We don't print anything, but just 'abort'. + + { dg-shouldfail {'std::bad_cast' exception} } */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-2.C b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-2.C new file mode 100644 index 0000000..b047cbed --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-2.C @@ -0,0 +1,13 @@ +/* 'std::bad_cast' exception, caught. */ + +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mno-fake-exceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } + Compilation fails: + { dg-regexp {[^\r\n]+: In function 'int main\(\)':[\r\n]+(?:[^\r\n]+: sorry, unimplemented: exception handling not supported[\r\n]+)+} } + (Note, using 'dg-regexp' instead of 'dg-message', as the former runs before the auto-mark-UNSUPPORTED.) */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-2_-mfake-exceptions.C b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-2_-mfake-exceptions.C new file mode 100644 index 0000000..3f40951 --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-2_-mfake-exceptions.C @@ -0,0 +1,19 @@ +/* 'std::bad_cast' exception, caught, '-mfake-exceptions'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mfake-exceptions } + { dg-bogus {sorry, unimplemented: exception handling not supported} {} { target *-*-* } 0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ +/* { dg-bogus {_ZTISt8bad_cast} PR119734 { xfail *-*-* } 0 } */ + +#include "exceptions-bad_cast-2.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } + We don't print anything, but just 'abort'. + + There is no 'catch'ing; any exception is fatal. + { dg-shouldfail {'std::bad_cast' exception} } */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-3.C b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-3.C new file mode 100644 index 0000000..3d0118c --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-bad_cast-3.C @@ -0,0 +1,10 @@ +/* 'std::bad_cast' exception, dead code. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-3.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_bad_cast, } 1 optimized } } */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-pr118794-1.C b/gcc/testsuite/g++.target/nvptx/exceptions-pr118794-1.C new file mode 100644 index 0000000..20f9d49 --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-pr118794-1.C @@ -0,0 +1,17 @@ +/* Exception handling constructs in dead code. */ + +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mno-fake-exceptions } */ +/* { dg-additional-options -O0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.c++/target-exceptions-pr118794-1.C" + +/* In this specific C++ arrangement, distilled from PR118794, GCC synthesizes + '__builtin_eh_pointer', '__builtin_unwind_resume' calls as dead code in 'f': + { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 1 optimized } } + Given '-O0', compilation fails: + { dg-regexp {[^\r\n]+: In function 'void f\(\)':[\r\n]+(?:[^\r\n]+: sorry, unimplemented: exception handling not supported[\r\n]+)+} } + (Note, using 'dg-regexp' instead of 'dg-message', as the former runs before the auto-mark-UNSUPPORTED.) */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-pr118794-1_-mfake-exceptions.C b/gcc/testsuite/g++.target/nvptx/exceptions-pr118794-1_-mfake-exceptions.C new file mode 100644 index 0000000..a5f0da2 --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-pr118794-1_-mfake-exceptions.C @@ -0,0 +1,16 @@ +/* Exception handling constructs in dead code, '-mfake-exceptions'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mfake-exceptions } + { dg-bogus {sorry, unimplemented: exception handling not supported} {} { target *-*-* } 0 } */ +/* { dg-additional-options -O0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "exceptions-pr118794-1.C" + +/* In this specific C++ arrangement, distilled from PR118794, GCC synthesizes + '__builtin_eh_pointer', '__builtin_unwind_resume' calls as dead code in 'f': + { dg-final { scan-tree-dump-times {gimple_call <__builtin_eh_pointer, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__builtin_unwind_resume, } 1 optimized } } */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-throw-1.C b/gcc/testsuite/g++.target/nvptx/exceptions-throw-1.C new file mode 100644 index 0000000..6cadf58 --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-throw-1.C @@ -0,0 +1,16 @@ +/* 'throw'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-throw-1.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } + We don't print anything, but just 'abort'. + + { dg-shouldfail {'MyException' exception} } */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-throw-2.C b/gcc/testsuite/g++.target/nvptx/exceptions-throw-2.C new file mode 100644 index 0000000..671c810 --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-throw-2.C @@ -0,0 +1,14 @@ +/* 'throw', caught. */ + +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mno-fake-exceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-throw-2.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } + Compilation fails: + { dg-regexp {[^\r\n]+: In function 'int main\(\)':[\r\n]+(?:[^\r\n]+: sorry, unimplemented: exception handling not supported[\r\n]+)+} } + (Note, using 'dg-regexp' instead of 'dg-message', as the former runs before the auto-mark-UNSUPPORTED.) */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-throw-2_-mfake-exceptions.C b/gcc/testsuite/g++.target/nvptx/exceptions-throw-2_-mfake-exceptions.C new file mode 100644 index 0000000..f1fd505 --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-throw-2_-mfake-exceptions.C @@ -0,0 +1,19 @@ +/* 'throw', caught, '-mfake-exceptions'. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -mfake-exceptions } + { dg-bogus {sorry, unimplemented: exception handling not supported} {} { target *-*-* } 0 } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "exceptions-throw-2.C" + +/* { dg-output {CheCKpOInT[\r\n]+} } + + { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } + We don't print anything, but just 'abort'. + + There is no 'catch'ing; any exception is fatal. + { dg-shouldfail {'MyException' exception} } */ diff --git a/gcc/testsuite/g++.target/nvptx/exceptions-throw-3.C b/gcc/testsuite/g++.target/nvptx/exceptions-throw-3.C new file mode 100644 index 0000000..5c1ad7a --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/exceptions-throw-3.C @@ -0,0 +1,11 @@ +/* 'throw', dead code. */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ +/* { dg-additional-options -fexceptions } */ +/* { dg-additional-options -fdump-tree-optimized-raw } */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/exceptions-throw-3.C" + +/* { dg-final { scan-tree-dump-times {gimple_call <__cxa_allocate_exception, } 1 optimized } } + { dg-final { scan-tree-dump-times {gimple_call <__cxa_throw, } 1 optimized } } */ diff --git a/gcc/testsuite/g++.target/nvptx/pr119692-1-1.C b/gcc/testsuite/g++.target/nvptx/pr119692-1-1.C new file mode 100644 index 0000000..b44b08d --- /dev/null +++ b/gcc/testsuite/g++.target/nvptx/pr119692-1-1.C @@ -0,0 +1,6 @@ +/* PR119692 "C++ 'typeinfo', 'vtable' vs. OpenACC, OpenMP 'target' offloading" */ + +/* { dg-do run } */ +/* Via the magic string "-std=*++" indicate that testing one (the default) C++ standard is sufficient. */ + +#include "../../../../libgomp/testsuite/libgomp.oacc-c++/pr119692-1-1.C" diff --git a/gcc/testsuite/g++.target/riscv/rvv/autovec/pr116595.C b/gcc/testsuite/g++.target/riscv/rvv/autovec/pr116595.C new file mode 100644 index 0000000..3747549 --- /dev/null +++ b/gcc/testsuite/g++.target/riscv/rvv/autovec/pr116595.C @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d" } */ + +#include <riscv_vector.h> + +void +vsseg (float *a, vfloat32mf2_t b, vfloat32mf2_t c, unsigned long vl) +{ + vfloat32mf2x2_t foo = vfloat32mf2x2_t (); +} diff --git a/gcc/testsuite/g++.target/riscv/rvv/autovec/pr119547-2.C b/gcc/testsuite/g++.target/riscv/rvv/autovec/pr119547-2.C new file mode 100644 index 0000000..1b98d3d --- /dev/null +++ b/gcc/testsuite/g++.target/riscv/rvv/autovec/pr119547-2.C @@ -0,0 +1,212 @@ +/* { dg-do run { target rv64 } } */ +/* { dg-require-effective-target riscv_v_ok } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d --param=logical-op-non-short-circuit=0" } */ + +#include <riscv_vector.h> + +using v_uint8 = vuint8m2_t; +using v_int8 = vint8m2_t; +using v_uint16 = vuint16m2_t; +using v_int16 = vint16m2_t; +using v_uint32 = vuint32m2_t; +using v_int32 = vint32m2_t; +using v_uint64 = vuint64m2_t; +using v_int64 = vint64m2_t; +using v_float32 = vfloat32m2_t; +using v_float64 = vfloat64m2_t; + +using uchar = unsigned char; +using schar = signed char; +using ushort = unsigned short; +using uint = unsigned int; +using uint64 = unsigned long int; +using int64 = long int; + +struct Size +{ + int width; + int height; +}; + +template <class T> struct VTraits; + +template <> struct VTraits<vint32m1_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e32m1 (); } + using lane_type = int32_t; + static const int max_nlanes = 1024 / 32 * 2; +}; +template <> struct VTraits<vint32m2_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e32m2 (); } + using lane_type = int32_t; + static const int max_nlanes = 1024 / 32 * 2; +}; +template <> struct VTraits<vint32m4_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e32m4 (); } + using lane_type = int32_t; + static const int max_nlanes = 1024 / 32 * 2; +}; +template <> struct VTraits<vint32m8_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e32m8 (); } + using lane_type = int32_t; + static const int max_nlanes = 1024 / 32 * 2; +}; + +template <> struct VTraits<vfloat64m1_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e64m1 (); } + using lane_type = double; + static const int max_nlanes = 1024 / 64 * 2; +}; +template <> struct VTraits<vfloat64m2_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e64m2 (); } + using lane_type = double; + static const int max_nlanes = 1024 / 64 * 2; +}; +template <> struct VTraits<vfloat64m4_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e64m4 (); } + using lane_type = double; + static const int max_nlanes = 1024 / 64 * 2; +}; +template <> struct VTraits<vfloat64m8_t> +{ + static inline int vlanes () { return __riscv_vsetvlmax_e64m8 (); } + using lane_type = double; + static const int max_nlanes = 1024 / 64 * 2; +}; + +static inline v_float64 +v_setall_f64 (double v) +{ + return __riscv_vfmv_v_f_f64m2 (v, VTraits<v_float64>::vlanes ()); +} +static inline v_float64 +vx_setall_f64 (double v) +{ + return v_setall_f64 (v); +} + +inline v_int32 +v_load_expand_q (const schar *ptr) +{ + return __riscv_vwcvt_x ( + __riscv_vwcvt_x (__riscv_vle8_v_i8mf2 (ptr, VTraits<v_int32>::vlanes ()), + VTraits<v_int32>::vlanes ()), + VTraits<v_int32>::vlanes ()); +} + +static inline v_int32 +vx_load_expand_q (const schar *ptr) +{ + return v_load_expand_q (ptr); +} + +inline v_float64 +v_cvt_f64 (const v_int32 &a) +{ + return __riscv_vget_f64m2 (__riscv_vfwcvt_f (a, VTraits<v_int32>::vlanes ()), + 0); +} + +inline v_float64 +v_cvt_f64_high (const v_int32 &a) +{ + return __riscv_vget_f64m2 (__riscv_vfwcvt_f (a, VTraits<v_int32>::vlanes ()), + 1); +} + +inline void +v_store (double *ptr, const v_float64 &a) +{ + __riscv_vse64 (ptr, a, VTraits<v_float64>::vlanes ()); +} + +static inline void +v_store_pair_as (double *ptr, const v_float64 &a, const v_float64 &b) +{ + v_store (ptr, a); + v_store (ptr + VTraits<v_float64>::vlanes (), b); +} + +static inline void +vx_load_pair_as (const schar *ptr, v_float64 &a, v_float64 &b) +{ + v_int32 v0 = vx_load_expand_q (ptr); + a = v_cvt_f64 (v0); + b = v_cvt_f64_high (v0); +} + +inline v_float64 +v_fma (const v_float64 &a, const v_float64 &b, const v_float64 &c) +{ + return __riscv_vfmacc_vv_f64m2 (c, a, b, VTraits<v_float64>::vlanes ()); +} + +template <typename _Tp> +static inline _Tp +saturate_cast (double v) +{ + return _Tp (v); +} + +template <typename _Ts, typename _Td> +__attribute__ ((noipa)) void +cvt_64f (const _Ts *src, size_t sstep, _Td *dst, size_t dstep, Size size, + double a, double b) +{ + v_float64 va = vx_setall_f64 (a), vb = vx_setall_f64 (b); + const int VECSZ = VTraits<v_float64>::vlanes () * 2; + + sstep /= sizeof (src[0]); + dstep /= sizeof (dst[0]); + + for (int i = 0; i < size.height; i++, src += sstep, dst += dstep) + { + int j = 0; + + for (; j < size.width; j += VECSZ) + { + if (j > size.width - VECSZ) + { + if (j == 0 || src == (_Ts *) dst) + break; + j = size.width - VECSZ; + } + v_float64 v0, v1; + vx_load_pair_as (src + j, v0, v1); + v0 = v_fma (v0, va, vb); + v1 = v_fma (v1, va, vb); + v_store_pair_as (dst + j, v0, v1); + } + + for (; j < size.width; j++) + dst[j] = saturate_cast<_Td> (src[j] * a + b); + } +} + +void +__attribute__ ((noipa)) +cvtScale8s64f (const uchar *src_, size_t sstep, const uchar *, size_t, + uchar *dst_, size_t dstep, Size size, void *scale_) +{ + const schar *src = (const schar *) src_; + double *dst = (double *) dst_; + double *scale = (double *) scale_; + cvt_64f (src, sstep, dst, dstep, size, (double) scale[0], (double) scale[1]); +} + +int main () +{ + uchar src[1024]; + uchar dst[1024]; + + double scale[2] = {2.0, 3.0}; + Size size {4, 1}; + + cvtScale8s64f (src, 4, NULL, 0, dst, 32, size, (void *)scale); +} diff --git a/gcc/testsuite/g++.target/riscv/rvv/autovec/pr119547.C b/gcc/testsuite/g++.target/riscv/rvv/autovec/pr119547.C new file mode 100644 index 0000000..bac0fb1 --- /dev/null +++ b/gcc/testsuite/g++.target/riscv/rvv/autovec/pr119547.C @@ -0,0 +1,82 @@ +/* { dg-do run { target rv64 } } */ +/* { dg-require-effective-target riscv_v_ok } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d --param=logical-op-non-short-circuit=0" } */ + +#include <riscv_vector.h> +using v_int32 = vint32m2_t; +using v_float64 = vfloat64m2_t; +struct Size +{ + int width; + int height; +}; +template <class> struct VTraits +{ + static int vlanes () { return __riscv_vsetvlmax_e32m2 (); } +}; +v_int32 +v_load_expand_q (const signed char *ptr) +{ + return __riscv_vwcvt_x ( + __riscv_vwcvt_x (__riscv_vle8_v_i8mf2 (ptr, VTraits<v_int32>::vlanes ()), + VTraits<v_int32>::vlanes ()), + VTraits<v_int32>::vlanes ()); +} +v_float64 +v_cvt_f64_high (v_int32 a) +{ + return __riscv_vget_f64m2 (__riscv_vfwcvt_f (a, VTraits<v_int32>::vlanes ()), + 1); +} +void +v_store (double *ptr, v_float64 a) +{ + __riscv_vse64 (ptr, a, __riscv_vsetvlmax_e64m2 ()); +} +void +v_store_pair_as (double *ptr, v_float64 b) +{ + v_store (ptr, b); +} +void +vx_load_pair_as (const signed char *ptr, v_float64, v_float64 &b) +{ + v_int32 v0; + b = v_cvt_f64_high (v0); +}; +void +cvt_64f (const signed char *src, double *dst, Size size) +{ + int VECSZ = __riscv_vsetvlmax_e64m2 (); + for (int i; i < size.height; i++) + { + int j; + for (;; j += VECSZ) + { + if (j > -VECSZ) + if (j == 0 || dst) + break; + v_float64 v0, v1; + vx_load_pair_as (src, v0, v1); + v_store_pair_as (dst, v1); + } + for (; j < size.width; j++) + dst[j] = (src[j]); + } +} +void +cvtScale8s64f (unsigned char *src_, unsigned char *dst_, + size_t, Size size, void *) +{ + signed char src; + double dst = *dst_; + cvt_64f (&src, &dst, size); +} +int main () +{ + unsigned char src[1]; + unsigned char dst[1024]; + double scale[1]; + Size size{4, 1}; + cvtScale8s64f (src, dst, 32, size, scale); +} diff --git a/gcc/testsuite/g++.target/s390/pr119834.C b/gcc/testsuite/g++.target/s390/pr119834.C new file mode 100644 index 0000000..66c0a69 --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr119834.C @@ -0,0 +1,76 @@ +// PR target/119834 +// { dg-do compile { target c++11 } } +// { dg-options "-O2 -march=z900" } + +int *a; +struct A; +struct B { + A begin (); + A end (); + operator bool * (); + void operator++ (); +}; +template <typename T> +auto operator| (int, T x) -> decltype (x (0)); +struct A : B { bool a; }; +struct C { A operator () (int); }; +enum D {} d; +int e; +void foo (); +struct E { + template <typename T> + T *garply () + { + if (d) + return 0; + if (e) + foo (); + return reinterpret_cast<T *> (f); + } + template <typename> + void bar (long x, bool) + { + if (&g - f) + __builtin_memset (a, 0, x); + f += x; + } + template <typename T> + T *baz (T *x, long y, bool z = true) + { + if (d) + return nullptr; + bar<T> ((char *)x + y - f, z); + return x; + } + template <typename T> + void qux (T x) { baz (x, x->j); } + char *f, g; +} *h; +struct F { + template <typename T> + int corge (T x) { x.freddy (this); return 0; } + template <typename T> + int boo (T x) { corge (x); return 0; } +} i; +template <typename T> +struct G { + template <typename U> friend T operator+ (U, G); + template <typename U> + void waldo (F *x, G y, U z) { x->boo (z + y); } + template <typename... Ts> + void plugh (E *y, Ts... z) { T *x = y->garply<T> (); x->thud (y, z...); } +}; +template <typename T> using H = G<T>; +struct I { + static constexpr unsigned j = 2; + void thud (E *x, A y) { x->qux (this); for (auto g : y) ; } +}; +H<I> k; +struct J { + void freddy (F *) { C a; auto b = 0 | a; k.plugh (h, b); } +}; +H<J> l; +struct K { + void freddy () { l.waldo (&i, l, this); } +}; +void grault () { K m; m.freddy (); } diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46534.c b/gcc/testsuite/gcc.c-torture/compile/pr46534.c index 1894636..7f10bc0 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr46534.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr46534.c @@ -1,4 +1,3 @@ -/* { dg-skip-if "too big" { nvptx-*-* } } */ /* PR middle-end/46534 */ extern int printf (const char *, ...); diff --git a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c index c48fe5f..09aaaa6 100644 --- a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c +++ b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c @@ -77,9 +77,9 @@ void test_integer_conversion_memset (void *d) /* Passing a ptrdiff_t where size_t is expected may not be unsafe but because GCC may emits suboptimal code for such calls warning for them helps improve efficiency. */ - memset (d, 0, diffi); /* { dg-warning ".memset. argument 3 promotes to .ptrdiff_t. {aka .\(long \)?\(int\)?\(__int20\)?.} where .\(long \)?\(__int20 \)?unsigned\( int\)?. is expected" } */ + memset (d, 0, diffi); /* { dg-warning ".memset. argument 3 promotes to .ptrdiff_t. {aka .\(long \)*\(int\)?\(__int20\)?.} where .\(long \)*\(__int20 \)?unsigned\( int\)?. is expected" } */ - memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is .double. where '\(long \)?\(__int20 \)?unsigned\( int\)?' is expected" } */ + memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is .double. where '\(long \)*\(__int20 \)?unsigned\( int\)?' is expected" } */ /* Verify that the same call as above but to the built-in doesn't trigger a warning. */ diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c index d9015ac..1890312 100644 --- a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c +++ b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c @@ -5,12 +5,12 @@ /* { dg-additional-options "-O2 -g" } */ -typedef long int ptrdiff_t; -typedef unsigned long int uintptr_t; -typedef long int EMACS_INT; +typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __UINTPTR_TYPE__ uintptr_t; +typedef __PTRDIFF_TYPE__ EMACS_INT; enum { - EMACS_INT_WIDTH = 64, + EMACS_INT_WIDTH = sizeof(EMACS_INT) * 8, VALBITS = EMACS_INT_WIDTH - 3, }; typedef struct Lisp_X* Lisp_Word; @@ -151,4 +151,5 @@ set_marker_internal(Lisp_Object position, Lisp_Object buffer) struct buffer* b = live_buffer(buffer); if (NILP(position) || (MARKERP(position) && !XMARKER(position)->buffer) || !b) /* { dg-bogus "Wanalyzer-deref-before-check" } */ unchain_marker(); + return 0; } diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c b/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c index 57b8acd..b40be66 100644 --- a/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c +++ b/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c @@ -68,7 +68,7 @@ extern void check_init_u32 (__u32 v); /* Adapted/reduced from arch/x86/kernel/cpu/mtrr/if.c: mtrr_ioctl, which is GPL-2.0 */ -long mtrr_ioctl(unsigned int cmd, unsigned long __arg) { +long mtrr_ioctl(unsigned int cmd, __UINTPTR_TYPE__ __arg) { int err = 0; struct mtrr_sentry sentry; struct mtrr_gentry gentry; diff --git a/gcc/testsuite/gcc.dg/asan/pr119582.c b/gcc/testsuite/gcc.dg/asan/pr119582.c new file mode 100644 index 0000000..f33cb51 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr119582.c @@ -0,0 +1,23 @@ +/* PR c/119582 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fsanitize=address,pointer-subtract,pointer-compare" } */ + +const char v; +typedef __PTRDIFF_TYPE__ ptrdiff_t; +char a; +const ptrdiff_t p = &a + 1 - &a; +const int q = (&a + 1) != &a; + +ptrdiff_t +foo (void) +{ + char b; + return &b + (v != '\n') - &b; +} + +int +bar (void) +{ + char b; + return (&b + (v != '\n')) != &b; +} diff --git a/gcc/testsuite/gcc.dg/bf-ms-attrib.c b/gcc/testsuite/gcc.dg/bf-ms-attrib.c index 2da4f03..5208c7f 100644 --- a/gcc/testsuite/gcc.dg/bf-ms-attrib.c +++ b/gcc/testsuite/gcc.dg/bf-ms-attrib.c @@ -32,7 +32,7 @@ main() /* As long as the sizes are as expected, we know attributes are working. bf-ms-layout.c makes sure the right thing happens when the attribute is on. */ - if (sizeof(struct one_ms) != 8) + if (sizeof(struct one_ms) != 12) abort(); if (sizeof(struct one_gcc) != 8) abort(); diff --git a/gcc/testsuite/gcc.dg/bitint-121.c b/gcc/testsuite/gcc.dg/bitint-121.c new file mode 100644 index 0000000..335b9a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-121.c @@ -0,0 +1,24 @@ +/* PR middle-end/119808 */ +/* { dg-do run { target { bitint && fstack_protector } } } */ +/* { dg-options "-O0 -ftree-coalesce-vars -fstack-protector-strong" } */ + +#if __BITINT_MAXWIDTH__ >= 129 +_BitInt(129) +foo () +{ + _BitInt(129) b = 0; + _BitInt(8) a + =__builtin_stdc_rotate_right (0x8c82111b5d2d37c57e9ada7213ed95a49uwb, b); + return b; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 129 + _BitInt(129) x = foo (); + if (x) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/bitint-122.c b/gcc/testsuite/gcc.dg/bitint-122.c new file mode 100644 index 0000000..c791969 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-122.c @@ -0,0 +1,20 @@ +/* PR tree-optimization/116093 */ +/* { dg-do run { target bitint } } */ +/* { dg-options "-Og -ftree-vrp -fno-tree-dce" } */ + +#if __BITINT_MAXWIDTH__ >= 129 +char +foo (int a, _BitInt (129) b, char c) +{ + return c << (5 / b % (0xdb75dbf5 | a)); +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 129 + if (foo (0, 6, 1) != 1) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/builtin-apply5.c b/gcc/testsuite/gcc.dg/builtin-apply5.c new file mode 100644 index 0000000..16892f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-apply5.c @@ -0,0 +1,23 @@ +/* { dg-options "-O2 -Wmissing-noreturn -fgnu89-inline" } */ +/* { dg-additional-options "-mno-mmx" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ +/* { dg-do compile } */ + +extern void abort (void); + +double +foo (int arg) +{ + if (arg != 116) + abort(); + return arg + 1; +} + +__attribute__((noreturn)) +double +bar (int arg) +{ + foo (arg); + __builtin_return (__builtin_apply ((void (*) ()) foo, /* { dg-warning "'noreturn' function does return" } */ + __builtin_apply_args (), 16)); +} + diff --git a/gcc/testsuite/gcc.dg/cpp/pr118674.c b/gcc/testsuite/gcc.dg/cpp/pr118674.c new file mode 100644 index 0000000..00ea438 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr118674.c @@ -0,0 +1,5 @@ +/* PR preprocessor/118674 */ +/* { dg-do preprocess } */ +#define M(__VA_ARGS__, ...) +/* { dg-error "'__VA_ARGS__' can only appear in the expansion of a C99 variadic macro" "" { target *-*-* } .-1 } */ +/* { dg-error "duplicate macro parameter '__VA_ARGS__'" "" { target *-*-* } .-2 } */ diff --git a/gcc/testsuite/gcc.dg/gnu23-tag-6.c b/gcc/testsuite/gcc.dg/gnu23-tag-6.c new file mode 100644 index 0000000..b28c7b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gnu23-tag-6.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu23" } */ + +int f(int n) +{ + struct foo { struct { char (*x)[n]; }; } a; + { + struct foo { struct { char (*x)[n]; }; } b = a; + } +} + +int g(int n) +{ + struct foo { struct { char (*x)[n]; }; } a; + { + struct foo { struct { char (*x)[n]; }; } *b = &a; + } +} + +int h(int n) +{ + struct foo { struct { struct bar { char (*x)[n]; }* p; }; } a; + { + struct foo { struct { struct bar { char (*x)[n]; }* p; }; } *b = &a; + } +} + diff --git a/gcc/testsuite/gcc.dg/guality/pr36728-3.c b/gcc/testsuite/gcc.dg/guality/pr36728-3.c index 4700d50..589009b 100644 --- a/gcc/testsuite/gcc.dg/guality/pr36728-3.c +++ b/gcc/testsuite/gcc.dg/guality/pr36728-3.c @@ -30,7 +30,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7) /* { dg-final { gdb-test 14 "arg5" "5" } } */ /* { dg-final { gdb-test 14 "arg6" "6" } } */ /* { dg-final { gdb-test 14 "arg7" "30" } } */ -/* { dg-final { gdb-test 14 "y" "2" } } */ +/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { any-opts "-O3" } } } } } */ /* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg3" "3" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr41353-1.c b/gcc/testsuite/gcc.dg/guality/pr41353-1.c index 6639a52..ead9d89 100644 --- a/gcc/testsuite/gcc.dg/guality/pr41353-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr41353-1.c @@ -22,7 +22,7 @@ f2 (int i, int j) { j += i; /* { dg-final { gdb-test .+4 "i" "37" } } */ - /* { dg-final { gdb-test .+3 "j" "28 + 37" { xfail { no-opts "-O0" } } } } */ + /* { dg-final { gdb-test .+3 "j" "28 + 37" { xfail { { ! aarch64-*-* } && { no-opts "-O0" } } } } } */ int i1 = 2 * i; /* { dg-final { gdb-test .+2 "i1" "2 * 37" } } */ int i2 = 3 * i; /* { dg-final { gdb-test .+1 "i2" "3 * 37" } } */ return j; diff --git a/gcc/testsuite/gcc.dg/guality/pr54693-2.c b/gcc/testsuite/gcc.dg/guality/pr54693-2.c index 7a0ae73..229ef0e 100644 --- a/gcc/testsuite/gcc.dg/guality/pr54693-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr54693-2.c @@ -18,7 +18,7 @@ foo (int x, int y, int z) while (x > 3 && y > 3 && z > 3) { /* { dg-final { gdb-test .+2 "i" "v + 1" } } */ /* { dg-final { gdb-test .+1 "x" "10 - i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ - bar (i); /* { dg-final { gdb-test . "y" "20 - 2 * i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ + bar (i); /* { dg-final { gdb-test . "y" "20 - 2 * i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-Os" } } } } } */ /* { dg-final { gdb-test .-1 "z" "30 - 3 * i" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" "-Os" } } } } } */ i++, x--, y -= 2, z -= 3; } diff --git a/gcc/testsuite/gcc.dg/guality/pr68860-1.c b/gcc/testsuite/gcc.dg/guality/pr68860-1.c index 8c8d835..96d3b43 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68860-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr68860-1.c @@ -31,7 +31,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int a /* { dg-final { gdb-test 14 "arg6" "6" } } */ /* { dg-final { gdb-test 14 "arg7" "30" } } */ /* { dg-final { gdb-test 14 "arg8" "7" } } */ -/* { dg-final { gdb-test 14 "y" "2" } } */ +/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { any-opts "-O3" } } } } } */ /* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg3" "3" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr68860-2.c b/gcc/testsuite/gcc.dg/guality/pr68860-2.c index 070efbc..a18a04e 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68860-2.c +++ b/gcc/testsuite/gcc.dg/guality/pr68860-2.c @@ -31,7 +31,7 @@ foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int a /* { dg-final { gdb-test 14 "arg6" "6" } } */ /* { dg-final { gdb-test 14 "arg7" "30" } } */ /* { dg-final { gdb-test 14 "arg8" "7" } } */ -/* { dg-final { gdb-test 14 "y" "2" } } */ +/* { dg-final { gdb-test 14 "y" "2" { xfail { aarch64*-*-* && { any-opts "-O3" } } } } } */ /* { dg-final { gdb-test 16 "arg1" "1" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg2" "2" { target { ! "s390*-*-*" } } } } */ /* { dg-final { gdb-test 16 "arg3" "3" } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr90074.c b/gcc/testsuite/gcc.dg/guality/pr90074.c index 2fd8842..1294928 100644 --- a/gcc/testsuite/gcc.dg/guality/pr90074.c +++ b/gcc/testsuite/gcc.dg/guality/pr90074.c @@ -25,7 +25,7 @@ int main() debug stmt for the final value of the loop during loop distribution which would fix the UNSUPPORTED cases. c is optimized out at -Og for no obvious reason. */ - optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "8" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ - /* { dg-final { gdb-test .-1 "c + 1" "2" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ + optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "8" } } */ + /* { dg-final { gdb-test .-1 "c + 1" "2" } } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/guality/pr90716.c b/gcc/testsuite/gcc.dg/guality/pr90716.c index fe7e556..b2f5c9d 100644 --- a/gcc/testsuite/gcc.dg/guality/pr90716.c +++ b/gcc/testsuite/gcc.dg/guality/pr90716.c @@ -20,6 +20,6 @@ int main() Instead test j + 1 which will make the test UNSUPPORTED if i is optimized out. Since the test previously had wrong debug with j == 0 this is acceptable. */ - optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ + optimize_me_not(); /* { dg-final { gdb-test . "j + 1" "9" } } */ return 0; } diff --git a/gcc/testsuite/gcc.dg/guality/sra-1.c b/gcc/testsuite/gcc.dg/guality/sra-1.c index c0d1cf6..9d4cafbf 100644 --- a/gcc/testsuite/gcc.dg/guality/sra-1.c +++ b/gcc/testsuite/gcc.dg/guality/sra-1.c @@ -39,7 +39,7 @@ f3 (int k) struct B a = { 4, k + 6 }; asm ("" : "+r" (a.i)); a.j++; - bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" { xfail { aarch64*-*-* && { { any-opts "-Og" "-O2" "-O3" } && { ! { any-opts "-fno-fat-lto-objects" } } } } } } } */ + bar (a.i); /* { dg-final { gdb-test .+1 "a.i" "4" { xfail { aarch64*-*-* && { any-opts "-Og" "-fno-fat-lto-objects" } } } } } */ bar (a.j); /* { dg-final { gdb-test . "a.j" "14" { xfail { aarch64*-*-* && { any-opts "-Og" "-fno-fat-lto-objects" } } } } } */ return a.i + a.j; } diff --git a/gcc/testsuite/gcc.dg/guality/vla-1.c b/gcc/testsuite/gcc.dg/guality/vla-1.c index 264b9f3..f44474e 100644 --- a/gcc/testsuite/gcc.dg/guality/vla-1.c +++ b/gcc/testsuite/gcc.dg/guality/vla-1.c @@ -20,8 +20,8 @@ f1 (int i) int __attribute__((noinline)) f2 (int i) { - short a[i * 2 + 7]; /* { dg-final { gdb-test .+1 "i" "5" } } */ - bar (a); /* { dg-final { gdb-test . "sizeof (a)" "17 * sizeof (short)" } } */ + short a[i * 2 + 7]; /* { dg-final { gdb-test .+1 "i" "5" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ + bar (a); /* { dg-final { gdb-test . "sizeof (a)" "17 * sizeof (short)" { xfail { aarch64*-*-* && { any-opts "-fno-fat-lto-objects" } } } } } */ return a[i + 4]; } diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c b/gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c new file mode 100644 index 0000000..bf74e64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-clone-4.c @@ -0,0 +1,30 @@ +/* { dg-options "-O3 -fdump-ipa-cp" } */ +__attribute__ ((used)) +int a[1000]; + +__attribute__ ((noinline)) +void +test2(int sz) +{ + for (int i = 0; i < sz; i++) + a[i]++; + asm volatile (""::"m"(a)); +} + +__attribute__ ((noinline)) +void +test1 (int sz) +{ + for (int i = 0; i < 1000; i++) + test2(sz); +} +int main() +{ + test1(1000); + return 0; +} +/* We should clone test1 and test2 for constant 1000. + In the past we did not do this since we did not clone for edges that are not hot + and call main->test1 is not considered hot since it is executed just once. */ +/* { dg-final { scan-ipa-dump-times "Creating a specialized node of test1" 1 "cp"} } */ +/* { dg-final { scan-ipa-dump-times "Creating a specialized node of test2" 1 "cp"} } */ diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c index c34c89e..39874ad 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-19.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ /* { dg-additional-options "-msse2" { target ia32 } } */ -/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* powerpc-wrs-vxworks* } } */ +/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* powerpc-wrs-vxworks* powerpc-*-elf } } */ typedef int __attribute__((__vector_size__(16))) vectype; diff --git a/gcc/testsuite/gcc.dg/ipa/pr119318.c b/gcc/testsuite/gcc.dg/ipa/pr119318.c new file mode 100644 index 0000000..f179aed --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr119318.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int128 } */ +/* { dg-options "-Wno-psabi -w -O2" } */ + +typedef unsigned V __attribute__((vector_size (64))); +typedef unsigned __int128 W __attribute__((vector_size (64))); + +W a; +W b; +W c = { -0xffff, -0xffff, -0xffff, -0xffff }; + +static __attribute__((__noinline__, __noclone__)) W +bar (unsigned __int128 u) +{ + return u + c; +} + +static inline W +foo (unsigned short s, V v) +{ + V y = (V) bar ((unsigned short) ~s); + v >>= y; + b ^= (W) a; + v *= v; + return (W) v + b; +} + + +int +main () +{ + W x = foo (0, (V) { 0, 5 }); + for (unsigned i = 0; i < sizeof(x)/sizeof(x[0]); i++) + if (x[i] != (i ? 0 : 0x1900000000)) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ipa/pr119530.c b/gcc/testsuite/gcc.dg/ipa/pr119530.c new file mode 100644 index 0000000..f99c4fd --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr119530.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-tree-vrp -fno-inline" } */ + +struct a { + int b; +}; +int c; +signed char d; +static int e(long long f) { return f < 0; } +static void g(unsigned f) { c = e(~f); } +int main() { + int h; + struct a i = {128}; + h = d > i.b; + g(h); + if (h) + __builtin_abort(); + if (c) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/ipa/pr119803.c b/gcc/testsuite/gcc.dg/ipa/pr119803.c new file mode 100644 index 0000000..1a7bfd2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr119803.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern void f(int p); +int a, b; +char c; +static int d(int e) { return !e || a == 1 ? 0 : a / e; } +static void h(short e) { + int g = d(e); + f(g); +} +void i() { + c = 128; + h(c); + b = d(65536); +} diff --git a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c index 8c15097..2be31fa 100644 --- a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c +++ b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c @@ -25,5 +25,5 @@ bar (long a) } /* { dg-final { scan-rtl-dump "Will split live ranges of parameters" "ira" } } */ -/* { dg-final { scan-rtl-dump "Split live-range of register" "ira" { xfail { ! aarch64*-*-* } } } } */ +/* { dg-final { scan-rtl-dump "Split live-range of register" "ira" { xfail { ! { aarch64*-*-* i?86-*-* x86_64-*-* } } } } } */ /* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" } } */ diff --git a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c index 0690e03..61ee4c6 100644 --- a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c +++ b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c @@ -30,6 +30,6 @@ bar (long a) } /* { dg-final { scan-rtl-dump "Will split live ranges of parameters" "ira" } } */ -/* { dg-final { scan-rtl-dump "Split live-range of register" "ira" { xfail { ! aarch64*-*-* } } } } */ +/* { dg-final { scan-rtl-dump "Split live-range of register" "ira" { xfail { ! { aarch64*-*-* i?86-*-* x86_64-*-* } } } } } */ /* XFAIL due to PR70681. */ /* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { xfail arm*-*-* powerpc*-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/memcpy-4.c b/gcc/testsuite/gcc.dg/memcpy-4.c index 4c726f0..b17b369 100644 --- a/gcc/testsuite/gcc.dg/memcpy-4.c +++ b/gcc/testsuite/gcc.dg/memcpy-4.c @@ -1,13 +1,8 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-rtl-expand" } */ +/* { dg-options "-O2" } */ -#ifdef __mips -__attribute__((nomips16)) -#endif void f1 (char *p) { __builtin_memcpy (p, "12345", 5); } - -/* { dg-final { scan-rtl-dump "mem/u.*mem/u" "expand" { target mips*-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/pr116357.c b/gcc/testsuite/gcc.dg/pr116357.c index 07effa1..12aaf62 100644 --- a/gcc/testsuite/gcc.dg/pr116357.c +++ b/gcc/testsuite/gcc.dg/pr116357.c @@ -2,9 +2,9 @@ /* { dg-do compile } */ /* { dg-options "" } */ -typedef int A __attribute__((aligned (2 * alignof (int)))); +typedef int A __attribute__((aligned (2 * sizeof (int)))); A a[4]; /* { dg-error "alignment of array elements is greater than element size" } */ -typedef volatile int B __attribute__((aligned (2 * alignof (int)))); +typedef volatile int B __attribute__((aligned (2 * sizeof (int)))); B b[4]; /* { dg-error "alignment of array elements is greater than element size" } */ -typedef const int C __attribute__((aligned (2 * alignof (int)))); +typedef const int C __attribute__((aligned (2 * sizeof (int)))); C c[4]; /* { dg-error "alignment of array elements is greater than element size" } */ diff --git a/gcc/testsuite/gcc.dg/pr118947-1.c b/gcc/testsuite/gcc.dg/pr118947-1.c new file mode 100644 index 0000000..8733e8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr118947-1.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/118947 */ +/* { dg-do compile { target size32plus } } */ +/* { dg-options "-O2 -fdump-tree-forwprop1-details" } */ +/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */ + +void* aaa(); +void* bbb() +{ + char buf[1025] = {}; + /* Tha call to aaa should not matter and clobber buf. */ + void* ret = aaa(); + __builtin_memcpy(ret, buf, sizeof(buf)); + return ret; +} + diff --git a/gcc/testsuite/gcc.dg/pr119160.c b/gcc/testsuite/gcc.dg/pr119160.c new file mode 100644 index 0000000..b4629a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr119160.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -finstrument-functions-once -favoid-store-forwarding -fnon-call-exceptions -fschedule-insns -mgeneral-regs-only -Wno-psabi" } */ + +typedef __attribute__((__vector_size__ (32))) int V; + +void +foo (V v, V, V, V *r) +{ + V u = (V){} + v[0]; + *r = u; +} + +__attribute__((__noipa__)) void +bar(int x) +{ + if (x != 2) __builtin_abort(); +} + +int +main () +{ + V x; + foo ((V){ 2, 3 }, (V){ }, (V){ }, &x); + for (unsigned i = 0; i < sizeof(x)/sizeof(x[0]); i++) + bar(x[i]); +}
\ No newline at end of file diff --git a/gcc/testsuite/gcc.dg/pr119594.c b/gcc/testsuite/gcc.dg/pr119594.c new file mode 100644 index 0000000..5d1cb37 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr119594.c @@ -0,0 +1,32 @@ +/* PR rtl-optimization/119594 */ +/* { dg-do run } */ +/* { dg-options "-Os -fno-dce -fno-tree-dce -fno-tree-dse" } */ + +int a, b; +static unsigned c = -1; + +void +foo (int e) +{ + a = a ^ e; +} + +void +bar (long e) +{ + foo (e >> 1); +} + +int +main () +{ + int g[2]; + for (int h = 0; h < 2; h++) + g[h] = -1; + for (; b; b++) + ; + g[1] = 0; + bar (c); + if (!a) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/pr119612.c b/gcc/testsuite/gcc.dg/pr119612.c new file mode 100644 index 0000000..82bc5d9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr119612.c @@ -0,0 +1,9 @@ +/* PR c/119612 + * { dg-do compile } + * { dg-options "-std=gnu23" } + * */ + +int n = 3; +void a(struct { char (*p)[n]; } *); /* { dg-warning "anonymous struct" } */ +void b(struct { char (*p)[n]; } *); /* { dg-warning "anonymous struct" } */ + diff --git a/gcc/testsuite/gcc.dg/pr119664.c b/gcc/testsuite/gcc.dg/pr119664.c new file mode 100644 index 0000000..23ffc30 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr119664.c @@ -0,0 +1,15 @@ +/* PR target/119664 */ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +struct S { unsigned : 1, a : 1; } *s; +int foo (void); +void bar (void); + +int +baz (void) +{ + int a = s->a; + bar (); + return a && foo (); +} diff --git a/gcc/testsuite/gcc.dg/pr119717.c b/gcc/testsuite/gcc.dg/pr119717.c new file mode 100644 index 0000000..e5eedc5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr119717.c @@ -0,0 +1,24 @@ +/* PR c/119717 */ +/* { dg-additional-options "-std=c23" } */ +/* { dg-do compile } */ + +struct annotated { + unsigned count; + [[gnu::counted_by(count)]] char array[]; +}; + +[[gnu::noinline,gnu::noipa]] +static unsigned +size_of (bool x, struct annotated *a) +{ + char *p = (x ? a : 0)->array; + return __builtin_dynamic_object_size (p, 1); +} + +int main() +{ + struct annotated *p = __builtin_malloc(sizeof *p); + p->count = 0; + __builtin_printf ("the bdos whole is %ld\n", size_of (0, p)); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr78408-3.c b/gcc/testsuite/gcc.dg/pr78408-3.c new file mode 100644 index 0000000..5ea5458 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr78408-3.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/78408 */ +/* { dg-do compile { target size32plus } } */ +/* { dg-options "-O2 -fdump-tree-forwprop1-details" } */ +/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */ + +void* aaa(); +void* bbb() +{ + void* ret = aaa(); + char buf[1025] = {}; + __builtin_memcpy(ret, buf, sizeof(buf)); + return ret; +} + diff --git a/gcc/testsuite/gcc.dg/raw-string-1.c b/gcc/testsuite/gcc.dg/raw-string-1.c new file mode 100644 index 0000000..77d6145 --- /dev/null +++ b/gcc/testsuite/gcc.dg/raw-string-1.c @@ -0,0 +1,25 @@ +/* PR c++/110343 */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu23" } */ + +const void *s0 = R"0123456789abcdefg()0123456789abcdefg" 0; + /* { dg-error "raw string delimiter longer" "longer" { target *-*-* } .-1 } */ + /* { dg-error "stray" "stray" { target *-*-* } .-2 } */ +const void *s1 = R" () " 0; + /* { dg-error "invalid character" "invalid" { target *-*-* } .-1 } */ + /* { dg-error "stray" "stray" { target *-*-* } .-2 } */ +const void *s2 = R" () " 0; + /* { dg-error "invalid character" "invalid" { target *-*-* } .-1 } */ + /* { dg-error "stray" "stray" { target *-*-* } .-2 } */ +const void *s3 = R")())" 0; + /* { dg-error "invalid character" "invalid" { target *-*-* } .-1 } */ + /* { dg-error "stray" "stray" { target *-*-* } .-2 } */ +const char *s4 = R"@()@"; +const char *s5 = R"$()$"; +const char *s6 = R"`()`"; +const void *s7 = R"\u0040()\u0040" 0; + /* { dg-error "invalid character" "invalid" { target *-*-* } .-1 } */ + /* { dg-error "stray" "stray" { target *-*-* } .-2 } */ +const char *s8 = R"`@$$@`@`$()`@$$@`@`$"; + +int main () {} diff --git a/gcc/testsuite/gcc.dg/rtl/i386/vector_eq-2.c b/gcc/testsuite/gcc.dg/rtl/i386/vector_eq-2.c new file mode 100644 index 0000000..871d489 --- /dev/null +++ b/gcc/testsuite/gcc.dg/rtl/i386/vector_eq-2.c @@ -0,0 +1,71 @@ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-additional-options "-O2 -march=x86-64-v3" } */ + +typedef int v4si __attribute__((vector_size(16))); +typedef int v8si __attribute__((vector_size(32))); +typedef int v2di __attribute__((vector_size(16))); + +v4si __RTL (startwith ("vregs1")) foo1 (void) +{ +(function "foo1" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cnote 2 NOTE_INSN_FUNCTION_BEG) + (cinsn 3 (set (reg:V4SI <0>) (const_vector:V4SI [(const_int -1) (const_int -1) (const_int -1) (const_int -1)]))) + (cinsn 4 (set (reg:V4SI <1>) (const_vector:V4SI [(const_int -1) (const_int -1) (const_int -1) (const_int -1)]))) + (cinsn 5 (set (reg:V4SI <2>) + (eq:V4SI (reg:V4SI <0>) (reg:V4SI <1>)))) + (cinsn 6 (set (reg:V4SI <3>) (reg:V4SI <2>))) + (cinsn 7 (set (reg:V4SI xmm0) (reg:V4SI <3>))) + (edge-to exit (flags "FALLTHRU")) + ) + ) + (crtl (return_rtx (reg/i:V4SI xmm0))) +) +} + +v8si __RTL (startwith ("vregs1")) foo2 (void) +{ +(function "foo2" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cnote 2 NOTE_INSN_FUNCTION_BEG) + (cinsn 3 (set (reg:V8SI <0>) (const_vector:V8SI [(const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1)]))) + (cinsn 4 (set (reg:V8SI <1>) (const_vector:V8SI [(const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1) (const_int -1)]))) + (cinsn 5 (set (reg:V8SI <2>) + (eq:V8SI (reg:V8SI <0>) (reg:V8SI <1>)))) + (cinsn 6 (set (reg:V8SI <3>) (reg:V8SI <2>))) + (cinsn 7 (set (reg:V8SI xmm0) (reg:V8SI <3>))) + (edge-to exit (flags "FALLTHRU")) + ) + ) + (crtl (return_rtx (reg/i:V8SI xmm0))) +) +} + +v2di __RTL (startwith ("vregs1")) foo3 (void) +{ +(function "foo3" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cnote 2 NOTE_INSN_FUNCTION_BEG) + (cinsn 3 (set (reg:V2DI <0>) (const_vector:V2DI [(const_int -1) (const_int -1)]))) + (cinsn 4 (set (reg:V2DI <1>) (const_vector:V2DI [(const_int -1) (const_int -1)]))) + (cinsn 5 (set (reg:V2DI <2>) + (eq:V2DI (reg:V2DI <0>) (reg:V2DI <1>)))) + (cinsn 6 (set (reg:V2DI <3>) (reg:V2DI <2>))) + (cinsn 7 (set (reg:V2DI xmm0) (reg:V2DI <3>))) + (edge-to exit (flags "FALLTHRU")) + ) + ) + (crtl (return_rtx (reg/i:V2DI xmm0))) +) +} + +/* { dg-final { scan-assembler-times "vpcmpeq" 3 } } */ diff --git a/gcc/testsuite/gcc.dg/rtl/i386/vector_eq-3.c b/gcc/testsuite/gcc.dg/rtl/i386/vector_eq-3.c new file mode 100644 index 0000000..276c4c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/rtl/i386/vector_eq-3.c @@ -0,0 +1,74 @@ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-additional-options "-O2 -march=x86-64-v3" } */ + +typedef int v4si __attribute__((vector_size(16))); +typedef int v8si __attribute__((vector_size(32))); +typedef int v2di __attribute__((vector_size(16))); + +v4si __RTL (startwith ("vregs1")) foo1 (void) +{ +(function "foo1" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cnote 2 NOTE_INSN_FUNCTION_BEG) + (cinsn 3 (set (reg:V4SI <1>) + (mem:V4SI (reg:SI di) [0 ptr S128 A128]))) + (cinsn 4 (set (reg:V4SI <2>) + (eq:V4SI (reg:V4SI <1>) + (mem:V4SI (reg:SI di) [0 ptr S128 A128])))) + (cinsn 5 (set (reg:V4SI <3>) (reg:V4SI <2>))) + (cinsn 6 (set (reg:V4SI xmm0) (reg:V4SI <3>))) + (edge-to exit (flags "FALLTHRU")) + ) + ) + (crtl (return_rtx (reg/i:V4SI xmm0))) +) +} + +v8si __RTL (startwith ("vregs1")) foo2 (void) +{ +(function "foo2" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cnote 2 NOTE_INSN_FUNCTION_BEG) + (cinsn 3 (set (reg:V8SI <1>) + (mem:V8SI (reg:SI di) [0 ptr S256 A256]))) + (cinsn 4 (set (reg:V8SI <2>) + (eq:V8SI (mem:V8SI (reg:SI di) [0 ptr S256 A256]) + (reg:V8SI <1>)))) + (cinsn 5 (set (reg:V8SI <3>) (reg:V8SI <2>))) + (cinsn 6 (set (reg:V8SI xmm0) (reg:V8SI <3>))) + (edge-to exit (flags "FALLTHRU")) + ) + ) + (crtl (return_rtx (reg/i:V8SI xmm0))) +) +} + +v2di __RTL (startwith ("vregs1")) foo3 (void) +{ +(function "foo3" + (insn-chain + (block 2 + (edge-from entry (flags "FALLTHRU")) + (cnote 1 [bb 2] NOTE_INSN_BASIC_BLOCK) + (cnote 2 NOTE_INSN_FUNCTION_BEG) + (cinsn 3 (set (reg:V2DI <1>) + (mem:V2DI (reg:SI di) [0 ptr S128 A128]))) + (cinsn 4 (set (reg:V2DI <2>) + (eq:V2DI (reg:V2DI <1>) + (mem:V2DI (reg:SI di) [0 ptr S128 A128])))) + (cinsn 5 (set (reg:V2DI <3>) (reg:V2DI <2>))) + (cinsn 6 (set (reg:V2DI xmm0) (reg:V2DI <3>))) + (edge-to exit (flags "FALLTHRU")) + ) + ) + (crtl (return_rtx (reg/i:V2DI xmm0))) +) +} + +/* { dg-final { scan-assembler-times "vpcmpeq" 3 } } */ diff --git a/gcc/testsuite/gcc.dg/torture/bitint-76.c b/gcc/testsuite/gcc.dg/torture/bitint-76.c new file mode 100644 index 0000000..df47857 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-76.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/119707 */ +/* { dg-do run { target bitint } } */ + +#if __BITINT_MAXWIDTH__ >= 256 +__attribute__((noipa)) unsigned _BitInt(256) +foo (unsigned _BitInt(256) x, _BitInt(129) y) +{ + return x + (unsigned _BitInt(255)) y; +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 256 + if (foo (0, -1) != 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffuwb) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/bitint-77.c b/gcc/testsuite/gcc.dg/torture/bitint-77.c new file mode 100644 index 0000000..3e2523f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/bitint-77.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/119722 */ +/* { dg-do run { target bitint } } */ +/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-copy-prop -fno-tree-fre" } */ + +#if __BITINT_MAXWIDTH__ >= 33300 +unsigned _BitInt(33300) g; + +unsigned +foo (long c) +{ + unsigned _BitInt(33300) b + = __builtin_stdc_rotate_left ((unsigned _BitInt(13)) 8, c); + return ((unsigned _BitInt(50)) (g >> 50) + + ({ unsigned _BitInt(300) unused; b; })); +} +#endif + +int +main () +{ +#if __BITINT_MAXWIDTH__ >= 33300 + unsigned x = foo (0); + if (x != 8) + __builtin_abort (); +#endif +} diff --git a/gcc/testsuite/gcc.dg/torture/pr118476-1.c b/gcc/testsuite/gcc.dg/torture/pr118476-1.c new file mode 100644 index 0000000..33509403 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr118476-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +/* PR tree-optimization/118476 */ + +typedef unsigned long long poly64x1 __attribute__((__vector_size__(1*sizeof(long long)))); + +poly64x1 vext_p64(poly64x1 a, poly64x1 b, const int n) +{ + poly64x1 r = a; + unsigned src = (unsigned)n; + long long t = b[0]; + r[0] = (src < 1) ? a[src] : t; + return r; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr119599-1.c b/gcc/testsuite/gcc.dg/torture/pr119599-1.c new file mode 100644 index 0000000..4fbd228 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr119599-1.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-einline" } */ + +/* PR ipa/119599 */ +/* inlining a noreturn function which returns + can cause an ICE when dealing finding an unreachable block. + We should get a __builtin_unreachable after the inliing. */ + + +void baz (void); + +static inline __attribute__((always_inline, noreturn)) void +bar (void) +{ + static volatile int t = 0; + if (t == 0) + baz (); +} /* { dg-warning "function does return" } */ + +void +foo (void) +{ + bar (); +} + +/* After inlining, we should have call to __builtin_unreachable now. */ +/* { dg-final { scan-tree-dump "__builtin_unreachable " "einline" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/ipa-cp-1.c b/gcc/testsuite/gcc.dg/tree-prof/ipa-cp-1.c new file mode 100644 index 0000000..ab6a7f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-prof/ipa-cp-1.c @@ -0,0 +1,30 @@ +/* { dg-options "-O2 -fdump-ipa-cp" } */ +__attribute__ ((used)) +int a[1000]; + +__attribute__ ((noinline)) +void +test2(int sz) +{ + for (int i = 0; i < sz; i++) + a[i]++; + asm volatile (""::"m"(a)); +} + +__attribute__ ((noinline)) +void +test1 (int sz) +{ + for (int i = 0; i < 1000; i++) + test2(sz); +} +int main() +{ + test1(1000); + return 0; +} +/* We should clone test1 and test2 for constant 1000. + In the past we did not do this since we did not clone for edges that are not hot + and call main->test1 is not considered hot since it is executed just once. */ +/* { dg-final-use { scan-ipa-dump-times "Creating a specialized node of test1" 1 "cp"} } */ +/* { dg-final-use { scan-ipa-dump-times "Creating a specialized node of test2" 1 "cp"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c new file mode 100644 index 0000000..fa21b8a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr118902-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +void foo(int); +void l(int**); +int f1(int j, int t) +{ + int p = 0; + int *a = &p; + l(&a); + if (a == &p) + return 0; + for(int i = 0; i < j; i++) + { + if (a == &p) foo(p); + } + return 0; +} + +/* We should be able to remove the call to foo because a is never equal to &p inside the loop. */ +/* { dg-final { scan-tree-dump-not "foo " "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c index 5c89e3f..6fa52f6 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c @@ -27,4 +27,4 @@ foo () but the loop reads only one element at a time, and DOM cannot resolve these. The same happens on powerpc depending on the SIMD support available. */ -/* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail { { alpha*-*-* hppa*64*-*-* nvptx*-*-* mmix-knuth-mmixware } || { { { lp64 && { powerpc*-*-* sparc*-*-* } } || aarch64_sve } || { arm*-*-* && { ! arm_neon } } } } } } } */ +/* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail { { alpha*-*-* hppa*64*-*-* nvptx*-*-* mmix-knuth-mmixware } || { { { lp64 && { mips*-*-* powerpc*-*-* sparc*-*-* riscv*-*-* } } || aarch64_sve } || { arm*-*-* && { ! arm_neon } } } } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c new file mode 100644 index 0000000..9e605ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-52.c @@ -0,0 +1,30 @@ +/* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre -fdump-tree-optimized" } */ + +/* PR tree-optimization/87901 */ + +char z[32]; +void foo1(void) +{ + char z1[17]; + char z2[24]; + __builtin_memset (z1, 0, 17); + __builtin_memcpy (z, z1, 17); + __builtin_memset (z2, 0, 24); + __builtin_memcpy (z+8, z2, 24); +} + +/* we should get: + MEM <unsigned char[8]> [(char * {ref-all})&z] = {}; + MEM <unsigned char[24]> [(char * {ref-all})&z + 8B] = {}; + after DSE; trimming the first memset to z (which was memcpy) to 8 bytes + from the original 17. + and not have a [17] in the IR after DSE. + The two memset to z1/z2 will also be removed. + */ +/* { dg-final { scan-tree-dump-not "\\\[17\\\]" "optimized" } } */ +/* { dg-final { scan-tree-dump "\\\[8\\\]" "dse1" } } */ + +/* { dg-final { scan-tree-dump-times "Trimming statement " 1 "dse1" } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead call:" 2 "dse1" } } */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c new file mode 100644 index 0000000..a2df591 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-53.c @@ -0,0 +1,26 @@ +/* { dg-options "-O2 -fno-strict-aliasing -fdump-tree-dse-details -fno-tree-fre -fdump-tree-optimized" } */ + +/* PR tree-optimization/87901 */ + + +int i; +int foo () +{ + i = 0; + *((short *)&i + 1) = 1; + return i; +} + +/* we should get: + MEM <char[2]> [(int *)&i] = {}; + MEM[(short int *)&i + 2B] = 1; + in DSE1. + + Note later on the stores will be merged. */ +/* { dg-final { scan-tree-dump "return 65536;" "optimized" { target le } } } */ +/* { dg-final { scan-tree-dump "return 1;" "optimized" { target be } } } */ +/* { dg-final { scan-tree-dump "\\\[2\\\]" "dse1" } } */ + +/* { dg-final { scan-tree-dump-times "Trimming statement " 1 "dse1" } } */ + + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c new file mode 100644 index 0000000..7e79a73 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-54.c @@ -0,0 +1,25 @@ +/* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre -fdump-tree-optimized" } */ + +/* PR tree-optimization/87901 */ + +int z[128]; +void foo1(void) +{ + int z1; + int z2[24/sizeof(int)]; + __builtin_memset (&z1, 0, sizeof(int)); + __builtin_memcpy (z, &z1, sizeof(int)); + __builtin_memset (z2, 0, 24); + __builtin_memcpy (((char*)z)+1, z2, 24); +} + +/* we should get: + MEM[(char * {ref-all})&z] = {}; + __builtin_memset (&MEM <int[128]> [(void *)&z + 1B], 0, 24); + */ + +/* { dg-final { scan-tree-dump-not "MEM <unsigned int>" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "MEM \\\[" "dse1" } } */ +/* { dg-final { scan-tree-dump-times "Trimming statement " 1 "dse1" } } */ +/* { dg-final { scan-tree-dump-times "Deleted dead call:" 1 "dse1" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c index fdf6ed0..683533f 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c @@ -15,4 +15,4 @@ int main() { return 1; } -/* { dg-final { scan-assembler-not {vset} } } */ +/* { dg-final { scan-assembler-not {vset} { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c index acc7081..94435d3 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c @@ -15,4 +15,4 @@ int main() { return 1; } -/* { dg-final { scan-assembler-not {vset} } } */ +/* { dg-final { scan-assembler-not {vset} { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c index 0163129..415c4bd 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c @@ -15,4 +15,4 @@ int main() { return 1; } -/* { dg-final { scan-assembler-not {vset} } } */ +/* { dg-final { scan-assembler-not {vset} { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr119399.c b/gcc/testsuite/gcc.dg/vect/pr119399.c new file mode 100644 index 0000000..8d868f4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr119399.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fdump-tree-vect-raw" } */ + +void foo(int *p, int *q, int n) +{ + for (int i = 0; i < n; i++) + p[i] = q[i] + 1; +} + +/* { dg-final { scan-tree-dump-not {<pointer_diff_expr,} "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr119586.c b/gcc/testsuite/gcc.dg/vect/pr119586.c new file mode 100644 index 0000000..04a00ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr119586.c @@ -0,0 +1,21 @@ +#include "tree-vect.h" + +void __attribute__((noipa)) foo (long *) {} +void __attribute__((noipa)) +d() +{ + long e[6][8][5]; + for (int b = 0; b < 6; b++) + for (int c = 0; c < 8; c++) + { + e[b][c][0] = 1; + e[b][c][1] = 1; + e[b][c][4] = 1; + } + foo (&e[0][0][0]); +} +int main() +{ + check_vect (); + d(); +} diff --git a/gcc/testsuite/gcc.dg/vect/pr119640.c b/gcc/testsuite/gcc.dg/vect/pr119640.c new file mode 100644 index 0000000..8872817 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr119640.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-funswitch-loops" } */ + +int save, mask_nbits; + +void execute(long imm) +{ + long shift = 0; + int destReg[4]; + for (unsigned i = 0; i < 4; i++) + { + if (imm) + shift = 1ULL << mask_nbits; + destReg[i] = shift; + save = destReg[0]; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/pr119757.c b/gcc/testsuite/gcc.dg/vect/pr119757.c new file mode 100644 index 0000000..8644299 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr119757.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +void base64_encode(const char *table64, + const char *inputbuff, int insize, + char * __restrict output) +{ + const unsigned char *in = (const unsigned char *)inputbuff; + + while(insize >= 3) { + *output++ = table64[ in[0] >> 2 ]; + *output++ = table64[ ((in[0] & 0x03) << 4) | (in[1] >> 4) ]; + *output++ = table64[ ((in[1] & 0x0F) << 2) | ((in[2] & 0xC0) >> 6) ]; + *output++ = table64[ in[2] & 0x3F ]; + insize -= 3; + in += 3; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/pr99102.c b/gcc/testsuite/gcc.dg/vect/pr99102.c index 071741f..fcbf036 100644 --- a/gcc/testsuite/gcc.dg/vect/pr99102.c +++ b/gcc/testsuite/gcc.dg/vect/pr99102.c @@ -1,5 +1,5 @@ /* { dg-additional-options "-O2 -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details" } */ -/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-march=armv8-a+sve -msve-vector-bits=256" { target aarch64_sve256_hw } } */ long a[44]; short d, e = -7; __attribute__((noipa)) void b(char f, short j, short k, unsigned l) { diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_18.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_18.c index edddb44..cd39704 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_18.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_18.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target vect_early_break } */ /* { dg-require-effective-target vect_int } */ - +/* { dg-additional-options "-march=gfx908" { target amdgcn*-*-* } } */ /* { dg-additional-options "-Ofast" } */ /* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_load_lanes } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_38.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_38.c index 36fc6a6..010e7ea 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-early-break_38.c +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_38.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target vect_early_break } */ /* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-march=gfx908" { target amdgcn*-*-* } } */ #ifndef N #define N 803 diff --git a/gcc/testsuite/gcc.dg/vect/vect-fncall-mask.c b/gcc/testsuite/gcc.dg/vect/vect-fncall-mask.c index 554488e..ba1886d 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fncall-mask.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fncall-mask.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { aarch64*-*-* } } } */ -/* { dg-additional-options "-march=armv8.2-a+sve -fdump-tree-ifcvt-raw -Ofast" { target { aarch64*-*-* } } } */ +/* { dg-additional-options "-march=armv8.2-a+sve -fdump-tree-ifcvt -Ofast" { target { aarch64*-*-* } } } */ -extern int __attribute__ ((simd, const)) fn (int); +extern int __attribute__ ((simd, const)) fn (float); const int N = 20; const float lim = 101.0; @@ -26,6 +26,4 @@ int main (void) return (0); } -/* { dg-final { scan-tree-dump {gimple_assign <gt_expr, _12, _1, 1.01e\+2, NULL>} ifcvt } } */ -/* { dg-final { scan-tree-dump {gimple_assign <bit_not_expr, _34, _12, NULL, NULL>} ifcvt } } */ -/* { dg-final { scan-tree-dump {gimple_call <.MASK_CALL, _3, fn, _2, _34>} ifcvt } } */ +/* { dg-final { scan-tree-dump {(_\d+) = (_\d+) > 1.01e\+2;\n\s*(_\d+) = ~\1;\n\s*_\d+ = .MASK_CALL \(fn, \2, \3\);} ifcvt } } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov-31.c b/gcc/testsuite/gcc.misc-tests/gcov-31.c index 6c42d34..5f060e9 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov-31.c +++ b/gcc/testsuite/gcc.misc-tests/gcov-31.c @@ -20,7 +20,7 @@ run_pending_traps () jump_to_top_level (2); for (sig = 1; sig < (64 + 1) ; sig++) - __sigsetjmp ((return_catch), 0); + sigsetjmp ((return_catch), 0); } /* Distilled from alsalib-1.2.11 pcm/pcm_route.c. */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp index c8f20e1..4d427c8 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov.exp +++ b/gcc/testsuite/gcc.misc-tests/gcov.exp @@ -21,12 +21,19 @@ load_lib gcc-dg.exp load_lib gcov.exp global GCC_UNDER_TEST +global GCOV_UNDER_TEST -# For now find gcov in the same directory as $GCC_UNDER_TEST. -if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] +# For now find gcov in the same directory as $GCC_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] + } else { + set GCOV [gcc-transform-out-of-tree gcov] + } } else { - set GCOV [gcc-transform-out-of-tree gcov] + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/gcc.target/aarch64/_Float16_cmp_1.c b/gcc/testsuite/gcc.target/aarch64/_Float16_cmp_1.c new file mode 100644 index 0000000..e49ace1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/_Float16_cmp_1.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=armv8.2-a+fp16" } */ + +/* +** test_fcmp_store: +** fcmp h0, h1 +** cset w0, eq +** ret +*/ +int +test_fcmp_store(_Float16 a, _Float16 b) +{ + return a == b; +} + +/* +** test_fcmpe_store: +** fcmpe h0, h1 +** cset w0, mi +** ret +*/ +int +test_fcmpe_store(_Float16 a, _Float16 b) +{ + return a < b; +} + +/* +** test_fcmp_branch: +** fcmp h0, h1 +** ... +*/ +_Float16 +test_fcmp_branch(_Float16 a, _Float16 b) +{ + if (a == b) + return a * b; + return a; +} + +/* +** test_fcmpe_branch: +** fcmpe h0, h1 +** ... +*/ +_Float16 +test_fcmpe_branch(_Float16 a, _Float16 b) +{ + if (a < b) + return a * b; + return a; +} + +/* { dg-final { check-function-bodies "**" "" "" } } */
\ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/_Float16_cmp_2.c b/gcc/testsuite/gcc.target/aarch64/_Float16_cmp_2.c new file mode 100644 index 0000000..0ff7cda --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/_Float16_cmp_2.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=armv8.2-a+nofp16" } */ + +#include "_Float16_cmp_1.c" + +/* { dg-final { scan-assembler-not {\tfcmp\th[0-9]+} } } */ +/* { dg-final { scan-assembler-not {\tfcmpe\th[0-9]+} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/acle/rwsr-ungated.c b/gcc/testsuite/gcc.target/aarch64/acle/rwsr-ungated.c new file mode 100644 index 0000000..d67a426 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/acle/rwsr-ungated.c @@ -0,0 +1,13 @@ +/* Test that __arm_[r,w]sr intrinsics aren't gated (by default). */ + +/* { dg-do compile } */ +/* { dg-options "-march=armv8-a" } */ + +#include <arm_acle.h> + +uint64_t +foo (uint64_t a) +{ + __arm_wsr64 ("zcr_el1", a); + return __arm_rsr64 ("smcr_el1"); +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c index 0892ce7..a653296 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c @@ -1,7 +1,3 @@ -/* We haven't implemented these intrinsics for arm yet. */ -/* { dg-skip-if "unimplemented" { arm*-*-* } } */ -/* { dg-options "-O3" } */ - #include <arm_neon.h> #include "arm-neon-ref.h" @@ -39,7 +35,6 @@ VARIANT (int32, 2, _s32) \ VARIANT (int64, 1, _s64) \ VARIANT (poly8, 8, _p8) \ VARIANT (poly16, 4, _p16) \ -VARIANT (float16, 4, _f16) \ VARIANT (float32, 2, _f32) \ VARIANT (uint8, 16, q_u8) \ VARIANT (uint16, 8, q_u16) \ @@ -51,17 +46,30 @@ VARIANT (int32, 4, q_s32) \ VARIANT (int64, 2, q_s64) \ VARIANT (poly8, 16, q_p8) \ VARIANT (poly16, 8, q_p16) \ -VARIANT (float16, 8, q_f16) \ VARIANT (float32, 4, q_f32) +#if defined (__ARM_FP16_FORMAT_IEEE) \ + || defined (__ARM_FP16_FORMAT_ALTERNATIVE) \ + || defined (__aarch64__) +#define VARIANTS_F16(VARIANT) \ + VARIANT (float16, 4, _f16) \ + VARIANT (float16, 8, q_f16) +#else +#define VARIANTS_F16(VARIANTS_F16) +#endif + #ifdef __aarch64__ #define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) \ +VARIANT (poly64, 1, _p64) \ +VARIANT (poly64, 2, q_p64) \ VARIANT (mfloat8, 8, _mf8) \ VARIANT (mfloat8, 16, q_mf8) \ VARIANT (float64, 1, _f64) \ VARIANT (float64, 2, q_f64) #else -#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) +#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) #endif /* Tests of vld1_x2 and vld1q_x2. */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x3.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x3.c index 9465e4a..832ee75 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x3.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x3.c @@ -1,7 +1,3 @@ -/* We haven't implemented these intrinsics for arm yet. */ -/* { dg-skip-if "unimplemented" { arm*-*-* } } */ -/* { dg-options "-O3" } */ - #include <arm_neon.h> #include "arm-neon-ref.h" @@ -40,7 +36,6 @@ VARIANT (int32, 2, _s32) \ VARIANT (int64, 1, _s64) \ VARIANT (poly8, 8, _p8) \ VARIANT (poly16, 4, _p16) \ -VARIANT (float16, 4, _f16) \ VARIANT (float32, 2, _f32) \ VARIANT (uint8, 16, q_u8) \ VARIANT (uint16, 8, q_u16) \ @@ -52,17 +47,30 @@ VARIANT (int32, 4, q_s32) \ VARIANT (int64, 2, q_s64) \ VARIANT (poly8, 16, q_p8) \ VARIANT (poly16, 8, q_p16) \ -VARIANT (float16, 8, q_f16) \ VARIANT (float32, 4, q_f32) +#if defined (__ARM_FP16_FORMAT_IEEE) \ + || defined (__ARM_FP16_FORMAT_ALTERNATIVE) \ + || defined (__aarch64__) +#define VARIANTS_F16(VARIANT) \ + VARIANT (float16, 4, _f16) \ + VARIANT (float16, 8, q_f16) +#else +#define VARIANTS_F16(VARIANTS_F16) +#endif + #ifdef __aarch64__ #define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) \ +VARIANT (poly64, 1, _p64) \ +VARIANT (poly64, 2, q_p64) \ VARIANT (mfloat8, 8, _mf8) \ VARIANT (mfloat8, 16, q_mf8) \ VARIANT (float64, 1, _f64) \ VARIANT (float64, 2, q_f64) #else -#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) +#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) #endif diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x4.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x4.c index a1461fd..e5f55f0 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x4.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x4.c @@ -1,7 +1,3 @@ -/* We haven't implemented these intrinsics for arm yet. */ -/* { dg-skip-if "unimplemented" { arm*-*-* } } */ -/* { dg-options "-O3" } */ - #include <stdbool.h> #include <arm_neon.h> #include "arm-neon-ref.h" @@ -42,8 +38,6 @@ VARIANT (int32, 2, _s32) \ VARIANT (int64, 1, _s64) \ VARIANT (poly8, 8, _p8) \ VARIANT (poly16, 4, _p16) \ -VARIANT (poly64, 1, _p64) \ -VARIANT (float16, 4, _f16) \ VARIANT (float32, 2, _f32) \ VARIANT (uint8, 16, q_u8) \ VARIANT (uint16, 8, q_u16) \ @@ -55,18 +49,30 @@ VARIANT (int32, 4, q_s32) \ VARIANT (int64, 2, q_s64) \ VARIANT (poly8, 16, q_p8) \ VARIANT (poly16, 8, q_p16) \ -VARIANT (poly64, 2, q_p64) \ -VARIANT (float16, 8, q_f16) \ VARIANT (float32, 4, q_f32) +#if defined (__ARM_FP16_FORMAT_IEEE) \ + || defined (__ARM_FP16_FORMAT_ALTERNATIVE) \ + || defined (__aarch64__) +#define VARIANTS_F16(VARIANT) \ + VARIANT (float16, 4, _f16) \ + VARIANT (float16, 8, q_f16) +#else +#define VARIANTS_F16(VARIANTS_F16) +#endif + #ifdef __aarch64__ #define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) \ +VARIANT (poly64, 1, _p64) \ +VARIANT (poly64, 2, q_p64) \ VARIANT (mfloat8, 8, _mf8) \ VARIANT (mfloat8, 16, q_mf8) \ VARIANT (float64, 1, _f64) \ VARIANT (float64, 2, q_f64) #else -#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) +#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) #endif /* Tests of vld1_x4 and vld1q_x4. */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x2.c index 3cf5eb3..8399290 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x2.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x2.c @@ -1,7 +1,3 @@ -/* We haven't implemented these intrinsics for arm yet. */ -/* { dg-skip-if "unimplemented" { arm*-*-* } } */ -/* { dg-options "-O3" } */ - #include <arm_neon.h> #include "arm-neon-ref.h" @@ -39,7 +35,6 @@ VARIANT (int32, 2, _s32) \ VARIANT (int64, 1, _s64) \ VARIANT (poly8, 8, _p8) \ VARIANT (poly16, 4, _p16) \ -VARIANT (float16, 4, _f16) \ VARIANT (float32, 2, _f32) \ VARIANT (uint8, 16, q_u8) \ VARIANT (uint16, 8, q_u16) \ @@ -51,17 +46,30 @@ VARIANT (int32, 4, q_s32) \ VARIANT (int64, 2, q_s64) \ VARIANT (poly8, 16, q_p8) \ VARIANT (poly16, 8, q_p16) \ -VARIANT (float16, 8, q_f16) \ VARIANT (float32, 4, q_f32) +#if defined (__ARM_FP16_FORMAT_IEEE) \ + || defined (__ARM_FP16_FORMAT_ALTERNATIVE) \ + || defined (__aarch64__) +#define VARIANTS_F16(VARIANT) \ + VARIANT (float16, 4, _f16) \ + VARIANT (float16, 8, q_f16) +#else +#define VARIANTS_F16(VARIANTS_F16) +#endif + #ifdef __aarch64__ #define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) \ +VARIANT (poly64, 1, _p64) \ +VARIANT (poly64, 2, q_p64) \ VARIANT (mfloat8, 8, _mf8) \ VARIANT (mfloat8, 16, q_mf8) \ VARIANT (float64, 1, _f64) \ VARIANT (float64, 2, q_f64) #else -#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) +#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) #endif /* Tests of vst1_x2 and vst1q_x2. */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x3.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x3.c index c05f8e7..e7d9e02 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x3.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x3.c @@ -1,7 +1,3 @@ -/* We haven't implemented these intrinsics for arm yet. */ -/* { dg-skip-if "unimplemented" { arm*-*-* } } */ -/* { dg-options "-O3" } */ - #include <arm_neon.h> #include "arm-neon-ref.h" @@ -40,7 +36,6 @@ VARIANT (int32, 2, _s32) \ VARIANT (int64, 1, _s64) \ VARIANT (poly8, 8, _p8) \ VARIANT (poly16, 4, _p16) \ -VARIANT (float16, 4, _f16) \ VARIANT (float32, 2, _f32) \ VARIANT (uint8, 16, q_u8) \ VARIANT (uint16, 8, q_u16) \ @@ -52,17 +47,30 @@ VARIANT (int32, 4, q_s32) \ VARIANT (int64, 2, q_s64) \ VARIANT (poly8, 16, q_p8) \ VARIANT (poly16, 8, q_p16) \ -VARIANT (float16, 8, q_f16) \ VARIANT (float32, 4, q_f32) +#if defined (__ARM_FP16_FORMAT_IEEE) \ + || defined (__ARM_FP16_FORMAT_ALTERNATIVE) \ + || defined (__aarch64__) +#define VARIANTS_F16(VARIANT) \ + VARIANT (float16, 4, _f16) \ + VARIANT (float16, 8, q_f16) +#else +#define VARIANTS_F16(VARIANTS_F16) +#endif + #ifdef __aarch64__ #define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) \ +VARIANT (poly64, 1, _p64) \ +VARIANT (poly64, 2, q_p64) \ VARIANT (mfloat8, 8, _mf8) \ VARIANT (mfloat8, 16, q_mf8) \ VARIANT (float64, 1, _f64) \ VARIANT (float64, 2, q_f64) #else -#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) +#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) #endif /* Tests of vst1_x3 and vst1q_x3. */ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x4.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x4.c index a9867c3..83b0567 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x4.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1x4.c @@ -1,7 +1,3 @@ -/* We haven't implemented these intrinsics for arm yet. */ -/* { dg-skip-if "unimplemented" { arm*-*-* } } */ -/* { dg-options "-O3" } */ - #include <arm_neon.h> #include "arm-neon-ref.h" @@ -41,8 +37,6 @@ VARIANT (int32, 2, _s32) \ VARIANT (int64, 1, _s64) \ VARIANT (poly8, 8, _p8) \ VARIANT (poly16, 4, _p16) \ -VARIANT (poly64, 1, _p64) \ -VARIANT (float16, 4, _f16) \ VARIANT (float32, 2, _f32) \ VARIANT (uint8, 16, q_u8) \ VARIANT (uint16, 8, q_u16) \ @@ -54,18 +48,30 @@ VARIANT (int32, 4, q_s32) \ VARIANT (int64, 2, q_s64) \ VARIANT (poly8, 16, q_p8) \ VARIANT (poly16, 8, q_p16) \ -VARIANT (poly64, 2, q_p64) \ -VARIANT (float16, 8, q_f16) \ VARIANT (float32, 4, q_f32) +#if defined (__ARM_FP16_FORMAT_IEEE) \ + || defined (__ARM_FP16_FORMAT_ALTERNATIVE) \ + || defined (__aarch64__) +#define VARIANTS_F16(VARIANT) \ + VARIANT (float16, 4, _f16) \ + VARIANT (float16, 8, q_f16) +#else +#define VARIANTS_F16(VARIANTS_F16) +#endif + #ifdef __aarch64__ #define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) \ +VARIANT (poly64, 1, _p64) \ +VARIANT (poly64, 2, q_p64) \ VARIANT (mfloat8, 8, _mf8) \ VARIANT (mfloat8, 16, q_mf8) \ VARIANT (float64, 1, _f64) \ VARIANT (float64, 2, q_f64) #else -#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) +#define VARIANTS(VARIANT) VARIANTS_1(VARIANT) \ +VARIANTS_F16(VARIANT) #endif /* Tests of vst1_x4 and vst1q_x4. */ diff --git a/gcc/testsuite/gcc.target/aarch64/bic-1.c b/gcc/testsuite/gcc.target/aarch64/bic-1.c new file mode 100644 index 0000000..65e1514 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/bic-1.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { check-function-bodies "**" "" "" } } */ + +/* PR rtl-optmization/111949 */ + +/* +**func1: +** bic w([0-9]+), w0, w1 +** and w0, w\1, 1 +** ret +*/ + +unsigned func1(unsigned a, bool b) +{ + int c = a & b; + return (c ^ a)&1; +} + +/* +**func2: +** bic w([0-9]+), w1, w0 +** and w0, w\1, 255 +** ret +*/ +unsigned func2(bool a, bool b) +{ + return ~a & b; +} + +/* +**func3: +** bic w([0-9]+), w1, w0 +** and w0, w\1, 1 +** ret +*/ +bool func3(bool a, unsigned char b) +{ + return !a & b; +} diff --git a/gcc/testsuite/gcc.target/aarch64/popcnt-le-1.c b/gcc/testsuite/gcc.target/aarch64/popcnt-le-1.c index b4141da..843fdac 100644 --- a/gcc/testsuite/gcc.target/aarch64/popcnt-le-1.c +++ b/gcc/testsuite/gcc.target/aarch64/popcnt-le-1.c @@ -8,7 +8,7 @@ /* ** le32: ** sub w([0-9]+), w0, #1 -** tst w0, w\1 +** tst (?:w0, w\1|w\1, w0) ** cset w0, eq ** ret */ @@ -20,7 +20,7 @@ unsigned le32 (const unsigned int a) { /* ** gt32: ** sub w([0-9]+), w0, #1 -** tst w0, w\1 +** tst (?:w0, w\1|w\1, w0) ** cset w0, ne ** ret */ diff --git a/gcc/testsuite/gcc.target/aarch64/popcnt-le-3.c b/gcc/testsuite/gcc.target/aarch64/popcnt-le-3.c index b811e6f..3b558e9 100644 --- a/gcc/testsuite/gcc.target/aarch64/popcnt-le-3.c +++ b/gcc/testsuite/gcc.target/aarch64/popcnt-le-3.c @@ -8,7 +8,7 @@ /* ** le16: ** sub w([0-9]+), w0, #1 -** and w([0-9]+), w0, w\1 +** and w([0-9]+), (?:w0, w\1|w\1, w0) ** tst w\2, 65535 ** cset w0, eq ** ret @@ -21,7 +21,7 @@ unsigned le16 (const unsigned short a) { /* ** gt16: ** sub w([0-9]+), w0, #1 -** and w([0-9]+), w0, w\1 +** and w([0-9]+), (?:w0, w\1|w\1, w0) ** tst w\2, 65535 ** cset w0, ne ** ret diff --git a/gcc/testsuite/gcc.target/aarch64/pr100056.c b/gcc/testsuite/gcc.target/aarch64/pr100056.c index 0b77824..70499772 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr100056.c +++ b/gcc/testsuite/gcc.target/aarch64/pr100056.c @@ -1,7 +1,9 @@ /* PR target/100056 */ /* { dg-do compile } */ /* { dg-options "-O2" } */ -/* { dg-final { scan-assembler-not {\t[us]bfiz\tw[0-9]+, w[0-9]+, 11} } } */ +/* { dg-final { scan-assembler-not {\t[us]bfiz\tw[0-9]+, w[0-9]+, 11} { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times {\t[us]bfiz\tw[0-9]+, w[0-9]+, 11} 2 } } */ +/* { dg-final { scan-assembler-times {\tadd\tw[0-9]+, w[0-9]+, w[0-9]+, uxtb\n} 2 } } */ int or_shift_u8 (unsigned char i) diff --git a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c index dcac6d5..3799fb4 100644 --- a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c +++ b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c @@ -315,3 +315,18 @@ #ifndef __ARM_FEATURE_FP8DOT2 #error Foo #endif + +#pragma GCC target "arch=armv9.4-a" +#ifdef __ARM_FEATURE_FAMINMAX +#error Foo +#endif + +#pragma GCC target "arch=armv9.5-a" +#ifndef __ARM_FEATURE_FAMINMAX +#error Foo +#endif + +#pragma GCC target "arch=armv8-a+faminmax" +#ifndef __ARM_FEATURE_FAMINMAX +#error Foo +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/sve/gomp/gomp.exp b/gcc/testsuite/gcc.target/aarch64/sve/gomp/gomp.exp new file mode 100644 index 0000000..376985d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/gomp/gomp.exp @@ -0,0 +1,46 @@ +# Copyright (C) 2006-2025 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't an AArch64 target. +if {![istarget aarch64*-*-*] } then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +if ![check_effective_target_fopenmp] { + return +} + +if { [check_effective_target_aarch64_sve] } { + set sve_flags "" +} else { + set sve_flags "-march=armv8.2-a+sve" +} + +# Main loop. +dg-runtest [lsort [find $srcdir/$subdir *.c]] "$sve_flags -fopenmp" "" + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-device.c b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-device.c new file mode 100644 index 0000000..75dd39b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-device.c @@ -0,0 +1,201 @@ +/* { dg-do compile } */ +/* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */ + +#include <arm_sve.h> + +#define N __ARM_FEATURE_SVE_BITS + +int64_t __attribute__ ((noipa)) +target_device_ptr_vla (svbool_t vp, svint32_t *vptr) +{ + + int a[N], b[N], c[N]; + svint32_t va, vb, vc; + int64_t res; + int i; + +#pragma omp parallel for + for (i = 0; i < N; i++) + { + b[i] = i; + c[i] = i + 1; + } +/* { dg-error {SVE type 'svint32_t \*' not allowed in 'target' device clauses} "" { target *-*-* } .+1 } */ +#pragma omp target data use_device_ptr (vptr) map (to: b, c) +/* { dg-error {SVE type 'svint32_t \*' not allowed in 'target' device clauses} "" { target *-*-* } .+1 } */ +#pragma omp target is_device_ptr (vptr) map (to: b, c) map (from: res) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + vb = *vptr; + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+2 } */ + /* { dg-error "cannot reference 'svbool_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + vc = svld1_s32 (vp, c); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (vp, vb, vc); + res = svaddv_s32 (svptrue_b32 (), va); + } + + return res; +} + +int64_t __attribute__ ((noipa)) +target_device_addr_vla (svbool_t vp, svint32_t *vptr) +{ + + int a[N], b[N], c[N]; + svint32_t va, vb, vc; + int64_t res; + int i; + +#pragma omp parallel for + for (i = 0; i < N; i++) + { + b[i] = i; + c[i] = i + 1; + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'target' device clauses" "" { target *-*-* } .+1 } */ +#pragma omp target data use_device_addr (vb) map (to: b, c) +/* { dg-error {SVE type 'svint32_t \*' not allowed in 'target' device clauses} "" { target *-*-* } .+1 } */ +#pragma omp target is_device_ptr (vptr) map (to: b, c) map (from: res) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + vb = *vptr; + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+2 } */ + /* { dg-error "cannot reference 'svbool_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + vc = svld1_s32 (vp, c); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (vp, vb, vc); + res = svaddv_s32 (svptrue_b32 (), va); + } + + return res; +} + +int64_t __attribute__ ((noipa)) +target_has_device_addr_vla (svbool_t vp, svint32_t *vptr) +{ + + int a[N], b[N], c[N]; + svint32_t va, vb, vc; + int64_t res; + int i; + +#pragma omp parallel for + for (i = 0; i < N; i++) + { + b[i] = i; + c[i] = i + 1; + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'target' device clauses" "" { target *-*-* } .+1 } */ +#pragma omp target data use_device_addr (vb) map (to: b, c) +/* { dg-error "SVE type 'svint32_t' not allowed in 'target' device clauses" "" { target *-*-* } .+1 } */ +#pragma omp target has_device_addr (vb) map (to: b, c) map (from: res) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svbool_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + vb = svld1_s32 (vp, b); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + vc = svld1_s32 (vp, c); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (vp, vb, vc); + res = svaddv_s32 (svptrue_b32 (), va); + } + + return res; +} + +#define FIXED_ATTR __attribute__ ((arm_sve_vector_bits (N))) + +typedef __SVInt32_t v8si FIXED_ATTR; +typedef svbool_t v8bi FIXED_ATTR; + +int64_t __attribute__ ((noipa)) +target_device_ptr_vls (v8bi vp, v8si *vptr) +{ + + int a[N], b[N], c[N]; + v8si va, vb, vc; + int64_t res; + int i; + +#pragma omp parallel for + for (i = 0; i < N; i++) + { + b[i] = i; + c[i] = i + 1; + } + +#pragma omp target data use_device_ptr (vptr) map (to: b, c) +#pragma omp target is_device_ptr (vptr) map (to: b, c) map (from: res) + for (i = 0; i < 8; i++) + { + vb = *vptr; + vc = svld1_s32 (vp, c); + va = svadd_s32_z (vp, vb, vc); + res = svaddv_s32 (svptrue_b32 (), va); + } + + return res; +} + +int64_t __attribute__ ((noipa)) +target_device_addr_vls (v8bi vp, v8si *vptr) +{ + + int a[N], b[N], c[N]; + v8si va, vb, vc; + int64_t res; + int i; + +#pragma omp parallel for + for (i = 0; i < N; i++) + { + b[i] = i; + c[i] = i + 1; + } + +#pragma omp target data use_device_addr (vb) map (to: b, c) +#pragma omp target is_device_ptr (vptr) map (to: b, c) map (from: res) + for (i = 0; i < 8; i++) + { + vb = *vptr; + vc = svld1_s32 (vp, c); + va = svadd_s32_z (vp, vb, vc); + res = svaddv_s32 (svptrue_b32 (), va); + } + + return res; +} + +int64_t __attribute__ ((noipa)) +target_has_device_addr_vls (v8bi vp, v8si *vptr) +{ + + int a[N], b[N], c[N]; + v8si va, vb, vc; + int64_t res; + int i; + +#pragma omp parallel for + for (i = 0; i < N; i++) + { + b[i] = i; + c[i] = i + 1; + } + +#pragma omp target data use_device_addr (vb) map (to: b, c) +#pragma omp target has_device_addr (vb) map (to: b, c) map (from: res) + for (i = 0; i < 8; i++) + { + vb = svld1_s32 (vp, b); + vc = svld1_s32 (vp, c); + va = svadd_s32_z (vp, vb, vc); + res = svaddv_s32 (svptrue_b32 (), va); + } + + return res; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-link.c b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-link.c new file mode 100644 index 0000000..2f6184b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target-link.c @@ -0,0 +1,57 @@ +/* { dg-do compile } */ +/* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */ + +#include <arm_sve.h> + +#define N __ARM_FEATURE_SVE_BITS +#define FIXED_ATTR __attribute__((arm_sve_vector_bits (N))) + +typedef __SVInt32_t v8si FIXED_ATTR; + +static v8si local_vec; +#pragma omp declare target link(local_vec) + +v8si global_vec; +#pragma omp declare target link(global_vec) + +/* { dg-error {SVE type 'svint32_t' does not have a fixed size} "" { target *-*-* } .+1 } */ +static svint32_t slocal_vec; + +/* { dg-error {'slocal_vec' does not have a mappable type in 'link' clause} "" { target *-*-* } .+1 } */ +#pragma omp declare target link(slocal_vec) + +void +one_get_inc2_local_vec_vls () +{ + v8si res, res2, tmp; + +#pragma omp target map(from: res, res2) + { + res = local_vec; + local_vec = svadd_s32_z (svptrue_b32 (), local_vec, local_vec); + res2 = local_vec; + } + + tmp = svadd_s32_z (svptrue_b32 (), res, res); + svbool_t p = svcmpne_s32 (svptrue_b32 (), tmp, res2); + if (svptest_any (svptrue_b32 (), p)) + __builtin_abort (); +} + +void +one_get_inc3_global_vec_vls () +{ + v8si res, res2, tmp; + +#pragma omp target map(from: res, res2) + { + res = global_vec; + global_vec = svadd_s32_z (svptrue_b32 (), global_vec, global_vec); + res2 = global_vec; + } + + tmp = svadd_s32_z (svptrue_b32 (), res, res); + svbool_t p = svcmpne_s32 (svptrue_b32 (), tmp, res2); + if (svptest_any (svptrue_b32 (), p)) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/gomp/target.c b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target.c new file mode 100644 index 0000000..812183d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/gomp/target.c @@ -0,0 +1,2049 @@ +/* { dg-do compile } */ +/* { dg-options "-msve-vector-bits=256 -fopenmp -O2" } */ + +#include <arm_sve.h> + +#define N __ARM_FEATURE_SVE_BITS +#define FIXED_ATTR __attribute__((arm_sve_vector_bits (N))) + +typedef svint32_t v8si FIXED_ATTR; +typedef svbool_t v8bi FIXED_ATTR; + +void +target_vla1 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target + for (i = 0; i < 8; i++) + { + svint32_t va; + + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla1 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla1 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla1 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla1 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls1 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls1 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls1 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls1 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls1 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vla2 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target parallel + for (i = 0; i < 8; i++) + { + svint32_t va; + + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla2 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla2 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla2 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla2 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target parallel + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls2 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target parallel + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls2 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target parallel map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls2 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target parallel map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target parallel map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls2 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target parallel map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target parallel map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls2 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target parallel + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target parallel map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vla3 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target parallel loop + for (i = 0; i < 8; i++) + { + svint32_t va; + + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla3 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla3 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla3 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel loop map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel loop map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla3 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target parallel loop + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target parallel loop map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls3 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target parallel loop + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls3 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target parallel loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls3 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target parallel loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target parallel map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls3 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target parallel loop map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target parallel loop map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls3 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target parallel loop + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target parallel loop map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vla4 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target simd + for (i = 0; i < 8; i++) + { + svint32_t va; + + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla4 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla4 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target simd map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla4 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target simd map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target simd map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla4 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target simd + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target simd map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls4 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target simd + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls4 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls4 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target simd map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls4 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target simd map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target simd map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls4 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target simd + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target simd map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vla5 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams + for (i = 0; i < 8; i++) + { + svint32_t va; + + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla5 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla5 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla5 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla5 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls5 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls5 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls5 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls5 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target teams map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls5 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vla6 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams loop + for (i = 0; i < 8; i++) + { + svint32_t va; + + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla6 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla6 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla6 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams loop map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams loop map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla6 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams loop + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams loop map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls6 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams loop + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls6 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls6 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams loop map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls6 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target teams loop map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams loop map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls6 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams loop + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target teams loop map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vla7 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams distribute + for (i = 0; i < 8; i++) + { + svint32_t va; + + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla7 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla7 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla7 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla7 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams distribute + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls7 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams distribute + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls7 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams distribute map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls7 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams distribute map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls7 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target teams distribute map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams distribute map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls7 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams distribute + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target teams distribute map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vla8 (svint32_t vb, svint32_t vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams distribute simd + for (i = 0; i < 8; i++) + { + svint32_t va; + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +svint32_t +target_data_map_1_vla8 (svint32_t vb, svint32_t vc, int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +svint32_t +target_data_map_2_vla8 (svint32_t vb, svint32_t vc, int *a, int *b, + int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +svint32_t +target_map_data_enter_exit_vla8 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target enter data map(to: b, c, vb, vc) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute simd map(from: va) + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute simd map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target exit data map(from: va) + + return va; +} + +svint32_t +target_map_data_alloc_update_vla8 (svint32_t vb, svint32_t vc, int *a, + int *b, int *c) +{ + svint32_t va; + int i; + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams distribute simd + for (i = 0; i < 8; i++) + { + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + /* { dg-error "cannot reference 'svint32_t' object types in 'target' region" "" { target *-*-* } .+1 } */ + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +/* { dg-error "SVE type 'svint32_t' not allowed in 'map' clause" "" { target *-*-* } .+1 } */ +#pragma omp target teams distribute simd map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +void +target_vls8 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + int i; + +#pragma omp target teams distribute simd + for (i = 0; i < 8; i++) + { + v8si va; + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + va = svadd_s32_z (svptrue_b32 (), vb, vc); + svst1_s32 (svptrue_b32 (), a + i * 8, va); + } +} + +v8si +target_data_map_1_vls8 (v8si vb, v8si vc, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams distribute simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + return va; +} + +v8si +target_data_map_2_vls8 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target teams distribute simd map(to: b, c, vb, vc) map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} + +v8si +target_map_data_enter_exit_vls8 (v8si vb, v8si vc, int *a, int *b, int *c) +{ + v8si va; + int i; + +#pragma omp target enter data map(to: b, c, vb, vc) + +#pragma omp target teams distribute simd map(from: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target teams distribute simd map(to: va) map(to: a) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + +#pragma omp target exit data map(from: va) + + return va; +} + +v8si +target_map_data_alloc_update_vls8 (v8si vb, v8si vc, int *a, int *b, + int *c) +{ + v8si va; + int i; + +#pragma omp target data map(to: b, c, vb, vc) map(alloc: va) + +#pragma omp target teams distribute simd + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), b + i * 8, vb); + svst1_s32 (svptrue_b32 (), c + i * 8, vc); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), vb, vc); + } + +#pragma omp target update from(va) + +#pragma omp target teams distribute simd map(to: a) map(tofrom: va) + for (i = 0; i < 8; i++) + { + svst1_s32 (svptrue_b32 (), a + i * 8, va); + if (i == 7) + va = svadd_s32_z (svptrue_b32 (), va, svindex_s32 (1, 1)); + } + return va; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_10.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_10.c new file mode 100644 index 0000000..b7a7bc5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_10.c @@ -0,0 +1,24 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ + +#define N 512 +#define START 0 +#define END 505 + +int x[N] __attribute__((aligned(32))); + +int __attribute__((noipa)) +foo (int start) +{ + for (unsigned int i = start; i < END; ++i) + { + if (x[i] == 0) + return i; + } + return -1; +} + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ +/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */ +/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_10_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_10_run.c new file mode 100644 index 0000000..6169aeb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_10_run.c @@ -0,0 +1,17 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-Ofast --param aarch64-autovec-preference=sve-only" } */ +/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve128_hw } } */ + +#include "peel_ind_10.c" + +int __attribute__ ((optimize (1))) +main (void) +{ + int res = foo (START); + asm volatile (""); + if (res != START) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_5.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_5.c new file mode 100644 index 0000000..a03bb1d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_5.c @@ -0,0 +1,24 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ + +#define N 512 +#define START 2 +#define END 505 + +int x[N] __attribute__((aligned(32))); + +int __attribute__((noipa)) +foo (void) +{ + for (signed int i = START; i < END; ++i) + { + if (x[i] == 0) + return i; + } + return -1; +} + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ +/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */ +/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_5_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_5_run.c new file mode 100644 index 0000000..f26befe --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_5_run.c @@ -0,0 +1,17 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-Ofast --param aarch64-autovec-preference=sve-only" } */ +/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve128_hw } } */ + +#include "peel_ind_5.c" + +int __attribute__ ((optimize (1))) +main (void) +{ + int res = foo (); + asm volatile (""); + if (res != START) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_6.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_6.c new file mode 100644 index 0000000..9bfd1a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_6.c @@ -0,0 +1,24 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ + +#define N 512 +#define START 1 +#define END 505 + +int x[N] __attribute__((aligned(32))); + +int __attribute__((noipa)) +foo (int start) +{ + for (unsigned int i = start; i < END; ++i) + { + if (x[i] == 0) + return i; + } + return -1; +} + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ +/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */ +/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_6_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_6_run.c new file mode 100644 index 0000000..4fdf3e4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_6_run.c @@ -0,0 +1,17 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-Ofast --param aarch64-autovec-preference=sve-only" } */ +/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve128_hw } } */ + +#include "peel_ind_6.c" + +int __attribute__ ((optimize (1))) +main (void) +{ + int res = foo (START); + asm volatile (""); + if (res != START) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_7.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_7.c new file mode 100644 index 0000000..0182e13 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_7.c @@ -0,0 +1,24 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ + +#define N 512 +#define START 1 +#define END 505 + +int x[N] __attribute__((aligned(32))); + +int __attribute__((noipa)) +foo (void) +{ + for (unsigned int i = START; i < END; ++i) + { + if (x[i] == 0) + return i; + } + return -1; +} + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ +/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */ +/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_7_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_7_run.c new file mode 100644 index 0000000..05608dd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_7_run.c @@ -0,0 +1,17 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-Ofast --param aarch64-autovec-preference=sve-only" } */ +/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve128_hw } } */ + +#include "peel_ind_7.c" + +int __attribute__ ((optimize (1))) +main (void) +{ + int res = foo (); + asm volatile (""); + if (res != START) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_8.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_8.c new file mode 100644 index 0000000..043348b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_8.c @@ -0,0 +1,24 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ + +#define N 512 +#define START 1 +#define END 505 + +int x[N] __attribute__((aligned(32))); + +int __attribute__((noipa)) +foo (void) +{ + for (unsigned int i = START; i < END; i*=2) + { + if (x[i] == 0) + return i; + } + return -1; +} + +/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" } } */ +/* { dg-final { scan-tree-dump-not "pfa_iv_offset" "vect" } } */ +/* { dg-final { scan-tree-dump-not "Alignment of access forced using peeling" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_8_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_8_run.c new file mode 100644 index 0000000..aa86122 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_8_run.c @@ -0,0 +1,17 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-Ofast --param aarch64-autovec-preference=sve-only" } */ +/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve128_hw } } */ + +#include "peel_ind_8.c" + +int __attribute__ ((optimize (1))) +main (void) +{ + int res = foo (); + asm volatile (""); + if (res != START) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_9.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_9.c new file mode 100644 index 0000000..cc904e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_9.c @@ -0,0 +1,25 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ + +#define N 512 +#define START 1 +#define END 505 + +int x[N] __attribute__((aligned(32))); + +int __attribute__((noipa)) +foo (void) +{ + for (int *p = x + START; p < x + END; p++) + { + if (*p == 0) + return START; + } + return -1; +} + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ +/* Peels using a scalar loop. */ +/* { dg-final { scan-tree-dump-not "pfa_iv_offset" "vect" } } */ +/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_9_run.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_9_run.c new file mode 100644 index 0000000..767f8bd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_9_run.c @@ -0,0 +1,17 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-Ofast --param aarch64-autovec-preference=sve-only" } */ +/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve128_hw } } */ + +#include "peel_ind_9.c" + +int __attribute__ ((optimize (1))) +main (void) +{ + int res = foo (); + asm volatile (""); + if (res != START) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr119351.c b/gcc/testsuite/gcc.target/aarch64/sve/pr119351.c new file mode 100644 index 0000000..85aab35 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr119351.c @@ -0,0 +1,39 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -msve-vector-bits=256 --param aarch64-autovec-preference=sve-only -fdump-tree-vect-details" } */ +/* { dg-final { check-function-bodies "**" "" ""} } */ + +#define N 512 +#define START 1 +#define END 505 + +int x[N] __attribute__((aligned(32))); + +/* +** foo: +** ... +** ld1w z[0-9]+.s, p[0-9]+/z, \[x[0-9], x[0-9], lsl 2\] +** cmple p[0-9]+.s, p[0-9]+/z, z[0-9]+.s, #0 +** ptest p[0-9]+, p[0-9]+.b +** ... +*/ + +int __attribute__((noipa)) +foo (void) +{ + int z = 0; + for (unsigned int i = START; i < END; ++i) + { + z++; + if (x[i] > 0) + continue; + + return z; + } + return -1; +} + +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */ +/* { dg-final { scan-tree-dump "pfa_iv_offset" "vect" } } */ +/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr119351_run.c b/gcc/testsuite/gcc.target/aarch64/sve/pr119351_run.c new file mode 100644 index 0000000..d36ab0e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr119351_run.c @@ -0,0 +1,20 @@ +/* Fix for PR119351 alignment peeling with vectors and VLS. */ +/* { dg-do run { target aarch64_sve_hw } } */ +/* { dg-options "-Ofast --param aarch64-autovec-preference=sve-only" } */ +/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve256_hw } } */ +/* { dg-additional-options "-msve-vector-bits=128" { target aarch64_sve128_hw } } */ + +#include "pr119351.c" + +int __attribute__ ((optimize (1))) +main (void) +{ + x[0] = 1; + x[1] = 21; + x[2] = 39; + x[3] = 59; + int res = foo (); + if (res != 4) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-1.c b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-1.c index a7d2795..c9a8b82 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-1.c @@ -19,6 +19,6 @@ void f10(double * restrict z, double * restrict w, double * restrict x, double * } } -/* { dg-final { scan-assembler-not {\tbic\t} { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times {\tnot\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b\n} 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-not {\tbic\t} } } */ +/* { dg-final { scan-assembler-times {\tnot\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b\n} 1 } } */ /* { dg-final { scan-assembler-times {\tfcmgt\tp[0-9]+\.d, p[0-9]+/z, z[0-9]+\.d, #0} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c index 20cbd75..1845bd3 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pred-not-gen-4.c @@ -8,6 +8,6 @@ void f13(double * restrict z, double * restrict w, double * restrict x, double * } } -/* { dg-final { scan-assembler-not {\tbic\t} { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times {\tnot\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b\n} 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-not {\tbic\t} } } */ +/* { dg-final { scan-assembler-times {\tnot\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b\n} 1 } } */ /* { dg-final { scan-assembler-times {\tfcmuo\tp[0-9]+\.d, p[0-9]+/z, z[0-9]+\.d, z[0-9]+\.d} 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/var_stride_2.c b/gcc/testsuite/gcc.target/aarch64/sve/var_stride_2.c index 33b9f0f..b8afea7 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/var_stride_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/var_stride_2.c @@ -16,7 +16,8 @@ f (TYPE *x, TYPE *y, unsigned short n, unsigned short m) /* { dg-final { scan-assembler {\tldr\tw[0-9]+} } } */ /* { dg-final { scan-assembler {\tstr\tw[0-9]+} } } */ /* Should multiply by (257-1)*4 rather than (VF-1)*4 or (VF-2)*4. */ -/* { dg-final { scan-assembler-times {\tadd\tx[0-9]+, x[0-9]+, x[0-9]+, lsl 10\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tubfiz\tx[0-9]+, x2, 10, 16\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tubfiz\tx[0-9]+, x3, 10, 16\n} 1 } } */ /* { dg-final { scan-assembler-not {\tcmp\tx[0-9]+, 0} } } */ /* { dg-final { scan-assembler-not {\tcmp\tw[0-9]+, 0} } } */ /* { dg-final { scan-assembler-not {\tcsel\tx[0-9]+} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/var_stride_4.c b/gcc/testsuite/gcc.target/aarch64/sve/var_stride_4.c index 71b826a..d2e74f9 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/var_stride_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/var_stride_4.c @@ -16,7 +16,8 @@ f (TYPE *x, TYPE *y, int n, int m) /* { dg-final { scan-assembler {\tldr\tw[0-9]+} } } */ /* { dg-final { scan-assembler {\tstr\tw[0-9]+} } } */ /* Should multiply by (257-1)*4 rather than (VF-1)*4. */ -/* { dg-final { scan-assembler-times {\t(?:lsl\tx[0-9]+, x[0-9]+, 10|sbfiz\tx[0-9]+, x[0-9]+, 10, 32)\n} 2 } } */ +/* { dg-final { scan-assembler-times {\tsbfiz\tx[0-9]+, x2, 10, 32\n} 1 } } */ +/* { dg-final { scan-assembler-times {\tsbfiz\tx[0-9]+, x3, 10, 32\n} 1 } } */ /* { dg-final { scan-assembler {\tcmp\tw2, 0} } } */ /* { dg-final { scan-assembler {\tcmp\tw3, 0} } } */ /* { dg-final { scan-assembler-times {\tcsel\tx[0-9]+} 4 } } */ diff --git a/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c new file mode 100644 index 0000000..631d14f --- /dev/null +++ b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } } */ + +typedef unsigned int __attribute__ ((mode (DI))) int64_t; +typedef unsigned int __attribute__ ((mode (SI))) int32_t; + +typedef union + { + int32_t l[8]; + } +val; + +typedef struct + { + int32_t l[2]; + val v; + } +tre; + +typedef struct + { + int32_t l[3]; + tre t; + } +due; + +typedef struct + { + val v; + int64_t q; + int32_t l[2]; + due d; + } +uno; + +void +memcpy_nested_offset_long (uno *u) +{ + u->d.t.v = u->v; +} + +/* Expect assembly such as: + + ldq $4,0($16) + ldq $3,8($16) + ldq $2,16($16) + srl $4,32,$7 + ldq $1,24($16) + srl $3,32,$6 + stl $4,68($16) + srl $2,32,$5 + stl $7,72($16) + srl $1,32,$4 + stl $3,76($16) + stl $6,80($16) + stl $2,84($16) + stl $5,88($16) + stl $1,92($16) + stl $4,96($16) + + that is with four quadword loads at offsets 0, 8, 16, 24 each and + eight longword stores at offsets 68, 72, 76, 80, 84, 88, 92, 96 each. */ + +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,0\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,8\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,16\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,24\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,68\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,72\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,76\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,80\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,84\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,88\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,92\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,96\\\(\\\$16\\\)\\s" 1 } } */ diff --git a/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c new file mode 100644 index 0000000..1d2227e --- /dev/null +++ b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c @@ -0,0 +1,64 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } } */ + +typedef unsigned int __attribute__ ((mode (DI))) int64_t; +typedef unsigned int __attribute__ ((mode (SI))) int32_t; + +typedef union + { + int32_t l[8]; + } +val; + +typedef struct + { + int32_t l[2]; + val v; + } +tre; + +typedef struct + { + int32_t l[3]; + tre t; + } +due; + +typedef struct + { + val v; + int64_t q; + int32_t l[3]; + due d; + } +uno; + +void +memcpy_nested_offset_quad (uno *u) +{ + u->d.t.v = u->v; +} + +/* Expect assembly such as: + + ldq $4,0($16) + ldq $3,8($16) + ldq $2,16($16) + ldq $1,24($16) + stq $4,72($16) + stq $3,80($16) + stq $2,88($16) + stq $1,96($16) + + that is with four quadword loads at offsets 0, 8, 16, 24 each + and four quadword stores at offsets 72, 80, 88, 96 each. */ + +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,0\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,8\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,16\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,24\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,72\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,80\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,88\\\(\\\$16\\\)\\s" 1 } } */ +/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,96\\\(\\\$16\\\)\\s" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/ivopts.c b/gcc/testsuite/gcc.target/arm/ivopts.c index d7d72a5..582fdab 100644 --- a/gcc/testsuite/gcc.target/arm/ivopts.c +++ b/gcc/testsuite/gcc.target/arm/ivopts.c @@ -11,6 +11,6 @@ tr5 (short array[], int n) } /* { dg-final { scan-tree-dump-times "PHI <" 1 "ivopts"} } */ -/* { dg-final { object-size text <= 20 { target { arm_thumb2_no_arm_v8_1_lob } } } } */ +/* { dg-final { object-size text <= 20 { target { arm_thumb2_no_arm_v8_1m_lob } } } } */ /* { dg-final { object-size text <= 32 { target { arm_nothumb && { ! arm_iwmmxt_ok } } } } } */ /* { dg-final { object-size text <= 36 { target { arm_nothumb && arm_iwmmxt_ok } } } } */ diff --git a/gcc/testsuite/gcc.target/arm/lob1.c b/gcc/testsuite/gcc.target/arm/lob1.c index c8ce653..f42a367 100644 --- a/gcc/testsuite/gcc.target/arm/lob1.c +++ b/gcc/testsuite/gcc.target/arm/lob1.c @@ -1,7 +1,7 @@ /* Check that GCC generates Armv8.1-M low over head loop instructions for some simple loops. */ /* { dg-do run } */ -/* { dg-require-effective-target arm_v8_1_lob_ok } */ +/* { dg-require-effective-target arm_v8_1m_lob_hw } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ /* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps" } */ #include <stdlib.h> diff --git a/gcc/testsuite/gcc.target/arm/lob6.c b/gcc/testsuite/gcc.target/arm/lob6.c index 4fe116e..e19635b 100644 --- a/gcc/testsuite/gcc.target/arm/lob6.c +++ b/gcc/testsuite/gcc.target/arm/lob6.c @@ -1,7 +1,7 @@ /* Check that GCC generates Armv8.1-M low over head loop instructions with some less trivial loops and the result is correct. */ /* { dg-do run } */ -/* { dg-require-effective-target arm_v8_1_lob_ok } */ +/* { dg-require-effective-target arm_v8_1m_lob_hw } */ /* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */ /* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps" } */ #include <stdlib.h> diff --git a/gcc/testsuite/gcc.target/arm/mve/mve.exp b/gcc/testsuite/gcc.target/arm/mve/mve.exp index a5d8511..9dc56c9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/mve.exp +++ b/gcc/testsuite/gcc.target/arm/mve/mve.exp @@ -35,6 +35,7 @@ global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'" +set saved-dg-do-what-default ${dg-do-what-default} set dg-do-what-default "assemble" # Initialize `dg'. @@ -53,6 +54,8 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/general-c/*.\[cCS\]]] \ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ "" $DEFAULT_CFLAGS +set dg-do-what-default ${saved-dg-do-what-default} + # All done. set dg_runtest_extra_prunes "" dg-finish diff --git a/gcc/testsuite/gcc.target/arm/short-vfp-1.c b/gcc/testsuite/gcc.target/arm/short-vfp-1.c index 18d38a5..418fc27 100644 --- a/gcc/testsuite/gcc.target/arm/short-vfp-1.c +++ b/gcc/testsuite/gcc.target/arm/short-vfp-1.c @@ -1,45 +1,75 @@ /* { dg-do compile } */ -/* { dg-require-effective-target arm_vfp_ok } -/* { dg-add-options arm_vfp } */ +/* { dg-require-effective-target arm_arch_v7a_fp_hard_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_arch_v7a_fp_hard } */ +/* { dg-final { check-function-bodies "**" "" } } */ +/* +** test_sisf: +** vcvt.s32.f32 (s[0-9]+), s0 +** vmov r0, \1 @ int +** bx lr +*/ int test_sisf (float x) { return (int)x; } +/* +** test_hisf: +** vcvt.s32.f32 (s[0-9]+), s0 +** vmov (r[0-9]+), \1 @ int +** sxth r0, \2 +** bx lr +*/ short test_hisf (float x) { return (short)x; } +/* +** test_sfsi: +** vmov (s[0-9]+), r0 @ int +** vcvt.f32.s32 s0, \1 +** bx lr +*/ float test_sfsi (int x) { return (float)x; } +/* +** test_sfhi: +** vmov (s[0-9]+), r0 @ int +** vcvt.f32.s32 s0, \1 +** bx lr +*/ float test_sfhi (short x) { return (float)x; } +/* +** test_hisi: +** sxth r0, r0 +** bx lr +*/ short test_hisi (int x) { return (short)x; } +/* +** test_sihi: +** bx lr +*/ int test_sihi (short x) { return (int)x; } - -/* { dg-final { scan-assembler-times {vcvt\.s32\.f32\ts[0-9]+,s[0-9]+} 2 } } */ -/* { dg-final { scan-assembler-times {vcvt\.f32\.s32\ts[0-9]+,s[0-9]+} 2 } } */ -/* { dg-final { scan-assembler-times {vmov\tr[0-9]+,s[0-9]+} 2 } } */ -/* { dg-final { scan-assembler-times {vmov\ts[0-9]+,r[0-9]+} 2 } } */ -/* { dg-final { scan-assembler-times {sxth\tr[0-9]+,r[0-9]+} 2 } } */ diff --git a/gcc/testsuite/gcc.target/arm/unsigned-extend-2.c b/gcc/testsuite/gcc.target/arm/unsigned-extend-2.c index 9272e4c..41ee994 100644 --- a/gcc/testsuite/gcc.target/arm/unsigned-extend-2.c +++ b/gcc/testsuite/gcc.target/arm/unsigned-extend-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target arm_thumb2_ok_no_arm_v8_1_lob } */ +/* { dg-require-effective-target arm_thumb2_ok_no_arm_v8_1m_lob } */ /* { dg-options "-O" } */ unsigned short foo (unsigned short x, unsigned short c) diff --git a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c index fefe2e6..fa1acc7 100644 --- a/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c +++ b/gcc/testsuite/gcc.target/i386/apx-interrupt-1.c @@ -66,7 +66,7 @@ void foo (void *frame) /* { dg-final { scan-assembler-times {\t\.cfi_offset 132, -120} 1 } } */ /* { dg-final { scan-assembler-times {\t\.cfi_offset 131, -128} 1 } } */ /* { dg-final { scan-assembler-times {\t\.cfi_offset 130, -136} 1 } } */ -/* { dg-final { scan-assembler-times ".cfi_restore" 15} } */ +/* { dg-final { scan-assembler-times ".cfi_restore" 31 } } */ /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)ax" 1 } } */ /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)bx" 1 } } */ /* { dg-final { scan-assembler-times "pop(?:l|q)\[\\t \]*%(?:e|r)cx" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/apx-nf-pr119539.c b/gcc/testsuite/gcc.target/i386/apx-nf-pr119539.c new file mode 100644 index 0000000..5dfec55 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/apx-nf-pr119539.c @@ -0,0 +1,6 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-mapx-features=nf -march=x86-64 -O2" } */ +/* { dg-final { scan-assembler-times "\{nf\} rol" 2 } } */ + +long int f1 (int x) { return ~(1ULL << (x & 0x3f)); } +long int f2 (char x) { return ~(1ULL << (x & 0x3f)); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr96891-3.c b/gcc/testsuite/gcc.target/i386/avx512f-pr96891-3.c index 5b26081..5eb60d9 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-pr96891-3.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr96891-3.c @@ -1,11 +1,10 @@ /* { dg-do compile } */ /* { dg-options "-mavx512vl -mavx512bw -mavx512dq -O2 -masm=att -mstv -mno-stackrealign" } */ /* { dg-final { scan-assembler-not {not[bwlqd]\]} } } */ -/* { dg-final { scan-assembler-times {(?n)vpcmp[bwdq][ \t]*\$5} 4} } */ -/* { dg-final { scan-assembler-times {(?n)vpcmp[bwdq][ \t]*\$6} 4} } */ +/* { dg-final { scan-assembler-times {(?n)vpcmp[bwdq][ \t]*\$5} 2} } */ +/* { dg-final { scan-assembler-times {(?n)vpcmp[bwdq][ \t]*\$6} 3} } */ /* { dg-final { scan-assembler-times {(?n)vpcmp[bwdq][ \t]*\$[37]} 4} } */ -/* { dg-final { scan-assembler-times {(?n)vcmpp[sd][ \t]*\$5} 2} } */ -/* { dg-final { scan-assembler-times {(?n)vcmpp[sd][ \t]*\$6} 2} } */ +/* { dg-final { scan-assembler-times {(?n)vcmpp[sd][ \t]*\$6} 1} } */ /* { dg-final { scan-assembler-times {(?n)vcmpp[sd][ \t]*\$7} 2} } */ #include<immintrin.h> @@ -20,20 +19,14 @@ FOO (__m128i,, epi8, __mmask16, 128, 1); FOO (__m128i,, epi16, __mmask8, 128, 1); -FOO (__m128i,, epi32, __mmask8, 128, 1); -FOO (__m128i,, epi64, __mmask8, 128, 1); FOO (__m256i, 256, epi8, __mmask32, 256, 2); FOO (__m256i, 256, epi16, __mmask16, 256, 2); FOO (__m256i, 256, epi32, __mmask8, 256, 2); -FOO (__m256i, 256, epi64, __mmask8, 256, 2); FOO (__m512i, 512, epi8, __mmask64, 512, 3); FOO (__m512i, 512, epi16, __mmask32, 512, 3); FOO (__m512i, 512, epi32, __mmask16, 512, 3); FOO (__m512i, 512, epi64, __mmask8, 512, 3); -FOO (__m128,, ps, __mmask8, 128, 1); -FOO (__m128d,, pd, __mmask8, 128, 1); FOO (__m256, 256, ps, __mmask8, 256, 2); -FOO (__m256d, 256, pd, __mmask8, 256, 2); FOO (__m512, 512, ps, __mmask16, 512, 3); FOO (__m512d, 512, pd, __mmask8, 512, 3); diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtuq-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtuq-1.c index ef6a525..37ca646 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtuq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vpcmpgtuq-1.c @@ -12,5 +12,5 @@ void extern avx512f_test (void) { m = _mm512_cmpgt_epu64_mask (x, x); - m = _mm512_mask_cmpgt_epu64_mask (3, x, x); + m = _mm512_mask_cmpgt_epu64_mask (5, x, x); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-pr103750-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-pr103750-1.c new file mode 100644 index 0000000..a15fae8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512vl-pr103750-1.c @@ -0,0 +1,79 @@ +/* PR target/103750 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx512vl" } */ +/* { dg-final { scan-assembler-not "and" } } */ + +#include <immintrin.h> +extern __m128i* pi128; +extern __m256i* pi256; + +extern __m128* ps128; +extern __m256* ps256; + +extern __m128d* pd128; +extern __m256d* pd256; + +extern char a; +void +foo () +{ + __mmask8 mask1 = _mm_cmpeq_epu32_mask (pi128[0], pi128[1]); + a = mask1 & 15; +} + +void +foo1 () +{ + __mmask8 mask1 = _mm_cmpeq_epu64_mask (pi128[0], pi128[1]); + a = mask1 & 3; +} + +void +foo2 () +{ + __mmask8 mask1 = _mm256_cmpeq_epu64_mask (pi256[0], pi256[1]); + a = mask1 & 15; +} + +void +sign_foo () +{ + __mmask8 mask1 = _mm_cmpeq_epi32_mask (pi128[0], pi128[1]); + a = mask1 & 15; +} + +void +sign_foo1 () +{ + __mmask8 mask1 = _mm_cmpeq_epi64_mask (pi128[0], pi128[1]); + a = mask1 & 3; +} + + +void +sign_foo2 () +{ + __mmask8 mask1 = _mm256_cmpeq_epi64_mask (pi256[0], pi256[1]); + a = mask1 & 15; +} + +void +float_foo () +{ + __mmask8 mask1 = _mm_cmp_ps_mask (ps128[0], ps128[1], 1); + a = mask1 & 15; +} + +void +double_foo () +{ + __mmask8 mask1 = _mm_cmp_pd_mask (pd128[0], pd128[1], 1); + a = mask1 & 3; +} + +void +double_foo2 () +{ + __mmask8 mask1 = _mm256_cmp_pd_mask (pd256[0], pd256[1], 1); + a = mask1 & 15; +} diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c index 69b200a..a798d06 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpeqq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpeq_epi64_mask (x128, x128); m = _mm256_cmpeq_epi64_mask (x256, x256); - m = _mm_mask_cmpeq_epi64_mask (3, x128, x128); - m = _mm256_mask_cmpeq_epi64_mask (3, x256, x256); + m = _mm_mask_cmpeq_epi64_mask (5, x128, x128); + m = _mm256_mask_cmpeq_epi64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpequq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpequq-1.c index c925d32..736763f 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpequq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpequq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpeq_epu64_mask (x128, x128); m = _mm256_cmpeq_epu64_mask (x256, x256); - m = _mm_mask_cmpeq_epu64_mask (3, x128, x128); - m = _mm256_mask_cmpeq_epu64_mask (3, x256, x256); + m = _mm_mask_cmpeq_epu64_mask (5, x128, x128); + m = _mm256_mask_cmpeq_epu64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeq-1.c index ef40e41..19110a5 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpge_epi64_mask (x128, x128); m = _mm256_cmpge_epi64_mask (x256, x256); - m = _mm_mask_cmpge_epi64_mask (3, x128, x128); - m = _mm256_mask_cmpge_epi64_mask (3, x256, x256); + m = _mm_mask_cmpge_epi64_mask (5, x128, x128); + m = _mm256_mask_cmpge_epi64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeuq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeuq-1.c index 1f7dd49..d82f8e5 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeuq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgeuq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpge_epu64_mask (x128, x128); m = _mm256_cmpge_epu64_mask (x256, x256); - m = _mm_mask_cmpge_epu64_mask (3, x128, x128); - m = _mm256_mask_cmpge_epu64_mask (3, x256, x256); + m = _mm_mask_cmpge_epu64_mask (5, x128, x128); + m = _mm256_mask_cmpge_epu64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c index 26cac3a..79f9430 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpgt_epi64_mask (x128, x128); m = _mm256_cmpgt_epi64_mask (x256, x256); - m = _mm_mask_cmpgt_epi64_mask (3, x128, x128); - m = _mm256_mask_cmpgt_epi64_mask (3, x256, x256); + m = _mm_mask_cmpgt_epi64_mask (5, x128, x128); + m = _mm256_mask_cmpgt_epi64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtuq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtuq-1.c index 10717cd..bef015f 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtuq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpgtuq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpgt_epu64_mask (x128, x128); m = _mm256_cmpgt_epu64_mask (x256, x256); - m = _mm_mask_cmpgt_epu64_mask (3, x128, x128); - m = _mm256_mask_cmpgt_epu64_mask (3, x256, x256); + m = _mm_mask_cmpgt_epu64_mask (5, x128, x128); + m = _mm256_mask_cmpgt_epu64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleq-1.c index 110ff70..9974aa5 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmple_epi64_mask (x128, x128); m = _mm256_cmple_epi64_mask (x256, x256); - m = _mm_mask_cmple_epi64_mask (3, x128, x128); - m = _mm256_mask_cmple_epi64_mask (3, x256, x256); + m = _mm_mask_cmple_epi64_mask (5, x128, x128); + m = _mm256_mask_cmple_epi64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleuq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleuq-1.c index e3faf41..0a5a513 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleuq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpleuq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmple_epu64_mask (x128, x128); m = _mm256_cmple_epu64_mask (x256, x256); - m = _mm_mask_cmple_epu64_mask (3, x128, x128); - m = _mm256_mask_cmple_epu64_mask (3, x256, x256); + m = _mm_mask_cmple_epu64_mask (5, x128, x128); + m = _mm256_mask_cmple_epu64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltq-1.c index 1b8f7f1..5f40c79 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmplt_epi64_mask (x128, x128); m = _mm256_cmplt_epi64_mask (x256, x256); - m = _mm_mask_cmplt_epi64_mask (3, x128, x128); - m = _mm256_mask_cmplt_epi64_mask (3, x256, x256); + m = _mm_mask_cmplt_epi64_mask (5, x128, x128); + m = _mm256_mask_cmplt_epi64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltuq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltuq-1.c index 5c2f025..afda5e7 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltuq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltuq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmplt_epu64_mask (x128, x128); m = _mm256_cmplt_epu64_mask (x256, x256); - m = _mm_mask_cmplt_epu64_mask (3, x128, x128); - m = _mm256_mask_cmplt_epu64_mask (3, x256, x256); + m = _mm_mask_cmplt_epu64_mask (5, x128, x128); + m = _mm256_mask_cmplt_epu64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpneqq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpneqq-1.c index f48de10..5ef2548 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpneqq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpneqq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpneq_epi64_mask (x128, x128); m = _mm256_cmpneq_epi64_mask (x256, x256); - m = _mm_mask_cmpneq_epi64_mask (3, x128, x128); - m = _mm256_mask_cmpneq_epi64_mask (3, x256, x256); + m = _mm_mask_cmpneq_epi64_mask (5, x128, x128); + m = _mm256_mask_cmpneq_epi64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpnequq-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpnequq-1.c index 726a887..4a9aacf 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpnequq-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpnequq-1.c @@ -16,6 +16,6 @@ avx512vl_test (void) { m = _mm_cmpneq_epu64_mask (x128, x128); m = _mm256_cmpneq_epu64_mask (x256, x256); - m = _mm_mask_cmpneq_epu64_mask (3, x128, x128); - m = _mm256_mask_cmpneq_epu64_mask (3, x256, x256); + m = _mm_mask_cmpneq_epu64_mask (5, x128, x128); + m = _mm256_mask_cmpneq_epu64_mask (5, x256, x256); } diff --git a/gcc/testsuite/gcc.target/i386/blendv-to-maxmin.c b/gcc/testsuite/gcc.target/i386/blendv-to-maxmin.c new file mode 100644 index 0000000..042eb7d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/blendv-to-maxmin.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=x86-64-v3 -O2 -mfpmath=sse" } */ +/* { dg-final { scan-assembler-times "vmaxsd" 1 } } */ + +double +foo (double a) +{ + if (a > 0.0) + return a; + return 0.0; +} + diff --git a/gcc/testsuite/gcc.target/i386/blendv-to-pand.c b/gcc/testsuite/gcc.target/i386/blendv-to-pand.c new file mode 100644 index 0000000..2896a2b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/blendv-to-pand.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=x86-64-v3 -mfpmath=sse" } */ +/* { dg-final { scan-assembler-not "vblendv" } } */ + +void +foo (float* a, float* b, float* c, float* __restrict d, int n) +{ + for (int i = 0; i != n; i++) + { + c[i] *= 2.0f; + if (a[i] > b[i]) + d[i] = 0.0f; + else + d[i] = c[i]; + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr111673.c b/gcc/testsuite/gcc.target/i386/pr111673.c index b9ceacf..0f08ba89 100644 --- a/gcc/testsuite/gcc.target/i386/pr111673.c +++ b/gcc/testsuite/gcc.target/i386/pr111673.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ -/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } */ +/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue -fasynchronous-unwind-tables -fdwarf2-cfi-asm" } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ /* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr115910.c b/gcc/testsuite/gcc.target/i386/pr115910.c new file mode 100644 index 0000000..5f1cd9a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr115910.c @@ -0,0 +1,20 @@ +/* PR target/115910 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -march=x86-64 -mtune=generic -masm=att" } */ +/* { dg-final { scan-assembler-times {\timulq\t} 2 } } */ +/* { dg-final { scan-assembler-times {\tshrq\t\$33,} 2 } } */ +/* { dg-final { scan-assembler-not {\tsarl\t} } } */ + +int +foo (int x) +{ + if (x < 0) + __builtin_unreachable (); + return x / 3U; +} + +int +bar (int x) +{ + return x / 3U; +} diff --git a/gcc/testsuite/gcc.target/i386/pr119386-1.c b/gcc/testsuite/gcc.target/i386/pr119386-1.c new file mode 100644 index 0000000..9a0dc64 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119386-1.c @@ -0,0 +1,10 @@ +/* PR target/119386 */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -fpic -pg" } */ +/* { dg-final { scan-assembler "call\[ \t\]+mcount@PLT" } } */ + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr119386-2.c b/gcc/testsuite/gcc.target/i386/pr119386-2.c new file mode 100644 index 0000000..3ea978e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119386-2.c @@ -0,0 +1,12 @@ +/* PR target/119386 */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -fpic -fno-plt -pg" } */ +/* { dg-final { scan-assembler "call\[ \t\]+\\*mcount@GOTPCREL\\(" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]+\\*mcount@GOT\\(" { target ia32 } } } */ + + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr119386-3.c b/gcc/testsuite/gcc.target/i386/pr119386-3.c new file mode 100644 index 0000000..287410b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119386-3.c @@ -0,0 +1,10 @@ +/* PR target/119386 */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-options "-O2 -fpic -pg -mnop-mcount" } */ +/* { dg-final { scan-assembler ".byte\[ \t\]+0x0f, 0x1f, 0x44, 0x00, 0x00" } } */ + +int +main () +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr119784a.c b/gcc/testsuite/gcc.target/i386/pr119784a.c new file mode 100644 index 0000000..8a119d4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119784a.c @@ -0,0 +1,96 @@ +/* { dg-do compile { target { *-*-linux* && lp64 } } } */ +/* { dg-options "-O2 -fno-pic -mtune=generic -mgeneral-regs-only -mapxf -mtune-ctrl=prologue_using_move,epilogue_using_move" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* start must save and restore all caller saved registers. */ + +/* +**start: +**.LFB[0-9]+: +** .cfi_startproc +** subq \$248, %rsp +**... +** movq %rax, \(%rsp\) +** movq %rdx, 8\(%rsp\) +** movq %rcx, 16\(%rsp\) +** movq %rbx, 24\(%rsp\) +** movq %rsi, 32\(%rsp\) +** movq %rdi, 40\(%rsp\) +**... +** movq %rbp, 48\(%rsp\) +** movq %r8, 56\(%rsp\) +** movq %r9, 64\(%rsp\) +** movq %r10, 72\(%rsp\) +** movq %r11, 80\(%rsp\) +** movq %r12, 88\(%rsp\) +** movq %r13, 96\(%rsp\) +** movq %r14, 104\(%rsp\) +** movq %r15, 112\(%rsp\) +** movq %r16, 120\(%rsp\) +** movq %r17, 128\(%rsp\) +** movq %r18, 136\(%rsp\) +** movq %r19, 144\(%rsp\) +** movq %r20, 152\(%rsp\) +** movq %r21, 160\(%rsp\) +** movq %r22, 168\(%rsp\) +** movq %r23, 176\(%rsp\) +** movq %r24, 184\(%rsp\) +** movq %r25, 192\(%rsp\) +** movq %r26, 200\(%rsp\) +** movq %r27, 208\(%rsp\) +** movq %r28, 216\(%rsp\) +** movq %r29, 224\(%rsp\) +** movq %r30, 232\(%rsp\) +** movq %r31, 240\(%rsp\) +**... +** call \*code\(%rip\) +** movq \(%rsp\), %rax +** movq 8\(%rsp\), %rdx +** movq 16\(%rsp\), %rcx +** movq 24\(%rsp\), %rbx +** movq 32\(%rsp\), %rsi +** movq 40\(%rsp\), %rdi +** movq 48\(%rsp\), %rbp +** movq 56\(%rsp\), %r8 +** movq 64\(%rsp\), %r9 +** movq 72\(%rsp\), %r10 +** movq 80\(%rsp\), %r11 +** movq 88\(%rsp\), %r12 +** movq 96\(%rsp\), %r13 +** movq 104\(%rsp\), %r14 +** movq 112\(%rsp\), %r15 +** movq 120\(%rsp\), %r16 +** movq 128\(%rsp\), %r17 +** movq 136\(%rsp\), %r18 +** movq 144\(%rsp\), %r19 +** movq 152\(%rsp\), %r20 +** movq 160\(%rsp\), %r21 +** movq 168\(%rsp\), %r22 +** movq 176\(%rsp\), %r23 +** movq 184\(%rsp\), %r24 +** movq 192\(%rsp\), %r25 +** movq 200\(%rsp\), %r26 +** movq 208\(%rsp\), %r27 +** movq 216\(%rsp\), %r28 +** movq 224\(%rsp\), %r29 +** movq 232\(%rsp\), %r30 +** movq 240\(%rsp\), %r31 +** addq \$248, %rsp +**... +** ret +** .cfi_endproc +**... +*/ + +#define DONT_SAVE_REGS __attribute__((no_callee_saved_registers)) +#define SAVE_REGS __attribute__((no_caller_saved_registers)) + +typedef DONT_SAVE_REGS void (*op_t)(void); + +extern op_t code[]; + +SAVE_REGS void start() +{ + code[0](); +} diff --git a/gcc/testsuite/gcc.target/i386/pr119784b.c b/gcc/testsuite/gcc.target/i386/pr119784b.c new file mode 100644 index 0000000..c676197 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119784b.c @@ -0,0 +1,87 @@ +/* { dg-do compile { target { *-*-linux* && x32 } } } */ +/* { dg-options "-O2 -fno-pic -mtune=generic -mgeneral-regs-only -mapxf -mtune-ctrl=prologue_using_move,epilogue_using_move" } */ +/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ +/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ + +/* start must save and restore all caller saved registers. */ + +/* +**start: +**.LFB[0-9]+: +** .cfi_startproc +** subl \$248, %esp +**... +** movq %rax, \(%rsp\) +** movq %rdx, 8\(%rsp\) +** movq %rcx, 16\(%rsp\) +** movq %rbx, 24\(%rsp\) +** movq %rsi, 32\(%rsp\) +** movq %rdi, 40\(%rsp\) +**... +** movq %rbp, 48\(%rsp\) +** movq %r8, 56\(%rsp\) +** movq %r9, 64\(%rsp\) +** movq %r10, 72\(%rsp\) +** movq %r11, 80\(%rsp\) +** movq %r12, 88\(%rsp\) +** movq %r13, 96\(%rsp\) +** movq %r14, 104\(%rsp\) +** movq %r15, 112\(%rsp\) +** movq %r16, 120\(%rsp\) +** movq %r17, 128\(%rsp\) +** movq %r18, 136\(%rsp\) +** movq %r19, 144\(%rsp\) +** movq %r20, 152\(%rsp\) +** movq %r21, 160\(%rsp\) +** movq %r22, 168\(%rsp\) +** movq %r23, 176\(%rsp\) +** movq %r24, 184\(%rsp\) +** movq %r25, 192\(%rsp\) +** movq %r26, 200\(%rsp\) +** movq %r27, 208\(%rsp\) +** movq %r28, 216\(%rsp\) +** movq %r29, 224\(%rsp\) +** movq %r30, 232\(%rsp\) +** movq %r31, 240\(%rsp\) +**... +** movl code\(%rip\), %ebp +** call \*%rbp +** movq \(%rsp\), %rax +** movq 8\(%rsp\), %rdx +** movq 16\(%rsp\), %rcx +** movq 24\(%rsp\), %rbx +** movq 32\(%rsp\), %rsi +** movq 40\(%rsp\), %rdi +** movq 48\(%rsp\), %rbp +** movq 56\(%rsp\), %r8 +** movq 64\(%rsp\), %r9 +** movq 72\(%rsp\), %r10 +** movq 80\(%rsp\), %r11 +** movq 88\(%rsp\), %r12 +** movq 96\(%rsp\), %r13 +** movq 104\(%rsp\), %r14 +** movq 112\(%rsp\), %r15 +** movq 120\(%rsp\), %r16 +** movq 128\(%rsp\), %r17 +** movq 136\(%rsp\), %r18 +** movq 144\(%rsp\), %r19 +** movq 152\(%rsp\), %r20 +** movq 160\(%rsp\), %r21 +** movq 168\(%rsp\), %r22 +** movq 176\(%rsp\), %r23 +** movq 184\(%rsp\), %r24 +** movq 192\(%rsp\), %r25 +** movq 200\(%rsp\), %r26 +** movq 208\(%rsp\), %r27 +** movq 216\(%rsp\), %r28 +** movq 224\(%rsp\), %r29 +** movq 232\(%rsp\), %r30 +** movq 240\(%rsp\), %r31 +** addl \$248, %esp +**... +** ret +** .cfi_endproc +**... +*/ + +#include "pr119784a.c" diff --git a/gcc/testsuite/gcc.target/i386/pr119919.c b/gcc/testsuite/gcc.target/i386/pr119919.c new file mode 100644 index 0000000..ed64656 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119919.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -fdump-tree-vect-details" } */ +int a[9*9]; +bool b[9]; +void test() +{ + for (int i = 0; i < 9; i++) + { + b[i] = a[i*9] != 0; + } +} + +/* { dg-final { scan-tree-dump "loop vectorized using 8 byte vectors" "vect" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr67215-1.c b/gcc/testsuite/gcc.target/i386/pr67215-1.c index fd37f8e..ab69550 100644 --- a/gcc/testsuite/gcc.target/i386/pr67215-1.c +++ b/gcc/testsuite/gcc.target/i386/pr67215-1.c @@ -13,8 +13,8 @@ foo (void) arr[i] = bar (128); } -/* { dg-final { scan-assembler "call\[ \t\]*.bar@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*.bar@GOT\\(" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "mov(l|q)\[ \t\]*.bar@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]*.bar@GOT\\(" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*.bar@PLT" } } */ +/* { dg-final { scan-assembler "call\[ \t\]+\\*bar@GOTPCREL" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]+\\*bar@GOT\\(" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "mov(l|q)\[ \t\]+bar@GOTPCREL" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]+bar@GOT\\(" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "call\[ \t\]+\\*bar@PLT" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr67215-2.c b/gcc/testsuite/gcc.target/i386/pr67215-2.c index ebf2919..9fd7469 100644 --- a/gcc/testsuite/gcc.target/i386/pr67215-2.c +++ b/gcc/testsuite/gcc.target/i386/pr67215-2.c @@ -13,8 +13,8 @@ foo (void) arr[i] = bar (128); } -/* { dg-final { scan-assembler "call\[ \t\]*.bar@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "call\[ \t\]*.bar@GOT\\(" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "mov(l|q)\[ \t\]*.bar@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]*.bar@GOT\\(" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "call\[ \t\]*.bar@PLT" } } */ +/* { dg-final { scan-assembler "call\[ \t\]+\\*bar@GOTPCREL" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "call\[ \t\]+\\*bar@GOT\\(" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "mov(l|q)\[ \t\]+bar@GOTPCREL" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]+bar@GOT\\(" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "call\[ \t\]+\\*bar@PLT" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr82142a.c b/gcc/testsuite/gcc.target/i386/pr82142a.c index a40c038..a536150 100644 --- a/gcc/testsuite/gcc.target/i386/pr82142a.c +++ b/gcc/testsuite/gcc.target/i386/pr82142a.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { ! ia32 } } } */ -/* { dg-options "-O2 -mno-avx -msse2" } */ +/* { dg-options "-O2 -mno-avx -msse2 -fasynchronous-unwind-tables -fdwarf2-cfi-asm" } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ /* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr82142b.c b/gcc/testsuite/gcc.target/i386/pr82142b.c index b1bf12d..d18b7c4 100644 --- a/gcc/testsuite/gcc.target/i386/pr82142b.c +++ b/gcc/testsuite/gcc.target/i386/pr82142b.c @@ -1,5 +1,5 @@ /* { dg-do compile { target ia32 } } */ -/* { dg-options "-O2 -mno-avx -msse2" } */ +/* { dg-options "-O2 -mno-avx -msse2 -mno-stackrealign -fasynchronous-unwind-tables -fdwarf2-cfi-asm" } */ /* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */ /* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr89618-2.c b/gcc/testsuite/gcc.target/i386/pr89618-2.c index c414053..11d658f 100644 --- a/gcc/testsuite/gcc.target/i386/pr89618-2.c +++ b/gcc/testsuite/gcc.target/i386/pr89618-2.c @@ -19,5 +19,9 @@ void foo (int n, int *off, double *a) } /* Make sure the cost model selects SSE vectors rather than AVX to avoid - too many scalar ops for the address computes in the loop. */ -/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors" "vect" { target { ! ia32 } } } } */ + too many scalar ops for the address computes in the loop. + + Since open-coded scatters are costed wrong, we no longer vectorize after fixing + COND_EXPR costs. See PR119902. */ +/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors" "vect" { target { ! ia32 } xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-not "loop vectorized using 32 byte vectors" "vect" { target { ! ia32 } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/recip-vec-divf-fma.c b/gcc/testsuite/gcc.target/i386/recip-vec-divf-fma.c new file mode 100644 index 0000000..ad9e07b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/recip-vec-divf-fma.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast -mfma -mavx2" } */ +/* { dg-final { scan-assembler-times {(?n)vfn?m(add|sub)[1-3]*ps} 2 } } */ + +typedef float v4sf __attribute__((vector_size(16))); +/* (a - (rcp(b) * a * b)) * rcp(b) + rcp(b) * a */ + +v4sf +foo (v4sf a, v4sf b) +{ + return a / b; +} diff --git a/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp b/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp index f56d2f1..9df3f29 100644 --- a/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp +++ b/gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp @@ -35,7 +35,7 @@ dg-init # If the target hardware supports LSX, the default action is "run", otherwise # just "compile". -global dg-do-what-default +set saved-dg-do-what-default ${dg-do-what-default} if {[check_effective_target_loongarch_sx_hw]} then { set dg-do-what-default run } else { @@ -45,6 +45,7 @@ if {[check_effective_target_loongarch_sx_hw]} then { #Main loop. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/lsx/*.\[cS\]]] \ " -mlsx" $DEFAULT_CFLAGS +set dg-do-what-default ${saved-dg-do-what-default} dg-finish @@ -52,7 +53,7 @@ dg-init # If the target hardware supports LASX, the default action is "run", otherwise # just "compile". -global dg-do-what-default +set saved-dg-do-what-default ${dg-do-what-default} if {[check_effective_target_loongarch_asx_hw]} then { set dg-do-what-default run } else { @@ -61,5 +62,6 @@ if {[check_effective_target_loongarch_asx_hw]} then { dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/lasx/*.\[cS\]]] \ " -mlasx" $DEFAULT_CFLAGS +set dg-do-what-default ${saved-dg-do-what-default} # All done. dg-finish diff --git a/gcc/testsuite/gcc.target/mips/clear-cache-1.c b/gcc/testsuite/gcc.target/mips/clear-cache-1.c index f1554f5..cd11c66 100644 --- a/gcc/testsuite/gcc.target/mips/clear-cache-1.c +++ b/gcc/testsuite/gcc.target/mips/clear-cache-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-msynci isa_rev>=2" } */ /* { dg-final { scan-assembler "\tsynci\t" } } */ -/* { dg-final { scan-assembler "\tjr.hb\t" } } */ +/* { dg-final { scan-assembler "\tjrc?.hb\t" } } */ /* { dg-final { scan-assembler-not "_flush_cache|mips_sync_icache|_cacheflush" } } */ NOMIPS16 void f() diff --git a/gcc/testsuite/gcc.target/mips/memcpy-2.c b/gcc/testsuite/gcc.target/mips/memcpy-2.c new file mode 100644 index 0000000..df0cd18 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/memcpy-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "isa_rev<=5 -fdump-rtl-expand" } */ +/* { dg-skip-if "code quality test" { *-*-* } { "-Os" } { "" } } */ + +__attribute__((nomips16)) +void +f1 (char *p) +{ + __builtin_memcpy (p, "12345", 5); +} + +/* { dg-final { scan-rtl-dump "mem/u.*mem/u" "expand" } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/alloca-2-O0_-mfake-ptx-alloca.c b/gcc/testsuite/gcc.target/nvptx/alloca-2-O0_-mfake-ptx-alloca.c index 4cc4d0c..92562cd 100644 --- a/gcc/testsuite/gcc.target/nvptx/alloca-2-O0_-mfake-ptx-alloca.c +++ b/gcc/testsuite/gcc.target/nvptx/alloca-2-O0_-mfake-ptx-alloca.c @@ -1,4 +1,4 @@ -/* { dg-do link } */ +/* { dg-do run } */ /* { dg-options {-O0 -mno-soft-stack} } */ /* { dg-additional-options -march=sm_30 } */ /* { dg-additional-options -mfake-ptx-alloca } */ @@ -13,6 +13,7 @@ main(void) /* { dg-final { scan-assembler-times {(?n)^\.extern \.func \(\.param\.u64 %value_out\) __GCC_nvptx__PTX_alloca_not_supported \(\.param\.u64 %in_ar0\);$} 1 } } */ -/* { dg-message __GCC_nvptx__PTX_alloca_not_supported {unresolved symbol} { target *-*-* } 0 } */ +/* { dg-bogus __GCC_nvptx__PTX_alloca_not_supported {unresolved symbol} { target *-*-* } 0 } */ -/* { dg-final output-exists-not } */ +/* { dg-output {GCC/nvptx: sorry, unimplemented: dynamic stack allocation not supported[\r\n]+} } + { dg-shouldfail __GCC_nvptx__PTX_alloca_not_supported } */ diff --git a/gcc/testsuite/gcc.target/nvptx/decl.c b/gcc/testsuite/gcc.target/nvptx/decl.c index 190a64d..45dd699 100644 --- a/gcc/testsuite/gcc.target/nvptx/decl.c +++ b/gcc/testsuite/gcc.target/nvptx/decl.c @@ -13,8 +13,8 @@ int Foo () } /* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.visible .global \[^,\r\n\]*glob_export" } } */ -/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.visible .const \[^,\r\n\]*cst_export" } } */ +/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.visible .global \[^,\r\n\]*cst_export" } } */ /* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.global \[^,\r\n\]*glob_local" } } */ -/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.const \[^,\r\n\]*cst_local" } } */ +/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.global \[^,\r\n\]*cst_local" } } */ /* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.extern .global \[^,\r\n\]*glob_import" } } */ -/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.extern .const \[^,\r\n\]*cst_import" } } */ +/* { dg-final { scan-assembler "\[\r\n\]\[\t \]*.extern .global \[^,\r\n\]*cst_import" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/power11-3.c b/gcc/testsuite/gcc.target/powerpc/power11-3.c index fa1aedd..56bf881 100644 --- a/gcc/testsuite/gcc.target/powerpc/power11-3.c +++ b/gcc/testsuite/gcc.target/powerpc/power11-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mdejagnu-cpu=power8 -O2" } */ +/* { dg-require-ifunc "" } */ /* Check if we can set the power11 target via a target_clones attribute. */ diff --git a/gcc/testsuite/gcc.target/riscv/bext-ext-2.c b/gcc/testsuite/gcc.target/riscv/bext-ext-2.c new file mode 100644 index 0000000..aa170d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/bext-ext-2.c @@ -0,0 +1,74 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcb -mabi=lp64" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } } */ + +struct obstack; +struct bitmap_head_def; +typedef struct bitmap_head_def *bitmap; +struct obstack +{ + long chunk_size; + struct _obstack_chunk *chunk; + char *object_base; + char *next_free; + char *chunk_limit; + long int temp; + int alignment_mask; + + + + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; + unsigned use_extra_arg:1; + unsigned maybe_empty_object:1; + + + + unsigned alloc_failed:1; + + +}; + +typedef unsigned long BITMAP_WORD; +typedef struct bitmap_obstack { + struct bitmap_element_def *elements; + struct bitmap_head_def *heads; + struct obstack obstack; +} bitmap_obstack; +typedef struct bitmap_element_def { + struct bitmap_element_def *next; + struct bitmap_element_def *prev; + unsigned int indx; + BITMAP_WORD bits[((128 + (8 + * 8 * 1u) - 1) / (8 + * 8 * 1u))]; +} bitmap_element; +bitmap_element *bitmap_find_bit (bitmap, unsigned int); + + +int +bitmap_bit_p (bitmap head, int bit) +{ + bitmap_element *ptr; + unsigned bit_num; + unsigned word_num; + + ptr = bitmap_find_bit (head, bit); + if (ptr == 0) + return 0; + + bit_num = bit % (8 + * 8 * 1u); + word_num = bit / (8 + * 8 * 1u) % ((128 + (8 + * 8 * 1u) - 1) / (8 + * 8 * 1u)); + + return (ptr->bits[word_num] >> bit_num) & 1; +} + +/* { dg-final { scan-assembler-times "bext\t" 1 } } */ +/* { dg-final { scan-assembler-not "slr\t"} } */ +/* { dg-final { scan-assembler-not "andi\t"} } */ + diff --git a/gcc/testsuite/gcc.target/riscv/gnu-property-align-rv32.c b/gcc/testsuite/gcc.target/riscv/gnu-property-align-rv32.c new file mode 100644 index 0000000..4f48cff --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/gnu-property-align-rv32.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32g_zicfiss -fcf-protection=return -mabi=ilp32d " } */ + +void foo() {} + +/* { dg-final { scan-assembler-times ".p2align\t2" 3 } } */ +/* { dg-final { scan-assembler-not ".p2align\t3" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/gnu-property-align-rv64.c b/gcc/testsuite/gcc.target/riscv/gnu-property-align-rv64.c new file mode 100644 index 0000000..1bfd127 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/gnu-property-align-rv64.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64g_zicfiss -fcf-protection=return -mabi=lp64d " } */ + +void foo() {} + +/* { dg-final { scan-assembler-times ".p2align\t3" 3 } } */ +/* { dg-final { scan-assembler-not ".p2align\t2" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/jump-table-large-code-model.c b/gcc/testsuite/gcc.target/riscv/jump-table-large-code-model.c new file mode 100644 index 0000000..1ee7f6c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/jump-table-large-code-model.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64 -mcmodel=large" } */ + +int foo(int x, int y) +{ + switch(x){ + case 0: + return 123 + y; + case 1: + return 456 + y; + case 2: + return 789 - y; + case 3: + return 12 * y; + case 4: + return 13 % y; + case 5: + return 11 *y; + } + return 0; +} + + +/* { dg-final { scan-assembler-not "\.section \.rodata" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xiangshan-nanhu.c b/gcc/testsuite/gcc.target/riscv/mcpu-xiangshan-nanhu.c index 2903c88..c2a374f 100644 --- a/gcc/testsuite/gcc.target/riscv/mcpu-xiangshan-nanhu.c +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xiangshan-nanhu.c @@ -1,6 +1,6 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { rv64 } } } */ /* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ -/* { dg-options "-mcpu=xiangshan-nanhu" { target { rv64 } } } */ +/* { dg-options "-mcpu=xiangshan-nanhu" } */ /* XiangShan Nanhu => rv64imafdc_zba_zbb_zbc_zbs_zbkb_zbkc_zbkx_zknd _zkne_zknh_zksed_zksh_svinval_zicbom_zicboz */ diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908.c new file mode 100644 index 0000000..cb28baf --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908.c @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ +/* { dg-options "-mcpu=xt-c908" { target { rv64 } } } */ +/* XuanTie C908 => rv64imafdc_zicbom_zicbop_zicboz_zicntr_zicsr_zifencei_ +zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_sstc_svinval_svnapot_svpbmt_xtheadba_ +xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadmac_ +xtheadmemidx_xtheadmempair_xtheadsync */ + +#if !((__riscv_xlen == 64) \ + && !defined(__riscv_32e) \ + && defined(__riscv_mul) \ + && defined(__riscv_atomic) \ + && (__riscv_flen == 64) \ + && defined(__riscv_compressed) \ + && defined(__riscv_zicbom) \ + && defined(__riscv_zicbop) \ + && defined(__riscv_zicboz) \ + && defined(__riscv_zicntr) \ + && defined(__riscv_zicsr) \ + && defined(__riscv_zifencei) \ + && defined(__riscv_zihintpause) \ + && defined(__riscv_zihpm) \ + && defined(__riscv_zfh) \ + && defined(__riscv_zba) \ + && defined(__riscv_zbb) \ + && defined(__riscv_zbc) \ + && defined(__riscv_zbs) \ + && defined(__riscv_sstc) \ + && defined(__riscv_svinval) \ + && defined(__riscv_svnapot) \ + && defined(__riscv_svpbmt) \ + && defined(__riscv_xtheadba) \ + && defined(__riscv_xtheadbb) \ + && defined(__riscv_xtheadbs) \ + && defined(__riscv_xtheadcmo) \ + && defined(__riscv_xtheadcondmov) \ + && defined(__riscv_xtheadfmemidx) \ + && defined(__riscv_xtheadmac) \ + && defined(__riscv_xtheadmemidx) \ + && defined(__riscv_xtheadmempair) \ + && defined(__riscv_xtheadsync)) +#error "unexpected arch" +#endif + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908v.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908v.c new file mode 100644 index 0000000..1b1ee18 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c908v.c @@ -0,0 +1,50 @@ +/* { dg-do compile } */ +/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ +/* { dg-options "-mcpu=xt-c908v" { target { rv64 } } } */ +/* XuanTie C908v => rv64imafdcv_zicbom_zicbop_zicboz_zicntr_zicsr_zifencei_ +zihintpause_zihpm_zfh_zba_zbb_zbc_zbs_sstc_svinval_svnapot_svpbmt_xtheadba_ +xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadmac_ +xtheadmemidx_xtheadmempair_xtheadsync_xtheadvdot */ + +#if !((__riscv_xlen == 64) \ + && !defined(__riscv_32e) \ + && defined(__riscv_mul) \ + && defined(__riscv_atomic) \ + && (__riscv_flen == 64) \ + && defined(__riscv_compressed) \ + && defined(__riscv_v) \ + && defined(__riscv_zicbom) \ + && defined(__riscv_zicbop) \ + && defined(__riscv_zicboz) \ + && defined(__riscv_zicntr) \ + && defined(__riscv_zicsr) \ + && defined(__riscv_zifencei) \ + && defined(__riscv_zihintpause) \ + && defined(__riscv_zihpm) \ + && defined(__riscv_zfh) \ + && defined(__riscv_zba) \ + && defined(__riscv_zbb) \ + && defined(__riscv_zbc) \ + && defined(__riscv_zbs) \ + && defined(__riscv_sstc) \ + && defined(__riscv_svinval) \ + && defined(__riscv_svnapot) \ + && defined(__riscv_svpbmt) \ + && defined(__riscv_xtheadba) \ + && defined(__riscv_xtheadbb) \ + && defined(__riscv_xtheadbs) \ + && defined(__riscv_xtheadcmo) \ + && defined(__riscv_xtheadcondmov) \ + && defined(__riscv_xtheadfmemidx) \ + && defined(__riscv_xtheadmac) \ + && defined(__riscv_xtheadmemidx) \ + && defined(__riscv_xtheadmempair) \ + && defined(__riscv_xtheadsync) \ + && defined (__riscv__xtheadvdot)) +#error "unexpected arch" +#endif + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910.c new file mode 100644 index 0000000..1e27665 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ +/* { dg-options "-mcpu=xt-c910" { target { rv64 } } } */ +/* XuanTie C910 => rv64imafdc_zicntr_zicsr_zifencei_zihpm_zfh_xtheadba_ +xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadmac_ +xtheadmemidx_xtheadmempair_xtheadsync */ + +#if !((__riscv_xlen == 64) \ + && !defined(__riscv_32e) \ + && defined(__riscv_mul) \ + && defined(__riscv_atomic) \ + && (__riscv_flen == 64) \ + && defined(__riscv_compressed) \ + && defined(__riscv_zicntr) \ + && defined(__riscv_zicsr) \ + && defined(__riscv_zifencei) \ + && defined(__riscv_zihpm) \ + && defined(__riscv_zfh) \ + && defined(__riscv_xtheadba) \ + && defined(__riscv_xtheadbb) \ + && defined(__riscv_xtheadbs) \ + && defined(__riscv_xtheadcmo) \ + && defined(__riscv_xtheadcondmov) \ + && defined(__riscv_xtheadfmemidx) \ + && defined(__riscv_xtheadmac) \ + && defined(__riscv_xtheadmemidx) \ + && defined(__riscv_xtheadmempair) \ + && defined(__riscv_xtheadsync)) +#error "unexpected arch" +#endif + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910v2.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910v2.c new file mode 100644 index 0000000..6a54f09 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c910v2.c @@ -0,0 +1,51 @@ +/* { dg-do compile } */ +/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ +/* { dg-options "-mcpu=xt-c910v2" { target { rv64 } } } */ +/* XuanTie C910v2 => rv64imafdc_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_ +zifencei _zihintntl_zihintpause_zihpm_zawrs_zfa_zfbfmin_zfh_zca_zcb_zcd_zba_ +zbb_zbc_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_ +xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync */ + +#if !((__riscv_xlen == 64) \ + && !defined(__riscv_32e) \ + && defined(__riscv_mul) \ + && defined(__riscv_atomic) \ + && (__riscv_flen == 64) \ + && defined(__riscv_compressed) \ + && defined(__riscv_zicbom) \ + && defined(__riscv_zicbop) \ + && defined(__riscv_zicboz) \ + && defined(__riscv_zicntr) \ + && defined(__riscv_zicond) \ + && defined(__riscv_zicsr) \ + && defined(__riscv_zifencei ) \ + && defined(__riscv_zihintntl) \ + && defined(__riscv_zihintpause) \ + && defined(__riscv_zihpm) \ + && defined(__riscv_zawrs) \ + && defined(__riscv_zfa) \ + && defined(__riscv_zfbfmin) \ + && defined(__riscv_zfh) \ + && defined(__riscv_zca) \ + && defined(__riscv_zcb) \ + && defined(__riscv_zcd) \ + && defined(__riscv_zba) \ + && defined(__riscv_zbb) \ + && defined(__riscv_zbc) \ + && defined(__riscv_xtheadba) \ + && defined(__riscv_xtheadbb) \ + && defined(__riscv_xtheadbs) \ + && defined(__riscv_xtheadcmo) \ + && defined(__riscv_xtheadcondmov) \ + && defined(__riscv_xtheadfmemidx) \ + && defined(__riscv_xtheadmac) \ + && defined(__riscv_xtheadmemidx) \ + && defined(__riscv_xtheadmempair) \ + && defined(__riscv_xtheadsync)) +#error "unexpected arch" +#endif + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920.c new file mode 100644 index 0000000..6bcd687 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ +/* { dg-options "-mcpu=xt-c920" { target { rv64 } } } */ +/* XuanTie c920 => rv64imafdc_zicntr_zicsr_zifencei_zihpm_zfh_"xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync_xtheadvector */ + +#if !((__riscv_xlen == 64) \ + && !defined(__riscv_32e) \ + && defined(__riscv_mul) \ + && defined(__riscv_atomic) \ + && (__riscv_flen == 64) \ + && defined(__riscv_compressed) \ + && defined(__riscv_zicntr) \ + && defined(__riscv_zicsr) \ + && defined(__riscv_zifencei) \ + && defined(__riscv_zihpm) \ + && defined(__riscv_zfh) \ + && defined(__riscv_xtheadba) \ + && defined(__riscv_xtheadbb) \ + && defined(__riscv_xtheadbs) \ + && defined(__riscv_xtheadcmo) \ + && defined(__riscv_xtheadcondmov) \ + && defined(__riscv_xtheadfmemidx) \ + && defined(__riscv_xtheadmac) \ + && defined(__riscv_xtheadmemidx) \ + && defined(__riscv_xtheadmempair) \ + && defined(__riscv_xtheadsync) \ + && defined(__riscv_xtheadvector)) +#error "unexpected arch" +#endif + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920v2.c b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920v2.c new file mode 100644 index 0000000..36a6267 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/mcpu-xt-c920v2.c @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */ +/* { dg-options "-mcpu=xt-c920v2" { target { rv64 } } } */ +/* XuanTie C920v2 => rv64imafdcv_zicbom_zicbop_zicboz_zicntr_zicond_zicsr_zifencei _zihintntl_zihintpause_zihpm_zawrs_zfa_zfbfmin_zfh_zca_zcb_zcd_zba_zbb_zbc_zbs_zvfbfmin_zvfbfwma_zvfh_sscofpmf_sstc_svinval_svnapot_svpbmt_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadsync_xtheadvdot */ + +#if !((__riscv_xlen == 64) \ + && !defined(__riscv_32e) \ + && defined(__riscv_mul) \ + && defined(__riscv_atomic) \ + && (__riscv_flen == 64) \ + && defined(__riscv_compressed) \ + && defined(__riscv_v) \ + && defined(__riscv_zicbom) \ + && defined(__riscv_zicbop) \ + && defined(__riscv_zicboz) \ + && defined(__riscv_zicntr) \ + && defined(__riscv_zicond) \ + && defined(__riscv_zicsr) \ + && defined(__riscv_zifencei ) \ + && defined(__riscv_zihintntl) \ + && defined(__riscv_zihintpause) \ + && defined(__riscv_zihpm) \ + && defined(__riscv_zawrs) \ + && defined(__riscv_zfa) \ + && defined(__riscv_zfbfmin) \ + && defined(__riscv_zfh) \ + && defined(__riscv_zca) \ + && defined(__riscv_zcb) \ + && defined(__riscv_zcd) \ + && defined(__riscv_zba) \ + && defined(__riscv_zbb) \ + && defined(__riscv_zbc) \ + && defined(__riscv_zbs) \ + && defined(__riscv_zvfbfmin) \ + && defined(__riscv_zvfbfwma) \ + && defined(__riscv_zvfh) \ + && defined(__riscv_sscofpmf) \ + && defined(__riscv_sstc) \ + && defined(__riscv_svinval) \ + && defined(__riscv_svnapot) \ + && defined(__riscv_svpbmt) \ + && defined(__riscv_xtheadba) \ + && defined(__riscv_xtheadbb) \ + && defined(__riscv_xtheadbs) \ + && defined(__riscv_xtheadcmo) \ + && defined(__riscv_xtheadcondmov) \ + && defined(__riscv_xtheadfmemidx) \ + && defined(__riscv_xtheadsync) \ + && defined(__riscv_xtheadvdot)) +#error "unexpected arch" +#endif + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/riscv/pr108016.c b/gcc/testsuite/gcc.target/riscv/pr108016.c new file mode 100644 index 0000000..b60df42 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr108016.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } } */ + +unsigned int addu (unsigned int a, unsigned int b) +{ + unsigned int out; + unsigned int overflow = __builtin_add_overflow (a, b, &out); + return overflow & out; +} + +int addi (int a, int b) +{ + int out; + int overflow = __builtin_add_overflow (a, b, &out); + return overflow & out; +} + +unsigned int subu (unsigned int a, unsigned int b) +{ + unsigned int out; + unsigned int overflow = __builtin_sub_overflow (a, b, &out); + return overflow & out; +} + +int subi (int a, int b) +{ + int out; + int overflow = __builtin_sub_overflow (a, b, &out); + return overflow & out; +} + +/* { dg-final { scan-assembler-not "sext\.w\t" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/pr118410-1.c b/gcc/testsuite/gcc.target/riscv/pr118410-1.c new file mode 100644 index 0000000..4a8b847 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr118410-1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */ +/* { dg-options "-march=rv64gcb -mabi=lp64d" { target { rv64} } } */ +/* { dg-options "-march=rv32gcb -mabi=ilp32" { target { rv32} } } */ + +long orlow(long x) { return x | ((1L << 24) - 1); } + +/* { dg-final { scan-assembler-times "orn\t" 1 } } */ +/* { dg-final { scan-assembler-not "addi\t" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/pr118410-2.c b/gcc/testsuite/gcc.target/riscv/pr118410-2.c new file mode 100644 index 0000000..b63a1d9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr118410-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */ +/* { dg-options "-march=rv64gcb -mabi=lp64d" { target { rv64} } } */ +/* { dg-options "-march=rv32gcb -mabi=ilp32" { target { rv32} } } */ + +long xorlow(long x) { return x ^ ((1L << 24) - 1); } + +/* { dg-final { scan-assembler-times "xnor\t" 1 } } */ +/* { dg-final { scan-assembler-not "addi\t" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f16.c deleted file mode 100644 index e4ff310..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f16.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d -mrvv-vector-bits=scalable -ffast-math" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (float, _Float16) - -/* { dg-final { scan-assembler-times {\tvfwmul\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f32.c deleted file mode 100644 index 7d2b448..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-f32.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=scalable -ffast-math" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (double, float) - -/* { dg-final { scan-assembler-times {\tvfwmul\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i16.c deleted file mode 100644 index dc7e1da..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i16.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=scalable" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (int32_t, int16_t) - -/* { dg-final { scan-assembler-times {\tvwmul\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i32.c deleted file mode 100644 index de1072f..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i32.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=scalable" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (int64_t, int32_t) - -/* { dg-final { scan-assembler-times {\tvwmul\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i8.c deleted file mode 100644 index 8de5ef4..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-i8.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=scalable" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (int16_t, int8_t) - -/* { dg-final { scan-assembler-times {\tvwmul\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u16.c deleted file mode 100644 index a4aafd2..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u16.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=scalable" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (uint32_t, uint16_t) - -/* { dg-final { scan-assembler-times {\tvwmulu\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u32.c deleted file mode 100644 index 0deeaa0..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u32.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=scalable" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (uint64_t, uint32_t) - -/* { dg-final { scan-assembler-times {\tvwmulu\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u8.c deleted file mode 100644 index a6afcd0..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3-u8.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile } */ -/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=scalable" } */ - -#include "cond_widen_complicate-3.h" - -TEST_TYPE (uint16_t, uint8_t) - -/* { dg-final { scan-assembler-times {\tvwmulu\.vv} 1 } } */ -/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.c new file mode 100644 index 0000000..d02a8e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d -mrvv-vector-bits=scalable -ffast-math" } */ + +#include <stdint-gcc.h> + +#define TEST_TYPE(TYPE1, TYPE2) \ + __attribute__ ((noipa)) void vwadd_##TYPE1_##TYPE2 ( \ + TYPE1 *__restrict dst, TYPE1 *__restrict dst2, TYPE1 *__restrict dst3, \ + TYPE1 *__restrict dst4, TYPE2 *__restrict a, TYPE2 *__restrict b, \ + TYPE2 *__restrict a2, TYPE2 *__restrict b2, int *__restrict pred, int n) \ + { \ + for (int i = 0; i < n; i++) \ + { \ + dst[i] = pred[i] ? (TYPE1) a[i] * (TYPE1) b[i] : dst[i]; \ + dst2[i] = pred[i] ? (TYPE1) a2[i] * (TYPE1) b[i] : dst2[i]; \ + dst3[i] = pred[i] ? (TYPE1) a2[i] * (TYPE1) a[i] : dst3[i]; \ + dst4[i] = pred[i] ? (TYPE1) a[i] * (TYPE1) b2[i] : dst4[i]; \ + } \ + } + +#define TEST_ALL() \ + TEST_TYPE (int16_t, int8_t) \ + TEST_TYPE (uint16_t, uint8_t) \ + TEST_TYPE (int32_t, int16_t) \ + TEST_TYPE (uint32_t, uint16_t) \ + TEST_TYPE (int64_t, int32_t) \ + TEST_TYPE (uint64_t, uint32_t) \ + TEST_TYPE (float, _Float16) \ + TEST_TYPE (double, float) + +TEST_ALL () + +/* { dg-final { scan-assembler-times {\tvwmul\.vv} 12 } } */ +/* { dg-final { scan-assembler-times {\tvwmulu\.vv} 12 } } */ +/* { dg-final { scan-assembler-times {\tvfwmul\.vv} 8 } } */ +/* { dg-final { scan-assembler-not {\tvmerge\.vvm\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.h deleted file mode 100644 index 974846f..0000000 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef COND_WIDEN_COMPLICATE_3_H -#define COND_WIDEN_COMPLICATE_3_H - -#include <stdint-gcc.h> - -#define TEST_TYPE(TYPE1, TYPE2) \ - __attribute__ ((noipa)) void vwadd_##TYPE1##_##TYPE2 ( \ - TYPE1 *__restrict dst, TYPE1 *__restrict dst2, TYPE1 *__restrict dst3, \ - TYPE1 *__restrict dst4, TYPE2 *__restrict a, TYPE2 *__restrict b, \ - TYPE2 *__restrict a2, TYPE2 *__restrict b2, int *__restrict pred, int n) \ - { \ - for (int i = 0; i < n; i++) \ - { \ - dst[i] = pred[i] ? (TYPE1) a[i] * (TYPE1) b[i] : dst[i]; \ - dst2[i] = pred[i] ? (TYPE1) a2[i] * (TYPE1) b[i] : dst2[i]; \ - dst3[i] = pred[i] ? (TYPE1) a2[i] * (TYPE1) a[i] : dst3[i]; \ - dst4[i] = pred[i] ? (TYPE1) a[i] * (TYPE1) b2[i] : dst4[i]; \ - } \ - } - -#endif diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr117722.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr117722.c index 493dab0..0267078 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr117722.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr117722.c @@ -18,6 +18,5 @@ int pixel_sad_n(unsigned char *pix1, unsigned char *pix2, int n) return sum; } -/* { dg-final { scan-assembler {vrsub\.v} } } */ /* { dg-final { scan-assembler {vmax\.v} } } */ -/* { dg-final { scan-assembler {vwsubu\.v} } } */ +/* { dg-final { scan-assembler-times {vwsubu\.v} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c index 638e90f..69a94d5 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gczve32x -mabi=lp64d -mrvv-vector-bits=zvl" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar (int8_t *data); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c index 380d0c1..5e0f136 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gcv_zvl4096b -mabi=lp64d -mrvv-vector-bits=zvl" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar (int8_t *data); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-save-restore.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-save-restore.c index 9ed72a6..a3c0a6d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-save-restore.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-save-restore.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gcv_zfh -mabi=lp64d -msave-restore" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar (int8_t *data); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-zcmp.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-zcmp.c index b6b708f..b1cf6aa 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-zcmp.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1-zcmp.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gv_zfh_zca_zcmp -mabi=lp64d -fno-shrink-wrap-separate" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar (int8_t *data); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1.c index 13e3328..8838f0d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-1.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gcv_zfh -mabi=lp64d" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar (int8_t *data); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c index d21b810..77f1c7c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gcv_zfh -mabi=lp64d -msave-restore" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar1 (vint8m1_t a); void bar2 (); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c index 70a32d7..37127a8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gv_zfh_zca_zcmp -mabi=lp64d -fno-shrink-wrap-separate" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar1 (vint8m1_t a); void bar2 (); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2.c index 3f2cb2f..a8daeeb 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2.c @@ -2,7 +2,7 @@ /* { dg-options "-O1 -march=rv64gcv_zfh -mabi=lp64d" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar1 (vint8m1_t a); void bar2 (); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10-2.c index fe3a1ef..f8143b9 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10-2.c @@ -4,7 +4,7 @@ /* { dg-require-effective-target riscv_zvfh_ok } */ /* { dg-options " -march=rv64gcv_zvfh -mabi=lp64d -O2" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" int8_t a[1]; uint16_t b[1]; diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10.c b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10.c index 60fdfc4..05628d5 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-10.c @@ -4,7 +4,7 @@ /* { dg-require-effective-target riscv_zvfh_ok } */ /* { dg-options " -march=rv64gcv_zvfh -mabi=lp64d -O2 --param=vsetvl-strategy=optim -fno-schedule-insns -fno-schedule-insns2 -fno-schedule-fusion " } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void __attribute__ ((noipa)) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-7.c b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-7.c index 28766ce..3180f71 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-7.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-7.c @@ -3,7 +3,7 @@ /* { dg-options "-march=rv64gcv -mabi=lp64d -O2" { target { rv64 } } } */ /* { dg-options "-march=rv32gcv -mabi=ilp32d -O2" { target { rv32 } } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vint64m1_t f1 (vint64m1_t vd, vint64m1_t vs2, size_t vl) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-8.c b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-8.c index 975f755..31b68c4 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-8.c @@ -3,7 +3,7 @@ /* { dg-options "-march=rv64gcv -mabi=lp64d -O0" { target { rv64 } } } */ /* { dg-options "-march=rv32gcv -mabi=ilp32d -O0" { target { rv32 } } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vint64m1_t f1 (vint64m1_t vd, vint64m1_t vs2, size_t vl) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-9.c b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-9.c index 8cfe965..f7c9ad1 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/bug-9.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/bug-9.c @@ -3,7 +3,7 @@ /* { dg-options "-march=rv64gcv -mabi=lp64d -O2" { target { rv64 } } } */ /* { dg-options "-march=rv32gcv -mabi=ilp32d -O2" { target { rv32 } } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vfloat16m1_t f0 (vfloat16m1_t vs2, vfloat16m1_t vs1, size_t vl) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr110943.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110943.c index 8a6c00f..a08ac6e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr110943.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr110943.c @@ -2,7 +2,7 @@ /* { dg-options "-O3 -march=rv64gcv -mabi=lp64d" } */ /* { dg-final { check-function-bodies "**" "" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" /* ** foo9: diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-21.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-21.c index 3e43c94..a0ed793 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-21.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-21.c @@ -1,7 +1,7 @@ /* { dg-do run { target { riscv_v } } } */ /* { dg-additional-options "-O3 -ansi -pedantic-errors -std=gnu99" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" size_t __attribute__ ((noinline)) sumation (size_t sum0, size_t sum1, size_t sum2, size_t sum3, size_t sum4, diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr114639-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr114639-1.c index 3ad91db..c5b35c8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr114639-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr114639-1.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" extern size_t get_vl (); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068-run.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068-run.c index d552eb5..e9e41f7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068-run.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068-run.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target riscv_v_ok } */ /* { dg-add-options riscv_v } */ -/* { dg-additional-options "-std=gnu99" } */ +/* { dg-additional-options "-std=gnu99 -Wno-pedantic" } */ #include "pr115068.c" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068.c index af2cba6..ce9a389 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr115068.c @@ -1,9 +1,9 @@ /* { dg-do compile { target { ! riscv_abi_e } } } */ /* { dg-add-options riscv_v } */ -/* { dg-additional-options "-std=gnu99" } */ +/* { dg-additional-options "-std=gnu99 -Wno-pedantic" } */ #include <stdint.h> -#include <riscv_vector.h> +#include "riscv_vector.h" vfloat64m8_t test_vfwadd_wf_f64m8_m (vbool8_t vm, vfloat64m8_t vs2, float rs1, size_t vl) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr117286.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr117286.c index dabb8ae..7b6eefe 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr117286.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr117286.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64gcv_zvfh -mabi=lp64d -O1" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" _Float16 a[10]; void func(){ int placeholder0 = 10; diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr117544.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr117544.c index af3532a..81e0ec3 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr117544.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr117544.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void bar() __attribute__((riscv_vector_cc)); vint32m1_t foo(vint32m1_t a, vint32m1_t b) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr117955.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr117955.c index 81e3a6e..4904c92 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr117955.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr117955.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { rv64 } } } */ /* { dg-options "-march=rv64gcv_zvfh -mabi=lp64d -O3" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" _Float16 a (uint64_t); int8_t b () { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr118872.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr118872.c index adb54d6..d62751e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr118872.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr118872.c @@ -3,7 +3,7 @@ /* { dg-options "-march=rv64gcv -mabi=lp64d -O2" { target { rv64 } } } */ /* { dg-options "-march=rv32gcv -mabi=ilp32d -O2" { target { rv32 } } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vfloat32m2_t foo (vfloat16m1_t a, size_t vl) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c index 4253729..6bb7e1c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vlmul_ext-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vint16m8_t test_vlmul_ext_v_i16mf4_i16m8(vint16mf4_t op1) { return __riscv_vlmul_ext_v_i16mf4_i16m8(op1); diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-1.c index 606854b..a278709 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=rv64gcv -mabi=lp64d" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vuint64m1_t test_vssubu_vx_u64m1(vuint64m1_t op1) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-2.c index 78abd09..2f8c146 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vssubu-2.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -march=rv32gcv -mabi=ilp32d" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vuint64m1_t test_vssubu_vx_u64m1(vuint64m1_t op1) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c index 6e027a5..43be202 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c @@ -1,9 +1,9 @@ -/* { dg-do compile { target { ! riscv_abi_e } } } */ +/* { dg-do compile { target { { ! riscv_abi_e } && rv64 } } } */ /* { dg-add-options riscv_v } */ -/* { dg-additional-options "-std=gnu99 -O3 -fno-schedule-insns -fno-schedule-insns2" } */ +/* { dg-additional-options "-std=gnu99 -O3 -fno-schedule-insns -fno-schedule-insns2 -Wno-pedantic" } */ #include <stdint.h> -#include <riscv_vector.h> +#include "riscv_vector.h" /* ** vwadd_wx_i64m8_m: diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-68.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-68.c index bf95e1c..64666d3 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-68.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-68.c @@ -21,6 +21,12 @@ void f2 (void * restrict in, void * restrict out, int l, int n, int m) } } +/* The second check is XFAILed because we currently don't lift + vsetvls into non-transparent (in LCM parlance) blocks. + See PR119547. + In this test it is still possible because the conflicting + register only ever feeds vsetvls. */ + /* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-g" no-opts "-funroll-loops" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-g" no-opts "-funroll-loops" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*[a-x0-9]+,\s*e8,\s*mf8,\s*tu,\s*m[au]} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-g" no-opts "-funroll-loops" } xfail { *-*-* } } } } */ /* { dg-final { scan-assembler-times {addi\s+[a-x0-9]+,\s*[a-x0-9]+,\s*44} 1 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-g" no-opts "-funroll-loops" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c index 871cf65..f594217 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111234.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mrvv-vector-bits=scalable -march=rv64gcv -mabi=lp64d -O3" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void f (vint32m1_t *in, vint64m2_t *out, vbool32_t *m, int b) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr115214.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr115214.c index b76760b..48f200f 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr115214.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr115214.c @@ -2,7 +2,7 @@ /* { dg-options "-mrvv-vector-bits=scalable -march=rv64gcv -mabi=lp64d -O3 -w -std=gnu17" } */ /* { dg-skip-if "" { *-*-* } { "-flto" } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" static inline __attribute__(()) int vaddq_f32(); static inline __attribute__(()) int vload_tillz_f32(int nlane) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c index ddf53ca..0dbf34a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c @@ -43,6 +43,6 @@ void foo (int8_t * restrict in, int8_t * restrict out, int n, int cond) } } -/* { dg-final { scan-assembler-times {vsetvli} 15 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-flto" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli} 14 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-flto" } } } } */ /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */ -/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 4 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-24.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-24.c index 7096159e..3867681 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-24.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl-24.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-mrvv-vector-bits=scalable -march=rv64gcv -mabi=lp64d" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" size_t foo () { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-3.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-3.c index c155f56..3acbc73 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-3.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-3.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-march=rv32gcv -mabi=ilp32d -O2 -fdump-rtl-vsetvl-details" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" uint64_t a[2], b[2]; diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-4.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-4.c index 04a8ff2..2b2fe27 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-4.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vsetvl_bug-4.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64gcv -mabi=lp64d -O2 -fno-schedule-insns -fdump-rtl-vsetvl-details" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vuint16m1_t foo (vuint16m1_t a, vuint16m1_t b, size_t avl) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c index dfaf82c..ad27c38 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116591.c @@ -2,7 +2,7 @@ /* { dg-options "-march=rv32gc_xtheadvector -mabi=ilp32d -O2 -save-temps" { target { rv32 } } } */ /* { dg-options "-march=rv64gc_xtheadvector -mabi=lp64d -O2 -save-temps" { target { rv64 } } } */ -#include <riscv_vector.h> +#include "riscv_vector.h" void foo (float *a, int b) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116592.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116592.c index a7cd8c5..c8056a8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116592.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr116592.c @@ -3,7 +3,7 @@ /* { dg-options "-march=rv64gc_zfh_xtheadvector -mabi=lp64d -O2 -save-temps" { target { rv64 } } } */ #include <math.h> -#include <riscv_vector.h> +#include "riscv_vector.h" static vfloat32m8_t atan2_ps(vfloat32m8_t a, vfloat32m8_t b, size_t vl) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr118357.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr118357.c index aebb0e3..b3c3428 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr118357.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr118357.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { rv64 } } } */ /* { dg-options "-march=rv64gc_xtheadvector -mabi=lp64d -O2" } */ -#include <riscv_vector.h> +#include "riscv_vector.h" vfloat16m4_t foo (float *ptr, size_t vl) { diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vsext.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vsext.c new file mode 100644 index 0000000..42fa43e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vsext.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { rv64 } } } */ +/* { dg-options "-march=rv64gc_xtheadvector -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +struct a +{ + int b[]; +} c (vint32m4_t), d; + +char e; +char *f; + +void g () +{ + int h; + vint32m4_t i; + vint8m1_t j = __riscv_vlse8_v_i8m1 (&e, d.b[3], h); + vint16m2_t k = __riscv_vwadd_vx_i16m2 (j, 0, h); + i = __riscv_vwmacc_vx_i32m4 (i, f[0], k, h); + c (i); +} + +/* { dg-final { scan-assembler-not {th\.vsext\.vf2} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vzext.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vzext.c new file mode 100644 index 0000000..d622b72 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/vzext.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { rv64 } } } */ +/* { dg-options "-march=rv64gc_xtheadvector -mabi=lp64d -O3" } */ + +#include "riscv_vector.h" + +struct a +{ + int b[]; +} c (vuint32m4_t), d; + +char e; +char *f; + +void g () +{ + int h; + vuint32m4_t i; + vuint8m1_t j = __riscv_vlse8_v_u8m1 (&e, d.b[3], h); + vuint16m2_t k = __riscv_vwaddu_vx_u16m2 (j, 0, h); + i = __riscv_vwmaccu_vx_u32m4 (i, f[0], k, h); + c (i); +} + +/* { dg-final { scan-assembler-not {th\.vzext\.vf2} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-1-i64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-1-i64.c index c0d643d..929de16 100644 --- a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-1-i64.c +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-1-i64.c @@ -15,7 +15,7 @@ ** li\s+[atx][0-9]+,\s*-1 ** srli\s+[atx][0-9]+,\s*[atx][0-9]+,\s*1 ** xor\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ -** neg\s+[atx][0-9]+,\s*[atx][0-9]+ +** srai\s+[atx][0-9]+,\s*[atx][0-9]+,\s*63 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ ** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-2-i64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-2-i64.c index 470e6b7..a540198 100644 --- a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-2-i64.c +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-2-i64.c @@ -15,7 +15,7 @@ ** li\s+[atx][0-9]+,\s*-1 ** srli\s+[atx][0-9]+,\s*[atx][0-9]+,\s*1 ** xor\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ -** neg\s+[atx][0-9]+,\s*[atx][0-9]+ +** srai\s+[atx][0-9]+,\s*[atx][0-9]+,\s*63 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ ** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-3-i64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-3-i64.c index bb94775..e3fe6c7 100644 --- a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-3-i64.c +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-3-i64.c @@ -15,7 +15,7 @@ ** li\s+[atx][0-9]+,\s*-1 ** srli\s+[atx][0-9]+,\s*[atx][0-9]+,\s*1 ** xor\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ -** neg\s+[atx][0-9]+,\s*[atx][0-9]+ +** srai\s+[atx][0-9]+,\s*[atx][0-9]+,\s*63 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ ** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-4-i64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-4-i64.c index cc598eb..f42ffea 100644 --- a/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-4-i64.c +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_s_sub-4-i64.c @@ -15,7 +15,7 @@ ** li\s+[atx][0-9]+,\s*-1 ** srli\s+[atx][0-9]+,\s*[atx][0-9]+,\s*1 ** xor\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ -** neg\s+[atx][0-9]+,\s*[atx][0-9]+ +** srai\s+[atx][0-9]+,\s*[atx][0-9]+,\s*63 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ ** addi\s+[atx][0-9]+,\s*[atx][0-9]+,\s*-1 ** and\s+[atx][0-9]+,\s*[atx][0-9]+,\s*[atx][0-9]+ diff --git a/gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c b/gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c new file mode 100644 index 0000000..303f3cb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zba -mabi=lp64" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */ + +long long sub (unsigned long long a, unsigned long long b) +{ + b = (b << 50) >> 49; + unsigned int x = a + b; + return x; +} + +/* { dg-final { scan-assembler-not {\msh1add} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c b/gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c new file mode 100644 index 0000000..883cce2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c @@ -0,0 +1,21 @@ +/* { dg-do run { target { rv64 } } } */ +/* { dg-options "-march=rv64gc_zba -mabi=lp64d -O2" } */ + +struct { + unsigned a : 14; + unsigned b : 3; +} c; + +unsigned long long d; +void e (unsigned long long *f, long p2) { *f = p2; } +signed g; +long i; + +int main () { + c.b = 4; + i = -(-c.a - (3023282U + c.a + g)); + e (&d, i); + if (d != 3023282) + __builtin_abort (); + __builtin_exit (0); +} diff --git a/gcc/testsuite/gcc.target/sh/pr111814.c b/gcc/testsuite/gcc.target/sh/pr111814.c new file mode 100644 index 0000000..a88e5d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/pr111814.c @@ -0,0 +1,7 @@ +/* Verify that __builtin_nan("") produces a constant matches + architecture specification. */ +/* { dg-do compile } */ + +double d = __builtin_nan (""); + +/* { dg-final { scan-assembler "\t.long\t-1\n\t.long\t2146959359\n" } } */ diff --git a/gcc/testsuite/gdc.dg/debug/dwarf2/pr118309.d b/gcc/testsuite/gdc.dg/debug/dwarf2/pr118309.d new file mode 100644 index 0000000..50e4216 --- /dev/null +++ b/gcc/testsuite/gdc.dg/debug/dwarf2/pr118309.d @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-options "-fno-druntime -gdwarf-4 -dA -fno-merge-debug-strings" } +// { dg-final { scan-assembler-times "DIE\[^\n\r\]*DW_TAG_enumeration_type" 1 } } +// { dg-final { scan-assembler-times " DW_AT_enum_class" 1 } } +// { dg-final { scan-assembler-times "\"E..\"\[^\n\]*DW_AT_name" 1 } } +// { dg-final { scan-assembler-times "\"E1..\"\[^\n\]*DW_AT_name" 1 } } +// { dg-final { scan-assembler-times "\"C1..\"\[^\n\]*DW_AT_name" 1 } } +// { dg-final { scan-assembler-times "\"C2..\"\[^\n\]*DW_AT_name" 1 } } +// { dg-final { scan-assembler-times "\"C3..\"\[^\n\]*DW_AT_name" 1 } } +// { dg-final { scan-assembler-times "\"C4..\"\[^\n\]*DW_AT_name" 1 } } +// { dg-final { scan-assembler-times "\"S1..\"\[^\n\]*DW_AT_name" 1 } } + +module expression; +extern (C++): +class C1 +{ + bool bfn() { return true; } +} +class C2 : C1 +{ + C4 cfn() { return null; } +} +class C3 : C2 +{ + S1.E s; +} +class C4 : C3 +{ + S1 s; +} +struct S1 +{ + enum E : ubyte { E1 } + E e; + C3 c; +} diff --git a/gcc/testsuite/gdc.dg/debug/imports/m119817/a.d b/gcc/testsuite/gdc.dg/debug/imports/m119817/a.d new file mode 100644 index 0000000..a137472 --- /dev/null +++ b/gcc/testsuite/gdc.dg/debug/imports/m119817/a.d @@ -0,0 +1,2 @@ +module imports.m119817.a; +void f119817()() { } diff --git a/gcc/testsuite/gdc.dg/debug/imports/m119817/b.d b/gcc/testsuite/gdc.dg/debug/imports/m119817/b.d new file mode 100644 index 0000000..aef0e37 --- /dev/null +++ b/gcc/testsuite/gdc.dg/debug/imports/m119817/b.d @@ -0,0 +1,2 @@ +module imports.m119817.b; +void f119817() { } diff --git a/gcc/testsuite/gdc.dg/debug/imports/m119817/package.d b/gcc/testsuite/gdc.dg/debug/imports/m119817/package.d new file mode 100644 index 0000000..188827e --- /dev/null +++ b/gcc/testsuite/gdc.dg/debug/imports/m119817/package.d @@ -0,0 +1,4 @@ +module imports.m119817; +public import + imports.m119817.a, + imports.m119817.b; diff --git a/gcc/testsuite/gdc.dg/debug/imports/pr119826b.d b/gcc/testsuite/gdc.dg/debug/imports/pr119826b.d new file mode 100644 index 0000000..3c5a6ac --- /dev/null +++ b/gcc/testsuite/gdc.dg/debug/imports/pr119826b.d @@ -0,0 +1,14 @@ +module imports.pr119826b; + +import pr119826 : t119826; + +class C119826 +{ + enum E119826 { Evalue } + const E119826 em = void; +} + +void f119826(C119826 c) +{ + t119826(c.em); +} diff --git a/gcc/testsuite/gdc.dg/debug/pr119817.d b/gcc/testsuite/gdc.dg/debug/pr119817.d new file mode 100644 index 0000000..3eea6ba --- /dev/null +++ b/gcc/testsuite/gdc.dg/debug/pr119817.d @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-additional-sources "imports/m119817/package.d" } +// { dg-additional-sources "imports/m119817/a.d" } +// { dg-additional-sources "imports/m119817/b.d" } +module pr119817; +import imports.m119817 : f119817; diff --git a/gcc/testsuite/gdc.dg/debug/pr119826.d b/gcc/testsuite/gdc.dg/debug/pr119826.d new file mode 100644 index 0000000..2fb98c7 --- /dev/null +++ b/gcc/testsuite/gdc.dg/debug/pr119826.d @@ -0,0 +1,8 @@ +// { dg-do compile } +// { dg-additional-sources "imports/pr119826b.d" } +module pr119826; + +int t119826(A)(A args) +{ + assert(false); +} diff --git a/gcc/testsuite/gdc.dg/driver_fonly1.d b/gcc/testsuite/gdc.dg/driver_fonly1.d new file mode 100644 index 0000000..1af956a --- /dev/null +++ b/gcc/testsuite/gdc.dg/driver_fonly1.d @@ -0,0 +1,2 @@ +// { dg-additional-options "-fonly=not-a-file" } +// { dg-error "argument is different from first input file name" "" { target *-*-* } 0 } diff --git a/gcc/testsuite/gdc.dg/driver_fonly2.d b/gcc/testsuite/gdc.dg/driver_fonly2.d new file mode 100644 index 0000000..97cd93d --- /dev/null +++ b/gcc/testsuite/gdc.dg/driver_fonly2.d @@ -0,0 +1,8 @@ +// { dg-do "compile" } +// { dg-additional-options "-fonly=driver_fonly2.d" } +// { dg-additional-sources "imports/fonly.d" } +// { dg-final { scan-assembler "_D1a10fonly_testFZv" } } +// { dg-final { scan-assembler-not "_D1b10fonly_testFZv" } } +module a; + +void fonly_test() { } diff --git a/gcc/testsuite/gdc.dg/driver_fonly3.d b/gcc/testsuite/gdc.dg/driver_fonly3.d new file mode 100644 index 0000000..de2983f --- /dev/null +++ b/gcc/testsuite/gdc.dg/driver_fonly3.d @@ -0,0 +1,8 @@ +// { dg-do "compile" } +// { dg-additional-options "-fonly=imports/fonly" } +// { dg-additional-sources "imports/fonly.d" } +// { dg-final { scan-assembler-not "_D1a10fonly_testFZv" } } +// { dg-final { scan-assembler "_D1b10fonly_testFZv" } } +module a; + +void fonly_test() { } diff --git a/gcc/testsuite/gdc.dg/gcov.exp b/gcc/testsuite/gdc.dg/gcov.exp index a65d000..3f0234e 100644 --- a/gcc/testsuite/gdc.dg/gcov.exp +++ b/gcc/testsuite/gdc.dg/gcov.exp @@ -21,12 +21,19 @@ load_lib gdc-dg.exp load_lib gcov.exp global GDC_UNDER_TEST +global GCOV_UNDER_TEST -# For now find gcov in the same directory as $GDC_UNDER_TEST. -if { ![is_remote host] && [string match "*/*" [lindex $GDC_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GDC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] +# For now find gcov in the same directory as $GDC_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GDC_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GDC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] + } else { + set GCOV [gcc-transform-out-of-tree gcov] + } } else { - set GCOV [gcc-transform-out-of-tree gcov] + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/gdc.dg/import-c/import-c.exp b/gcc/testsuite/gdc.dg/import-c/import-c.exp new file mode 100644 index 0000000..53d1478 --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/import-c.exp @@ -0,0 +1,29 @@ +# Copyright (C) 2025 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Load support procs. +load_lib gdc-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. +gdc-dg-runtest [lsort \ + [glob -nocomplain $srcdir/$subdir/*.d ] ] "" \ + "-I $srcdir/$subdir -finclude-imports" + +# All done. +dg-finish diff --git a/gcc/testsuite/gdc.dg/import-c/pr119761.d b/gcc/testsuite/gdc.dg/import-c/pr119761.d new file mode 100644 index 0000000..20eff31 --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/pr119761.d @@ -0,0 +1,2 @@ +// { dg-do compile } +import pr119761c; diff --git a/gcc/testsuite/gdc.dg/import-c/pr119761c.c b/gcc/testsuite/gdc.dg/import-c/pr119761c.c new file mode 100644 index 0000000..522f1bf --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/pr119761c.c @@ -0,0 +1,4 @@ +int f119761(const char *, ...) +{ + return 0; +} diff --git a/gcc/testsuite/gdc.dg/import-c/pr119799.d b/gcc/testsuite/gdc.dg/import-c/pr119799.d new file mode 100644 index 0000000..d8b0fa2 --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/pr119799.d @@ -0,0 +1,2 @@ +// { dg-do compile } +import pr119799c; diff --git a/gcc/testsuite/gdc.dg/import-c/pr119799c.c b/gcc/testsuite/gdc.dg/import-c/pr119799c.c new file mode 100644 index 0000000..b80e856 --- /dev/null +++ b/gcc/testsuite/gdc.dg/import-c/pr119799c.c @@ -0,0 +1 @@ +static struct {} s119799; diff --git a/gcc/testsuite/gdc.dg/imports/fonly.d b/gcc/testsuite/gdc.dg/imports/fonly.d new file mode 100644 index 0000000..2b7755e --- /dev/null +++ b/gcc/testsuite/gdc.dg/imports/fonly.d @@ -0,0 +1,3 @@ +module b; + +void fonly_test() { } diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr109023.d b/gcc/testsuite/gdc.dg/torture/imports/pr109023.d new file mode 100644 index 0000000..e85e0ed --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/imports/pr109023.d @@ -0,0 +1,3 @@ +module imports.pr109023; + +void f109023() { } diff --git a/gcc/testsuite/gdc.dg/torture/pr109023.d b/gcc/testsuite/gdc.dg/torture/pr109023.d new file mode 100644 index 0000000..3060446 --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/pr109023.d @@ -0,0 +1,6 @@ +// { dg-do "compile" } +// { dg-additional-options "-I[srcdir] -finclude-imports" } +// { dg-additional-files "imports/pr109023.d" } +// { dg-final { scan-assembler "_D7imports8pr1090237f109023FZv" } } +module pr109023; +import imports.pr109023; diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21098_phobos.d b/gcc/testsuite/gdc.test/compilable/imports/test21098_phobos.d new file mode 100644 index 0000000..29c77eb --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test21098_phobos.d @@ -0,0 +1,77 @@ +struct Nullable(T) +{ + static struct DontCallDestructorT + { + T payload; + } + + DontCallDestructorT _value; + + string toString() const + { + Appender!string app; + formatValueImpl(app, _value); + return null; + } +} + + + +struct Appender(A) +{ + InPlaceAppender!A impl; +} + +struct InPlaceAppender(T) +{ + static void toStringImpl(const T[] data) + { + string app; + formatValue(app, data); + } +} + + + +void formatValueImpl(Writer, T)(Writer, const(T)) {} + +void formatValueImpl(Writer, T)(Writer w, T obj) +if (is(T == U[], U)) +{ + formatValue(w, obj[0]); +} + +enum HasToStringResult +{ + none, + bla +} + +template hasToString(T) +{ + static if (is(typeof( + (T val) { + val.toString(s); + }))) + enum hasToString = HasToStringResult.bla; + else + enum hasToString = HasToStringResult.none; +} + +void formatValueImpl(Writer, T)(ref Writer w, T val) +if (is(T == struct) || is(T == union)) +{ + static if (hasToString!T) + int dummy; + formatElement(w, val.tupleof); +} + +void formatElement(Writer, T)(Writer w, T val) +{ + formatValueImpl(w, val); +} + +void formatValue(Writer, T)(Writer w, T val) +{ + formatValueImpl(w, val); +} diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21098b.d b/gcc/testsuite/gdc.test/compilable/imports/test21098b.d new file mode 100644 index 0000000..74c9fa8 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/imports/test21098b.d @@ -0,0 +1,12 @@ +import imports.test21098_phobos : Appender, Nullable; + +struct Type { + Nullable!(Type[]) templateArgs; +} + +Type[] parseDeclarations() { + Appender!(Type[]) members; + return null; +} + +enum ast = parseDeclarations(); diff --git a/gcc/testsuite/gdc.test/compilable/test21098.d b/gcc/testsuite/gdc.test/compilable/test21098.d new file mode 100644 index 0000000..9b02b7b --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21098.d @@ -0,0 +1,4 @@ +// https://github.com/dlang/dmd/issues/21098 + +// EXTRA_FILES: imports/test21098b.d imports/test21098_phobos.d +import imports.test21098b; diff --git a/gcc/testsuite/gdc.test/compilable/test21153.d b/gcc/testsuite/gdc.test/compilable/test21153.d new file mode 100644 index 0000000..cd92a31 --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21153.d @@ -0,0 +1,8 @@ +// https://github.com/dlang/dmd/issues/21153 +alias AliasSeq(TList...) = TList; +class DataClass; +void reduce(DataClass[] r) +{ + alias Args = AliasSeq!(DataClass); + Args result = r[0]; +} diff --git a/gcc/testsuite/gdc.test/compilable/test21179.d b/gcc/testsuite/gdc.test/compilable/test21179.d new file mode 100644 index 0000000..78bdffd --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test21179.d @@ -0,0 +1,11 @@ +// https://github.com/dlang/dmd/issues/21179 + +void bigEndianToNative(ubyte[2] a) {} + +void main() +{ + ubyte[] arr; + const ubyte[2] bytes; + bigEndianToNative(bytes); + auto b = cast(const ubyte[2][]) arr; +} diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d b/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d index 2016a50..79242b1 100644 --- a/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d +++ b/gcc/testsuite/gdc.test/fail_compilation/fail_pretty_errors.d @@ -1,22 +1,24 @@ -/* +/* REQUIRED_ARGS: -verrors=context TEST_OUTPUT: --- -fail_compilation/fail_pretty_errors.d(27): Error: undefined identifier `a` +fail_compilation/fail_pretty_errors.d(29): Error: undefined identifier `a` a = 1; ^ -fail_compilation/fail_pretty_errors.d-mixin-32(32): Error: undefined identifier `b` -fail_compilation/fail_pretty_errors.d(37): Error: cannot implicitly convert expression `5` of type `int` to `string` +fail_compilation/fail_pretty_errors.d-mixin-34(34): Error: undefined identifier `b` +b = 1; +^ +fail_compilation/fail_pretty_errors.d(39): Error: cannot implicitly convert expression `5` of type `int` to `string` string x = 5; ^ -fail_compilation/fail_pretty_errors.d(42): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating +fail_compilation/fail_pretty_errors.d(44): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating mixin mixinTemplate; ^ -fail_compilation/fail_pretty_errors.d(48): Error: invalid array operation `"" + ""` (possible missing []) +fail_compilation/fail_pretty_errors.d(50): Error: invalid array operation `"" + ""` (possible missing []) auto x = ""+""; ^ -fail_compilation/fail_pretty_errors.d(48): did you mean to concatenate (`"" ~ ""`) instead ? -fail_compilation/fail_pretty_errors.d(51): Error: cannot implicitly convert expression `1111` of type `int` to `byte` +fail_compilation/fail_pretty_errors.d(50): did you mean to concatenate (`"" ~ ""`) instead ? +fail_compilation/fail_pretty_errors.d(53): Error: cannot implicitly convert expression `1111` of type `int` to `byte` byte ɑ = 1111; ^ --- diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21247.d b/gcc/testsuite/gdc.test/fail_compilation/test21247.d new file mode 100644 index 0000000..c3e4105 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21247.d @@ -0,0 +1,20 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test21247.d(13): Error: anonymous union can only be a part of an aggregate, not function `hang_dmd` +fail_compilation/test21247.d(17): Error: undefined identifier `u` +fail_compilation/test21247.d(18): Error: undefined identifier `b` +fail_compilation/test21247.d(20): called from here: `hang_dmd(0u)` +--- + */ +// https://github.com/dlang/dmd/issues/21247 +ubyte[4] hang_dmd(uint a) +{ + union { + uint u = void; + ubyte[4] b; + } + u = a; + return b; +} +enum T = hang_dmd(0); diff --git a/gcc/testsuite/gdc.test/fail_compilation/test21247b.d b/gcc/testsuite/gdc.test/fail_compilation/test21247b.d new file mode 100644 index 0000000..ecd4603 --- /dev/null +++ b/gcc/testsuite/gdc.test/fail_compilation/test21247b.d @@ -0,0 +1,14 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test21247b.d(10): Error: anonymous union can only be a part of an aggregate, not function `test21247` +--- + */ +// https://github.com/dlang/dmd/issues/21247 +void test21247() +{ + union { + uint u = void; + ubyte[4] b; + } +} diff --git a/gcc/testsuite/gfortran.dg/coarray/coindexed_3.f08 b/gcc/testsuite/gfortran.dg/coarray/coindexed_3.f08 index 29c2b3a..7fd2085 100644 --- a/gcc/testsuite/gfortran.dg/coarray/coindexed_3.f08 +++ b/gcc/testsuite/gfortran.dg/coarray/coindexed_3.f08 @@ -9,6 +9,7 @@ program pr98903 integer :: a[*] type(team_type) :: team + team = get_team() me = this_image() n = num_images() a = 42 diff --git a/gcc/testsuite/gfortran.dg/coarray/coindexed_5.f90 b/gcc/testsuite/gfortran.dg/coarray/coindexed_5.f90 new file mode 100644 index 0000000..c35ec10 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/coindexed_5.f90 @@ -0,0 +1,80 @@ +!{ dg-do run } + +! Check coindexes with team= or team_number= are working. + +program coindexed_5 + use, intrinsic :: iso_fortran_env + + type(team_type) :: parentteam, team, formed_team + integer :: t_num= 42, stat = 42, lhs + integer(kind=2) :: st_num=42 + integer :: caf(2)[*] + + parentteam = get_team() + + caf = [23, 32] + form team(t_num, team, new_index=1) + form team(t_num, formed_team) + + change team(team, cell[*] => caf(2)) + ! for get_from_remote + ! Checking against caf_single is very limitted. + if (cell[1, team_number=t_num] /= 32) stop 1 + if (cell[1, team_number=st_num] /= 32) stop 2 + if (cell[1, team=parentteam] /= 32) stop 3 + + ! Check that team_number is validated + lhs = cell[1, team_number=5, stat=stat] + if (stat /= 1) stop 4 + + ! Check that only access to active teams is valid + stat = 42 + lhs = cell[1, team=formed_team, stat=stat] + if (stat /= 1) stop 5 + + ! for send_to_remote + ! Checking against caf_single is very limitted. + cell[1, team_number=t_num] = 45 + if (cell /= 45) stop 11 + cell[1, team_number=st_num] = 46 + if (cell /= 46) stop 12 + cell[1, team=parentteam] = 47 + if (cell /= 47) stop 13 + + ! Check that team_number is validated + stat = -1 + cell[1, team_number=5, stat=stat] = 0 + if (stat /= 1) stop 14 + + ! Check that only access to active teams is valid + stat = 42 + cell[1, team=formed_team, stat=stat] = -1 + if (stat /= 1) stop 15 + + ! for transfer_between_remotes + ! Checking against caf_single is very limitted. + cell[1, team_number=t_num] = caf(1)[1, team_number=-1] + if (cell /= 23) stop 21 + cell[1, team_number=st_num] = caf(2)[1, team_number=-1] + ! cell is an alias for caf(2) and has been overwritten by caf(1)! + if (cell /= 23) stop 22 + cell[1, team=parentteam] = caf(1)[1, team= team] + if (cell /= 23) stop 23 + + ! Check that team_number is validated + stat = -1 + cell[1, team_number=5, stat=stat] = caf(1)[1, team_number= -1] + if (stat /= 1) stop 24 + stat = -1 + cell[1, team_number=t_num] = caf(1)[1, team_number= -2, stat=stat] + if (stat /= 1) stop 25 + + ! Check that only access to active teams is valid + stat = 42 + cell[1, team=formed_team, stat=stat] = caf(1)[1] + if (stat /= 1) stop 26 + stat = 42 + cell[1] = caf(1)[1, team=formed_team, stat=stat] + if (stat /= 1) stop 27 + end team +end program coindexed_5 diff --git a/gcc/testsuite/gfortran.dg/coarray/get_team_1.f90 b/gcc/testsuite/gfortran.dg/coarray/get_team_1.f90 new file mode 100644 index 0000000..f37d1c7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/get_team_1.f90 @@ -0,0 +1,29 @@ +!{ dg-do compile } + +! PR 97210 +! Tests get_team syntax + + use iso_fortran_env + implicit none + type(team_type) :: team, ret + integer :: level + + ret = get_team() + ret = get_team('abc') !{ dg-error "must be INTEGER" } + ret = get_team(level, 'abc') !{ dg-error "Too many arguments" } + ret = get_team([1,2]) !{ dg-error "must be a scalar" } + ret = get_team(team) !{ dg-error "must be INTEGER" } + + ret = get_team(INITIAL_TEAM) + ret = get_team(CURRENT_TEAM) + ret = get_team(PARENT_TEAM) + ret = get_team(INITIAL_TEAM, CURRENT_TEAM) !{ dg-error "Too many arguments" } + + level = INITIAL_TEAM + ret = get_team(level) + ret = get_team(99) !{ dg-error "specify one of the INITIAL_TEAM, PARENT_TEAM" } + level = 99 + ret = get_team(level) + level = get_team() !{ dg-error "Cannot convert TYPE\\(team_type\\)" } +end + diff --git a/gcc/testsuite/gfortran.dg/coarray/image_status_1.f08 b/gcc/testsuite/gfortran.dg/coarray/image_status_1.f08 index 098a2bb..b7ec5a6 100644 --- a/gcc/testsuite/gfortran.dg/coarray/image_status_1.f08 +++ b/gcc/testsuite/gfortran.dg/coarray/image_status_1.f08 @@ -18,7 +18,7 @@ program test_image_status_1 isv = image_status(k2) ! Ok isv = image_status(k4) ! Ok isv = image_status(k8) ! Ok - isv = image_status(1, team=1) ! { dg-error "'team' argument of 'image_status' intrinsic at \\(1\\) not yet supported" } + isv = image_status(1, team=1) ! { dg-error "shall be of type 'team_type'" } isv = image_status() ! { dg-error "Missing actual argument 'image' in call to 'image_status' at \\(1\\)" } isv = image_status(team=1) ! { dg-error "Missing actual argument 'image' in call to 'image_status' at \\(1\\)" } diff --git a/gcc/testsuite/gfortran.dg/coarray_10.f90 b/gcc/testsuite/gfortran.dg/coarray_10.f90 index 53917b5..6f453d5 100644 --- a/gcc/testsuite/gfortran.dg/coarray_10.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_10.f90 @@ -21,7 +21,7 @@ subroutine this_image_check() integer,save :: z(4)[*], i j = this_image(a,dim=3) ! { dg-error "not a valid codimension index" } - j = this_image(dim=3) ! { dg-error "DIM argument without COARRAY argument" } + j = this_image(dim=3) ! { dg-error "'dim' argument without 'coarray' argument" } i = image_index(i, [ 1 ]) ! { dg-error "Expected coarray variable" } i = image_index(z, 2) ! { dg-error "must be a rank one array" } end subroutine this_image_check diff --git a/gcc/testsuite/gfortran.dg/coarray_49.f90 b/gcc/testsuite/gfortran.dg/coarray_49.f90 index 370e3fd..fd8549b 100644 --- a/gcc/testsuite/gfortran.dg/coarray_49.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_49.f90 @@ -5,5 +5,5 @@ program p integer :: x[*] - print *, image_index (x, [1.0]) ! { dg-error "shall be INTEGER" } + print *, image_index (x, [1.0]) ! { dg-error "must be INTEGER" } end diff --git a/gcc/testsuite/gfortran.dg/coarray_collectives_12.f90 b/gcc/testsuite/gfortran.dg/coarray_collectives_12.f90 index 299ea62..2d8a39a 100644 --- a/gcc/testsuite/gfortran.dg/coarray_collectives_12.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_collectives_12.f90 @@ -20,6 +20,6 @@ program test call co_broadcast(val3, source_image=res,stat=stat3, errmsg=errmesg3) end program test -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_broadcast \\(&desc.., _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 6\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_broadcast \\(&desc.., _gfortran_caf_num_images \\(0B, 0B\\), &stat1, errmesg1, 6\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_co_broadcast \\(&val2, 4, &stat2, errmesg2, 7\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_co_broadcast \\(&desc.., res, &stat3, errmesg3, 8\\);" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 b/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 index 8419cf9..05a1350 100644 --- a/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_collectives_16.f90 @@ -33,6 +33,6 @@ contains end function hc end program test -! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., fr, 4, _gfortran_caf_num_images \\(0B, 0B\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_critical_2.f90 b/gcc/testsuite/gfortran.dg/coarray_critical_2.f90 new file mode 100644 index 0000000..702611c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_critical_2.f90 @@ -0,0 +1,30 @@ +!{ dg-do compile } +!{ dg-additional-options "-fcoarray=lib" } + +! Test critical syntax errors with stat= and errmsg= specifiers + + implicit none + integer :: istat + character(len=30) :: err + integer(kind=1) :: too_small_stat + + critical (stat=err) !{ dg-error "must be a scalar INTEGER" } + continue + end critical + + critical (stat=istat, stat=istat) !{ dg-error "Duplicate STAT" } + continue + end critical !{ dg-error "Expecting END PROGRAM" } + + critical (stat=istat, errmsg=istat) !{ dg-error "must be a scalar CHARACTER variable" } + continue + end critical + + critical (stat=istat, errmsg=err, errmsg=err) !{ dg-error "Duplicate ERRMSG" } + continue + end critical !{ dg-error "Expecting END PROGRAM" } + + critical (stat=too_small_stat) !{ dg-error "scalar INTEGER variable of at least kind 2" } + continue + end critical +end diff --git a/gcc/testsuite/gfortran.dg/coarray_critical_3.f90 b/gcc/testsuite/gfortran.dg/coarray_critical_3.f90 new file mode 100644 index 0000000..cd609bd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_critical_3.f90 @@ -0,0 +1,32 @@ +! { dg-do run } +! { dg-options "-fcoarray=lib -fdump-tree-original -lcaf_single" } +! { dg-additional-options "-latomic" { target libatomic_available } } + +! PR 87939 +! Test critical construct with stat= and errmsg= specifiers +! + use, intrinsic :: iso_fortran_env, only: int16 + implicit none + integer :: istat = 42 + integer(kind=int16) :: istat16 = 42 + character(len=30) :: err = 'unchanged' + integer :: fail = 0 + + critical (stat=istat, errmsg=err) + if (istat /= 0) fail = 1 + if (trim(err) /= 'unchanged') fail = 2 + end critical + + if (fail /= 0) stop fail + + critical (stat=istat16, errmsg=err) + if (istat16 /= 0) fail = 3 + if (trim(err) /= 'unchanged') fail = 4 + end critical + + if (fail /= 0) stop fail +end + +! { dg-final { scan-tree-dump "_gfortran_caf_lock \\(caf_token\\.\[0-9\]+, 0, 1, 0B, &istat, &err, 30\\);" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_lock \\(caf_token\\.\[0-9\]+, 0, 1, 0B, &stat\\.\[0-9\]+, &err, 30\\);" "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(caf_token\\.\[0-9\]+, 0, 1, &stat\\.\[0-9\]+, 0B, 0\\);" 2 "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_this_image_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_this_image_1.f90 index 63cca3e..7939a79 100644 --- a/gcc/testsuite/gfortran.dg/coarray_lib_this_image_1.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_lib_this_image_1.f90 @@ -19,8 +19,8 @@ end ! { dg-final { scan-tree-dump-times "bar \\(real\\(kind=4\\)\\\[2\\\] \\* restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) caf_offset..\\)" 1 "original" } } ! { dg-final { scan-tree-dump-times "mylcobound = 5;" 1 "original" } } ! { dg-final { scan-tree-dump-times "parm...dim\\\[1\\\].lbound = 5;" 1 "original" } } -! { dg-final { scan-tree-dump-times "myucobound =\[^\n\r\]* parm...dim\\\[1\\\].lbound \\+ \[^\n\r]*_gfortran_caf_num_images \\(0, -1\\).? \\+ -?\[0-9\]+\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "myucobound =\[^\n\r\]* parm...dim\\\[1\\\].lbound \\+ \[^\n\r]*_gfortran_caf_num_images \\(0B, 0B\\).? \\+ -?\[0-9\]+\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "mylbound = 1;" 1 "original" } } -! { dg-final { scan-tree-dump-times "mythis_image = _gfortran_caf_this_image \\(0\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "mythis_image = _gfortran_caf_this_image \\(0B\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "bar \\(x, caf_token.., 0\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_init \\(&argc, &argv\\);" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 index a27d740..31a7677 100644 --- a/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90 @@ -19,8 +19,8 @@ end ! { dg-final { scan-tree-dump-times "bar \\(struct array02_real\\(kind=4\\) & restrict x, void \\* restrict caf_token.., integer\\(kind=\[48\]\\) caf_offset..\\)" 1 "original" } } ! { dg-final { scan-tree-dump-times "mylcobound = 5;" 1 "original" } } ! { dg-final { scan-tree-dump-times "parm...dim\\\[1\\\].lbound = 5;" 1 "original" } } -! { dg-final { scan-tree-dump-times "myucobound =\[^\n\r\]* parm...dim\\\[1\\\].lbound \\+ \[^\n\r\]*_gfortran_caf_num_images \\(0, -1\\).? \\+ -?\[0-9\]+\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "myucobound =\[^\n\r\]* parm...dim\\\[1\\\].lbound \\+ \[^\n\r\]*_gfortran_caf_num_images \\(0B, 0B\\).? \\+ -?\[0-9\]+\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "mylbound = 1;" 1 "original" } } -! { dg-final { scan-tree-dump-times "mythis_image = _gfortran_caf_this_image \\(0\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "mythis_image = _gfortran_caf_this_image \\(0B\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "bar \\(&parm.\[0-9\]+, caf_token.\[0-9\]+, \\(integer\\(kind=\[48\]\\)\\) parm.\[0-9\]+.data - \\(integer\\(kind=\[48\]\\)\\) x\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_init \\(&argc, &argv\\);" 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_this_image_1.f90 b/gcc/testsuite/gfortran.dg/coarray_this_image_1.f90 index 1fe2318..5a609d8 100644 --- a/gcc/testsuite/gfortran.dg/coarray_this_image_1.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_this_image_1.f90 @@ -1,19 +1,52 @@ -! { dg-do compile } -! { dg-options "-fdump-tree-original -fcoarray=single" } +!{ dg-do run } +!{ dg-options "-fdump-tree-original -fcoarray=single" } ! -j1 = this_image(distance=4) -j2 = this_image(5) + +use, intrinsic :: iso_fortran_env, only: team_type +integer :: caf[2,*] +integer, allocatable :: res(:) +type(team_type) :: team + +form team(1, team, new_index=MOD(this_image() + 43, num_images()) + 1) +j1 = this_image() +if (j1 /= 1) then + print *, me, ":", j1 + stop 1 +endif +res = this_image(caf) +if (any (res /= [1, 1])) then + print *, me, ":", res + stop 2 +endif +j2 = this_image(caf, 1) +if (j2 /= 1) then + print *, me, ":", j2 + stop 3 +endif +j3 = this_image(team) +if (j3 /= MOD(this_image() + 43, num_images()) +1) then + print *, me, ":", j3 + stop 4 +endif +res = this_image(caf, team) +if (any(res /= [1, 1])) then + print *, me, ":", res + stop 5 +endif +j4 = this_image(caf, 1, team) +if (j4 /= 1) then + print *, me, ":", j4 + stop 6 +endif +associate(me => this_image()) +end associate k1 = num_images() -k2 = num_images(6) -k3 = num_images(distance=7) -k4 = num_images(distance=8, failed=.true.) -k5 = num_images(failed=.false.) +k2 = num_images(team) +k3 = num_images(-1) end -! { dg-final { scan-tree-dump-times "j1 = 1;" 1 "original" } } -! { dg-final { scan-tree-dump-times "j2 = 1;" 1 "original" } } -! { dg-final { scan-tree-dump-times "k1 = 1;" 1 "original" } } -! { dg-final { scan-tree-dump-times "k2 = 1;" 1 "original" } } -! { dg-final { scan-tree-dump-times "k3 = 1;" 1 "original" } } -! { dg-final { scan-tree-dump-times "k4 = 0;" 1 "original" } } -! { dg-final { scan-tree-dump-times "k5 = 1;" 1 "original" } } +! { dg-final { scan-tree-dump-times "j\[1-4\] = 1;" 4 "original" } } +! { dg-final { scan-tree-dump-times "A\\.\[0-9\]+\\\[2\\\] = \\\{1, 1\\\};" 4 "original" } } +! { dg-final { scan-tree-dump "k1 = 1;" "original" } } +! { dg-final { scan-tree-dump "k2 = 1;" "original" } } +! { dg-final { scan-tree-dump "k3 = 1;" "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_this_image_2.f90 b/gcc/testsuite/gfortran.dg/coarray_this_image_2.f90 index 002c897..9713e3d 100644 --- a/gcc/testsuite/gfortran.dg/coarray_this_image_2.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_this_image_2.f90 @@ -1,19 +1,57 @@ -! { dg-do compile } -! { dg-options "-fdump-tree-original -fcoarray=lib" } +!{ dg-do run } +!{ dg-additional-options "-fdump-tree-original -fcoarray=lib -lcaf_single" } ! -j1 = this_image(distance=4) -j2 = this_image(5) + +use, intrinsic :: iso_fortran_env, only: team_type +integer :: caf[2,*] +integer, allocatable :: res(:) +type(team_type) :: team + +form team(1, team, new_index=MOD(this_image() + 43, num_images()) + 1) + +associate(me => this_image()) +j1 = this_image() +if (j1 /= 1) then + print *, me, ":", j1 + stop 1 +endif +res = this_image(caf) +if (any (res /= [1, 1])) then + print *, me, ":", res + stop 2 +endif +j2 = this_image(caf, 1) +if (j2 /= 1) then + print *, me, ":", j2 + stop 3 +endif +j3 = this_image(team) +if (j3 /= MOD(this_image() + 43, num_images()) +1) then + print *, me, ":", j3 + stop 4 +endif +res = this_image(caf, team) +if (any(res /= [1, 1])) then + print *, me, ":", res + stop 5 +endif +j4 = this_image(caf, 1, team) +if (j4 /= 1) then + print *, me, ":", j4 + stop 6 +endif +end associate k1 = num_images() -k2 = num_images(6) -k3 = num_images(distance=7) -k4 = num_images(distance=8, failed=.true.) -k5 = num_images(failed=.false.) +k2 = num_images(team) +k3 = num_images(-1) +k4 = num_images(1) end -! { dg-final { scan-tree-dump-times "j1 = _gfortran_caf_this_image \\(4\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "j2 = _gfortran_caf_this_image \\(5\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "k1 = _gfortran_caf_num_images \\(0, -1\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "k2 = _gfortran_caf_num_images \\(6, -1\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "k3 = _gfortran_caf_num_images \\(7, -1\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "k4 = _gfortran_caf_num_images \\(8, 1\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times "k5 = _gfortran_caf_num_images \\(0, 0\\);" 1 "original" } } +! { dg-final { scan-tree-dump "j1 = _gfortran_caf_this_image \\(0B\\);" "original" } } +! { dg-final { scan-tree-dump "j3 = _gfortran_caf_this_image \\(team\\);" "original" } } +! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = _gfortran_caf_this_image \\(team\\) \\+ -1;" 2 "original" } } +! { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = _gfortran_caf_this_image \\(0B\\) \\+ -1;" 2 "original" } } +! { dg-final { scan-tree-dump "k1 = _gfortran_caf_num_images \\(0B, 0B\\);" "original" } } +! { dg-final { scan-tree-dump "k2 = _gfortran_caf_num_images \\(team, 0B\\);" "original" } } +! { dg-final { scan-tree-dump "k3 = _gfortran_caf_num_images \\(0B, &D\\.\[0-9\]+\\);" "original" } } +! { dg-final { scan-tree-dump "k4 = _gfortran_caf_num_images \\(0B, &D\\.\[0-9\]+\\);" "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_this_image_3.f90 b/gcc/testsuite/gfortran.dg/coarray_this_image_3.f90 new file mode 100644 index 0000000..b8433b2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_this_image_3.f90 @@ -0,0 +1,31 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } + + +use, intrinsic :: iso_fortran_env, only: team_type +integer :: caf[*] +integer, allocatable :: res(:) +type(team_type) :: team + +j1 = this_image() ! ok +j1 = this_image('bar') !{ dg-error "First argument of 'this_image'" } +res = this_image(caf) ! ok +res = this_image(caf, caf) !{ dg-error "Second argument of 'this_image'" } +j2 = this_image(caf, 1) ! ok +j3 = this_image(caf, 'foo') !{ dg-error "Second argument of 'this_image'" } +j4 = this_image(caf, [1, 2]) !{ dg-error "Second argument of 'this_image'" } +j5 = this_image(team) ! ok +j6 = this_image(team, caf) !{ dg-error "Second argument of 'this_image'" } +res = this_image(caf, team) ! ok +res = this_image(caf, team, 'foo') !{ dg-error "shall be of type 'team_type'" } +j4 = this_image(caf, 1, team) ! ok +j5 = this_image(caf, 1, team, 'baz') !{ dg-error "Too many arguments in call" } +j6 = this_image(dim=1, team=team, coarray=caf) + +k1 = num_images() ! ok +k2 = num_images(team) ! ok +k3 = num_images(team, 2) !{ dg-error "Too many arguments in call to" } +k4 = num_images(1) ! ok +k5 = num_images('abc') !{ dg-error "'team/team_number' argument of 'num_images' intrinsic" } +k6 = num_images(1, team) !{ dg-error "Too many arguments in call to" } +end diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_11.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_11.f90 new file mode 100644 index 0000000..d4890a3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_concurrent_11.f90 @@ -0,0 +1,53 @@ +! { dg-do run } +! { dg-additional-options "-fdump-tree-original" } + +module m +implicit none +contains +subroutine sub(y,str) +integer :: y, x, i +character(len=5) :: str +character(len=5) :: z = "abcde" +logical :: error = .false. + +x = 5 +z = "12345" +do concurrent (i = 1: 3) local_init(x) local_init(z) shared(error)default(none) + if (x /= 5) error = .true. + if (z /= "12345") error = .true. + x = 99 + z = "XXXXX" +end do +if (x /= 5 .or. z /= "12345") stop 1 +if (error) stop 2 + +do concurrent (i = 1: 3) local(y) local(str) shared(error) default(none) + y = 99 + str = "XXXXX" +end do +if (y /= 42 .or. str /= "ABCDE") stop 3 +end +end + +use m +implicit none +character(len=5) :: chars = "ABCDE" +integer :: fourtytwo = 42 +call sub(fourtytwo, chars) +end + + +! { dg-final { scan-tree-dump-times " integer\\(kind=4\\) x;" 2 "original" } } +! { dg-final { scan-tree-dump-times " static character\\(kind=1\\) z\\\[1:5\\\] = .abcde.;" 1 "original" } } +! { dg-final { scan-tree-dump-times " character\\(kind=1\\) z\\\[1:5\\\];" 1 "original" } } +! { dg-final { scan-tree-dump-times " integer\\(kind=4\\) y;" 1 "original" } } +! { dg-final { scan-tree-dump-times " character\\(kind=1\\) str\\\[1:5\\\];" 1 "original" } } + +! { dg-final { scan-tree-dump-times " x = 5;" 1 "original" } } +! { dg-final { scan-tree-dump-times " __builtin_memmove \\(\\(void \\*\\) &z, \\(void \\*\\) &.12345.\\\[1\\\]\{lb: 1 sz: 1\}, 5\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times " x = x;" 1 "original" } } +! { dg-final { scan-tree-dump-times " __builtin_memmove \\(\\(void \\*\\) &z, \\(void \\*\\)\\ &z, 5\\);" 1 "original" } } + +! { dg-final { scan-tree-dump-not " y = y;" "original" } } +! { dg-final { scan-tree-dump-times " __builtin_memmove \\(\\(void \\*\\) &str, \\(void \\*\\)\\ &.XXXXX.\\\[1\\\]\{lb: 1 sz: 1\}, 5\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times " __builtin_memmove \\(\\(void \\*\\) &str," 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_12.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_12.f90 new file mode 100644 index 0000000..8a2acfa --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_concurrent_12.f90 @@ -0,0 +1,175 @@ +! { dg-do compile } + +! Fails to compile because default initializers aren't supported. +! cf. do_concurrent_14.f90 and PR fortran/101602 (comment 6) + +module m +implicit none +type t + integer :: y = 44 + integer, pointer :: ptr(:) => null() +end type t + +contains + +subroutine sub(x, y) + integer :: i + type(t) :: x, y(4) + type(t) :: a, b(3) + logical :: error = .false. + integer, target :: tgt(6) + integer, target :: tgt2(7) + + x%y = 100 + x%ptr => tgt + y(1)%y = 101 + y(2)%y = 102 + y(3)%y = 103 + y(4)%y = 104 + y(1)%ptr => tgt + y(2)%ptr => tgt + y(3)%ptr => tgt + y(4)%ptr => tgt + + a%y = 105 + a%ptr => tgt + b(1)%y = 106 + b(2)%y = 107 + b(3)%y = 108 + b(1)%ptr => tgt + b(2)%ptr => tgt + b(3)%ptr => tgt + + do concurrent (i = 1: 3) local_init(x,y,a,b) shared(error,tgt,tgt2) default(none) + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + error = .true. + + x%y = 900 + x%ptr => tgt + y(1)%y = 901 + y(2)%y = 902 + y(3)%y = 903 + y(4)%y = 904 + y(1)%ptr => tgt2 + y(2)%ptr => tgt2 + y(3)%ptr => tgt2 + y(4)%ptr => tgt2 + + a%y = 905 + a%ptr => tgt + b(1)%y = 906 + b(2)%y = 907 + b(3)%y = 908 + b(1)%ptr => tgt2 + b(2)%ptr => tgt2 + b(3)%ptr => tgt2 + end do + + if (error) stop 1 + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + stop 2 + + do concurrent (i = 1: 3) local(x,y,a,b) shared(error,tgt,tgt2) default(none) +! { dg-error "34: Sorry, LOCAL specifier at .1. for 'x' of derived type with default initializer is not yet supported" "" { target *-*-* } .-1 } +! { dg-error "36: Sorry, LOCAL specifier at .1. for 'y' of derived type with default initializer is not yet supported" "" { target *-*-* } .-2 } +! { dg-error "38: Sorry, LOCAL specifier at .1. for 'a' of derived type with default initializer is not yet supported" "" { target *-*-* } .-3 } +! { dg-error "40: Sorry, LOCAL specifier at .1. for 'b' of derived type with default initializer is not yet supported" "" { target *-*-* } .-4 } + + if (x%y /= 44) error = .true. + if (any(y(:)%y /= 44)) error = .true. + if (a%y /= 44) error = .true. + if (any (b(:)%y /= 44)) error = .true. + + if (associated(x%ptr)) error = .true. + if (associated(y(1)%ptr)) error = .true. + if (associated(y(2)%ptr)) error = .true. + if (associated(y(3)%ptr)) error = .true. + if (associated(y(4)%ptr)) error = .true. + if (associated(a%ptr)) error = .true. + if (associated(b(1)%ptr)) error = .true. + if (associated(b(2)%ptr)) error = .true. + if (associated(b(3)%ptr)) error = .true. + + x%y = 900 + x%ptr => tgt + y(1)%y = 901 + y(2)%y = 902 + y(3)%y = 903 + y(4)%y = 904 + y(1)%ptr => tgt2 + y(2)%ptr => tgt2 + y(3)%ptr => tgt2 + y(4)%ptr => tgt2 + + a%y = 905 + a%ptr => tgt + b(1)%y = 906 + b(2)%y = 907 + b(3)%y = 908 + b(1)%ptr => tgt2 + b(2)%ptr => tgt2 + b(3)%ptr => tgt2 + end do + + if (error) stop 3 + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + stop 4 +end +end + +use m +implicit none +type(t) :: q, r(4) +call sub(q,r) +end diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_13.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_13.f90 new file mode 100644 index 0000000..6545780 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_concurrent_13.f90 @@ -0,0 +1,211 @@ +! { dg-do run } +! { dg-additional-options "-fdump-tree-original" } + +module m +implicit none +type t + integer :: y = 44 + integer, pointer :: ptr(:) => null() +end type t + +contains + +subroutine sub(x, y) + integer :: i + type(t), pointer :: x, y(:) + type(t), pointer :: a, b(:) + logical :: error = .false. + integer, target :: tgt(6) + integer, target :: tgt2(7) + + type(t), pointer :: x_saved + type(t), pointer :: y_saved(:) + type(t), pointer :: a_saved + type(t), pointer :: b_saved(:) + + allocate(a, b(3)) + + x_saved => x + y_saved => y + a_saved => a + b_saved => b + + x%y = 100 + x%ptr => tgt + y(1)%y = 101 + y(2)%y = 102 + y(3)%y = 103 + y(4)%y = 104 + y(1)%ptr => tgt + y(2)%ptr => tgt + y(3)%ptr => tgt + y(4)%ptr => tgt + + a%y = 105 + a%ptr => tgt + b(1)%y = 106 + b(2)%y = 107 + b(3)%y = 108 + b(1)%ptr => tgt + b(2)%ptr => tgt + b(3)%ptr => tgt + + do concurrent (i = 1: 3) local_init(x,y,a,b) shared(error,tgt,tgt2,x_saved,y_saved,a_saved,b_saved) default(none) + if (.not.associated(x,x_saved)) error = .true. + if (.not.associated(y,y_saved)) error = .true. + if (.not.associated(a,a_saved)) error = .true. + if (.not.associated(b,b_saved)) error = .true. + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + error = .true. + + if (i == 3) then + ! This is a hack - assuming no concurrency! + x%y = 900 + y(1)%y = 901 + a%y = 905 + b(1)%y = 906 + endif + x => null() + y => null() + a => null() + b => null() + end do + + if (error) stop 1 + if (.not.associated(x,x_saved)) stop 2 + if (.not.associated(y,y_saved)) stop 3 + if (.not.associated(a,a_saved)) stop 4 + if (.not.associated(b,b_saved)) stop 5 + ! Value a bit changed because of the hack above! + if (x%y /= 900 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 901 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 905 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 906 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + stop 6 + + ! Reset + x%y = 100 + y(1)%y = 101 + a%y = 105 + b(1)%y = 106 + + do concurrent (i = 1: 3) local(x,y,a,b) shared(error) default(none) + x => null() + y => null() + a => null() + b => null() + end do + + if (.not.associated(x,x_saved)) stop 7 + if (.not.associated(y,y_saved)) stop 8 + if (.not.associated(a,a_saved)) stop 9 + if (.not.associated(b,b_saved)) stop 10 + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + stop 11 + + do concurrent (i = 1: 3) local(x,y,a,b) shared(error,tgt,tgt2,x_saved,y_saved,a_saved,b_saved) default(none) + x => a_saved + y => b_saved + a => x_saved + b => y_saved + if (a%y /= 100 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 101 & + .or. b(2)%y /= 102 & + .or. b(3)%y /= 103 & + .or. b(4)%y /= 104 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt) & + .or. .not.associated (b(4)%ptr, tgt) & + .or. x%y /= 105 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 106 & + .or. y(2)%y /= 107 & + .or. y(3)%y /= 108 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt)) & + error = .true. + end do + + if (.not.associated(x,x_saved)) stop 12 + if (.not.associated(y,y_saved)) stop 13 + if (.not.associated(a,a_saved)) stop 14 + if (.not.associated(b,b_saved)) stop 15 + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + stop 16 +end +end + +use m +implicit none +type(t), pointer :: q, r(:) +allocate(q, r(4)) +call sub(q,r) +end diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_14.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_14.f90 new file mode 100644 index 0000000..c0a90ff --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_concurrent_14.f90 @@ -0,0 +1,176 @@ +! { dg-do run } + +module m +implicit none +type t + integer :: y = 44 + integer, pointer :: ptr(:) => null() +end type t + +! No default initializers, cf. do_concurrent_12.f90 +! and PR fortran/101602 (comment 6) +type t2 + integer :: y + integer, pointer :: ptr(:) +end type t2 + +contains + +subroutine sub(x, y) + integer :: i + type(t) :: x, y(4) + type(t) :: a, b(3) + type(t2) :: x2, y2(4) + type(t2) :: a2, b2(3) + logical :: error = .false. + integer, target :: tgt(6) + integer, target :: tgt2(7) + + x%y = 100 + x%ptr => tgt + y(1)%y = 101 + y(2)%y = 102 + y(3)%y = 103 + y(4)%y = 104 + y(1)%ptr => tgt + y(2)%ptr => tgt + y(3)%ptr => tgt + y(4)%ptr => tgt + + a%y = 105 + a%ptr => tgt + b(1)%y = 106 + b(2)%y = 107 + b(3)%y = 108 + b(1)%ptr => tgt + b(2)%ptr => tgt + b(3)%ptr => tgt + + ! Copy values from 't' to associated 't2' variables + x2%y = x%y + x2%ptr => x%ptr + a2%y = a%y + a2%ptr => a%ptr + y2(:)%y = y(:)%y + do i = 1, size(y) + y2(i)%ptr => y(i)%ptr + end do + b2(:)%y = b(:)%y + do i = 1, size(b) + b2(i)%ptr => b(i)%ptr + end do + + do concurrent (i = 1: 3) local_init(x,y,a,b) shared(error,tgt,tgt2) default(none) + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + error = .true. + + x%y = 900 + x%ptr => tgt + y(1)%y = 901 + y(2)%y = 902 + y(3)%y = 903 + y(4)%y = 904 + y(1)%ptr => tgt2 + y(2)%ptr => tgt2 + y(3)%ptr => tgt2 + y(4)%ptr => tgt2 + + a%y = 905 + a%ptr => tgt + b(1)%y = 906 + b(2)%y = 907 + b(3)%y = 908 + b(1)%ptr => tgt2 + b(2)%ptr => tgt2 + b(3)%ptr => tgt2 + end do + + if (error) stop 1 + if (x%y /= 100 & + .or. .not.associated (x%ptr, tgt) & + .or. y(1)%y /= 101 & + .or. y(2)%y /= 102 & + .or. y(3)%y /= 103 & + .or. y(4)%y /= 104 & + .or. .not.associated (y(1)%ptr, tgt) & + .or. .not.associated (y(2)%ptr, tgt) & + .or. .not.associated (y(3)%ptr, tgt) & + .or. .not.associated (y(4)%ptr, tgt) & + .or. a%y /= 105 & + .or. .not.associated (a%ptr, tgt) & + .or. b(1)%y /= 106 & + .or. b(2)%y /= 107 & + .or. b(3)%y /= 108 & + .or. .not.associated (b(1)%ptr, tgt) & + .or. .not.associated (b(2)%ptr, tgt) & + .or. .not.associated (b(3)%ptr, tgt)) & + stop 2 + + ! Use version without default initializers + do concurrent (i = 1: 3) local(x2,y2,a2,b2) shared(error,tgt,tgt2) default(none) + x2%y = 900 + x2%ptr => tgt + y2(1)%y = 901 + y2(2)%y = 902 + y2(3)%y = 903 + y2(4)%y = 904 + y2(1)%ptr => tgt2 + y2(2)%ptr => tgt2 + y2(3)%ptr => tgt2 + y2(4)%ptr => tgt2 + + a2%y = 905 + a2%ptr => tgt + b2(1)%y = 906 + b2(2)%y = 907 + b2(3)%y = 908 + b2(1)%ptr => tgt2 + b2(2)%ptr => tgt2 + b2(3)%ptr => tgt2 + end do + + if (error) stop 3 + if (x2%y /= 100 & + .or. .not.associated (x2%ptr, tgt) & + .or. y2(1)%y /= 101 & + .or. y2(2)%y /= 102 & + .or. y2(3)%y /= 103 & + .or. y2(4)%y /= 104 & + .or. .not.associated (y2(1)%ptr, tgt) & + .or. .not.associated (y2(2)%ptr, tgt) & + .or. .not.associated (y2(3)%ptr, tgt) & + .or. .not.associated (y2(4)%ptr, tgt) & + .or. a2%y /= 105 & + .or. .not.associated (a2%ptr, tgt) & + .or. b2(1)%y /= 106 & + .or. b2(2)%y /= 107 & + .or. b2(3)%y /= 108 & + .or. .not.associated (b2(1)%ptr, tgt) & + .or. .not.associated (b2(2)%ptr, tgt) & + .or. .not.associated (b2(3)%ptr, tgt)) & + stop 4 +end +end + +use m +implicit none +type(t) :: q, r(4) +call sub(q,r) +end diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_15.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_15.f90 new file mode 100644 index 0000000..f0003c8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/do_concurrent_15.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } + +! Fails to compile because assumed-size arrays are not yet +! handled with LOCAL / LOCAL_INIT, cf. PR fortran/101602 (comment 6) + +subroutine test_it(xx, yy) + implicit none + integer :: xx(:), yy(:,:) + integer :: i, sz1, sz2 + + sz1 = size(xx) + do , concurrent (i = 1 : sz1) local(xx) ! { dg-error "39: Sorry, LOCAL specifier at .1. for assumed-size array 'xx' is not yet supported" } + xx(i) = 1 + end do + + sz2 = size(yy,dim=1) + do , concurrent (i=1:sz2) local_init(yy) ! { dg-error "40: Sorry, LOCAL_INIT specifier at .1. for assumed-size array 'yy' is not yet supported" } + yy(i,:) = 1 + end do +end diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_8_f2023.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_8_f2023.f90 index a99d81e..55eb97b 100644 --- a/gcc/testsuite/gfortran.dg/do_concurrent_8_f2023.f90 +++ b/gcc/testsuite/gfortran.dg/do_concurrent_8_f2023.f90 @@ -8,10 +8,8 @@ program do_concurrent_complex product = 1 do concurrent (i = 1:10) local(j) shared(sum) reduce(+:sum) ! { dg-error "Variable .sum. at .1. has already been specified in a locality-spec" "" { target *-*-* } .-1 } - ! { dg-error "Sorry, LOCAL and LOCAL_INIT are not yet supported for 'do concurrent' constructs" "" { target *-*-* } .-2 } do concurrent (j = 1:10) local(k) shared(product) reduce(*:product) ! { dg-error "Variable .product. at .1. has already been specified in a locality-spec" "" { target *-*-* } .-1 } - ! { dg-error "Sorry, LOCAL and LOCAL_INIT are not yet supported for 'do concurrent' constructs" "" { target *-*-* } .-2 } do concurrent (k = 1:10) array(i,j,k) = i * j * k sum = sum + array(i,j,k) @@ -20,4 +18,4 @@ program do_concurrent_complex end do end do print *, sum, product -end program do_concurrent_complex
\ No newline at end of file +end program do_concurrent_complex diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_9.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_9.f90 index 98cef3e..9c1bca6 100644 --- a/gcc/testsuite/gfortran.dg/do_concurrent_9.f90 +++ b/gcc/testsuite/gfortran.dg/do_concurrent_9.f90 @@ -6,7 +6,7 @@ program do_concurrent_default_none x = 0 y = 0 z = 0 - do concurrent (i = 1:10) default(none) shared(x) local(y) ! { dg-error "Sorry, LOCAL and LOCAL_INIT are not yet supported" } + do concurrent (i = 1:10) default(none) shared(x) local(y) ! { dg-error "Variable 'z' .* not specified in a locality spec .* but required due to DEFAULT \\(NONE\\)" "" { target *-*-* } .-1 } x = x + i y = i * 2 diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_all_clauses.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_all_clauses.f90 index 2e1c18c..a7fa7c3 100644 --- a/gcc/testsuite/gfortran.dg/do_concurrent_all_clauses.f90 +++ b/gcc/testsuite/gfortran.dg/do_concurrent_all_clauses.f90 @@ -11,7 +11,6 @@ program do_concurrent_all_clauses shared(arr, squared, sum, max_val) & reduce(+:sum) & ! { dg-error "Variable 'sum' at \\(1\\) has already been specified in a locality-spec" } reduce(max:max_val) ! { dg-error "Variable 'max_val' at \\(1\\) has already been specified in a locality-spec" } - ! { dg-error "Sorry, LOCAL and LOCAL_INIT are not yet supported*" "" { target *-*-* } .-1 } block integer :: temp2 temp = i * 2 @@ -19,7 +18,7 @@ program do_concurrent_all_clauses squared = i * i arr(i) = temp2 + squared sum = sum + arr(i) - max_val = max(max_val, arr(i)) ! { dg-error "Reference to impure function" } + max_val = max(max_val, arr(i)) end block end do print *, arr, sum, max_val diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_local_init.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_local_init.f90 index 08e1fb9..6c5e87e 100644 --- a/gcc/testsuite/gfortran.dg/do_concurrent_local_init.f90 +++ b/gcc/testsuite/gfortran.dg/do_concurrent_local_init.f90 @@ -3,9 +3,9 @@ program do_concurrent_local_init implicit none integer :: i, arr(10), temp - do concurrent (i = 1:10) local_init(temp) ! { dg-error "LOCAL and LOCAL_INIT are not yet supported for 'do concurrent' constructs" } + do concurrent (i = 1:10) local_init(temp) temp = i arr(i) = temp end do print *, arr -end program do_concurrent_local_init
\ No newline at end of file +end program do_concurrent_local_init diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_locality_specs.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_locality_specs.f90 index 0ee7a7e..ed3504e 100644 --- a/gcc/testsuite/gfortran.dg/do_concurrent_locality_specs.f90 +++ b/gcc/testsuite/gfortran.dg/do_concurrent_locality_specs.f90 @@ -6,9 +6,8 @@ do , concurrent (i = 1:5) shared(j,jj) local(k,kk) local_init(ll,lll) ! { dg-warning "Variable 'kk' in locality-spec at \\(1\\) is not used \\\[-Wunused-variable\\\]" "" { target *-*-* } .-1 } ! { dg-warning "Variable 'll' in locality-spec at \\(1\\) is not used \\\[-Wunused-variable\\\]" "" { target *-*-* } .-2 } ! { dg-warning "Variable 'jj' in locality-spec at \\(1\\) is not used \\\[-Wunused-variable\\\]" "" { target *-*-* } .-3 } - ! { dg-error "Sorry, LOCAL and LOCAL_INIT are not yet supported for 'do concurrent' constructs" "" { target *-*-* } .-4 } j = 5 k = 7 lll = 8 end do -end
\ No newline at end of file +end diff --git a/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90 b/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90 index f2c4d97..540079a 100644 --- a/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/append-args-interop.f90 @@ -23,6 +23,6 @@ use m call f() end -! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 3, interopobjs\.\[0-9\]+, tgt_tgtsync\.\[0-9\]+, pref_type\.\[0-9\]+, " "gimple" } } -! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 0, 0B, 0B, 0B, 0, 0B, 3, interopobjs\.\[0-9\]+," "gimple" } } +! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 3, &interopobjs\.\[0-9\]+, &tgt_tgtsync\.\[0-9\]+, &pref_type\.\[0-9\]+, " "gimple" } } +! { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(99, 0, 0B, 0B, 0B, 0, 0B, 3, &interopobjs\.\[0-9\]+," "gimple" } } ! { dg-final { scan-tree-dump "g \\(&interop\.\[0-9\]+, interop\.\[0-9\]+, &interop\.\[0-9\]+\\)" "gimple" } } diff --git a/gcc/testsuite/gfortran.dg/gomp/append_args-1.f90 b/gcc/testsuite/gfortran.dg/gomp/append_args-1.f90 index c994b55..7e4f74d 100644 --- a/gcc/testsuite/gfortran.dg/gomp/append_args-1.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/append_args-1.f90 @@ -49,7 +49,7 @@ contains end subroutine subroutine f2a () - !$omp declare variant (f1b) append_args ( interop ( prefer_type ( "cuda", "hip" ) ) , interop(target)) & + !$omp declare variant (f1b) append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target)) & !$omp& append_args ( interop ( target , targetsync) ) match(construct={dispatch}) ! { dg-error "'append_args' clause at .1. specified more than once" } end subroutine @@ -60,17 +60,17 @@ contains end subroutine subroutine f2c (x,y) - !$omp declare variant (fop) , append_args ( interop ( prefer_type ( "cuda", "hip" ) ) , interop(target)) , & + !$omp declare variant (fop) , append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target)) , & !$omp& adjust_args (need_device_ptr : x, y ) ! { dg-error "the 'adjust_args' clause at .1. can only be specified if the 'dispatch' selector of the construct selector set appears in the 'match' clause" } type(c_ptr) :: x, y value :: y end subroutine subroutine f2d () - !$omp declare variant (f1d) append_args ( interop ( prefer_type ( "cuda", "hip" ) ) , interop(target)) , ! { dg-error "111: expected 'match', 'adjust_args' or 'append_args' at .1." } + !$omp declare variant (f1d) append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target)) , ! { dg-error "119: expected 'match', 'adjust_args' or 'append_args' at .1." } end subroutine subroutine f2e () - !$omp declare variant (f1e) append_args ( interop ( prefer_type ( "cuda", "hip" ) ) , interop(target) interop(targetsync)) ! { dg-error "Expected ',' or '\\)' at .1." } + !$omp declare variant (f1e) append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target) interop(targetsync)) ! { dg-error "Expected ',' or '\\)' at .1." } end subroutine end diff --git a/gcc/testsuite/gfortran.dg/gomp/append_args-2.f90 b/gcc/testsuite/gfortran.dg/gomp/append_args-2.f90 index 7a68977..63a6934 100644 --- a/gcc/testsuite/gfortran.dg/gomp/append_args-2.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/append_args-2.f90 @@ -56,7 +56,7 @@ contains integer(omp_interop_kind),value :: obj2 end subroutine g1a (obj) - !$omp declare variant (g1 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g1 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) integer(omp_interop_kind),value :: obj end @@ -75,7 +75,7 @@ contains integer(omp_interop_kind) :: obj2 end subroutine g3a (obj) - !$omp declare variant (g3 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g3 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) integer(omp_interop_kind),value :: obj end @@ -84,7 +84,7 @@ contains integer(omp_interop_kind) :: obj2 end subroutine g4a (obj) - !$omp declare variant (g4 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g4 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) integer(omp_interop_kind),value :: obj end @@ -95,7 +95,7 @@ contains optional :: obj3 end subroutine g5a (obj) - !$omp declare variant (g5 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g5 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj3' at .1. with OPTIONAL attribute not support when utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -108,7 +108,7 @@ contains optional :: obj3 end subroutine g5avar (obj) - !$omp declare variant (g5var ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g5var ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj3' at .1. with OPTIONAL attribute not support when utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -120,7 +120,7 @@ contains integer(omp_interop_kind) :: obj2 end subroutine g6a (obj) - !$omp declare variant (g6 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g6 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj3' at .1. must be a nonpointer, nonallocatable scalar integer dummy argument of 'omp_interop_kind' kind as it utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -132,7 +132,7 @@ contains integer(omp_interop_kind),allocatable :: obj2 end subroutine g7a (obj) - !$omp declare variant (g7 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g7 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj2' at .1. must be a nonpointer, nonallocatable scalar integer dummy argument of 'omp_interop_kind' kind as it utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -144,7 +144,7 @@ contains integer(omp_interop_kind) :: obj2(:) end subroutine g8a (obj) - !$omp declare variant (g8 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g8 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj2' at .1. must be a nonpointer, nonallocatable scalar integer dummy argument of 'omp_interop_kind' kind as it utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -156,7 +156,7 @@ contains integer(omp_interop_kind) :: obj2(2) end subroutine g9a (obj) - !$omp declare variant (g9 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g9 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj2' at .1. must be a nonpointer, nonallocatable scalar integer dummy argument of 'omp_interop_kind' kind as it utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -168,7 +168,7 @@ contains integer(1) :: obj2 end subroutine g10a (obj) - !$omp declare variant (g10 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g10 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj2' at .1. must be a nonpointer, nonallocatable scalar integer dummy argument of 'omp_interop_kind' kind as it utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -180,7 +180,7 @@ contains real(omp_interop_kind) :: obj2 ! { dg-warning "C kind type parameter is for type INTEGER but type at .1. is REAL" } end subroutine g11a (obj) - !$omp declare variant (g11 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g11 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj2' at .1. must be a nonpointer, nonallocatable scalar integer dummy argument of 'omp_interop_kind' kind as it utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end @@ -192,7 +192,7 @@ contains integer(omp_interop_kind) :: obj2[*] end subroutine g12a (obj) - !$omp declare variant (g12 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (g12 ) match(construct={dispatch}) append_args ( interop ( target , targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ! { dg-error "'obj2' at .1. must be a nonpointer, nonallocatable scalar integer dummy argument of 'omp_interop_kind' kind as it utilized with the 'append_args' clause at .2." "" { target *-*-* } .-1 } integer(omp_interop_kind),value :: obj end diff --git a/gcc/testsuite/gfortran.dg/gomp/append_args-3.f90 b/gcc/testsuite/gfortran.dg/gomp/append_args-3.f90 index 5dbc246..3b5d3f8 100644 --- a/gcc/testsuite/gfortran.dg/gomp/append_args-3.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/append_args-3.f90 @@ -33,7 +33,7 @@ contains integer(omp_interop_kind), value :: o_value end subroutine sub_no_arg () - !$omp declare variant (vsub_no_arg ) match(construct={dispatch}) append_args (interop(targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (vsub_no_arg ) match(construct={dispatch}) append_args (interop(targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) end integer(c_int) function vfun_cbind(arg2_int, arg2_str, o2_dummy, o2_value) bind(C) diff --git a/gcc/testsuite/gfortran.dg/gomp/append_args-4.f90 b/gcc/testsuite/gfortran.dg/gomp/append_args-4.f90 index 6f55084..f07e3ab 100644 --- a/gcc/testsuite/gfortran.dg/gomp/append_args-4.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/append_args-4.f90 @@ -40,7 +40,7 @@ contains character(len=*) :: str integer, optional, value :: int_opt character(len=:), allocatable :: alloc_str - !$omp declare variant (vifun ) match(construct={dispatch}) append_args (interop(targetsync), interop( prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) + !$omp declare variant (vifun ) match(construct={dispatch}) append_args (interop(targetsync), interop( target, prefer_type ( {fr("cuda"), attr("ompx_xx")}, {attr("ompx_yy")} ))) ifun = 0 end diff --git a/gcc/testsuite/gfortran.dg/gomp/interop-1.f90 b/gcc/testsuite/gfortran.dg/gomp/interop-1.f90 index a16c384..eae0cb3 100644 --- a/gcc/testsuite/gfortran.dg/gomp/interop-1.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/interop-1.f90 @@ -33,12 +33,12 @@ integer(omp_interop_fr_kind), parameter :: ifr_array(2) = [omp_ifr_cuda, omp_ifr integer(omp_interop_kind) :: obj1, obj2, obj3, obj4, obj5 integer :: x -!$omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait ! OK -!$omp interop init(obj1) init (targetsync : obj2, obj3) nowait ! OK -!$omp interop init(obj1) init (targetsync , target : obj2, obj3) nowait ! OK +!$omp interop init(target: obj1) init(target,targetsync : obj2, obj3) nowait ! OK +!$omp interop init(target: obj1) init (targetsync : obj2, obj3) nowait ! OK +!$omp interop init(target: obj1) init (targetsync , target : obj2, obj3) nowait ! OK -!$omp interop init(obj1) init(target,targetsync,target: obj2, obj3) nowait ! { dg-error "Duplicate 'target'" } -!$omp interop init(obj1) init(target,targetsync, targetsync : obj2, obj3) nowait ! { dg-error "Duplicate 'targetsync'" } +!$omp interop init(target: obj1) init(target,targetsync,target: obj2, obj3) nowait ! { dg-error "Duplicate 'target'" } +!$omp interop init(target: obj1) init(target,targetsync, targetsync : obj2, obj3) nowait ! { dg-error "Duplicate 'targetsync'" } !$omp interop init(prefer_type("cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) & !$omp& destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0) @@ -47,7 +47,7 @@ integer :: x ! { dg-warning "Unknown foreign runtime identifier 'cu' at \\(1\\) \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } !$omp assume contains(interop) - !$omp interop init(prefer_type("cuða") : obj3) ! { dg-warning "Unknown foreign runtime identifier 'cu\[^'\]*a'" } + !$omp interop init(target, prefer_type("cuða") : obj3) ! { dg-warning "Unknown foreign runtime identifier 'cu\[^'\]*a'" } !$omp end assume !$omp interop init(prefer_type("cu"//char(0)//"da") : obj3) ! { dg-error "36: Expected ',' or '\\)'" } @@ -63,35 +63,35 @@ integer :: x !$omp interop init ( target , prefer_type( { fr("hsa"), attr("ompx_nothing") , fr("hsa" ) }) :obj1) ! { dg-error "Duplicated 'fr' preference-selector-name" } -!$omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) ! { dg-warning "Unknown foreign runtime identifier '20'" } -!$omp interop init ( prefer_type( sin(3.3) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( {fr(4 ) }) : obj1) ! OK -!$omp interop init ( prefer_type( {fr(4_"cuda" ) }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( {fr(c_char_"cuda") }) : obj1) ! OK -!$omp interop init ( prefer_type( {fr(1_"cuda" ) }) : obj1) ! OK -!$omp interop init ( prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) ! OK -!$omp interop init ( prefer_type( {fr("cuda" // "_driver") }) : obj1) ! { dg-error "46: Expected '\\)'" } -!$omp interop init ( prefer_type( {fr(trim("cuda" // "_driver")) }) : obj1) ! { dg-error "38: Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( {fr("hello" }) : obj1) ! { dg-error "47: Expected '\\)'" } +!$omp interop init ( target, prefer_type( 4, omp_ifr_hip*4) : obj1) ! { dg-warning "Unknown foreign runtime identifier '20'" } +!$omp interop init ( target, prefer_type( sin(3.3) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( {fr(4 ) }) : obj1) ! OK +!$omp interop init ( target, prefer_type( {fr(4_"cuda" ) }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( {fr(c_char_"cuda") }) : obj1) ! OK +!$omp interop init ( target, prefer_type( {fr(1_"cuda" ) }) : obj1) ! OK +!$omp interop init ( target, prefer_type( {fr(omp_ifr_level_zero ) }, {fr(omp_ifr_hip)}) : obj1) ! OK +!$omp interop init ( target, prefer_type( {fr("cuda" // "_driver") }) : obj1) ! { dg-error "54: Expected '\\)'" } +!$omp interop init ( target, prefer_type( {fr(trim("cuda" // "_driver")) }) : obj1) ! { dg-error "46: Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( {fr("hello" }) : obj1) ! { dg-error "55: Expected '\\)'" } ! { dg-warning "Unknown foreign runtime identifier 'hello' at \\(1\\) \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } -!$omp interop init ( prefer_type( {fr(x) }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( {fr(ifr_array ) }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( {fr(ifr_array(1) ) }) : obj1) +!$omp interop init ( target, prefer_type( {fr(x) }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( {fr(ifr_array ) }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( {fr(ifr_array(1) ) }) : obj1) -!$omp interop init ( prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) ! OK -!$omp interop init ( prefer_type( omp_ifr_level_zero +1 ) : obj1) ! OK -!$omp interop init ( prefer_type( x ) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( ifr_array ) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( ifr_array(2) ) : obj1) ! OK +!$omp interop init ( target, prefer_type( omp_ifr_level_zero, omp_ifr_hip ) : obj1) ! OK +!$omp interop init ( target, prefer_type( omp_ifr_level_zero +1 ) : obj1) ! OK +!$omp interop init ( target, prefer_type( x ) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( ifr_array ) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( ifr_array(2) ) : obj1) ! OK -!$omp interop init ( prefer_type( 4, omp_ifr_hip*4) : obj1) ! { dg-warning "Unknown foreign runtime identifier '20'" } -!$omp interop init ( prefer_type( 4, 1, 3) : obj1) +!$omp interop init ( target, prefer_type( 4, omp_ifr_hip*4) : obj1) ! { dg-warning "Unknown foreign runtime identifier '20'" } +!$omp interop init ( target, prefer_type( 4, 1, 3) : obj1) -!$omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) -!$omp interop init ( prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) ! { dg-error "65: Expected '\\)'" } -!$omp interop init ( prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) ! { dg-error "45: Expected '\\)' at" } -!$omp interop init ( prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1) -!$omp interop init ( prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1) +!$omp interop init ( target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) +!$omp interop init ( target, prefer_type( {fr("cuda") }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) ! { dg-error "73: Expected '\\)'" } +!$omp interop init ( target, prefer_type( {fr("cuda",5) }, {fr(omp_ifr_hsa,omp_ifr_level_zero)} , {attr("ompx_a") } , {fr(omp_ifr_hip) }) : obj1) ! { dg-error "53: Expected '\\)' at" } +!$omp interop init ( target, prefer_type( {fr("sycl"), attr("ompx_1", "ompx_2"), attr("ompx_3") }, {attr("ompx_4", "ompx_5"),fr(omp_ifr_level_zero)} ) : obj1) +!$omp interop init ( target, prefer_type( { fr(5), attr("ompx_1") }, {fr(omp_ifr_hsa)} , {attr("ompx_a") } ) : obj1) end diff --git a/gcc/testsuite/gfortran.dg/gomp/interop-2.f90 b/gcc/testsuite/gfortran.dg/gomp/interop-2.f90 index b313011..a8fc920 100644 --- a/gcc/testsuite/gfortran.dg/gomp/interop-2.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/interop-2.f90 @@ -27,13 +27,13 @@ integer(1) :: o1 integer, parameter :: mykind = mod (omp_interop_kind, 100) ! remove saving the 'comes from c_int' info real(mykind) :: or -!$omp interop init (op) ! { dg-error "'op' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } +!$omp interop init (target : op) ! { dg-error "'op' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } ! { dg-error "Object 'op' is not a variable at \\(1\\)" "" { target *-*-* } .-1 } -!$omp interop init (ointent) ! { dg-error "'ointent' at \\(1\\) in 'INIT' clause must be definable" } -!$omp interop init (od) ! { dg-error "'od' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } -!$omp interop init (od(1)) ! { dg-error "Syntax error in OpenMP variable list" } -!$omp interop init (o1) ! { dg-error "'o1' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } -!$omp interop init (or) ! { dg-error "'or' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } +!$omp interop init (target : ointent) ! { dg-error "'ointent' at \\(1\\) in 'INIT' clause must be definable" } +!$omp interop init (target : od) ! { dg-error "'od' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } +!$omp interop init (target : od(1)) ! { dg-error "Syntax error in OpenMP variable list" } +!$omp interop init (target: o1) ! { dg-error "'o1' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } +!$omp interop init (target: or) ! { dg-error "'or' at \\(1\\) in 'INIT' clause must be a scalar integer variable of 'omp_interop_kind' kind" } !$omp interop use (op) ! { dg-error "'op' at \\(1\\) in 'USE' clause must be a scalar integer variable of 'omp_interop_kind' kind" } ! { dg-error "Object 'op' is not a variable at \\(1\\)" "" { target *-*-* } .-1 } @@ -60,21 +60,21 @@ implicit none integer(omp_interop_kind) :: obj1, obj2, obj3, obj4, obj5 integer :: x -!$omp interop init ( prefer_type( {fr(1_"") }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } -!$omp interop init ( prefer_type( {fr(1_"hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "Expected default-kind character literal" } +!$omp interop init ( target, prefer_type( {fr(1_"") }) : obj1) ! { dg-error "Expected constant scalar integer expression or non-empty default-kind character literal" } +!$omp interop init ( target, prefer_type( {fr(1_"hip") , attr(omp_ifr_cuda) }) : obj1) ! { dg-error "Expected default-kind character literal" } -!$omp interop init ( prefer_type( {fr(1_"hip") , attr("myooption") }) : obj1) ! { dg-error "Character literal at .1. must start with 'ompx_'" } -!$omp interop init ( prefer_type( {fr(1_"hip") , attr("ompx_option") , attr("ompx_") } ) : obj1) -!$omp interop init ( prefer_type( {fr(1_"hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1) -!$omp interop init ( prefer_type( {fr(1_"hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) ! { dg-error "Expected ',' or '\\)'" } -!$omp interop init ( prefer_type( {fr(1_"hip") , attr("ompx_option") ) : obj1) ! { dg-error "Expected ',' or '\}'" } +!$omp interop init ( target, prefer_type( {fr(1_"hip") , attr("myooption") }) : obj1) ! { dg-error "Character literal at .1. must start with 'ompx_'" } +!$omp interop init ( target, prefer_type( {fr(1_"hip") , attr("ompx_option") , attr("ompx_") } ) : obj1) +!$omp interop init ( target, prefer_type( {fr(1_"hip") , attr("ompx_option") }, { attr("ompx_") } ) : obj1) +!$omp interop init ( target, prefer_type( {fr(1_"hip") , attr("ompx_option") } { attr("ompx_") } ) : obj1) ! { dg-error "Expected ',' or '\\)'" } +!$omp interop init ( target, prefer_type( {fr(1_"hip") , attr("ompx_option") ) : obj1) ! { dg-error "Expected ',' or '\}'" } -!$omp interop init ( prefer_type( {fr(1_"hip") attr("ompx_option") ) : obj1) ! { dg-error "Expected ',' or '\}'" } -!$omp interop init ( prefer_type( {fr(1_"hip")}), prefer_type("cuda") : obj1) ! { dg-error "Duplicate 'prefer_type' modifier" } +!$omp interop init ( target, prefer_type( {fr(1_"hip") attr("ompx_option") ) : obj1) ! { dg-error "Expected ',' or '\}'" } +!$omp interop init ( target, prefer_type( {fr(1_"hip")}), prefer_type("cuda") : obj1) ! { dg-error "Duplicate 'prefer_type' modifier" } -!$omp interop init ( prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1) ! { dg-error "Unexpected null or ',' character in character literal" } +!$omp interop init ( target, prefer_type( {attr("ompx_option1,ompx_option2") ) : obj1) ! { dg-error "Unexpected null or ',' character in character literal" } !$omp interop init ( targetsync other ) : obj1) ! { dg-error "Expected ',' or ':'" } -!$omp interop init ( prefer_type( {fr(1_"cuda") } ), other : obj1) ! { dg-error "Expected 'target' or 'targetsync'" } -!$omp interop init ( prefer_type( {fr(1_"cuda") } ), obj1) ! { dg-error "Expected 'target' or 'targetsync'" } +!$omp interop init ( target, prefer_type( {fr(1_"cuda") } ), other : obj1) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } +!$omp interop init ( target, prefer_type( {fr(1_"cuda") } ), obj1) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } end diff --git a/gcc/testsuite/gfortran.dg/gomp/interop-3.f90 b/gcc/testsuite/gfortran.dg/gomp/interop-3.f90 index a3bbfca..04015de 100644 --- a/gcc/testsuite/gfortran.dg/gomp/interop-3.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/interop-3.f90 @@ -25,16 +25,16 @@ integer(omp_interop_kind) :: obj1, obj2, obj3, obj4, obj5 integer(omp_interop_kind) :: target, targetsync,prefer_type integer :: x -!$omp interop init(obj1) init(target,targetsync : obj2, obj3) nowait +!$omp interop init(target: obj1) init(target,targetsync : obj2, obj3) nowait !$omp interop init(prefer_type(1_"cuda", omp_ifr_opencl, omp_ifr_level_zero, "hsa"), targetsync : obj1) & !$omp& destroy(obj2, obj3) depend(inout: x) use(obj4, obj5) device(device_num: 0) !$omp assume contains(interop) - !$omp interop init(prefer_type("cu da") : obj3) ! { dg-warning "Unknown foreign runtime identifier 'cu da'" } + !$omp interop init(target, prefer_type("cu da") : obj3) ! { dg-warning "Unknown foreign runtime identifier 'cu da'" } !$omp end assume -!$omp interop init(obj1, obj2, obj1), use(obj4) destroy(obj4) +!$omp interop init(target: obj1, obj2, obj1), use(obj4) destroy(obj4) ! { dg-error "Symbol 'obj1' present on multiple clauses" "" { target *-*-* } .-1 } ! { dg-error "Symbol 'obj4' present on multiple clauses" "" { target *-*-* } .-2 } @@ -44,13 +44,13 @@ integer :: x !$omp interop depend(inout: x) use(obj2), destroy(obj3) ! Likewise -!$omp interop depend(inout: x) use(obj2), destroy(obj3) init(obj4) ! { dg-error "DEPEND clause at .1. requires 'targetsync' interop-type, lacking it for 'obj4' at .2." } +!$omp interop depend(inout: x) use(obj2), destroy(obj3) init(target: obj4) ! { dg-error "DEPEND clause at .1. requires 'targetsync' interop-type, lacking it for 'obj4' at .2." } -!$omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(obj4) ! { dg-error "DEPEND clause at .1. requires 'targetsync' interop-type, lacking it for 'obj4' at .2." } +!$omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(target: obj4) ! { dg-error "DEPEND clause at .1. requires 'targetsync' interop-type, lacking it for 'obj4' at .2." } !$omp interop depend(inout: x) init(targetsync : obj5) use(obj2), destroy(obj3) init(prefer_type("cuda"), targetsync : obj4) ! OK -!$omp interop init(target, targetsync, prefer_type, obj1) -!$omp interop init(prefer_type, obj1, target, targetsync) +!$omp interop init(target, targetsync, prefer_type, obj1) ! { dg-error "51: Expected '\\(' after 'prefer_type'" } +!$omp interop init(target, prefer_type, obj1, targetsync) ! { dg-error "39: Expected '\\(' after 'prefer_type'" } ! Duplicated variable name or duplicated modifier: !$omp interop init(target, targetsync,target : obj1) ! { dg-error "Duplicate 'target' at \\(1\\)" } @@ -62,5 +62,5 @@ integer :: x !$omp interop init(target : target, targetsync,targetsync) ! { dg-error "Symbol 'targetsync' present on multiple clauses" } -!$omp interop init(, targetsync, prefer_type, obj1, target) ! { dg-error "Syntax error in OpenMP variable list" } +!$omp interop init(, targetsync, prefer_type, obj1, target) ! { dg-error "20: Expected 'prefer_type', 'target', or 'targetsync'" } end diff --git a/gcc/testsuite/gfortran.dg/gomp/interop-4.f90 b/gcc/testsuite/gfortran.dg/gomp/interop-4.f90 index 43c28d6..7422881 100644 --- a/gcc/testsuite/gfortran.dg/gomp/interop-4.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/interop-4.f90 @@ -26,14 +26,14 @@ implicit none integer(omp_interop_kind) :: obj1, obj2, obj3, obj4, obj5, obj6, obj7 integer :: x(6) -!$omp interop init ( obj1, obj2) use (obj3) destroy(obj4) init(obj5) destroy(obj6) use(obj7) -! { dg-final { scan-tree-dump-times "#pragma omp interop init\\(obj1\\) init\\(obj2\\) init\\(obj5\\) use\\(obj3\\) use\\(obj7\\) destroy\\(obj4\\) destroy\\(obj6\\)\[\r\n\]" 1 "original" } } +!$omp interop init ( target: obj1, obj2) use (obj3) destroy(obj4) init(target: obj5) destroy(obj6) use(obj7) +! { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target: obj1\\) init\\(target: obj2\\) init\\(target: obj5\\) use\\(obj3\\) use\\(obj7\\) destroy\\(obj4\\) destroy\\(obj6\\)\[\r\n\]" 1 "original" } } !$omp interop nowait init (targetsync : obj1, obj2) use (obj3) destroy(obj4) init(target, targetsync : obj5) destroy(obj6) use(obj7) depend(inout: x) ! { dg-final { scan-tree-dump-times "#pragma omp interop depend\\(inout:x\\) init\\(targetsync: obj1\\) init\\(targetsync: obj2\\) init\\(target, targetsync: obj5\\) use\\(obj3\\) use\\(obj7\\) destroy\\(obj4\\) destroy\\(obj6\\) nowait\[\r\n\]" 1 "original" } } -!$omp interop init ( obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5) -! { dg-final { scan-tree-dump-times "#pragma omp interop init\\(obj1\\) init\\(obj2\\) init\\(target: obj3\\) init\\(targetsync: obj4\\) init\\(target, targetsync: obj5\\)\[\r\n\]" 1 "original" } } +!$omp interop init ( target: obj1, obj2) init (target: obj3) init(targetsync : obj4) init(target,targetsync: obj5) +! { dg-final { scan-tree-dump-times "#pragma omp interop init\\(target: obj1\\) init\\(target: obj2\\) init\\(target: obj3\\) init\\(targetsync: obj4\\) init\\(target, targetsync: obj5\\)\[\r\n\]" 1 "original" } } ! -------------------------------------------- diff --git a/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 b/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 index 0c44296..f48addc 100644 --- a/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 @@ -10,5 +10,5 @@ type sct end type type(sct) var -!$omp target enter data map(to:var) ! { dg-error "allocatable components is not permitted in map clause" } +!$omp target enter data map(to:var) end diff --git a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-1.f90 b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-1.f90 new file mode 100644 index 0000000..750cec9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-1.f90 @@ -0,0 +1,30 @@ +type t + integer :: t +end type t +class(t), target, allocatable :: c, ca(:) +class(t), pointer :: p, pa(:) +integer :: x +allocate( t :: c, ca(5)) +p => c +pa => ca + +! 11111111112222222222333333333344 +!2345678901234567890123456789012345678901 +!$omp target enter data map(c, ca, p, pa) +! { dg-warning "29:Mapping of polymorphic list item 'c' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } +! { dg-warning "32:Mapping of polymorphic list item 'ca' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-2 } +! { dg-warning "36:Mapping of polymorphic list item 'p' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-3 } +! { dg-warning "39:Mapping of polymorphic list item 'pa' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-4 } + +! 11111111112222222222333333333344 +!2345678901234567890123456789012345678901 + +! 11111111112222222222333333333344 +!2345678901234567890123456789012345678901 +!$omp target update from(c,ca), to(p,pa) +! { dg-warning "26:Mapping of polymorphic list item 'c' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } +! { dg-warning "28:Mapping of polymorphic list item 'ca' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-2 } +! { dg-warning "36:Mapping of polymorphic list item 'p' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-3 } +! { dg-warning "38:Mapping of polymorphic list item 'pa' is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-4 } + +end diff --git a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-2.f90 b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-2.f90 index e25db68..3bedc9b 100644 --- a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-2.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-2.f90 @@ -9,7 +9,7 @@ allocate( t :: c, ca(5)) p => c pa => ca -!$omp target ! { dg-warning "Implicit mapping of polymorphic variable 'ca' is unspecified behavior \\\[-Wopenmp\\\]" } +!$omp target ! { dg-warning "Mapping of polymorphic list item 'ca' is unspecified behavior \\\[-Wopenmp\\\]" } ll = allocated(ca) !$omp end target diff --git a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-3.f90 b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-3.f90 new file mode 100644 index 0000000..9777ecf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-3.f90 @@ -0,0 +1,23 @@ +subroutine sub(var, var2) +type t + integer :: x +end type t + +type t2 + integer :: x + integer, allocatable :: y +end type + +class(t) var, var2 +type(t2) :: var3, var4 +!$omp target firstprivate(var) & ! { dg-error "Polymorphic list item 'var' at .1. in FIRSTPRIVATE clause has unspecified behavior and unsupported" } +!$omp& private(var2) ! { dg-error "Polymorphic list item 'var2' at .1. in PRIVATE clause has unspecified behavior and unsupported" } + var%x = 5 + var2%x = 5 +!$omp end target +!$omp target firstprivate(var3) & ! { dg-error "Sorry, list item 'var3' at .1. with allocatable components is not yet supported in FIRSTPRIVATE clause" } +!$omp& private(var4) ! { dg-error "Sorry, list item 'var4' at .1. with allocatable components is not yet supported in PRIVATE clause" } + var3%x = 5 + var4%x = 5 +!$omp end target +end diff --git a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-4.f90 b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-4.f90 new file mode 100644 index 0000000..5a1a70a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-4.f90 @@ -0,0 +1,9 @@ +subroutine one +implicit none +type t + class(*), allocatable :: ul +end type + +type(t) :: var +!$omp target enter data map(to:var) ! { dg-error "Mapping of unlimited polymorphic list item 'var.ul' is unspecified behavior and unsupported" } +end diff --git a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-5.f90 b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-5.f90 new file mode 100644 index 0000000..4b5814e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping-5.f90 @@ -0,0 +1,9 @@ +subroutine one +implicit none +type t + class(*), allocatable :: ul +end type + +class(*), allocatable :: ul_var +!$omp target enter data map(to: ul_var) ! { dg-error "Mapping of unlimited polymorphic list item 'ul_var' is unspecified behavior and unsupported" } +end diff --git a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping.f90 b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping.f90 index dd7eb31..752cca2 100644 --- a/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/polymorphic-mapping.f90 @@ -10,37 +10,21 @@ pa => ca ! 11111111112222222222333333333344 !2345678901234567890123456789012345678901 -!$omp target enter data map(c, ca, p, pa) -! { dg-warning "29:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } -! { dg-warning "32:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-2 } -! { dg-warning "36:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-3 } -! { dg-warning "39:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-4 } - -! 11111111112222222222333333333344 -!2345678901234567890123456789012345678901 -!$omp target firstprivate(ca) ! { dg-warning "27:FIRSTPRIVATE with polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" } +!$omp target firstprivate(ca) ! { dg-error "27:Polymorphic list item 'ca' at .1. in FIRSTPRIVATE clause has unspecified behavior and unsupported" } !$omp end target -!$omp target parallel do firstprivate(ca) ! { dg-warning "39:FIRSTPRIVATE with polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" } +!$omp target parallel do firstprivate(ca) ! { dg-error "39:Polymorphic list item 'ca' at .1. in FIRSTPRIVATE clause has unspecified behavior and unsupported" } do x = 0, 5 end do -!$omp target parallel do private(ca) ! OK; should map declared type +!$omp target parallel do private(ca) ! { dg-error "34:Polymorphic list item 'ca' at .1. in PRIVATE clause has unspecified behavior and unsupported" } do x = 0, 5 end do -!$omp target private(ca) ! OK; should map declared type +!$omp target private(ca) ! { dg-error "22:Polymorphic list item 'ca' at .1. in PRIVATE clause has unspecified behavior and unsupported" } block end block -! 11111111112222222222333333333344 -!2345678901234567890123456789012345678901 -!$omp target update from(c,ca), to(p,pa) -! { dg-warning "26:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-1 } -! { dg-warning "28:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-2 } -! { dg-warning "36:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-3 } -! { dg-warning "38:Mapping polymorphic list item at .1. is unspecified behavior \\\[-Wopenmp\\\]" "" { target *-*-* } .-4 } - ! ------------------------- !$omp target parallel map(release: x) ! { dg-error "36:TARGET with map-type other than TO, FROM, TOFROM, or ALLOC on MAP clause" } diff --git a/gcc/testsuite/gfortran.dg/gomp/pr118965-1.f90 b/gcc/testsuite/gfortran.dg/gomp/pr118965-1.f90 new file mode 100644 index 0000000..c9b1eca --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr118965-1.f90 @@ -0,0 +1,48 @@ +! At least one of the target and/or targetsync modifiers must be provided. +! This implies that there are always modifiers required, and the parser +! should reject e.g. "init (var1, var2)"; the first thing in the list is +! always an init_modifier in valid code. + +module m + use iso_c_binding + implicit none + + ! The following definitions are in omp_lib, which cannot be included + ! in gcc/testsuite/ + integer, parameter :: omp_interop_kind = c_intptr_t + integer, parameter :: omp_interop_fr_kind = c_int + + integer (omp_interop_kind), parameter :: omp_interop_none = 0_omp_interop_kind + integer (omp_interop_fr_kind), parameter :: omp_ifr_cuda = 1 + integer (omp_interop_fr_kind), parameter :: omp_ifr_cuda_driver = 2 + integer (omp_interop_fr_kind), parameter :: omp_ifr_opencl = 3 + integer (omp_interop_fr_kind), parameter :: omp_ifr_sycl = 4 + integer (omp_interop_fr_kind), parameter :: omp_ifr_hip = 5 + integer (omp_interop_fr_kind), parameter :: omp_ifr_level_zero = 6 + integer (omp_interop_fr_kind), parameter :: omp_ifr_hsa = 7 +end module m + +program main +use m +implicit none +integer(omp_interop_kind) :: obj1, obj2 + + !$omp interop init (obj1) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } + !$omp interop init (obj1, obj2) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } + !$omp interop init (obj1, target) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } + !$omp interop init (target, obj1) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } + !$omp interop init (obj1, targetsync) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } + !$omp interop init (targetsync, obj1) ! { dg-error "Expected 'prefer_type', 'target', or 'targetsync'" } + !$omp interop init (targetsync, target) ! { dg-error "Expected ',' or ':'" } + + !$omp interop init (target, prefer_type( {fr(4 ) }) : obj1) ! OK + !$omp interop init (targetsync, prefer_type( {fr(4 ) }) : obj1) ! OK + !$omp interop init (prefer_type( {fr(4 ) }), target : obj1) ! OK + + !$omp interop init (prefer_type( {fr(4 ) }) : obj1) ! { dg-error "Missing required 'target' and/or 'targetsync' modifier" } + + ! This does not complain about foobar not being declared because + ! Fortran parser error handling eats the whole rest of the statement. + !$omp interop init (prefer_type( {fr(4 ) }) : foobar) ! { dg-error "Missing required 'target' and/or 'targetsync' modifier" } + +end
\ No newline at end of file diff --git a/gcc/testsuite/gfortran.dg/gomp/pr118965-2.f90 b/gcc/testsuite/gfortran.dg/gomp/pr118965-2.f90 new file mode 100644 index 0000000..0b3015a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr118965-2.f90 @@ -0,0 +1,57 @@ +! At least one of the target and/or targetsync modifiers must be provided. + +module my_omp_lib + use iso_c_binding + implicit none + + ! The following definitions are in omp_lib, which cannot be included + ! in gcc/testsuite/ + integer, parameter :: omp_interop_kind = c_intptr_t + integer, parameter :: omp_interop_fr_kind = c_int + + integer (omp_interop_kind), parameter :: omp_interop_none = 0_omp_interop_kind + integer (omp_interop_fr_kind), parameter :: omp_ifr_cuda = 1 + integer (omp_interop_fr_kind), parameter :: omp_ifr_cuda_driver = 2 + integer (omp_interop_fr_kind), parameter :: omp_ifr_opencl = 3 + integer (omp_interop_fr_kind), parameter :: omp_ifr_sycl = 4 + integer (omp_interop_fr_kind), parameter :: omp_ifr_hip = 5 + integer (omp_interop_fr_kind), parameter :: omp_ifr_level_zero = 6 + integer (omp_interop_fr_kind), parameter :: omp_ifr_hsa = 7 +end module my_omp_lib + +module m + use my_omp_lib + implicit none + logical, parameter :: flag = .true. +contains + + subroutine f1 (i) + integer(omp_interop_kind) :: i + end + + subroutine g1 () + !$omp declare variant (f1) match(user={condition(flag)}) & + !$omp& append_args(interop(prefer_type({attr("ompx_fun")}))) + ! { dg-error "Missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-1 } + end + + function f2 (a1, a2) + integer(omp_interop_kind) :: a1 + integer(omp_interop_kind) :: a2 + integer :: f2 + f2 = 0 + end + + function g2 () + !$omp declare variant(f2) & + !$omp& append_args(interop(prefer_type("cuda")), & + !$omp& interop(prefer_type({fr("hsa")}))) & + !$omp& match(construct={dispatch}) + ! { dg-error "Missing required 'target' and/or 'targetsync' modifier" "" { target *-*-* } .-3 } + ! There is no diagnostic for the second interop arg because Fortran + ! error recovery skips to the end of the statement after diagnosing the + ! first one. + integer :: g2 + g2 = 5 + end +end diff --git a/gcc/testsuite/gfortran.dg/interface_59.f90 b/gcc/testsuite/gfortran.dg/interface_59.f90 new file mode 100644 index 0000000..c9ccd67 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_59.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! PR fortran/119669 - this used to generate an ICE. + +program a + implicit real(a-h,o-z) + external abstract_caller, caller, func +! real func + call abstract_caller (caller, func, 1.5) + call abstract_caller (caller, func, 1.5) +end program a + +function func (x) + real func, x + func = x * x - 1. +end diff --git a/gcc/testsuite/gfortran.dg/move_alloc_11.f90 b/gcc/testsuite/gfortran.dg/move_alloc_11.f90 new file mode 100644 index 0000000..d33e0ce --- /dev/null +++ b/gcc/testsuite/gfortran.dg/move_alloc_11.f90 @@ -0,0 +1,23 @@ +!{ dg-do compile } + +! General error checking for move_alloc parameter list. + +integer, allocatable :: i, o +integer :: st, s2 +character(30) :: e, e2 + + call move_alloc(i, o, STAT=st) + call move_alloc(i, o, STAT=st, STAT=s2) !{ dg-error "Keyword 'stat' at \\(1\\) has already appeared in the current argument list" } + call move_alloc(i, o, STAT=e) !{ dg-error "STAT= argument at \\(1\\) must be a scalar INTEGER variable of at least kind 2" } + call move_alloc(i, o, STAT=[st, s2]) !{ dg-error "STAT= argument at \\(1\\) must be a scalar INTEGER variable of at least kind 2" } + call move_alloc(i, o, STAT=.TRUE.) !{ dg-error "STAT= argument at \\(1\\) must be a scalar INTEGER variable of at least kind 2" } + + call move_alloc(i, o, STAT=st, ERRMSG=e) + call move_alloc(i, o, ERRMSG=e) + call move_alloc(i, o, ERRMSG=e, ERRMSG=e2) !{ dg-error "Keyword 'errmsg' at \\(1\\) has already appeared in the current argument list" } + call move_alloc(i, o, ERRMSG=st) !{ dg-error "ERRMSG= argument at \\(1\\) must be a scalar CHARACTER variable of at least kind 1" } + call move_alloc(i, o, ERRMSG=.TRUE.) !{ dg-error "ERRMSG= argument at \\(1\\) must be a scalar CHARACTER variable of at least kind 1" } + + +end + diff --git a/gcc/testsuite/gfortran.dg/num_images_1.f90 b/gcc/testsuite/gfortran.dg/num_images_1.f90 index dac34ba..e03857c 100644 --- a/gcc/testsuite/gfortran.dg/num_images_1.f90 +++ b/gcc/testsuite/gfortran.dg/num_images_1.f90 @@ -5,5 +5,5 @@ program foo implicit none integer k5 - k5 = num_images(failed=.false.) ! { dg-error "argument to NUM_IMAGES" } + k5 = num_images(failed=.false.) ! { dg-error "Cannot find keyword named 'failed' in call to 'num_images'" } end program foo diff --git a/gcc/testsuite/gfortran.dg/optional_absent_13.f90 b/gcc/testsuite/gfortran.dg/optional_absent_13.f90 new file mode 100644 index 0000000..9c2039b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/optional_absent_13.f90 @@ -0,0 +1,48 @@ +! { dg-do run } +! PR fortran/119656 - wrong code with impure elemental subroutine and interface +! +! Derived from testcase at: +! https://fortran-lang.discourse.group/t/ +! problem-with-impure-elemental-subroutine-in-interface-with-gfortran/9545 + +module m2 + implicit none + interface foo + module procedure foo_mat + module procedure foo_df + module procedure foo_cmat + end interface foo +contains + + subroutine foo_mat(x, nacf, label) + real, intent(in) :: x(:,:) + integer, intent(in) :: nacf + character(len=*), intent(in), optional :: label + end subroutine foo_mat + + impure elemental subroutine foo_df(nacf, outu, xstr) + integer , intent(in) :: nacf + integer , intent(in), optional :: outu + character(len=*), intent(in), optional :: xstr + if (present(xstr)) then + if (len (xstr) /= 2) then + print *,"nacf, len(xstr) =", nacf, len(xstr) + stop nacf + end if + end if + end subroutine foo_df + + subroutine foo_cmat(x, nacf, label) + complex, intent(in) :: x(:,:) + integer, intent(in) :: nacf + character(len=*), intent(in), optional :: label + end subroutine foo_cmat + +end module m2 + +program main + use m2, only: foo, foo_df + implicit none + call foo_df(nacf = 1, xstr="ab") + call foo (nacf = 2, xstr="ab") +end program main diff --git a/gcc/testsuite/gfortran.dg/pr102458.f90 b/gcc/testsuite/gfortran.dg/pr102458.f90 index 555e497..7c13084 100644 --- a/gcc/testsuite/gfortran.dg/pr102458.f90 +++ b/gcc/testsuite/gfortran.dg/pr102458.f90 @@ -9,7 +9,7 @@ end program p block - integer :: a(get_team()) = 1 ! { dg-error "Automatic array" } + integer :: a(get_team()) = 1 ! { dg-error "Automatic array | ISO_FORTRAN_ENV | must be of INTEGER" } print *, a end block end diff --git a/gcc/testsuite/gfortran.dg/pr119502.f90 b/gcc/testsuite/gfortran.dg/pr119502.f90 new file mode 100644 index 0000000..80d7c61 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr119502.f90 @@ -0,0 +1,15 @@ +! { dg-do run } + +! PR119502, negative unit numbers are not allowed without using NEWUNIT + +program foo + integer :: iun = -1 + integer :: ios + open (iun, iostat=ios) + if (ios == 0) stop 1 + write(iun,*, iostat=ios) "This is a test." + if (ios == 0) stop 2 + close (iun, iostat=ios) + if (ios == 0) stop 3 +end + diff --git a/gcc/testsuite/gfortran.dg/pr119836_1.f90 b/gcc/testsuite/gfortran.dg/pr119836_1.f90 new file mode 100644 index 0000000..984e2d0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr119836_1.f90 @@ -0,0 +1,18 @@ +! +! { dg-do run } +! +! PR fortran/119836 +! +program p + implicit none + integer, parameter :: n = 4 + integer :: i + integer :: y(n), x(n) + do concurrent (i=1:n) + x(i) = shiftl (i,1) ! accepted + block + y(i) = shiftl (i,1) ! wrongly rejected + end block + end do + if (any(x /= y)) stop 1 +end program p diff --git a/gcc/testsuite/gfortran.dg/pr119836_2.f90 b/gcc/testsuite/gfortran.dg/pr119836_2.f90 new file mode 100644 index 0000000..5e2d0c9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr119836_2.f90 @@ -0,0 +1,21 @@ +! +! { dg-do compile } +! +! PR fortran/119836 +! +! Although intrinsic functions contained within the Fortran standard +! are pure procedures, many of the additional intrinsic functions +! supplied in libgfortran are impure. RAND() is one such function. +! +program foo + implicit none + integer i + real x(4) + do concurrent (i=1:4) + x = rand() ! { dg-error "Reference to impure function" } + block + x = rand() ! { dg-error "Reference to impure function" } + end block + end do + print *, x +end program foo diff --git a/gcc/testsuite/gfortran.dg/pr119836_3.f90 b/gcc/testsuite/gfortran.dg/pr119836_3.f90 new file mode 100644 index 0000000..69a5fcf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr119836_3.f90 @@ -0,0 +1,30 @@ +! +! { dg-do run } +! +! PR fortran/119836 +! +program p + implicit none + integer, parameter :: n = 4 + integer :: i + integer :: y(n), x(n) + x = [(i,i=1,n)] + do concurrent (i=1:n) + call bar(x, y) + end do + if (any(x /= y)) stop 1 + x = 2 * x + do concurrent (i=1:n) + block + call bar(x, y) + end block + end do + if (any(x /= y)) stop 1 + + contains + elemental subroutine bar(x, y) + integer, intent(in) :: x + integer, intent(out) :: y + y = x + end subroutine +end program p diff --git a/gcc/testsuite/gfortran.dg/pr119836_4.f90 b/gcc/testsuite/gfortran.dg/pr119836_4.f90 new file mode 100644 index 0000000..dc6f72b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr119836_4.f90 @@ -0,0 +1,30 @@ +! +! { dg-do compile } +! +! PR fortran/119836 +! +program p + implicit none + integer, parameter :: n = 4 + integer :: i + integer :: y(n), x(n) + x = [(i,i=1,n)] + do concurrent (i=1:n) + call bar(x, y) ! { dg-error "Subroutine call" } + end do + if (any(x /= y)) stop 1 + x = 2 * x + do concurrent (i=1:n) + block + call bar(x, y) ! { dg-error "Subroutine call" } + end block + end do + if (any(x /= y)) stop 1 + + contains + subroutine bar(x, y) + integer, intent(in) :: x(:) + integer, intent(out) :: y(:) + y = x + end subroutine +end program p diff --git a/gcc/testsuite/gfortran.dg/pure_formal_proc_4.f90 b/gcc/testsuite/gfortran.dg/pure_formal_proc_4.f90 new file mode 100644 index 0000000..92640e2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pure_formal_proc_4.f90 @@ -0,0 +1,49 @@ +! { dg-do compile } +! PR fortran/106948 - check that passing of PURE procedures works +! +! Contributed by Jim Feng + +module a + implicit none + + interface new + pure module subroutine b(x, f) + integer, intent(inout) :: x + interface + pure function f(x) result(r) + real, intent(in) :: x + real :: r + end function f + end interface + end subroutine b + end interface new +end module a + +submodule(a) a_b + implicit none + +contains + module procedure b + x = int(f(real(x)) * 0.15) + end procedure b +end submodule a_b + +program test + use a + implicit none + + integer :: x + + x = 100 + call new(x, g) + print *, x + +contains + + pure function g(y) result(r) + real, intent(in) :: y + real :: r + + r = sqrt(y) + end function g +end program test diff --git a/gcc/testsuite/gfortran.dg/reduce_2.f90 b/gcc/testsuite/gfortran.dg/reduce_2.f90 index 52d7c68..cacd54a 100644 --- a/gcc/testsuite/gfortran.dg/reduce_2.f90 +++ b/gcc/testsuite/gfortran.dg/reduce_2.f90 @@ -8,6 +8,10 @@ integer, allocatable :: i(:,:,:) integer :: n(2,2) Logical :: l1(4), l2(2,3), l3(2,2) + type :: string_t + character(:), allocatable :: chr(:) + end type + type(string_t) :: str ! The ARRAY argument at (1) of REDUCE shall not be polymorphic print *, reduce (cstar, add) ! { dg-error "shall not be polymorphic" } @@ -54,6 +58,10 @@ ! (2) shall be the same print *, reduce ([character(4) :: 'abcd','efgh'], char_three) ! { dg-error "arguments of the OPERATION" } +! The character length of the ARRAY argument at (1) and of the arguments of the OPERATION at (2) +! shall be the same + str = reduce ([character(4) :: 'abcd','efgh'], char_one) ! { dg-error "character length of the ARRAY" } + ! The DIM argument at (1), if present, must be an integer scalar print *, reduce (i, add, dim = 2.0) ! { dg-error "must be an integer scalar" } diff --git a/gcc/testsuite/gfortran.dg/reduce_3.f90 b/gcc/testsuite/gfortran.dg/reduce_3.f90 new file mode 100644 index 0000000..c0ed062 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reduce_3.f90 @@ -0,0 +1,56 @@ +! { dg-do run } +! +! PR119460: Scalar reduce was failing with ARRAY elements larger than +! an address size. +! +! Contributed by Rainer Orth <ro@gcc.gnu.org> +! +program test_reduce + implicit none + integer :: i + integer, parameter :: dp = kind(1.0_8), extent = 4 + + real(dp) :: rarray(extent,extent,extent), rmat(extent,extent), & + rvec (extent), rscl + + type :: t + real(dp) :: field(extent) + end type t + + type (t) :: tmat(extent, extent), tarray(extent), tscalar + + rarray = reshape ([(real(i, kind = dp), i = 1, size(rarray))], & + shape (rarray)) + + rmat = reduce (rarray, add, dim = 1) + if (any (rmat /= sum (rarray, 1))) stop 1 + + rmat = reduce (rarray, add, dim = 2) + if (any (rmat /= sum (rarray, 2))) stop 2 + + rmat = reduce (rarray, add, dim = 3) + if (any (rmat /= sum (rarray, 3))) stop 3 + + rscl = reduce (rarray, add) + if (rscl /= sum (rarray)) stop 4 + + tmat%field(1) = rmat + tarray = reduce (tmat, t_add, dim =1) + rvec = reduce (rmat, add, dim = 1) + if (any (tarray%field(1) /= rvec)) stop 5 + + tscalar = reduce (tmat, t_add) + if (tscalar%field(1) /= sum (tmat%field(1))) stop 6 +contains + + pure real(dp) function add (i, j) + real(dp), intent(in) :: i, j + add = i + j + end function add + + pure type(t) function t_add (i, j) + type(t), intent(in) :: i, j + t_add%field(1) = i%field(1) + j%field(1) + end function t_add + +end diff --git a/gcc/testsuite/gfortran.dg/reduce_4.f90 b/gcc/testsuite/gfortran.dg/reduce_4.f90 new file mode 100644 index 0000000..edea931 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reduce_4.f90 @@ -0,0 +1,48 @@ +! { dg-do run } +! +! PR119540 comment2: REDUCE was getting the shape wrong. This testcase also +! verifies that the longest possible name for the OPERATION wrapper function +! is catered for. +! +! Contributed by Harald Anlauf <anlauf@gcc.gnu.org> +! +program p2345678901234567890123456789012345678901234567890123456789_123 + implicit none + integer, parameter :: n = 3 + integer, parameter :: vec(n) = [2, 5, 10] + integer, parameter :: mat(n,2) = reshape([vec,2*vec],[n,2]) + integer :: mat_shape(2), reduce_shape(1), r + integer, dimension(:), allocatable :: res1 + + mat_shape = shape (mat) + reduce_shape = shape (reduce (mat, add, 1), 1) + if (reduce_shape(1) /= mat_shape(2)) stop 1 + + reduce_shape = shape (reduce (mat, add, 1), 1) + if (reduce_shape(1) /= mat_shape(2)) stop 2 + + res1 = reduce (mat, add, 1) + if (any (res1 /= [17, 34])) stop 3 + + res1 = reduce (mat, add, 2) + if (any (res1 /= [6, 15, 30])) stop 4 + + r = reduce (vec, & + o2345678901234567890123456789012345678901234567890123456789_123) + if (r /= 17) stop 5 + + deallocate (res1) +contains + pure function add(i,j) result(sum_ij) + integer, intent(in) :: i, j + integer :: sum_ij + sum_ij = i + j + end function add + + pure function o2345678901234567890123456789012345678901234567890123456789_123 (i, j) & + result (sum) + integer, intent(in) :: i, j + integer :: sum + sum = i + j + end function +end diff --git a/gcc/testsuite/gfortran.dg/team_change_2.f90 b/gcc/testsuite/gfortran.dg/team_change_2.f90 new file mode 100644 index 0000000..66fe63c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_change_2.f90 @@ -0,0 +1,93 @@ +!{ dg-do compile } +!{ dg-additional-options "-fcoarray=lib" } + +! PR 87939 +! Tests change team syntax + + use iso_fortran_env, only : team_type + implicit none + type(team_type) :: team + integer :: new_team, istat + character(len=30) :: err + integer :: caf[*], caf2[*] + + new_team = mod(this_image(),2)+1 + + form team (new_team,team) + + change team !{ dg-error "Syntax error in CHANGE TEAM statement" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + change team (err) !{ dg-error "must be a scalar expression of type TEAM_TYPE" } + continue + end team + + change team (team, stat=err) !{ dg-error "must be a scalar INTEGER" } + continue + end team + + change team (team, stat=istat, stat=istat) !{ dg-error "Duplicate STAT" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + change team (team, stat=istat, errmsg=istat) !{ dg-error "must be a scalar CHARACTER variable" } + continue + end team + + change team (team, stat=istat, errmsg=str, errmsg=str) !{ dg-error "Duplicate ERRMSG" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + +1234 if (istat /= 0) stop 1 !{ dg-error "leaves CHANGE TEAM" } + + change team (team) + go to 1234 !{ dg-error "leaves CHANGE TEAM" } + end team + + call foo(team) + + ! F2018, C1113 + change team (team, caf[3,*] => caf) !{ dg-error "Codimension decl name" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + change team (team, c[3,*] => caf, c => caf2) !{ dg-error "Duplicate name" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + change team (team, c[3,*] => caf, caf => caf2) !{ dg-error "Codimension decl name" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + change team (team, caf2[3,*] => caf, c => caf2) !{ dg-error "Codimension decl name" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + ! F2018, C1114 + change team (team, c => [caf, caf2]) !{ dg-error "a named coarray" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + ! F2018, C1115 + change team (team, c => caf, c2 => caf) !{ dg-error "duplicates selector at" } + continue + end team !{ dg-error "Expecting END PROGRAM statement" } + + t: change team(team) + exit t + end team t + + change team(team) + exit t !{ dg-error "EXIT statement at \\(1\\) is not within construct 't'" } + end team +contains + subroutine foo(team) + type(team_type) :: team + + change team (team) + return !{ dg-error "Image control statement" } + end team + end subroutine +end + diff --git a/gcc/testsuite/gfortran.dg/team_change_3.f90 b/gcc/testsuite/gfortran.dg/team_change_3.f90 new file mode 100644 index 0000000..bc30c40 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_change_3.f90 @@ -0,0 +1,29 @@ +!{ dg-do run } +!{ dg-additional-options "-fcoarray=lib -fdump-tree-original -lcaf_single" } +!{ dg-additional-options "-latomic" { target libatomic_available } } + +! PR 87939 +! Tests change team stat= and errmsg= specifiers + + use iso_fortran_env, only : team_type + implicit none + type(team_type) :: team + integer :: new_team, istat = 42 + character(len=30) :: err = 'unchanged' + + new_team = mod(this_image(),2)+1 + + form team (new_team,team) + + change team (team, stat=istat) + if (istat /= 0) stop 1 + end team + + change team (team, stat=istat, errmsg=err) + if (trim(err) /= 'unchanged') stop 2 + end team + +end + +! { dg-final { scan-tree-dump "_gfortran_caf_change_team \\(team, &istat, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_change_team \\(team, &istat, &err, 30\\)" "original" } } diff --git a/gcc/testsuite/gfortran.dg/team_end_2.f90 b/gcc/testsuite/gfortran.dg/team_end_2.f90 new file mode 100644 index 0000000..c27b59d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_end_2.f90 @@ -0,0 +1,42 @@ +!{ dg-do compile } +!{ dg-additional-options "-fcoarray=lib" } + +! PR 87939 +! Tests change team syntax + + use iso_fortran_env, only : team_type + implicit none + type(team_type) :: team + integer :: new_team, istat + character(len=30) :: err + + new_team = mod(this_image(),2)+1 + + form team (new_team,team) + + change team (team) + continue + end team (stat=err) ! { dg-error "must be a scalar INTEGER" } + + change team (team) + continue + end team (stat=istat, stat=istat) ! { dg-error "Duplicate STAT" } + + change team (team) + continue + end team (stat=istat, errmsg=istat) ! { dg-error "must be a scalar CHARACTER variable" } + + change team (team) + continue + end team (stat=istat, errmsg=err, errmsg=err) ! { dg-error "Duplicate ERRMSG" } + + t: change team (team) + continue + end team (stat=istat) t ! ok + + t2: change team (team) + continue + end team ! { dg-error "Expected block name of 't2' in END TEAM" } + end team t2 ! close the team correctly to catch other errors +end + diff --git a/gcc/testsuite/gfortran.dg/team_end_3.f90 b/gcc/testsuite/gfortran.dg/team_end_3.f90 new file mode 100644 index 0000000..9cd7d4c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_end_3.f90 @@ -0,0 +1,41 @@ +!{ dg-do run } +!{ dg-additional-options "-fcoarray=lib -fdump-tree-original -lcaf_single" } +!{ dg-additional-options "-latomic" { target libatomic_available } } + +! PR 87939 +! Tests end team stat= and errmsg= specifiers + + use iso_fortran_env, only : team_type + implicit none + type(team_type) :: team + integer :: new_team, istat = 42 + character(len=30) :: err = 'unchanged' + integer, allocatable :: sample(:)[:] + integer, allocatable :: scal_caf[:] + + new_team = mod(this_image(),2)+1 + + form team (new_team,team) + + change team (team) + allocate(sample(5)[*], scal_caf[*]) + if (.NOT. allocated(sample)) stop 1 + if (.NOT. allocated(scal_caf)) stop 2 + end team (stat=istat) + if (istat /= 0) stop 3 + if (allocated(sample)) stop 4 + if (allocated(scal_caf)) stop 5 + + deallocate(sample, stat=istat) + if (istat == 0) stop 6 + + istat = 42 + t: change team (team) + continue + end team (stat=istat, errmsg=err) t + if (istat /= 0) stop 7 + if (trim(err) /= 'unchanged') stop 8 +end + +! { dg-final { scan-tree-dump "_gfortran_caf_end_team \\(&istat, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_end_team \\(&istat, &err, 30\\)" "original" } } diff --git a/gcc/testsuite/gfortran.dg/team_form_2.f90 b/gcc/testsuite/gfortran.dg/team_form_2.f90 new file mode 100644 index 0000000..5c6d81f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_form_2.f90 @@ -0,0 +1,27 @@ +!{ dg-do compile } +!{ dg-additional-options "-fcoarray=lib" } + +! PR 87939 +! Tests form team syntax errors + + use iso_fortran_env, only : team_type + implicit none + integer :: istat, new_team + character(len=30) :: err + type(team_type) :: team + + new_team = mod(this_image(),2)+1 + + form team ! { dg-error "Syntax error in FORM TEAM statement" } + form team (new_team) ! { dg-error "Syntax error in FORM TEAM statement" } + form team (new_team,err) ! { dg-error "must be a scalar expression of type TEAM_TYPE" } + form team (new_team,team,istat) ! { dg-error "Syntax error in FORM TEAM statement" } + form team (new_team,team,stat=istat,stat=istat) ! { dg-error "Duplicate STAT" } + form team (new_team,team,stat=istat,errmsg=istat) ! { dg-error "must be a scalar CHARACTER variable" } + form team (new_team,team,stat=istat,errmsg=err,errmsg=err) ! { dg-error "Duplicate ERRMSG" } + form team (new_team,team,new_index=1,new_index=1) ! { dg-error "Duplicate NEW_INDEX" } + form team (new_team,team,new_index=err) ! { dg-error "must be a scalar INTEGER" } + form team (new_team,team,new_index=1,new_index=1,stat=istat,errmsg=err) ! { dg-error "Duplicate NEW_INDEX" } + form team (new_team,team,new_index=1,stat=istat,errmsg=err,new_index=9) ! { dg-error "Duplicate NEW_INDEX" } + +end diff --git a/gcc/testsuite/gfortran.dg/team_form_3.f90 b/gcc/testsuite/gfortran.dg/team_form_3.f90 new file mode 100644 index 0000000..d9aae33 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_form_3.f90 @@ -0,0 +1,34 @@ +!{ dg-do run } +!{ dg-additional-options "-fcoarray=lib -fdump-tree-original -lcaf_single" } +!{ dg-additional-options "-latomic" { target libatomic_available } } + +! PR 87939 +! Tests form team with stat= and errmsg= + + use iso_fortran_env, only : team_type + implicit none + integer :: istat = 42, new_team + character(len=30) :: err = "unchanged" + type(team_type) :: team + + new_team = mod(this_image(),2)+1 + + form team (new_team,team) + form team (new_team,team,stat=istat) + if (istat /= 0) stop 1 + form team (new_team,team,stat=istat, errmsg=err) + if (trim(err) /= 'unchanged') stop 2 + form team (new_team,team,new_index=1) + istat = 42 + form team (new_team,team,new_index=1,stat=istat) + if (istat /= 0) stop 3 + form team (new_team,team,new_index=1,stat=istat,errmsg=err) + if (trim(err) /= 'unchanged') stop 4 +end + +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, 0B, 0B, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, 0B, &istat, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, 0B, &istat, &err, 30\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &C\\.\[0-9\]+, 0B, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &C\\.\[0-9\]+, &istat, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_form_team \\(new_team, &team, &C\\.\[0-9\]+, &istat, &err, 30\\)" "original" } } diff --git a/gcc/testsuite/gfortran.dg/team_get_1.f90 b/gcc/testsuite/gfortran.dg/team_get_1.f90 new file mode 100644 index 0000000..fe00ce8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_get_1.f90 @@ -0,0 +1,27 @@ +!{ dg-do compile } +!{ dg-additional-options "-fcoarray=lib -fdump-tree-original" } + +! PR 87939 +! Tests get_team + + use iso_fortran_env + implicit none + type(team_type) :: team, ret + integer :: new_team, level + + new_team = mod(this_image(),2)+1 + + form team (new_team,team) + + ret = get_team() + ret = get_team(INITIAL_TEAM) + ret = get_team(PARENT_TEAM) + ret = get_team(CURRENT_TEAM) + level = INITIAL_TEAM + ret = get_team(level) + +end + +! { dg-final { scan-tree-dump "_gfortran_caf_get_team \\(0B\\)" "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_caf_get_team \\(&C\.\[0-9\]+\\)" 3 "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_get_team \\(&level\\)" "original" } } diff --git a/gcc/testsuite/gfortran.dg/team_number_1.f90 b/gcc/testsuite/gfortran.dg/team_number_1.f90 index e44e17b..f0ee7d1 100644 --- a/gcc/testsuite/gfortran.dg/team_number_1.f90 +++ b/gcc/testsuite/gfortran.dg/team_number_1.f90 @@ -1,13 +1,13 @@ ! { dg-do run } ! { dg-options "-fcoarray=single" } ! -! Tests if team_number intrinsic fucntion works +! Tests if team_number intrinsic function works ! use iso_fortran_env, only : team_type implicit none - type(team_type) team + type(team_type) :: team integer, parameter :: standard_initial_value=-1 - integer new_team + integer :: new_team if (team_number()/=standard_initial_value) STOP 1 diff --git a/gcc/testsuite/gfortran.dg/team_sync_1.f90 b/gcc/testsuite/gfortran.dg/team_sync_1.f90 new file mode 100644 index 0000000..5b28651 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_sync_1.f90 @@ -0,0 +1,24 @@ +!{ dg-do compile } +!{ dg-additional-options "-fcoarray=lib" } + +! PR 87939 +! Test sync team syntax errors + + use iso_fortran_env, only : team_type + implicit none + integer :: istat + character(len=30) :: err + type(team_type) :: team + + form team (mod(this_image(),2)+1, team) + + change team (team) + sync team ! { dg-error "Syntax error in SYNC TEAM statement" } + sync team (err) ! { dg-error "must be a scalar expression of type TEAM_TYPE" } + sync team (team, istat) ! { dg-error "Syntax error in SYNC TEAM statement" } + sync team (team, stat=err) ! { dg-error "must be a scalar INTEGER" } + sync team (team, stat=istat, stat=istat) ! { dg-error "Duplicate STAT" } + sync team (team, stat=istat, errmsg=istat) ! { dg-error "must be a scalar CHARACTER variable" } + sync team (team, stat=istat, errmsg=err, errmsg=err) ! { dg-error "Duplicate ERRMSG" } + end team +end diff --git a/gcc/testsuite/gfortran.dg/team_sync_2.f90 b/gcc/testsuite/gfortran.dg/team_sync_2.f90 new file mode 100644 index 0000000..947f65d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/team_sync_2.f90 @@ -0,0 +1,27 @@ +!{ dg-do run } +!{ dg-additional-options "-fcoarray=lib -fdump-tree-original -lcaf_single" } +!{ dg-additional-options "-latomic" { target libatomic_available } } + +! PR 87939 +! Test sync team statement +! + use iso_fortran_env, only : team_type + implicit none + integer :: istat = 42 + type(team_type) :: team + character(len=30) :: err = "unchanged" + + form team (mod(this_image(),2)+1, team) + + change team (team) + sync team (team) + sync team (team, stat=istat) + if (istat /= 0) stop 1 + sync team (team, stat=istat, errmsg=err) + if (trim(err) /= 'unchanged') stop 2 + end team +end + +! { dg-final { scan-tree-dump "_gfortran_caf_sync_team \\(team, 0B, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_sync_team \\(team, &istat, 0B, 0\\)" "original" } } +! { dg-final { scan-tree-dump "_gfortran_caf_sync_team \\(team, &istat, &err, 30\\)" "original" } } diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/doc-examples-pass.exp b/gcc/testsuite/gm2.dg/doc/examples/pass/doc-examples-pass.exp new file mode 100644 index 0000000..0bfcea0 --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/doc-examples-pass.exp @@ -0,0 +1,18 @@ +# Compile tests, no torture testing. +# +# These tests should all pass. + +# Load support procs. +load_lib gm2-dg.exp + +gm2_init_pim4 $srcdir/$subdir + +# Initialize `dg'. +dg-init + +# Main loop. + +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] "" "" + +# All done. +dg-finish diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd.mod new file mode 100644 index 0000000..84020a8 --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd.mod @@ -0,0 +1,32 @@ +(* { dg-do assemble { target { x86_64-*-* } } } *) +(* { dg-options "-g" } *) + +MODULE exampleadd ; + +FROM libc IMPORT printf, exit ; + + +PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ; +VAR + myout: CARDINAL ; +BEGIN + ASM VOLATILE ("movl %1,%%eax; addl %2,%%eax; movl %%eax,%0" + : "=rm" (myout) (* outputs *) + : "rm" (foo), "rm" (bar) (* inputs *) + : "eax") ; (* we trash *) + RETURN( myout ) +END Example ; + + +VAR + a, b, c: CARDINAL ; +BEGIN + a := 1 ; + b := 2 ; + c := Example (a, b) ; + IF c # 3 + THEN + printf ("Example procedure function failed to return 3, seen %d", c) ; + exit (1) + END +END exampleadd. diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd2.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd2.mod new file mode 100644 index 0000000..f25397f --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/exampleadd2.mod @@ -0,0 +1,32 @@ +(* { dg-do assemble { target { x86_64-*-* } } } *) +(* { dg-options "-g" } *) + +MODULE exampleadd2 ; + +FROM libc IMPORT printf, exit ; + + +PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ; +VAR + myout: CARDINAL ; +BEGIN + ASM VOLATILE ( + "movl %[left],%%eax; addl %[right],%%eax; movl %%eax,%[output]" + : [output] "=rm" (myout) (* outputs *) + : [left] "rm" (foo), [right] "rm" (bar) (* inputs *) + : "eax") ; (* we trash *) + RETURN( myout ) +END Example ; + +VAR + a, b, c: CARDINAL ; +BEGIN + a := 1 ; + b := 2 ; + c := Example (a, b) ; + IF c # 3 + THEN + printf ("Example procedure function failed to return 3, seen %d", c) ; + exit (1) + END +END exampleadd2. diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/hello.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/hello.mod new file mode 100644 index 0000000..f9770ec --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/hello.mod @@ -0,0 +1,10 @@ +(* { dg-do run } *) +(* { dg-options "-g -fno-scaffold-dynamic" } *) + +MODULE hello ; + +FROM libc IMPORT printf ; + +BEGIN + printf ("hello world\n") +END hello. diff --git a/gcc/testsuite/gm2.dg/doc/examples/pass/hellopim.mod b/gcc/testsuite/gm2.dg/doc/examples/pass/hellopim.mod new file mode 100644 index 0000000..b7876cd --- /dev/null +++ b/gcc/testsuite/gm2.dg/doc/examples/pass/hellopim.mod @@ -0,0 +1,10 @@ +(* { dg-do run } *) +(* { dg-options "-g -fno-scaffold-dynamic" } *) + +MODULE hellopim ; + +FROM StrIO IMPORT WriteString, WriteLn ; + +BEGIN + WriteString ("hello world") ; WriteLn +END hellopim. diff --git a/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod b/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod new file mode 100644 index 0000000..cbcc804 --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod @@ -0,0 +1,10 @@ +MODULE constintarraybyte ; + +FROM FormatStrings IMPORT Sprintf1 ; +FROM DynamicStrings IMPORT String, InitString ; + +VAR + s: String ; +BEGIN + s := Sprintf1 (InitString("abc%x\n"), 42) +END constintarraybyte. diff --git a/gcc/testsuite/gm2/pimlib/run/pass/format2.mod b/gcc/testsuite/gm2/pimlib/run/pass/format2.mod new file mode 100644 index 0000000..2ad6a8c --- /dev/null +++ b/gcc/testsuite/gm2/pimlib/run/pass/format2.mod @@ -0,0 +1,63 @@ +MODULE format2; + +FROM libc IMPORT exit, printf ; +FROM Terminal IMPORT Write, WriteLn; +FROM NumberIO IMPORT WriteCard; +FROM DynamicStrings IMPORT String, Length, char, InitString; +FROM FormatStrings IMPORT Sprintf1; + +PROCEDURE WriteString (s: String); +VAR + l, i: CARDINAL; +BEGIN + l := Length (s) ; + i := 0 ; + WHILE i < l DO + Write (char (s, i)) ; + INC (i) + END +END WriteString; + + +(* + assert - +*) + +PROCEDURE assert (cond: BOOLEAN; line: CARDINAL; file: ARRAY OF CHAR) ; +BEGIN + IF NOT cond + THEN + printf ("%s:%d assertion failed\n", file, line); + exit (1) + END +END assert ; + + +VAR + n: CARDINAL; + r, s: String; +BEGIN + n := 2; + r := InitString("%u pieces of cake") ; + WriteString (r) ; WriteLn ; + assert (Length (r) = 17, __LINE__, __FILE__) ; + s := Sprintf1 (r, n) ; + WriteCard (Length (s), 4) ; WriteLn ; + assert (Length (s) = 16, __LINE__, __FILE__) ; + + r := InitString("%d pieces of cake") ; + WriteString (r) ; WriteLn ; + assert (Length (r) = 17, __LINE__, __FILE__) ; + s := Sprintf1 (r, n) ; + WriteCard (Length (s), 4) ; WriteLn ; + assert (Length (s) = 16, __LINE__, __FILE__) ; + + r := InitString("%x pieces of cake") ; + WriteString (r) ; WriteLn ; + assert (Length (r) = 17, __LINE__, __FILE__) ; + s := Sprintf1 (r, n) ; + WriteCard (Length (s), 4) ; WriteLn ; + assert (Length (s) = 16, __LINE__, __FILE__) ; + + WriteString (InitString ('all tests pass')) ; WriteLn ; +END format2. diff --git a/gcc/testsuite/gnat.dg/gcov/gcov.exp b/gcc/testsuite/gnat.dg/gcov/gcov.exp index 4fa887d..031914a 100644 --- a/gcc/testsuite/gnat.dg/gcov/gcov.exp +++ b/gcc/testsuite/gnat.dg/gcov/gcov.exp @@ -21,12 +21,19 @@ load_lib gnat-dg.exp load_lib gcov.exp global GCC_UNDER_TEST +global GCOV_UNDER_TEST -# For now find gcov in the same directory as $GCC_UNDER_TEST. -if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/gcov +# For now find gcov in the same directory as $GCC_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/gcov + } else { + set GCOV gcov + } } else { - set GCOV gcov + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/gnat.dg/lto29.adb b/gcc/testsuite/gnat.dg/lto29.adb new file mode 100644 index 0000000..44f556f --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto29.adb @@ -0,0 +1,9 @@ +-- { dg-do run } +-- { dg-options "-O -flto" { target lto } } + +with Lto29_Pkg; + +procedure Lto29 is +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/lto29_pkg.ads b/gcc/testsuite/gnat.dg/lto29_pkg.ads new file mode 100644 index 0000000..6008dc5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/lto29_pkg.ads @@ -0,0 +1,15 @@ +with Ada.Strings.Bounded; + +package Lto29_Pkg is + + package M is new Ada.Strings.Bounded.Generic_Bounded_Length (10); + + type T is new M.Bounded_String; + + Null_T : constant T; + +private + + Null_T : constant T := To_Bounded_String (""); + +end Lto29_Pkg; diff --git a/gcc/testsuite/gnat.dg/opt105.adb b/gcc/testsuite/gnat.dg/opt105.adb new file mode 100644 index 0000000..eb2c197 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt105.adb @@ -0,0 +1,30 @@ +-- { dg-do run } +-- { dg-options "-O" } + +with Opt105_Pkg; use Opt105_Pkg; + +procedure Opt105 is + + Val : constant Enum := + (if Enabled then (if Disabled then Two else One) else Three); + +begin + if Cond1 then + return; + end if; + + if Cond2 then + return; + end if; + + case Val is + when One => + raise Program_Error; + + when Two => + raise Constraint_Error; + + when Three => + null; + end case; +end; diff --git a/gcc/testsuite/gnat.dg/opt105_pkg.adb b/gcc/testsuite/gnat.dg/opt105_pkg.adb new file mode 100644 index 0000000..e00de94 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt105_pkg.adb @@ -0,0 +1,6 @@ +package body Opt105_Pkg is + + function Cond1 return Boolean is (False); + function Cond2 return Boolean is (False); + +end Opt105_Pkg; diff --git a/gcc/testsuite/gnat.dg/opt105_pkg.ads b/gcc/testsuite/gnat.dg/opt105_pkg.ads new file mode 100644 index 0000000..2b373b7 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt105_pkg.ads @@ -0,0 +1,11 @@ +package Opt105_Pkg is + + type Enum is (One, Two, Three); + + Enabled : Boolean := False; + Disabled : Boolean := False; + + function Cond1 return Boolean; + function Cond2 return Boolean; + +end Opt105_Pkg; diff --git a/gcc/testsuite/gnat.dg/renaming17.adb b/gcc/testsuite/gnat.dg/renaming17.adb new file mode 100644 index 0000000..d826433 --- /dev/null +++ b/gcc/testsuite/gnat.dg/renaming17.adb @@ -0,0 +1,17 @@ +-- { dg-do run } + +procedure Renaming17 is + + function Incr (V : Integer; I : Integer := 1) return Integer is + (V + I); + + function Incr_Ren (V : Integer; I : Positive := 1) return Positive + renames Incr; + + I : Integer; + +begin + I := Incr_Ren (-3); + I := Incr_Ren (-3, 2); + I := Incr_Ren (-3, 0); +end; diff --git a/gcc/testsuite/go.dg/pr119533-riscv-2.go b/gcc/testsuite/go.dg/pr119533-riscv-2.go new file mode 100644 index 0000000..ce3ffaf --- /dev/null +++ b/gcc/testsuite/go.dg/pr119533-riscv-2.go @@ -0,0 +1,42 @@ +// { dg-do compile { target riscv64*-*-* } } +// { dg-options "-O2 -march=rv64gcv -mabi=lp64d" } + +package ast + +type as struct { + bt []struct{} + an string +} + +func bj(a *as) string { + if b := a.bt; len(a.an) == 1 { + _ = b[0] + } + return a.an +} + +func MergePackageFiles(f map[string][]interface{}, g uint) []interface{} { + bl := make([]string, len(f)) + var bo []interface{} + bu := make(map[string]int) + for _, bm := range bl { + a := f[bm] + for _, d := range a { + if g != 0 { + if a, p := d.(*as); p { + n := bj(a) + if j, bp := bu[n]; bp { + _ = j + } + } + } + } + } + for _, bm := range bl { + _ = bm + } + for _, bm := range bl { + _ = f[bm] + } + return bo +} diff --git a/gcc/testsuite/go.dg/pr119533-riscv.go b/gcc/testsuite/go.dg/pr119533-riscv.go new file mode 100644 index 0000000..30f52d2 --- /dev/null +++ b/gcc/testsuite/go.dg/pr119533-riscv.go @@ -0,0 +1,120 @@ +// { dg-do compile { target riscv64*-*-* } } +// { dg-options "-O2 -march=rv64gcv -mabi=lp64d" } + +// Reduced from libgo build (multi-file reduction, merged mnaully +// and hand reduced again). + +package ast +import ( + "go/token" + "go/scanner" + "reflect" +) +type v struct {} +type w func( string, reflect.Value) bool +func x( string, reflect.Value) bool +type r struct { + scanner.ErrorList +} +type ab interface {} +type ae interface {} +type af interface {} +type ag struct {} +func (ag) Pos() token.Pos +func (ag) ah() token.Pos +type c struct { + aj ae } +type ak struct { + al []c } +type ( + am struct { + an string } + bs struct { + Value string + } +) +func ao(string) *am +type ( + ap interface {} + aq struct { + ar bs } +as struct { + bt ak + an am } +) +type File struct { + *ag + token.Pos + *am + at []af + *v + au []*aq + av *am + aw []*ag } +type ax struct { + an string + *v + ay map[string]File } +func a(az *token.FileSet, b token.Pos) int +type k struct { + l token.Pos + ah token.Pos +} +type m struct { + bb bool + bc *ag +} + +type bi uint +func bj(a *as) string { + if b := a.bt; len(b.al) == 1 { + c := b.al[0].aj + if e := c; e != nil {} + } + return a.an.an +} +func MergePackageFiles(f ax, g bi) *File { + h := 0 + bk := 0 + k := 0 + bl := make([]string, len(f.ay)) + i := 0 + for bm, a := range f.ay { + bl[i] = bm + k += len(a.at) + } + var bn *ag + var l token.Pos + if h > 0 {} + var bo []af + bu := make(map[string]int) + m := 0 + for _, bm := range bl { + a := f.ay[bm] + for _, d := range a.at { + if g!= 0 { + if a, p := d.(*as); p { + n := bj(a) + if j, bp := bu[n]; bp { + if bo != nil && bo[j]== nil {} + } + } + } + } + } + if m > 0 {} + var bq []*aq + q := make(map[string]bool) + for _, bm := range bl { + a := f.ay[bm] + for _, br := range a.au { + if o := br.ar.Value; q[o] {} + } + } + var bh = make([]*ag, bk) + for _, bm := range bl { + a := f.ay[bm] + copy(bh, a.aw) + } + return &File{bn, l, ao(f.an), bo, f.v, bq, nil, bh} +} diff --git a/gcc/testsuite/lib/cobol.exp b/gcc/testsuite/lib/cobol.exp index cd88bcb..723989e 100644 --- a/gcc/testsuite/lib/cobol.exp +++ b/gcc/testsuite/lib/cobol.exp @@ -107,8 +107,11 @@ proc cobol_link_flags { paths } { } if { $gccpath != "" } { + if [file exists "${gccpath}/libgcobol/libgcobol.spec"] { + append flags "-B${gccpath}/libgcobol " + } if [file exists "${gccpath}/libgcobol/libgcobol.a"] { - append flags "-L${gccpath}/libgcobol" + append flags "-L${gccpath}/libgcobol " } if { [file exists "${gccpath}/libgcobol/.libs/libgcobol.a"] || [file exists "${gccpath}/libgobol/.libs/libgcobol.${shlib_ext}"] } { @@ -119,6 +122,15 @@ proc cobol_link_flags { paths } { } append ld_library_path ":${gccpath}/libgcobol/.libs" } + if { [file exists "${gccpath}/libquadmath/.libs/libquadmath.a"] || + [file exists "${gccpath}/libquadmath/.libs/libquadmath.${shlib_ext}"] } { + if { $target_wants_B_option } { + append flags "-B${gccpath}/libquadmath/.libs " + } else { + append flags "-L${gccpath}/libquadmath/.libs " + } + append ld_library_path ":${gccpath}/libquadmath/.libs" + } if { [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] || [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] } { if { $target_wants_B_option } { @@ -160,7 +172,6 @@ proc cobol_init { args } { global gcc_warning_prefix global gcc_error_prefix global TEST_ALWAYS_FLAGS - global cobol_init_set_COBOL_UNDER_TEST # We set LC_ALL and LANG to C so that we get the same error messages as expected. setenv LC_ALL C @@ -176,24 +187,14 @@ proc cobol_init { args } { setenv LANG C.ASCII } - # COBOL_UNDER_TEST as set below contains $specpath, which depends on - # the used multilib config. Thus, its value may need to be reset; - # that's tracked via gfortran_init_set_COBOL_UNDER_TEST. - if { ![info exists COBOL_UNDER_TEST] - || [info exists cobol_init_set_COBOL_UNDER_TEST] } then { + if ![info exists COBOL_UNDER_TEST] then { if [info exists TOOL_EXECUTABLE] { set COBOL_UNDER_TEST $TOOL_EXECUTABLE } else { if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } { set COBOL_UNDER_TEST [transform gcobol] } else { - if [info exists TOOL_OPTIONS] { - set specpath [get_multilibs ${TOOL_OPTIONS}] - } else { - set specpath [get_multilibs] - } - set cobol_init_set_COBOL_UNDER_TEST 1 - set COBOL_UNDER_TEST [findfile $base_dir/../../gcobol "$base_dir/../../gcobol -B$base_dir/../../ -B$specpath/libgcobol/.libs" [findfile $base_dir/gcobol "$base_dir/gcobol -B$base_dir/" [transform gcobol]]] + set COBOL_UNDER_TEST [findfile $base_dir/../../gcobol "$base_dir/../../gcobol -B$base_dir/../../" [findfile $base_dir/gcobol "$base_dir/gcobol -B$base_dir/" [transform gcobol]]] } } } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index eadc1cd..6dd8fa3 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -507,8 +507,7 @@ if { [info procs ${tool}_load] != [list] \ set linenum 1 set outfile [open [lindex ${output-file} 1]] set do_fail 0 - set name [file tail [lindex ${output-file} 1]] - verbose "output-file args is $args program is $program" 1 + set name [testname-for-summary] while { [gets $outfile line] >= 0 } { if { $linenum != 1 } { set c [string index $output $idx] diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index ee4138a..869d150 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -562,6 +562,16 @@ proc check_effective_target_elf { } { } } +# Returns 1 if the target uses the PE/COFF object format, 0 otherwise. + +proc check_effective_target_pe { } { + if { [gcc_target_object_format] == "pe" } { + return 1; + } else { + return 0; + } +} + # Returns 1 if the target toolchain supports ifunc, 0 otherwise. proc check_ifunc_available { } { @@ -13489,11 +13499,11 @@ proc check_effective_target_arm_v8_3a_bkey_directive { } { # Return 1 if the target supports executing the Armv8.1-M Mainline Low # Overhead Loop, 0 otherwise. The test is valid for ARM. -proc check_effective_target_arm_v8_1_lob_ok { } { +proc check_effective_target_arm_v8_1m_lob_hw { } { if { ![check_effective_target_arm_cortex_m] } { return 0; } else { - return [check_runtime arm_v8_1_lob_hw_available { + return [check_runtime arm_v8_1m_lob_hw_available { int main (void) { int i = 0; @@ -13513,9 +13523,9 @@ proc check_effective_target_arm_v8_1_lob_ok { } { # the Armv8.1-M Mainline Low Overhead Loop, 0 otherwise. The test is # valid for ARM. -proc check_effective_target_arm_thumb2_no_arm_v8_1_lob { } { +proc check_effective_target_arm_thumb2_no_arm_v8_1m_lob { } { if { [check_effective_target_arm_thumb2] - && ![check_effective_target_arm_v8_1_lob_ok] } { + && ![check_effective_target_arm_v8_1m_lob_hw] } { return 1 } return 0 @@ -13525,9 +13535,9 @@ proc check_effective_target_arm_thumb2_no_arm_v8_1_lob { } { # used and the target does not support executing the Armv8.1-M # Mainline Low Overhead Loop, 0 otherwise. The test is valid for ARM. -proc check_effective_target_arm_thumb2_ok_no_arm_v8_1_lob { } { +proc check_effective_target_arm_thumb2_ok_no_arm_v8_1m_lob { } { if { [check_effective_target_arm_thumb2_ok] - && ![check_effective_target_arm_v8_1_lob_ok] } { + && ![check_effective_target_arm_v8_1m_lob_hw] } { return 1 } return 0 diff --git a/gcc/testsuite/rust/compile/enum_discriminant1.rs b/gcc/testsuite/rust/compile/enum_discriminant1.rs new file mode 100644 index 0000000..32092b2 --- /dev/null +++ b/gcc/testsuite/rust/compile/enum_discriminant1.rs @@ -0,0 +1,7 @@ +enum Foo { + Bar = 3 + 12, +} + +fn test() -> Foo { // { dg-warning "function is never used" } + return Foo::Bar; +}
\ No newline at end of file diff --git a/gcc/testsuite/rust/compile/enum_discriminant2.rs b/gcc/testsuite/rust/compile/enum_discriminant2.rs new file mode 100644 index 0000000..351dfbb --- /dev/null +++ b/gcc/testsuite/rust/compile/enum_discriminant2.rs @@ -0,0 +1,9 @@ +fn test() -> isize { + 1 +} + +enum Foo { + Bar = test() // { dg-error "only functions marked as .const." } +} + +fn main() {} diff --git a/gcc/testsuite/rust/compile/feature.rs b/gcc/testsuite/rust/compile/feature.rs index f743f92..6f428f0 100644 --- a/gcc/testsuite/rust/compile/feature.rs +++ b/gcc/testsuite/rust/compile/feature.rs @@ -2,5 +2,7 @@ #![feature(AA)] //{ dg-error "unknown feature .AA." } #![feature(iamcrabby)] // { dg-error "unknown feature .iamcrabby." } #![feature(nonexistent_gccrs_feature)] // { dg-error "unknown feature .nonexistent_gccrs_feature." } +// ErrorCode - E0556 +#![feature] // { dg-error "malformed .feature. attribute input" } fn main() {} diff --git a/gcc/testsuite/rust/compile/format_args_extra_comma.rs b/gcc/testsuite/rust/compile/format_args_extra_comma.rs new file mode 100644 index 0000000..fcc435c --- /dev/null +++ b/gcc/testsuite/rust/compile/format_args_extra_comma.rs @@ -0,0 +1,47 @@ +#![feature(rustc_attrs)] + +#[rustc_builtin_macro] +macro_rules! format_args { + () => {}; +} + +#[lang = "sized"] +trait Sized {} + +pub mod core { + pub mod fmt { + pub struct Formatter; + pub struct Result; + + pub struct Arguments<'a>; + + impl<'a> Arguments<'a> { + pub fn new_v1(_: &'a [&'static str], _: &'a [ArgumentV1<'a>]) -> Arguments<'a> { + Arguments + } + } + + pub struct ArgumentV1<'a>; + + impl<'a> ArgumentV1<'a> { + pub fn new<'b, T>(_: &'b T, _: fn(&T, &mut Formatter) -> Result) -> ArgumentV1 { + ArgumentV1 + } + } + + pub trait Display { + fn fmt(&self, _: &mut Formatter) -> Result; + } + + impl Display for i32 { + fn fmt(&self, _: &mut Formatter) -> Result { + // { dg-warning "unused name .self." "" { target *-*-* } .-1 } + Result + } + } + } +} + +fn main() { + let _formatted = format_args!("extra commas {} {}", 15, 14,); +} diff --git a/gcc/testsuite/rust/compile/invalid_label_name.rs b/gcc/testsuite/rust/compile/invalid_label_name.rs index 5c850da..66e40a6 100644 --- a/gcc/testsuite/rust/compile/invalid_label_name.rs +++ b/gcc/testsuite/rust/compile/invalid_label_name.rs @@ -1,20 +1,24 @@ +// { dg-additional-options "-frust-name-resolution-2.0" } pub fn function() { 'continue: loop { // { dg-error "invalid label name .'continue." "" { target *-*-* } .-1 } break 'extern; // { dg-error "invalid label name .'extern." "" { target *-*-* } .-1 } + // { dg-error "use of undeclared label .'extern." "" { target *-*-* } .-2 } } 'break: loop { // { dg-error "invalid label name .'break." "" { target *-*-* } .-1 } break 'for; // { dg-error "invalid label name .'for." "" { target *-*-* } .-1 } + // { dg-error "use of undeclared label .'for." "" { target *-*-* } .-2 } } 'crate: loop { // { dg-error "invalid label name .'crate." "" { target *-*-* } .-1 } break 'loop; // { dg-error "invalid label name .'loop." "" { target *-*-* } .-1 } + // { dg-error "use of undeclared label .'loop." "" { target *-*-* } .-2 } } 'a: loop { diff --git a/gcc/testsuite/rust/compile/issue-2812.rs b/gcc/testsuite/rust/compile/issue-2812.rs index 173259b..0de1738 100644 --- a/gcc/testsuite/rust/compile/issue-2812.rs +++ b/gcc/testsuite/rust/compile/issue-2812.rs @@ -1,4 +1,4 @@ // { dg-additional-options "-frust-compile-until=astvalidation" } fn foo_1(&self); -fn foo_1(&mut self); -fn foo_1(self); +fn foo_2(&mut self); +fn foo_3(self); diff --git a/gcc/testsuite/rust/compile/issue-3625.rs b/gcc/testsuite/rust/compile/issue-3625.rs new file mode 100644 index 0000000..91e0dc9 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3625.rs @@ -0,0 +1,2 @@ +type A = crate::A; +// { dg-error "failed to resolve type path segment: .A." "" { target *-*-* } .-2 } diff --git a/gcc/testsuite/rust/compile/issue-3643.rs b/gcc/testsuite/rust/compile/issue-3643.rs new file mode 100644 index 0000000..bed9ffc --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3643.rs @@ -0,0 +1,4 @@ +fn foo() { + let x: usize<foo>; + // { dg-error "generic arguments are not allowed for this type .E0109." "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/issue-3646.rs b/gcc/testsuite/rust/compile/issue-3646.rs new file mode 100644 index 0000000..80693cb --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3646.rs @@ -0,0 +1,7 @@ +trait Foo { + type T; + fn foo() -> Foo<main>; + // { dg-error "generic arguments are not allowed for this type .E0109." "" { target *-*-* } .-1 } +} + +fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-3647.rs b/gcc/testsuite/rust/compile/issue-3647.rs new file mode 100644 index 0000000..51d9478d --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3647.rs @@ -0,0 +1,7 @@ +#![allow(dead_code)] +type A = fn(); + +type B = for<'static> fn(); +// { dg-error "invalid lifetime parameter name: .static. .E0262." "" { target *-*-* } .-1 } + +pub fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-3648.rs b/gcc/testsuite/rust/compile/issue-3648.rs new file mode 100644 index 0000000..52ecbbf --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3648.rs @@ -0,0 +1,8 @@ +struct B; // { dg-warning "struct is never constructed" } + +impl B { + fn main() {} + // { dg-warning "associated function is never used" "" { target *-*-* } .-1 } +} + +fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-3654.rs b/gcc/testsuite/rust/compile/issue-3654.rs new file mode 100644 index 0000000..923488e --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3654.rs @@ -0,0 +1,3 @@ +type Meeshka = Mow<!>; +// { dg-error "generic arguments are not allowed for this type .E0109." "" { target *-*-* } .-1 } +type Mow = &'static fn(!) -> !; diff --git a/gcc/testsuite/rust/compile/issue-3656.rs b/gcc/testsuite/rust/compile/issue-3656.rs new file mode 100644 index 0000000..e0bec2f --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3656.rs @@ -0,0 +1,10 @@ +enum Foo { + Bar(isize), +} + +fn main() { + match Foo::Bar(205) { + Foo { i } => (), + // { dg-error "expected struct, variant or union type, found enum .Foo. .E0574." "" { target *-*-* } .-1 } + } +} diff --git a/gcc/testsuite/rust/compile/issue-3657.rs b/gcc/testsuite/rust/compile/issue-3657.rs new file mode 100644 index 0000000..978f3ce --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3657.rs @@ -0,0 +1,8 @@ +struct Foo<'_>(&'_ u8); + +impl Foo<'a> { + // { dg-error "unresolved lifetime" "" { target *-*-* } .-1 } + fn x() {} +} + +fn x() {} diff --git a/gcc/testsuite/rust/compile/issue-3663.rs b/gcc/testsuite/rust/compile/issue-3663.rs new file mode 100644 index 0000000..0f0559c --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3663.rs @@ -0,0 +1,6 @@ +pub trait TypeFn {} + +impl TypeFn for Output<{ 42 }> { + // { dg-error "could not resolve type path .Output. .E0412." "" { target *-*-* } .-1 } + type Output = (); +} diff --git a/gcc/testsuite/rust/compile/issue-3665.rs b/gcc/testsuite/rust/compile/issue-3665.rs new file mode 100644 index 0000000..d66a81f --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3665.rs @@ -0,0 +1,6 @@ +pub const uint_val: usize = 1; +pub const uint_expr: usize = 1 << uint_val; + +pub fn test() -> usize { + uint_expr +} diff --git a/gcc/testsuite/rust/compile/issue-3667.rs b/gcc/testsuite/rust/compile/issue-3667.rs new file mode 100644 index 0000000..e72069c --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3667.rs @@ -0,0 +1,24 @@ +// { dg-options "-w" } +#![feature(raw_ref_op)] + +const pq1: () = { + let mut x = 2; + &raw mut x; +}; //~ mutable reference + +static B: () = { + let mut x = 2; + &raw mut x; +}; //~ mutable reference + +static mut C: () = { + let mut x = 2; + &raw mut x; +}; //~ mutable reference + +const fn foo() { + let mut x = 0; + let y = &raw mut x; //~ mutable reference +} + +fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-3671.rs b/gcc/testsuite/rust/compile/issue-3671.rs new file mode 100644 index 0000000..e800d53 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3671.rs @@ -0,0 +1,2 @@ +impl Self<0> {} +// { dg-error "could not resolve type path" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3693.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3693.rs new file mode 100644 index 0000000..e990c8b --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3693.rs @@ -0,0 +1,10 @@ +macro_rules! generate_pattern_iterators { + { + $(#[$forward_iterator_attribute:meta])* + } => { + } +} + +generate_pattern_iterators! { + /// Created with the method [`split`]. +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs new file mode 100644 index 0000000..e5b38bb --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3708.rs @@ -0,0 +1,80 @@ +// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } + +macro_rules! impl_fn_for_zst { + ($( + $( #[$attr: meta] )* + struct $Name: ident impl$( <$( $lifetime : lifetime ),+> )? Fn = + |$( $arg: ident: $ArgTy: ty ),*| -> $ReturnTy: ty + $body: block; + )+) => { + $( + $( #[$attr] )* + struct $Name; + + impl $( <$( $lifetime ),+> )? Fn<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call(&self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + $body + } + } + + impl $( <$( $lifetime ),+> )? FnMut<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call_mut( + &mut self, + ($( $arg, )*): ($( $ArgTy, )*) + ) -> $ReturnTy { + Fn::call(&*self, ($( $arg, )*)) + } + } + + impl $( <$( $lifetime ),+> )? FnOnce<($( $ArgTy, )*)> for $Name { + type Output = $ReturnTy; + + #[inline] + extern "rust-call" fn call_once(self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + Fn::call(&self, ($( $arg, )*)) + } + } + )+ + } +} + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +#[lang = "fn"] +pub trait Fn<Args>: FnMut<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + +#[lang = "fn_mut"] +#[must_use = "closures are lazy and do nothing unless called"] +pub trait FnMut<Args>: FnOnce<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + /// The returned type after the call operator is used. + #[lang = "fn_once_output"] + #[stable(feature = "fn_once_output", since = "1.12.0")] + type Output; + + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +impl_fn_for_zst! { + #[derive(Copy)] + struct LinesAnyMap impl<'a> Fn = |line: &'a str| -> () { + }; +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-1.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-1.rs new file mode 100644 index 0000000..6fc3a31 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-1.rs @@ -0,0 +1,10 @@ +macro_rules! doc_comment { + (#[ $attr: meta ]) => { + #[$attr] + struct Generated; // { dg-warning "never constructed" } + }; +} + +doc_comment! { + /// This is a generated struct +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs new file mode 100644 index 0000000..cfc8ab4 --- /dev/null +++ b/gcc/testsuite/rust/compile/macros/mbe/macro-issue3709-2.rs @@ -0,0 +1,81 @@ +// { dg-additional-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } + +macro_rules! impl_fn_for_zst { + ($( + $( #[$attr: meta] )* + struct $Name: ident impl$( <$( $lifetime : lifetime ),+> )? Fn = + |$( $arg: ident: $ArgTy: ty ),*| -> $ReturnTy: ty + $body: block; + )+) => { + $( + $( #[$attr] )* + struct $Name; + + impl $( <$( $lifetime ),+> )? Fn<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call(&self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + $body + } + } + + impl $( <$( $lifetime ),+> )? FnMut<($( $ArgTy, )*)> for $Name { + #[inline] + extern "rust-call" fn call_mut( + &mut self, + ($( $arg, )*): ($( $ArgTy, )*) + ) -> $ReturnTy { + Fn::call(&*self, ($( $arg, )*)) + } + } + + impl $( <$( $lifetime ),+> )? FnOnce<($( $ArgTy, )*)> for $Name { + type Output = $ReturnTy; + + #[inline] + extern "rust-call" fn call_once(self, ($( $arg, )*): ($( $ArgTy, )*)) -> $ReturnTy { + Fn::call(&self, ($( $arg, )*)) + } + } + )+ + } +} + +#[lang = "sized"] +trait Sized {} + +#[lang = "copy"] +trait Copy {} + +#[lang = "fn"] +pub trait Fn<Args>: FnMut<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + +#[lang = "fn_mut"] +#[must_use = "closures are lazy and do nothing unless called"] +pub trait FnMut<Args>: FnOnce<Args> { + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + /// The returned type after the call operator is used. + #[lang = "fn_once_output"] + #[stable(feature = "fn_once_output", since = "1.12.0")] + type Output; + + /// Performs the call operation. + #[unstable(feature = "fn_traits", issue = "29625")] + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +impl_fn_for_zst! { + /// Documentation for the zst + #[derive(Copy)] + struct LinesAnyMap impl<'a> Fn = |line: &'a str| -> () { + }; +} diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro6.rs b/gcc/testsuite/rust/compile/macros/mbe/macro6.rs index 9c54a67..bbaaa25 100644 --- a/gcc/testsuite/rust/compile/macros/mbe/macro6.rs +++ b/gcc/testsuite/rust/compile/macros/mbe/macro6.rs @@ -1,6 +1,6 @@ macro_rules! zero_or_one { ($($a:literal)?) => { - f(); + 1 + 2; } } diff --git a/gcc/testsuite/rust/compile/min_specialization1.rs b/gcc/testsuite/rust/compile/min_specialization1.rs new file mode 100644 index 0000000..d38167e --- /dev/null +++ b/gcc/testsuite/rust/compile/min_specialization1.rs @@ -0,0 +1,15 @@ +#![feature(min_specialization)] + +pub trait Foo { + fn foo(&self) -> bool { + false + } +} + +pub struct Bar; + +impl Foo for Bar { + default fn foo(&self) -> bool { // { dg-warning "unused" } + true + } +} diff --git a/gcc/testsuite/rust/compile/nr2/compile.exp b/gcc/testsuite/rust/compile/nr2/compile.exp index 35637f1..9e15cdd 100644 --- a/gcc/testsuite/rust/compile/nr2/compile.exp +++ b/gcc/testsuite/rust/compile/nr2/compile.exp @@ -19,6 +19,15 @@ # Load support procs. load_lib rust-dg.exp +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p compile] { + return +} +gcc_parallel_test_enable 0 + # Initialize `dg'. dg-init @@ -47,18 +56,22 @@ namespace eval rust-nr2-ns { set tests_expect_ok "" set tests_expect_err "" + set compile_dir [list {*}[file split $srcdir] {*}[file split $subdir]] + set compile_dir [lreplace $compile_dir end end] + foreach test_dir $test_dirs { - set directory [list {*}[file split $srcdir] {*}[file split $subdir]] - set directory [lreplace $directory end end] - set directory [list {*}$directory {*}$test_dir] - foreach test [lsort [glob -nocomplain -tails -directory [file join {*}$directory] *.rs]] { + foreach test [lsort [glob -nocomplain -tails -directory [file join {*}$compile_dir {*}$test_dir] *.rs]] { # use '/' as the path seperator for entries in the exclude file set test_lbl [join [list {*}$test_dir $test] "/"] set idx [lsearch -exact -sorted $exclude $test_lbl] if {$idx == -1} { - lappend tests_expect_ok [file join {*}$directory $test] + if {[runtest_file_p $runtests [file join {*}$compile_dir {*}$test_dir $test]]} { + lappend tests_expect_ok [list {*}$test_dir $test] + } } else { - lappend tests_expect_err [file join {*}$directory $test] + if {[runtest_file_p $runtests [file join {*}$compile_dir {*}$test_dir $test]]} { + lappend tests_expect_err [list {*}$test_dir $test] + } set exclude [lreplace $exclude $idx $idx] } } @@ -83,10 +96,10 @@ namespace eval rust-nr2-ns { variable record_test_out switch $type { FAIL { - lappend record_test_out "$type: $msg" + lappend record_test_out [list $type $msg] } XPASS { - lappend record_test_out "$type: $msg" + lappend record_test_out [list $type $msg] } } } @@ -109,26 +122,28 @@ namespace eval rust-nr2-ns { # check for unexpected failures foreach test $tests_expect_ok { - set fails [try_test $test] + set fails [try_test [file join {*}$compile_dir {*}$test]] if {[llength $fails] != 0} { foreach ent $fails { - record_test FAIL "$test: nr2 failure: $ent" + record_test [lindex $ent 0] "on nr2: [lindex $ent 1]" } } else { - record_test PASS "$test: nr2 success" + record_test PASS "[file join {*}$test] on nr2" } } #check for unexpected successes foreach test $tests_expect_err { - set fails [try_test $test] + set fails [try_test [file join {*}$compile_dir {*}$test]] if {[llength $fails] == 0} { - record_test XPASS "$test: nr2 unexpectedly passed" + record_test XPASS "[file join {*}$test] on nr2" } else { - record_test XFAIL "$test: nr2 was rightfully excluded" + record_test XFAIL "[file join {*}$test] on nr2 was rightfully excluded" } } } # All done. dg-finish + +gcc_parallel_test_enable 1 diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index 19bf6f8..4772517 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -1,11 +1,8 @@ canonical_paths1.rs cfg1.rs generics9.rs -issue-2043.rs -issue-2812.rs issue-3315-2.rs lookup_err1.rs -macros/mbe/macro6.rs multiple_bindings1.rs multiple_bindings2.rs privacy5.rs @@ -13,21 +10,16 @@ privacy8.rs pub_restricted_1.rs pub_restricted_2.rs pub_restricted_3.rs -undeclared_label.rs use_1.rs -while_break_expr.rs issue-2905-2.rs -issue-266.rs derive_clone_enum3.rs derive-debug1.rs derive-default1.rs -issue-3402-1.rs -issue-3403.rs derive-eq-invalid.rs derive-hash1.rs torture/alt_patterns1.rs -torture/loop4.rs -torture/loop8.rs torture/name_resolve1.rs issue-3568.rs +issue-3663.rs +issue-3671.rs # please don't delete the trailing newline diff --git a/gcc/testsuite/rust/compile/track_caller.rs b/gcc/testsuite/rust/compile/track_caller.rs new file mode 100644 index 0000000..fd1d842 --- /dev/null +++ b/gcc/testsuite/rust/compile/track_caller.rs @@ -0,0 +1,6 @@ +#[track_caller] +fn foo() {} + +fn main() { + foo(); +} diff --git a/gcc/testsuite/rust/compile/undeclared_label.rs b/gcc/testsuite/rust/compile/undeclared_label.rs index 6efa2d9..9aa0553 100644 --- a/gcc/testsuite/rust/compile/undeclared_label.rs +++ b/gcc/testsuite/rust/compile/undeclared_label.rs @@ -2,12 +2,12 @@ #![allow(unused)] fn resolve_label_continue() -> () { loop { - continue 'a; // { dg-error "use of undeclared label .a. in .continue." } + continue 'a; // { dg-error "use of undeclared label .'a." } } } fn resolve_label_break() -> () { loop { - break 'crabby; // { dg-error "use of undeclared label .crabby. in .break." } + break 'crabby; // { dg-error "use of undeclared label .'crabby." } } } fn main() { diff --git a/gcc/testsuite/rust/execute/torture/min_specialization2.rs b/gcc/testsuite/rust/execute/torture/min_specialization2.rs new file mode 100644 index 0000000..d3239ee --- /dev/null +++ b/gcc/testsuite/rust/execute/torture/min_specialization2.rs @@ -0,0 +1,31 @@ +#![feature(min_specialization)] + +#[lang = "sized"] +trait Sized {} + +trait Foo { + fn foo(&self) -> i32; +} + +impl<T> Foo for T { + default fn foo(&self) -> i32 { // { dg-warning "unused" } + 15 + } +} + +impl Foo for bool { + fn foo(&self) -> i32 { + if *self { + 1 + } else { + 0 + } + } +} + +fn main() -> i32 { + let a = 1.foo() - 15; + let b = true.foo() - 1; + + a + b +} diff --git a/gcc/testsuite/rust/execute/torture/min_specialization3.rs b/gcc/testsuite/rust/execute/torture/min_specialization3.rs new file mode 100644 index 0000000..9eccd97 --- /dev/null +++ b/gcc/testsuite/rust/execute/torture/min_specialization3.rs @@ -0,0 +1,36 @@ +#![feature(min_specialization)] + +#[lang = "sized"] +trait Sized {} + +trait Foo { + fn foo(&self) -> i32; +} + +struct Wrap<T>(T); + +impl<T> Foo for T { + default fn foo(&self) -> i32 { + 15 + } +} + +impl<T> Foo for Wrap<T> { + default fn foo(&self) -> i32 { + 16 + } +} + +impl Foo for Wrap<bool> { + fn foo(&self) -> i32 { + if self.0 { + 1 + } else { + 0 + } + } +} + +fn main() -> i32 { + Wrap(true).foo() - 1 +} |