aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog327
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-7.c4
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-8.c9
-rw-r--r--gcc/testsuite/c-c++-common/gomp/append-args-9.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-1.c80
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-2.c64
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-3.c26
-rw-r--r--gcc/testsuite/c-c++-common/gomp/interop-4.c8
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr118965-1.c57
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr118965-2.c31
-rw-r--r--gcc/testsuite/c-c++-common/musttail15.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail16.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail17.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail18.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail19.c7
-rw-r--r--gcc/testsuite/c-c++-common/musttail20.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail21.c2
-rw-r--r--gcc/testsuite/c-c++-common/musttail28.c108
-rw-r--r--gcc/testsuite/c-c++-common/musttail29.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail30.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail31.c109
-rw-r--r--gcc/testsuite/c-c++-common/musttail8.c5
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob43
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out10
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob44
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out10
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob105
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out15
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob29
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out7
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob78
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out14
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_NULL.cob15
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob15
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob27
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out6
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob83
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.out9
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob75
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.out7
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob68
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.out13
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob71
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.out5
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob81
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.out9
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.cob77
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.out9
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.cob90
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.out7
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob58
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.out5
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob65
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.out9
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob17
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob13
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob15
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_AFTER.cob26
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob26
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob142
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out13
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.cob58
-rw-r--r--gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.out6
-rw-r--r--gcc/testsuite/g++.dg/abi/abi-tag18a.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp/embed-26.C63
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr119563.C79
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite6.C33
-rw-r--r--gcc/testsuite/g++.dg/ext/musttail1.C38
-rw-r--r--gcc/testsuite/g++.dg/ext/musttail2.C38
-rw-r--r--gcc/testsuite/g++.dg/ext/musttail3.C37
-rw-r--r--gcc/testsuite/g++.dg/gomp/append-args-1.C6
-rw-r--r--gcc/testsuite/g++.dg/gomp/append-args-2.C6
-rw-r--r--gcc/testsuite/g++.dg/gomp/append-args-6.C4
-rw-r--r--gcc/testsuite/g++.dg/gomp/append-args-7.C2
-rw-r--r--gcc/testsuite/g++.dg/gomp/append-args-8.C9
-rw-r--r--gcc/testsuite/g++.dg/gomp/interop-5.C8
-rw-r--r--gcc/testsuite/g++.dg/modules/internal-11.C24
-rw-r--r--gcc/testsuite/g++.dg/modules/internal-12_a.C13
-rw-r--r--gcc/testsuite/g++.dg/modules/internal-12_b.C14
-rw-r--r--gcc/testsuite/g++.dg/modules/internal-5_a.C8
-rw-r--r--gcc/testsuite/g++.dg/modules/internal-5_b.C6
-rw-r--r--gcc/testsuite/g++.dg/modules/pr98893_b.C2
-rw-r--r--gcc/testsuite/g++.dg/opt/musttail3.C41
-rw-r--r--gcc/testsuite/g++.dg/opt/musttail4.C35
-rw-r--r--gcc/testsuite/g++.dg/opt/musttail5.C41
-rw-r--r--gcc/testsuite/g++.target/riscv/mv-symbols1.C4
-rw-r--r--gcc/testsuite/g++.target/riscv/mv-symbols3.C4
-rw-r--r--gcc/testsuite/g++.target/riscv/mv-symbols4.C4
-rw-r--r--gcc/testsuite/g++.target/riscv/mv-symbols5.C4
-rw-r--r--gcc/testsuite/g++.target/riscv/mvc-symbols1.C4
-rw-r--r--gcc/testsuite/g++.target/riscv/mvc-symbols3.C4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr46534.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr119291.c33
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr119582.c23
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr90074.c4
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr90716.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr119493-1.c55
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr119534.c11
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr119586.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-fncall-mask.c8
-rw-r--r--gcc/testsuite/gcc.target/arm/short-vfp-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/apx-nf-pr119539.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr111673.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82142a.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82142b.c2
-rw-r--r--gcc/testsuite/gcc.target/nvptx/decl.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/cm_mv_rv32.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/cpymem-64.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/fmax-snan.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/fmaxf-snan.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/fmin-snan.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/fminf-snan.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/large-model.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-xiangshan-nanhu.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-1.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-4.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-7.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-9.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rv32e_zcmp.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/rv32i_zcmp.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/abi-callee-saved-2.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-1.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-3.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-4.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-1.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/movmem-1.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/pr114352-3.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/setmem-1.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/setmem-2.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/setmem-3.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/zba-shNadd-09.c12
-rw-r--r--gcc/testsuite/gcc.target/riscv/zba-shNadd-10.c21
-rw-r--r--gcc/testsuite/gcc.target/riscv/zcmp_stack_alignment.c2
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test21098_phobos.d77
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test21098b.d12
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21098.d4
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/append_args-1.f908
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/append_args-2.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/append_args-3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/append_args-4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/interop-1.f9062
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/interop-2.f9036
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/interop-3.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/interop-4.f908
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr118965-1.f9048
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr118965-2.f9057
156 files changed, 3458 insertions, 307 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a488c4d..9bc53e0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,330 @@
+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
+ * g++.dg/modules/internal-5_a.C: Add cases that should be
+ ignored.
+ * g++.dg/modules/internal-5_b.C: Test these new cases, and make
+ the testcase more robust.
+ * g++.dg/modules/internal-11.C: New test.
+ * g++.dg/modules/internal-12_a.C: New test.
+ * g++.dg/modules/internal-12_b.C: New test.
+
+2025-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/119493
+ * gcc.dg/pr119493-1.c: New test.
+
+2025-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/119291
+ * gcc.c-torture/execute/pr119291.c: New test.
+
+2025-04-01 Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/rv32i_zcmp.c: Tweak testcase for PIE.
+ * gcc.target/riscv/rv32e_zcmp.c: Likewise.
+ * gcc.target/riscv/zcmp_stack_alignment.c: Likewise.
+ * gcc.target/riscv/cm_mv_rv32.c: Likewise.
+ * gcc.target/riscv/cpymem-64.c: Likewise.
+ * gcc.target/riscv/fmax-snan.c: Likewise.
+ * gcc.target/riscv/fmaxf-snan.c: Likewise.
+ * gcc.target/riscv/fmin-snan.c: Likewise.
+ * gcc.target/riscv/fminf-snan.c: Likewise.
+ * gcc.target/riscv/large-model.c: Likewise.
+ * gcc.target/riscv/predef-1.c: Likewise.
+ * gcc.target/riscv/predef-4.c: Likewise.
+ * gcc.target/riscv/predef-7.c: Likewise.
+ * gcc.target/riscv/predef-9.c: Likewise.
+ * gcc.target/riscv/rvv/base/abi-callee-saved-2-save-restore.c: Likewise.
+ * gcc.target/riscv/rvv/base/abi-callee-saved-2-zcmp.c: Likewise.
+ * gcc.target/riscv/rvv/base/abi-callee-saved-2.c: Likewise.
+ * gcc.target/riscv/rvv/base/cmpmem-1.c: Likewise.
+ * gcc.target/riscv/rvv/base/cmpmem-3.c: Likewise.
+ * gcc.target/riscv/rvv/base/cmpmem-4.c: Likewise.
+ * gcc.target/riscv/rvv/base/cpymem-1.c: Likewise.
+ * gcc.target/riscv/rvv/base/movmem-1.c: Likewise.
+ * gcc.target/riscv/rvv/base/pr114352-3.c: Likewise.
+ * gcc.target/riscv/rvv/base/setmem-1.c: Likewise.
+ * gcc.target/riscv/rvv/base/setmem-2.c: Likewise.
+ * gcc.target/riscv/rvv/base/setmem-3.c: Likewise.
+ * gcc.target/riscv/rvv/base/spill-9.c: Likewise.
+ * g++.target/riscv/mv-symbols1.C: Likewise.
+ * g++.target/riscv/mv-symbols3.C: Likewise.
+ * g++.target/riscv/mv-symbols4.C: Likewise.
+ * g++.target/riscv/mv-symbols5.C: Likewise.
+ * g++.target/riscv/mvc-symbols1.C: Likewise.
+ * g++.target/riscv/mvc-symbols3.C: Likewise.
+
+2025-04-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/119534
+ * gcc.dg/vect/pr119534.c: New testcase.
+
+2025-04-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/119383
+ * g++.dg/cpp0x/temp-extend3.C: New test.
+
+2025-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR gcov-profile/119535
+ * c-c++-common/pr119535.c: New test.
+
+2025-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/119493
+ * gcc.dg/pr119493-2.c: New test.
+
+2025-04-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/119537
+ * c-c++-common/pr119537-1.c: New test.
+ * c-c++-common/pr119537-2.c: New test.
+
+2025-04-01 Thomas Schwinge <tschwinge@baylibre.com>
+
+ PR target/119369
+ * g++.dg/abi/pure-virtual1.C: 'dg-xfail-if' GCN.
+ * g++.dg/cpp0x/pr84497.C: 'dg-skip-if' GCN.
+ * g++.dg/ext/weak2.C: Likewise.
+ * gcc.dg/attr-weakref-1.c: Likewise.
+ * gcc.dg/weak/weak-1.c: Likewise.
+ * gcc.dg/weak/weak-12.c: Likewise.
+ * gcc.dg/weak/weak-15.c: Likewise.
+ * gcc.dg/weak/weak-16.c: Likewise.
+ * gcc.dg/weak/weak-2.c: Likewise.
+ * gcc.dg/weak/weak-3.c: Likewise.
+ * gcc.dg/weak/weak-4.c: Likewise.
+ * gcc.dg/weak/weak-5.c: Likewise.
+
+2025-04-01 Richard Biener <rguenther@suse.de>
+
+ PR target/119549
+ * gcc.target/i386/pr119549.c: New testcase.
+
+2025-04-01 Liao Shihua <shihua@iscas.ac.cn>
+
+ * gcc.target/riscv/cmo-zicbop-1.c: Fix missing { before target .
+ * gcc.target/riscv/cmo-zicbop-2.c: Likewise.
+ * gcc.target/riscv/prefetch-zicbop.c:Likewise.
+ * gcc.target/riscv/prefetch-zihintntl.c:Likewise.
+
+2025-04-01 Hu, Lin1 <lin1.hu@intel.com>
+ Hongyu Wang <hongyu.wang@intel.com>
+
+ PR target/119473
+ * gcc.target/i386/pr119473.c: New test.
+
+2025-04-01 Monk Chiang <monk.chiang@sifive.com>
+ Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/rvv/autovec/pr111391-2.c: Update test.
+ * gcc.target/riscv/rvv/base/abi-14.c: Update test.
+ * gcc.target/riscv/rvv/base/abi-16.c: Update test.
+ * gcc.target/riscv/rvv/base/abi-18.c: Update test.
+ * gcc.target/riscv/rvv/base/vsetvl_zve32-1.c: New test.
+ * gcc.target/riscv/rvv/base/vsetvl_zve32-2.c: New test.
+
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* rust/compile/issue-3613.rs: New test.
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/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/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/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/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/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/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/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/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..379c767 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" } } */
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/modules/internal-11.C b/gcc/testsuite/g++.dg/modules/internal-11.C
new file mode 100644
index 0000000..53eb30a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/internal-11.C
@@ -0,0 +1,24 @@
+// PR c++/119551
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi !M }
+
+export module M;
+
+static int tu_local = 5;
+static int* foo() { return &tu_local; }
+
+// For implementation reasons, we adjust [basic.link] p14.2 to restrict ignored
+// exposures to non-inline variables, since for inline variables without
+// dynamic initialisation we need to emit their initialiser for importer use.
+
+int* a = &tu_local; // OK
+inline int* b = &tu_local; // { dg-error "exposes TU-local entity" }
+
+// But dynamic initialisers are fine, importers will just treat them as external.
+inline int* c = foo(); // OK
+
+// For consistency, we follow the same rules with templates, noting that
+// we still need to emit definitions with dynamic initializers so we error.
+template <typename T> int* d = &tu_local; // OK
+template <typename T> inline int* e = &tu_local; // { dg-error "exposes TU-local entity" }
+template <typename T> inline int* f = foo(); // { dg-error "exposes TU-local entity" }
diff --git a/gcc/testsuite/g++.dg/modules/internal-12_a.C b/gcc/testsuite/g++.dg/modules/internal-12_a.C
new file mode 100644
index 0000000..5c4e7c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/internal-12_a.C
@@ -0,0 +1,13 @@
+// PR c++/119551
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi M }
+// Test that emitting variables referencing TU-local entities
+// builds and runs correctly.
+
+export module M;
+
+static int tu_local_var = 5;
+static int* tu_local_func() { return &tu_local_var; }
+
+export int* a = &tu_local_var;
+export inline int* b = tu_local_func();
diff --git a/gcc/testsuite/g++.dg/modules/internal-12_b.C b/gcc/testsuite/g++.dg/modules/internal-12_b.C
new file mode 100644
index 0000000..bc3edf9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/internal-12_b.C
@@ -0,0 +1,14 @@
+// PR c++/119551
+// { dg-module-do run }
+// { dg-additional-options "-fmodules" }
+
+import M;
+
+int main() {
+ if (*a != 5)
+ __builtin_abort();
+ if (*b != 5)
+ __builtin_abort();
+ if (a != b)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/g++.dg/modules/internal-5_a.C b/gcc/testsuite/g++.dg/modules/internal-5_a.C
index be97ffa..e5113b2 100644
--- a/gcc/testsuite/g++.dg/modules/internal-5_a.C
+++ b/gcc/testsuite/g++.dg/modules/internal-5_a.C
@@ -37,7 +37,7 @@ template void function_tmpl<ok_inst_tag>();
template <> void function_tmpl<ok_inst_tag*>() {}
-// The initializer for a variable or variable template
+// The initializer for a (non-inline) variable or variable template
export int var
= (internal_t{}, internal_tmpl_t<int>{},
internal_ovl(internal_x), internal_tmpl<int>(), 0);
@@ -53,9 +53,15 @@ template <typename T> int var_tmpl<T*> // { dg-warning "refers to TU-local enti
template int var_tmpl<ok_inst_tag>;
template <> int var_tmpl<ok_inst_tag*> = 0;
+export int* ptr = &internal_x;
+export template <typename T> int* ptr_tmpl = &internal_x; // { dg-warning "refers to TU-local entity" }
+
export int& constant_ref = internal_x;
static_assert (&constant_ref == &internal_x);
+// Support exposures in inline vars with dynamic initialisers
+export inline int dynamic_var = (internal_ovl(internal_x), 0);
+
// Friend declarations in a class definition
export struct klass { // { dg-bogus "TU-local" }
diff --git a/gcc/testsuite/g++.dg/modules/internal-5_b.C b/gcc/testsuite/g++.dg/modules/internal-5_b.C
index baf60fd..f04916e 100644
--- a/gcc/testsuite/g++.dg/modules/internal-5_b.C
+++ b/gcc/testsuite/g++.dg/modules/internal-5_b.C
@@ -15,11 +15,14 @@ int main() {
function_tmpl<ok_inst_tag*>();
int b = var_tmpl<ok_inst_tag>;
int c = var_tmpl<ok_inst_tag*>;
+ int d = *ptr;
+ int e = dynamic_var;
// But don't ignore exposures in these cases
function_tmpl<int>(); // { dg-message "required from here" }
int x = var_tmpl<int>; // { dg-message "required from here" }
int y = var_tmpl<int*>; // { dg-message "required from here" }
+ int z = *ptr_tmpl<int>; // { dg-message "required from here" }
// And decls initialized to a TU-local value are not constant here
// Unfortunately the error does not currently point to this decl
@@ -27,4 +30,7 @@ int main() {
// { dg-error "is not a constant expression" "" { target *-*-* } 0 }
}
+// The errors occur in a different file, so we just test that all the
+// needed "required from here"s are found above.
// { dg-error "instantiation exposes TU-local entity" "" { target *-*-* } 0 }
+// { dg-bogus "required from here" "" { target *-*-* } 0 }
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/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++.target/riscv/mv-symbols1.C b/gcc/testsuite/g++.target/riscv/mv-symbols1.C
index ea1a536..e18c984 100644
--- a/gcc/testsuite/g++.target/riscv/mv-symbols1.C
+++ b/gcc/testsuite/g++.target/riscv/mv-symbols1.C
@@ -57,7 +57,7 @@ int bar(int x)
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__v:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__zba__zbb:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\t\call\t_Z3foov\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\t\call\t_Z3foov(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */
@@ -65,6 +65,6 @@ int bar(int x)
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__v:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__zba__zbb:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\t\call\t_Z3fooi\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\t\call\t_Z3fooi(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */
diff --git a/gcc/testsuite/g++.target/riscv/mv-symbols3.C b/gcc/testsuite/g++.target/riscv/mv-symbols3.C
index 4dc81cf..6596a27 100644
--- a/gcc/testsuite/g++.target/riscv/mv-symbols3.C
+++ b/gcc/testsuite/g++.target/riscv/mv-symbols3.C
@@ -37,7 +37,7 @@ int bar()
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__v:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__zba__zbb:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */
@@ -45,6 +45,6 @@ int bar()
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__v:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__zba__zbb:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi\n" 0 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi(?:@plt)?\n" 0 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 0 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 0 } } */
diff --git a/gcc/testsuite/g++.target/riscv/mv-symbols4.C b/gcc/testsuite/g++.target/riscv/mv-symbols4.C
index b0ed16a..83d51e3 100644
--- a/gcc/testsuite/g++.target/riscv/mv-symbols4.C
+++ b/gcc/testsuite/g++.target/riscv/mv-symbols4.C
@@ -43,7 +43,7 @@ int bar()
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__v:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__zba__zbb:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */
@@ -51,6 +51,6 @@ int bar()
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__v:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__zba__zbb:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi\n" 0 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi(?:@plt)?\n" 0 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 0 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 0 } } */
diff --git a/gcc/testsuite/g++.target/riscv/mv-symbols5.C b/gcc/testsuite/g++.target/riscv/mv-symbols5.C
index f4c6b29..c92421a 100644
--- a/gcc/testsuite/g++.target/riscv/mv-symbols5.C
+++ b/gcc/testsuite/g++.target/riscv/mv-symbols5.C
@@ -49,7 +49,7 @@ int bar()
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__v:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__zba__zbb:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */
@@ -57,6 +57,6 @@ int bar()
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__v:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__zba__zbb:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 0 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi\n" 0 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi(?:@plt)?\n" 0 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 0 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 0 } } */
diff --git a/gcc/testsuite/g++.target/riscv/mvc-symbols1.C b/gcc/testsuite/g++.target/riscv/mvc-symbols1.C
index c78bc7c..bd65a2c 100644
--- a/gcc/testsuite/g++.target/riscv/mvc-symbols1.C
+++ b/gcc/testsuite/g++.target/riscv/mvc-symbols1.C
@@ -36,7 +36,7 @@ int bar(int x)
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__v:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__zba__zbb:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */
@@ -44,6 +44,6 @@ int bar(int x)
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__v:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__zba__zbb:\n" 1 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */
diff --git a/gcc/testsuite/g++.target/riscv/mvc-symbols3.C b/gcc/testsuite/g++.target/riscv/mvc-symbols3.C
index b36c3fa..78f027b 100644
--- a/gcc/testsuite/g++.target/riscv/mvc-symbols3.C
+++ b/gcc/testsuite/g++.target/riscv/mvc-symbols3.C
@@ -29,7 +29,7 @@ int bar(int x)
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__v:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.arch__zba__zbb:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3foov\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3foov(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3foov, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3foov,_Z3foov\.resolver\n" 1 } } */
@@ -37,6 +37,6 @@ int bar(int x)
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__v:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.arch__zba__zbb:\n" 0 } } */
/* { dg-final { scan-assembler-times "\n_Z3fooi\.resolver:\n" 1 } } */
-/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi\n" 1 } } */
+/* { dg-final { scan-assembler-times "\n\tcall\t_Z3fooi(?:@plt)?\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.type\t_Z3fooi, @gnu_indirect_function\n" 1 } } */
/* { dg-final { scan-assembler-times "\n\t\.set\t_Z3fooi,_Z3fooi\.resolver\n" 1 } } */
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.c-torture/execute/pr119291.c b/gcc/testsuite/gcc.c-torture/execute/pr119291.c
new file mode 100644
index 0000000..41eadf0
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr119291.c
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/119291 */
+
+int a;
+long c;
+
+__attribute__((noipa)) void
+foo (int x)
+{
+ if (x != 0)
+ __builtin_abort ();
+ a = 42;
+}
+
+int
+main ()
+{
+ int e = 1;
+lab:
+ if (a < 2)
+ {
+ int b = e;
+ _Bool d = a != 0;
+ _Bool f = b != 0;
+ unsigned long g = -(d & f);
+ unsigned long h = c & g;
+ unsigned long i = ~c;
+ e = -(i & h);
+ c = e != 0;
+ a = ~e + b;
+ foo (e);
+ goto lab;
+ }
+}
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/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/pr119493-1.c b/gcc/testsuite/gcc.dg/pr119493-1.c
new file mode 100644
index 0000000..edba61c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr119493-1.c
@@ -0,0 +1,55 @@
+/* PR tree-optimization/119493 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fdump-tree-tailr1" } */
+/* { dg-final { scan-tree-dump-times " = foo \\\(\[^\n\r;]*\\\);" 4 "tailr1" } } */
+/* { dg-final { scan-tree-dump-times " = bar \\\(\[^\n\r;]*\\\);" 4 "tailr1" } } */
+/* { dg-final { scan-tree-dump-not " = foo \\\(\[^\n\r;]*\\\); \\\[must tail call\\\]" "tailr1" } } */
+/* { dg-final { scan-tree-dump-not " = bar \\\(\[^\n\r;]*\\\); \\\[must tail call\\\]" "tailr1" } } */
+
+struct S { unsigned s; };
+struct T { struct S t[2]; };
+
+[[gnu::noinline, gnu::noclone]] struct S
+foo (struct S m)
+{
+ if (m.s == 0 || m.s == 42)
+ return m;
+ [[gnu::musttail]] return foo ((struct S) { m.s - 1 });
+}
+
+[[gnu::noinline, gnu::noclone]] struct S
+bar (struct T m, struct S n, int o, int p, int q)
+{
+ struct T r;
+ if (m.t[1].s != o || n.s != o)
+ __builtin_abort ();
+ if (o == 0 || o == 42)
+ return n;
+ r = m;
+ m.t[1].s -= p;
+ r.t[1].s -= q;
+ [[gnu::musttail]] return bar (r, m.t[1], o - 1, p, q);
+}
+
+int
+main ()
+{
+ if (foo ((struct S) { 0 }).s != 0)
+ __builtin_abort ();
+ if (foo ((struct S) { 4 }).s != 0)
+ __builtin_abort ();
+ if (foo ((struct S) { 42 }).s != 42)
+ __builtin_abort ();
+ if (foo ((struct S) { 51 }).s != 42)
+ __builtin_abort ();
+ if (bar ((struct T) { { { 0 }, { 0 } } }, (struct S) { 0 }, 0, 1, 1).s != 0)
+ __builtin_abort ();
+ if (bar ((struct T) { { { 7 }, { 7 } } }, (struct S) { 7 }, 7, 1, 1).s != 0)
+ __builtin_abort ();
+ if (bar ((struct T) { { { 42 }, { 42 } } },
+ (struct S) { 42 }, 42, 1, 1).s != 42)
+ __builtin_abort ();
+ if (bar ((struct T) { { { 48 }, { 48 } } },
+ (struct S) { 48 }, 48, 1, 1).s != 42)
+ __builtin_abort ();
+}
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..a879d30 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 && { powerpc*-*-* sparc*-*-* riscv*-*-* } } || aarch64_sve } || { arm*-*-* && { ! arm_neon } } } } } } } */
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/pr119534.c b/gcc/testsuite/gcc.dg/vect/pr119534.c
new file mode 100644
index 0000000..0b4130b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr119534.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mavx512bw" { target { x86_64-*-* i?86-*-* } } } */
+
+void f(int w, int *out, double *d)
+{
+ for (int j = 0; j < w; j++)
+ {
+ const int i = (j >= w / 2);
+ out[j] += d[i];
+ }
+}
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/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.target/arm/short-vfp-1.c b/gcc/testsuite/gcc.target/arm/short-vfp-1.c
index 18d38a5..f6866c4 100644
--- a/gcc/testsuite/gcc.target/arm/short-vfp-1.c
+++ b/gcc/testsuite/gcc.target/arm/short-vfp-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-require-effective-target arm_vfp_ok }
+/* { dg-require-effective-target arm_vfp_ok } */
/* { dg-add-options arm_vfp } */
int
@@ -38,8 +38,8 @@ 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 } } */
+/* { 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/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/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/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/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/riscv/cm_mv_rv32.c b/gcc/testsuite/gcc.target/riscv/cm_mv_rv32.c
index e2369fc..326d5dc 100644
--- a/gcc/testsuite/gcc.target/riscv/cm_mv_rv32.c
+++ b/gcc/testsuite/gcc.target/riscv/cm_mv_rv32.c
@@ -10,10 +10,10 @@ func (int a, int b);
**sum:
** ...
** cm.mvsa01 s1,s2
-** call func
+** call func(?:@plt)?
** mv s0,a0
** cm.mva01s s1,s2
-** call func
+** call func(?:@plt)?
** ...
*/
int
diff --git a/gcc/testsuite/gcc.target/riscv/cpymem-64.c b/gcc/testsuite/gcc.target/riscv/cpymem-64.c
index 37b8ef0..c91b015 100644
--- a/gcc/testsuite/gcc.target/riscv/cpymem-64.c
+++ b/gcc/testsuite/gcc.target/riscv/cpymem-64.c
@@ -95,7 +95,7 @@ COPY_ALIGNED_N(11)
/*
**copy_15:
** ...
-** (call|tail)\tmemcpy
+** (call|tail)\tmemcpy(?:@plt)?
** ...
*/
COPY_N(15)
@@ -116,7 +116,7 @@ COPY_ALIGNED_N(15)
/*
**copy_27:
** ...
-** (call|tail)\tmemcpy
+** (call|tail)\tmemcpy(?:@plt)?
** ...
*/
COPY_N(27)
diff --git a/gcc/testsuite/gcc.target/riscv/fmax-snan.c b/gcc/testsuite/gcc.target/riscv/fmax-snan.c
index aabaad5..a1f6149 100644
--- a/gcc/testsuite/gcc.target/riscv/fmax-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fmax-snan.c
@@ -10,4 +10,4 @@ fmax (double x, double y)
/* { dg-final { scan-assembler-not "\tfmax\\.d\t" } } */
/* { dg-final { scan-assembler-not "\tfge\\.d\t" } } */
-/* { dg-final { scan-assembler "\t(call|tail)\tfmax\t" } } */
+/* { dg-final { scan-assembler "\t(call|tail)\tfmax(?:@plt)?\t" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c b/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c
index f74a817..1daf3e9 100644
--- a/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fmaxf-snan.c
@@ -10,4 +10,4 @@ fmaxf (float x, float y)
/* { dg-final { scan-assembler-not "\tfmax\\.s\t" } } */
/* { dg-final { scan-assembler-not "\tfge\\.s\t" } } */
-/* { dg-final { scan-assembler "\t(call|tail)\tfmaxf\t" } } */
+/* { dg-final { scan-assembler "\t(call|tail)\tfmaxf(?:@plt)?\t" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fmin-snan.c b/gcc/testsuite/gcc.target/riscv/fmin-snan.c
index 3b2e8c3..cc0e16c 100644
--- a/gcc/testsuite/gcc.target/riscv/fmin-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fmin-snan.c
@@ -10,4 +10,4 @@ fmin (double x, double y)
/* { dg-final { scan-assembler-not "\tfmin\\.d\t" } } */
/* { dg-final { scan-assembler-not "\tfle\\.d\t" } } */
-/* { dg-final { scan-assembler "\t(call|tail)\tfmin\t" } } */
+/* { dg-final { scan-assembler "\t(call|tail)\tfmin(?:@plt)?\t" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/fminf-snan.c b/gcc/testsuite/gcc.target/riscv/fminf-snan.c
index d28822e..598644e 100644
--- a/gcc/testsuite/gcc.target/riscv/fminf-snan.c
+++ b/gcc/testsuite/gcc.target/riscv/fminf-snan.c
@@ -10,4 +10,4 @@ fminf (float x, float y)
/* { dg-final { scan-assembler-not "\tfmin\\.s\t" } } */
/* { dg-final { scan-assembler-not "\tfle\\.s\t" } } */
-/* { dg-final { scan-assembler "\t(call|tail)\tfminf\t" } } */
+/* { dg-final { scan-assembler "\t(call|tail)\tfminf(?:@plt)?\t" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/large-model.c b/gcc/testsuite/gcc.target/riscv/large-model.c
index 244d14e..d5ef7a0 100644
--- a/gcc/testsuite/gcc.target/riscv/large-model.c
+++ b/gcc/testsuite/gcc.target/riscv/large-model.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv64gc -mabi=lp64 -fno-section-anchors -mcmodel=large" } */
+/* { dg-options "-march=rv64gc -mabi=lp64 -fno-section-anchors -mcmodel=large -fno-pie" } */
/* { dg-skip-if "" { *-*-* } {"-O0"} } */
int a, b;
int foo1()
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/predef-1.c b/gcc/testsuite/gcc.target/riscv/predef-1.c
index 250812a..551346e 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-1.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv32i -mabi=ilp32 -mcmodel=medlow" } */
+/* { dg-options "-march=rv32i -mabi=ilp32 -mcmodel=medlow -fno-pie" } */
int main () {
#if !defined(__riscv)
diff --git a/gcc/testsuite/gcc.target/riscv/predef-4.c b/gcc/testsuite/gcc.target/riscv/predef-4.c
index ba8b5c7..7b3c054 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-4.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv64ia -mabi=lp64 -mcmodel=medlow" } */
+/* { dg-options "-march=rv64ia -mabi=lp64 -mcmodel=medlow -fno-pie" } */
int main () {
#if !defined(__riscv)
diff --git a/gcc/testsuite/gcc.target/riscv/predef-7.c b/gcc/testsuite/gcc.target/riscv/predef-7.c
index 833e2be..36caf8e 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-7.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-7.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv32em -mabi=ilp32e -mno-div -mcmodel=medlow" } */
+/* { dg-options "-march=rv32em -mabi=ilp32e -mno-div -mcmodel=medlow -fno-pie" } */
int main () {
#if !defined(__riscv)
diff --git a/gcc/testsuite/gcc.target/riscv/predef-9.c b/gcc/testsuite/gcc.target/riscv/predef-9.c
index b173d5d..fa072ad 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-9.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-9.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-march=rv64em -mabi=lp64e -mno-div -mcmodel=medlow" } */
+/* { dg-options "-march=rv64em -mabi=lp64e -mno-div -mcmodel=medlow -fno-pie" } */
/* { dg-warning "LP64E ABI is marked for deprecation in GCC" "" { target *-*-* } 0 } */
/* { dg-note "if you need LP64E please notify the GCC project via PR116152" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/riscv/rv32e_zcmp.c b/gcc/testsuite/gcc.target/riscv/rv32e_zcmp.c
index 0af4d71..fd845f5 100644
--- a/gcc/testsuite/gcc.target/riscv/rv32e_zcmp.c
+++ b/gcc/testsuite/gcc.target/riscv/rv32e_zcmp.c
@@ -244,9 +244,9 @@ test_f0 ()
/*
**foo:
** cm.push {ra}, -16
-** call f1
+** call f1(?:@plt)?
** cm.pop {ra}, 16
-** tail f2
+** tail f2(?:@plt)?
*/
void
foo (void)
@@ -258,7 +258,7 @@ foo (void)
/*
**test_popretz:
** cm.push {ra}, -16
-** call f1
+** call f1(?:@plt)?
** li a0,0
** cm.popret {ra}, 16
*/
diff --git a/gcc/testsuite/gcc.target/riscv/rv32i_zcmp.c b/gcc/testsuite/gcc.target/riscv/rv32i_zcmp.c
index 723889f4..d90f4f4 100644
--- a/gcc/testsuite/gcc.target/riscv/rv32i_zcmp.c
+++ b/gcc/testsuite/gcc.target/riscv/rv32i_zcmp.c
@@ -244,9 +244,9 @@ test_f0 ()
/*
**foo:
** cm.push {ra}, -16
-** call f1
+** call f1(?:@plt)?
** cm.pop {ra}, 16
-** tail f2
+** tail f2(?:@plt)?
*/
void
foo (void)
@@ -258,7 +258,7 @@ foo (void)
/*
**test_popretz:
** cm.push {ra}, -16
-** call f1
+** call f1(?:@plt)?
** li a0,0
** cm.popret {ra}, 16
*/
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 39c8c00..d21b810 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
@@ -51,7 +51,7 @@ foo1 (vint8m1_t a)
** vs1r\.v\tv30,0\(sp\)
** sub\tsp,sp,t0
** vs1r\.v\tv31,0\(sp\)
-** call\tbar2
+** call\tbar2(?:@plt)?
** csrr\tt0,vlenb
** vl1re64\.v\tv31,0\(sp\)
** add\tsp,sp,t0
@@ -96,8 +96,8 @@ foo2 (vint8m1_t a)
** foo3:
** call\tt0,__riscv_save_0
** vl1re8\.v\tv8,0\(a0\)
-** call\tbar1
-** call\tbar2
+** call\tbar1(?:@plt)?
+** call\tbar2(?:@plt)?
** tail\t__riscv_restore_0
*/
void
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 5f8f96f..70a32d7 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
@@ -10,7 +10,7 @@ void bar2 ();
/*
** foo1:
** cm.push\t{ra},\s*-16
-** call\tbar1
+** call\tbar1(?:@plt)?
** cm.popret\t{ra},\s*16
*/
void
@@ -53,7 +53,7 @@ foo1 (vint8m1_t a)
** vs1r\.v\tv30,0\(sp\)
** sub\tsp,sp,t0
** vs1r\.v\tv31,0\(sp\)
-** call\tbar2
+** call\tbar2(?:@plt)?
** csrr\tt0,vlenb
** vl1re64\.v\tv31,0\(sp\)
** add\tsp,sp,t0
@@ -97,7 +97,7 @@ foo2 (vint8m1_t a)
** foo3:
** cm.push\t{ra},\s*-16
** vl1re8\.v\tv8,0\(a0\)
-** call\tbar1
+** call\tbar1(?:@plt)?
** cm.popret\t{ra},\s*16
*/
void
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 a9f3855..3f2cb2f 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
@@ -11,7 +11,7 @@ void bar2 ();
** foo1:
** addi\tsp,sp,-16
** sd\tra,8\(sp\)
-** call\tbar1
+** call\tbar1(?:@plt)?
** ld\tra,8\(sp\)
** addi\tsp,sp,16
** jr\tra
@@ -57,7 +57,7 @@ foo1 (vint8m1_t a)
** vs1r\.v\tv30,0\(sp\)
** sub\tsp,sp,t0
** vs1r\.v\tv31,0\(sp\)
-** call\tbar2
+** call\tbar2(?:@plt)?
** csrr\tt0,vlenb
** vl1re64\.v\tv31,0\(sp\)
** add\tsp,sp,t0
@@ -105,7 +105,7 @@ foo2 (vint8m1_t a)
** addi\tsp,sp,-16
** sd\tra,8\(sp\)
** vl1re8\.v\tv8,0\(a0\)
-** call\tbar1
+** call\tbar1(?:@plt)?
** ld\tra,8\(sp\)
** addi\tsp,sp,16
** jr\tra
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-1.c
index 9edd6cb..3534720 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-1.c
@@ -21,7 +21,7 @@ f1 (void *a, void *b)
/* Tiny __builtin_memcmp should use libc.
** f2:
** li\s+a\d,\d+
-** tail\s+memcmp
+** tail\s+memcmp(?:@plt)?
*/
int
f2 (void *a, void *b)
@@ -79,7 +79,7 @@ f5 (void *a, void *b)
/* Don't inline if the length is too large for one operation.
** f6:
** li\s+a2,\d+
-** tail\s+memcmp
+** tail\s+memcmp(?:@plt)?
*/
int
f6 (void *a, void *b)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-3.c b/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-3.c
index 82aa307..c1c1aae 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-3.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-3.c
@@ -8,7 +8,7 @@
/* Tiny __builtin_memcmp should use libc.
** f1:
** li\s+a\d,\d+
-** tail\s+memcmp
+** tail\s+memcmp(?:@plt)?
*/
int
f1 (void *a, void *b)
@@ -36,7 +36,7 @@ f2 (void *a, void *b)
/* Don't inline if the length is too large for one operation.
** f3:
** li\s+a2,\d+
-** tail\s+memcmp
+** tail\s+memcmp(?:@plt)?
*/
int
f3 (void *a, void *b)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-4.c b/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-4.c
index e2dd6a1..ad87038 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-4.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-4.c
@@ -8,7 +8,7 @@
/* Tiny __builtin_memcmp should use libc.
** f1:
** li\s+a\d,\d+
-** tail\s+memcmp
+** tail\s+memcmp(?:@plt)?
*/
int
f1 (void *a, void *b)
@@ -53,7 +53,7 @@ f3 (void *a, void *b)
/* Don't inline if the length is too large for one operation.
** f4:
** li\s+a2,\d+
-** tail\s+memcmp
+** tail\s+memcmp(?:@plt)?
*/
int
f4 (void *a, void *b)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-1.c
index 654c800..5e35204 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! riscv_abi_e } } } */
-/* { dg-additional-options "-O1 -fno-schedule-insns -fno-schedule-insns2" } */
+/* { dg-additional-options "-O1 -fno-schedule-insns -fno-schedule-insns2 -fno-pie" } */
/* { dg-add-options riscv_v } */
/* { dg-final { check-function-bodies "**" "" } } */
@@ -109,4 +109,4 @@ void f3 ()
memcpy (&a_a, &a_b, sizeof a_a);
}
-/* { dg-final { scan-assembler-not {\m(tail|call)\s+memcpy\M} } } */
+/* { dg-final { scan-assembler-not {\m(tail|call)\s+memcpy(?:@plt)?\M} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/movmem-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/movmem-1.c
index 03e633b..44bf3d7 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/movmem-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/movmem-1.c
@@ -52,7 +52,7 @@ f3 (char *a, char const *b)
/* Don't vectorise if the move is too large for one operation
** f4:
** li\s+a2,\d+
-** tail\s+memmove
+** tail\s+memmove(?:@plt)?
*/
char *
f4 (char *a, char const *b)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr114352-3.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr114352-3.c
index 9bfa39c..4f375e5 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/pr114352-3.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr114352-3.c
@@ -93,9 +93,9 @@ test_5 (_Float16 *a, _Float16 *b, _Float16 *out, unsigned count)
/*
** test_6:
** ...
-** call\s+__extendhfsf2
+** call\s+__extendhfsf2(?:@plt)?
** ...
-** call\s+__truncsfhf2
+** call\s+__truncsfhf2(?:@plt)?
** ...
*/
void
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-1.c
index a22d366..490445f 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-1.c
@@ -94,7 +94,7 @@ f6 (void *a, int const b)
/* Don't vectorise if the move is too large for one operation.
** f7:
** li\s+a2,\d+
-** tail\s+memset
+** tail\s+memset(?:@plt)?
*/
void *
f7 (void *a, int const b)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-2.c
index a108868..876929e 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-2.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-2.c
@@ -44,7 +44,7 @@ f2 (void *a, int const b)
/* Don't vectorise if the move is too large for requested lmul.
** f3:
** li\s+a2,\d+
-** tail\s+memset
+** tail\s+memset(?:@plt)?
*/
void *
f3 (void *a, int const b)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-3.c b/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-3.c
index 460a8f2..a185916 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-3.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/setmem-3.c
@@ -62,7 +62,7 @@ f3 (void *a, int const b)
/* Don't vectorise if the move is too large for requested lmul.
** f4:
** li\s+a2,\d+
-** tail\s+memset
+** tail\s+memset(?:@plt)?
*/
void *
f4 (void *a, int const b)
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c
index 7e5758b..375d316 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/spill-9.c
@@ -18,7 +18,7 @@ void f (char*);
** ...
** addi\ta0,sp,15
** andi\ta0,a0,-16
-** call\tf
+** call\tf(?:@plt)?
** ...
** lw\tra,12\(sp\)
** lw\ts0,8\(sp\)
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..84d3c4c 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c
@@ -1,4 +1,4 @@
-/* { 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" } */
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/riscv/zcmp_stack_alignment.c b/gcc/testsuite/gcc.target/riscv/zcmp_stack_alignment.c
index f7d8f44..be304e7 100644
--- a/gcc/testsuite/gcc.target/riscv/zcmp_stack_alignment.c
+++ b/gcc/testsuite/gcc.target/riscv/zcmp_stack_alignment.c
@@ -10,7 +10,7 @@ bar ();
**fool_rv32e:
** cm.push {ra}, -32
** ...
-** call bar
+** call bar(?:@plt)?
** ...
** lw a[0-5],32\(sp\)
** ...
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/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/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