aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog200
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-1.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-2.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119614-3.c28
-rw-r--r--gcc/testsuite/c-c++-common/pr119616.c23
-rw-r--r--gcc/testsuite/c-c++-common/pr119618.c21
-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/cpp/embed-26.C63
-rw-r--r--gcc/testsuite/g++.dg/cpp/pr119391.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr119563.C79
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-requires41.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-requires2.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-requires3.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-requires4.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-requires5.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite6.C33
-rw-r--r--gcc/testsuite/g++.dg/opt/pr119613.C22
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr46534.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtin-apply5.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/torture/pr119599-1.c27
-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/vect-fncall-mask.c8
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/mve.exp3
-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/pr115910.c20
-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/mcpu-xiangshan-nanhu.c4
-rw-r--r--gcc/testsuite/gcc.target/riscv/rvv/base/vwaddsub-1.c2
76 files changed, 2168 insertions, 22 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1146a9e..9bc53e0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,203 @@
+2025-04-03 Thomas Schwinge <tschwinge@baylibre.com>
+
+ PR target/119573
+ * gcc.c-torture/compile/pr46534.c: Don't 'dg-skip-if' nvptx.
+ * gcc.target/nvptx/decl.c: Adjust.
+
+2025-04-03 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp2a/spaceship-rewrite6.C: New test.
+
+2025-04-03 Victor Do Nascimento <victor.donascimento@arm.com>
+
+ PR testsuite/118597
+ * gcc.dg/vect/vect-fncall-mask.c: Update test directives.
+
+2025-04-03 Bob Dubner <rdubner@symas.com>
+
+ * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob: New testcase.
+ * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob: Likewise.
+ * cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob: Likewise.
+ * cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob: Likewise.
+ * cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob: Likewise.
+ * cobol.dg/group2/INSPECT_CONVERTING_NULL.cob: Likewise.
+ * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob: Likewise.
+ * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_1.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_2.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_3.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_4.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_5.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_5-f.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_5-r.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_6.cob: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_7.cob: Likewise.
+ * cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob: Likewise.
+ * cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob: Likewise.
+ * cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob: Likewise.
+ * cobol.dg/group2/INSPECT_TALLYING_AFTER.cob: Likewise.
+ * cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob: Likewise.
+ * cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob: Likewise.
+ * cobol.dg/group2/INSPECT_TRAILING.cob: Likewise.
+ * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out: New known-good result.
+ * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out: Likewise.
+ * cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out: Likewise.
+ * cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out: Likewise.
+ * cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out: Likewise.
+ * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_1.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_2.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_3.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_4.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_5-f.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_5.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_5-r.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_6.out: Likewise.
+ * cobol.dg/group2/INSPECT_ISO_Example_7.out: Likewise.
+ * cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out: Likewise.
+ * cobol.dg/group2/INSPECT_TRAILING.out: Likewise.
+
+2025-04-03 Andrew Pinski <quic_apinski@quicinc.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/119563
+ * g++.dg/cpp0x/pr119563.C: New test.
+ * g++.dg/cpp/embed-26.C: New test.
+
+2025-04-03 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.dg/guality/pr90074.c: Remove xfail for aarch64.
+ * gcc.dg/guality/pr90716.c: Likewise.
+
+2025-04-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * gcc.target/i386/pr111673.c (dg-options): Add
+ -fasynchronous-unwind-tables -fdwarf2-cfi-asm.
+ * gcc.target/i386/pr82142a.c: Likewise.
+ * gcc.target/i386/pr82142b.c (dg-options): Add -mno-stackrealign
+ -fasynchronous-unwind-tables -fdwarf2-cfi-asm.
+
+2025-04-03 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.target/riscv/rvv/base/vwaddsub-1.c: Require rv64.
+
+2025-04-03 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.target/riscv/mcpu-xiangshan-nanhu.c: Skip on non-rv64.
+
+2025-04-03 Alexandre Oliva <oliva@adacore.com>
+
+ PR tree-optimization/113281
+ * gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c: XFAIL.
+ * gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c: Likewise.
+ * gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c: Likewise.
+
+2025-04-03 Alexandre Oliva <oliva@adacore.com>
+
+ * gcc.dg/tree-ssa/ssa-dom-cse-2.c: XFAIL on riscv lp64.
+
+2025-04-03 Hongyu Wang <hongyu.wang@intel.com>
+
+ PR target/119539
+ * gcc.target/i386/apx-nf-pr119539.c: New test.
+
+2025-04-02 Jin Ma <jinma@linux.alibaba.com>
+
+ * gcc.target/riscv/zba-shNadd-09.c: New test.
+ * gcc.target/riscv/zba-shNadd-10.c: New test.
+
+2025-04-02 John David Anglin <danglin@gcc.gnu.org>
+
+ * g++.dg/modules/pr98893_b.C: xfail __tcf_ZL1b
+ assembler check on hppa*-*-hpux*.
+
+2025-04-02 John David Anglin <danglin@gcc.gnu.org>
+
+ * g++.dg/abi/abi-tag18a.C: Skip on hppa*-*-hpux*.
+
+2025-04-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/119491
+ * g++.dg/opt/musttail3.C: New test.
+ * g++.dg/opt/musttail4.C: New test.
+ * g++.dg/opt/musttail5.C: New test.
+
+2025-04-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/119582
+ * gcc.dg/asan/pr119582.c: New test.
+
+2025-04-02 Sandra Loosemore <sloosemore@baylibre.com>
+
+ PR middle-end/118965
+ * c-c++-common/gomp/append-args-1.c: Add target/targetsync
+ modifiers so tests do what they were previously supposed to do.
+ Adjust expected output.
+ * c-c++-common/gomp/append-args-7.c: Likewise.
+ * c-c++-common/gomp/append-args-8.c: Likewise.
+ * c-c++-common/gomp/append-args-9.c: Likewise.
+ * c-c++-common/gomp/interop-1.c: Likewise.
+ * c-c++-common/gomp/interop-2.c: Likewise.
+ * c-c++-common/gomp/interop-3.c: Likewise.
+ * c-c++-common/gomp/interop-4.c: Likewise.
+ * c-c++-common/gomp/pr118965-1.c: New.
+ * c-c++-common/gomp/pr118965-2.c: New.
+ * g++.dg/gomp/append-args-1.C: Add target/targetsync modifiers
+ and adjust expected output.
+ * g++.dg/gomp/append-args-2.C: Likewise.
+ * g++.dg/gomp/append-args-6.C: Likewise.
+ * g++.dg/gomp/append-args-7.C: Likewise.
+ * g++.dg/gomp/append-args-8.C: Likewise.
+ * g++.dg/gomp/interop-5.C: Likewise.
+ * gfortran.dg/gomp/append_args-1.f90: Add target/targetsync
+ modifiers and adjust expected output.
+ * gfortran.dg/gomp/append_args-2.f90: Likewise.
+ * gfortran.dg/gomp/append_args-3.f90: Likewise.
+ * gfortran.dg/gomp/append_args-4.f90: Likewise.
+ * gfortran.dg/gomp/interop-1.f90: Likewise.
+ * gfortran.dg/gomp/interop-2.f90: Likewise.
+ * gfortran.dg/gomp/interop-3.f90: Likewise.
+ * gfortran.dg/gomp/interop-4.f90: Likewise.
+ * gfortran.dg/gomp/pr118965-1.f90: New.
+ * gfortran.dg/gomp/pr118965-2.f90: New.
+
+2025-04-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/119586
+ * gcc.dg/vect/pr119586.c: New testcase.
+
+2025-04-02 Jonathan Yong <10walls@gmail.com>
+
+ * gcc.dg/analyzer/torture/switch-3.c: Fix llp64 warnings.
+
+2025-04-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR ipa/119376
+ * c-c++-common/musttail8.c: Expect a warning rather than error in one
+ case.
+ (f4): Add int * argument.
+ * c-c++-common/musttail15.c: Don't disallow for C++98.
+ * c-c++-common/musttail16.c: Likewise.
+ * c-c++-common/musttail17.c: Likewise.
+ * c-c++-common/musttail18.c: Likewise.
+ * c-c++-common/musttail19.c: Likewise. Expect a warning rather than
+ error in one case.
+ (f4): Add int * argument.
+ * c-c++-common/musttail20.c: Don't disallow for C++98.
+ * c-c++-common/musttail21.c: Likewise.
+ * c-c++-common/musttail28.c: New test.
+ * c-c++-common/musttail29.c: New test.
+ * c-c++-common/musttail30.c: New test.
+ * c-c++-common/musttail31.c: New test.
+ * g++.dg/ext/musttail1.C: New test.
+ * g++.dg/ext/musttail2.C: New test.
+ * g++.dg/ext/musttail3.C: New test.
+
+2025-04-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/119556
+ * gcc.target/arm/short-vfp-1.c: Add missing spaces.
+
2025-04-01 Nathaniel Shead <nathanieloshead@gmail.com>
PR c++/119551
diff --git a/gcc/testsuite/c-c++-common/pr119614-1.c b/gcc/testsuite/c-c++-common/pr119614-1.c
new file mode 100644
index 0000000..89105a3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-1.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] const char *
+foo (int x)
+{
+ v += x;
+ return 0;
+}
+
+const char *
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+const char *
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-2.c b/gcc/testsuite/c-c++-common/pr119614-2.c
new file mode 100644
index 0000000..8833eee
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-2.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] const char *
+foo (int x)
+{
+ v += x;
+ return (const char *) -42;
+}
+
+const char *
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+const char *
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119614-3.c b/gcc/testsuite/c-c++-common/pr119614-3.c
new file mode 100644
index 0000000..59ed36b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119614-3.c
@@ -0,0 +1,28 @@
+/* PR tree-optimization/119614 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-O2" } */
+
+volatile int v;
+
+[[gnu::noinline]] double
+foo (int x)
+{
+ v += x;
+ return 0.5;
+}
+
+double
+bar (int x)
+{
+ if (x == 42)
+ [[gnu::musttail]] return foo (42);
+ [[gnu::musttail]] return foo (32);
+}
+
+double
+baz (int x)
+{
+ if (x == 5)
+ return foo (42);
+ return foo (32);
+}
diff --git a/gcc/testsuite/c-c++-common/pr119616.c b/gcc/testsuite/c-c++-common/pr119616.c
new file mode 100644
index 0000000..5ffdb8c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119616.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/119616 */
+/* { dg-do compile { target external_musttail } } */
+/* { dg-options "-O2" } */
+
+int foo (int *);
+int bar (int);
+
+int
+baz (int x)
+{
+ if (!x)
+ [[gnu::musttail]] return bar (x);
+ return foo (&x);
+}
+
+int
+qux (int x)
+{
+ if (!x)
+ [[gnu::musttail]] return bar (x);
+ foo (&x);
+ return 1;
+}
diff --git a/gcc/testsuite/c-c++-common/pr119618.c b/gcc/testsuite/c-c++-common/pr119618.c
new file mode 100644
index 0000000..a56e669
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr119618.c
@@ -0,0 +1,21 @@
+/* PR gcov-profile/119618 */
+/* { dg-do compile { target musttail } } */
+/* { dg-options "-fcompare-debug -fprofile-generate -O1" } */
+/* { dg-require-profiling "-fprofile-generate" } */
+
+struct S { char s; };
+int foo (void);
+int *(*fn) (void);
+
+int *
+bar (void)
+{
+ if (foo ())
+ return 0;
+ {
+ struct S s;
+ do
+ [[gnu::musttail]] return fn ();
+ while (0);
+ }
+}
diff --git a/gcc/testsuite/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/cpp/embed-26.C b/gcc/testsuite/g++.dg/cpp/embed-26.C
new file mode 100644
index 0000000..ad3f9de
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/embed-26.C
@@ -0,0 +1,63 @@
+// PR c++/119563
+// { dg-do run { target c++11 } }
+// { dg-options "-O2" }
+
+namespace std {
+template <typename T>
+struct initializer_list {
+private:
+ T *_M_array;
+ decltype (sizeof 0) _M_len;
+public:
+ constexpr decltype (sizeof 0)
+ size () const noexcept { return _M_len; }
+ constexpr const T *
+ begin () const noexcept { return _M_array; }
+ constexpr const T *
+ end () const noexcept { return begin () + size (); }
+};
+}
+
+struct A {} a;
+
+struct B {
+ constexpr B (int x) : B (a, x) {}
+ template <typename... T>
+ constexpr B (A, T... x) : b(x...) {}
+ int b;
+};
+
+struct C {
+ C (std::initializer_list<B> x)
+ {
+ unsigned char buf[] = {
+#embed __FILE__
+ };
+ if (x.size () != 2 * sizeof (buf) + 1024)
+ __builtin_abort ();
+ unsigned int i = 0;
+ for (auto a = x.begin (); a < x.end (); ++a, ++i)
+ if (a->b != (i < sizeof (buf) ? buf[i]
+ : i < sizeof (buf) + 1024 ? ((i - sizeof (buf)) & 7) + 1
+ : buf[i - sizeof (buf) - 1024]))
+ __builtin_abort ();
+ c = true;
+ }
+ bool c;
+};
+
+#define D 1 + 0, 2 + 0, 3 + 0, 4 + 0, 5 + 0, 6 + 0, 7 + 0, 8 + 0
+#define E D, D, D, D, D, D, D, D, D, D, D, D, D, D, D, D
+
+C c {
+#embed __FILE__ suffix (,)
+ E, E, E, E, E, E, E, E,
+#embed __FILE__
+};
+
+int
+main ()
+{
+ if (!c.c)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp/pr119391.C b/gcc/testsuite/g++.dg/cpp/pr119391.C
new file mode 100644
index 0000000..6e70efc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/pr119391.C
@@ -0,0 +1,15 @@
+// PR preprocessor/119391
+// { dg-do preprocess }
+// { dg-options "" }
+
+#if (1 << 63) != -9223372036854775807 - 1 // { dg-warning "integer overflow in preprocessor expression" "" { target c++98_only } }
+#warning "Unexpected value"
+#endif
+#if (3 << 62) != -4611686018427387904 // { dg-warning "integer overflow in preprocessor expression" "" { target c++98_only } }
+#warning "Unexpected value"
+#endif
+#if 1 << 64 // { dg-warning "integer overflow in preprocessor expression" }
+#endif
+#if (3 << 63) != -9223372036854775807 - 1 // { dg-warning "integer overflow in preprocessor expression" "" { target c++17_down } }
+#warning "Unexpected value"
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp0x/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/concepts-requires41.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires41.C
new file mode 100644
index 0000000..28c9761
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires41.C
@@ -0,0 +1,25 @@
+// PR c++/117849
+// { dg-do compile { target c++20 } }
+
+template<int N>
+struct array {
+ constexpr int size() const { return N; }
+};
+
+struct vector {
+ int _size = 3;
+ constexpr int size() const { return _size; }
+};
+
+template<int N>
+struct integral_constant {
+ constexpr operator int() const { return N; }
+};
+
+template<class T>
+concept StaticSize = requires (T& t) {
+ typename integral_constant<t.size()>;
+};
+
+static_assert(StaticSize<array<5>>);
+static_assert(!StaticSize<vector>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires2.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires2.C
new file mode 100644
index 0000000..be5a71a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires2.C
@@ -0,0 +1,8 @@
+// PR c++/99546
+// { dg-do compile { target c++20 } }
+
+int main() {
+ constexpr auto b = requires { []{}; };
+ static_assert(b);
+ static_assert(!b); // { dg-error "assertion failed" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires3.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires3.C
new file mode 100644
index 0000000..8c4ef06
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires3.C
@@ -0,0 +1,6 @@
+// PR c++/113925
+// { dg-do compile { target c++20 } }
+
+template<bool B>
+struct b{};
+static_assert(requires { b<([]()consteval{ return true; }())>{}; });
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires4.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires4.C
new file mode 100644
index 0000000..f3bb041
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires4.C
@@ -0,0 +1,6 @@
+// PR c++/106976
+// { dg-do compile { target c++20 } }
+
+struct S{
+ constexpr static auto s = requires { []; }; // { dg-error "expected '\{'" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-requires5.C b/gcc/testsuite/g++.dg/cpp2a/lambda-requires5.C
new file mode 100644
index 0000000..c818313
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-requires5.C
@@ -0,0 +1,10 @@
+// PR c++/109961
+// { dg-do compile { target c++20 } }
+
+auto a = requires{
+ []( int b ) consteval {
+ if( b ) {
+ throw b;
+ }
+ }( 0 );
+};
diff --git a/gcc/testsuite/g++.dg/cpp2a/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/opt/pr119613.C b/gcc/testsuite/g++.dg/opt/pr119613.C
new file mode 100644
index 0000000..432a30c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr119613.C
@@ -0,0 +1,22 @@
+// PR middle-end/119613
+// { dg-do compile { target { musttail && { c || c++11 } } } }
+// { dg-options "-O0" }
+
+struct S { S () {} };
+char *foo (S);
+void bar (int);
+
+[[gnu::always_inline]] inline char *
+baz (S x)
+{
+ unsigned i;
+ &i;
+ bar (i);
+ [[gnu::musttail]] return foo (x);
+}
+
+char *
+qux (S)
+{
+ [[gnu::musttail]] return baz (S {});
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46534.c b/gcc/testsuite/gcc.c-torture/compile/pr46534.c
index 1894636..7f10bc0 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr46534.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr46534.c
@@ -1,4 +1,3 @@
-/* { dg-skip-if "too big" { nvptx-*-* } } */
/* PR middle-end/46534 */
extern int printf (const char *, ...);
diff --git a/gcc/testsuite/gcc.dg/builtin-apply5.c b/gcc/testsuite/gcc.dg/builtin-apply5.c
new file mode 100644
index 0000000..16892f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtin-apply5.c
@@ -0,0 +1,23 @@
+/* { dg-options "-O2 -Wmissing-noreturn -fgnu89-inline" } */
+/* { dg-additional-options "-mno-mmx" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+/* { dg-do compile } */
+
+extern void abort (void);
+
+double
+foo (int arg)
+{
+ if (arg != 116)
+ abort();
+ return arg + 1;
+}
+
+__attribute__((noreturn))
+double
+bar (int arg)
+{
+ foo (arg);
+ __builtin_return (__builtin_apply ((void (*) ()) foo, /* { dg-warning "'noreturn' function does return" } */
+ __builtin_apply_args (), 16));
+}
+
diff --git a/gcc/testsuite/gcc.dg/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/torture/pr119599-1.c b/gcc/testsuite/gcc.dg/torture/pr119599-1.c
new file mode 100644
index 0000000..4fbd228
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr119599-1.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-einline" } */
+
+/* PR ipa/119599 */
+/* inlining a noreturn function which returns
+ can cause an ICE when dealing finding an unreachable block.
+ We should get a __builtin_unreachable after the inliing. */
+
+
+void baz (void);
+
+static inline __attribute__((always_inline, noreturn)) void
+bar (void)
+{
+ static volatile int t = 0;
+ if (t == 0)
+ baz ();
+} /* { dg-warning "function does return" } */
+
+void
+foo (void)
+{
+ bar ();
+}
+
+/* After inlining, we should have call to __builtin_unreachable now. */
+/* { dg-final { scan-tree-dump "__builtin_unreachable " "einline" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-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/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/mve/mve.exp b/gcc/testsuite/gcc.target/arm/mve/mve.exp
index a5d8511..9dc56c9 100644
--- a/gcc/testsuite/gcc.target/arm/mve/mve.exp
+++ b/gcc/testsuite/gcc.target/arm/mve/mve.exp
@@ -35,6 +35,7 @@ global dg_runtest_extra_prunes
set dg_runtest_extra_prunes ""
lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'"
+set saved-dg-do-what-default ${dg-do-what-default}
set dg-do-what-default "assemble"
# Initialize `dg'.
@@ -53,6 +54,8 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/general-c/*.\[cCS\]]] \
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
"" $DEFAULT_CFLAGS
+set dg-do-what-default ${saved-dg-do-what-default}
+
# All done.
set dg_runtest_extra_prunes ""
dg-finish
diff --git a/gcc/testsuite/gcc.target/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/pr115910.c b/gcc/testsuite/gcc.target/i386/pr115910.c
new file mode 100644
index 0000000..5f1cd9a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr115910.c
@@ -0,0 +1,20 @@
+/* PR target/115910 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -march=x86-64 -mtune=generic -masm=att" } */
+/* { dg-final { scan-assembler-times {\timulq\t} 2 } } */
+/* { dg-final { scan-assembler-times {\tshrq\t\$33,} 2 } } */
+/* { dg-final { scan-assembler-not {\tsarl\t} } } */
+
+int
+foo (int x)
+{
+ if (x < 0)
+ __builtin_unreachable ();
+ return x / 3U;
+}
+
+int
+bar (int x)
+{
+ return x / 3U;
+}
diff --git a/gcc/testsuite/gcc.target/i386/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/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/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" } */