diff options
Diffstat (limited to 'gcc/testsuite')
444 files changed, 9602 insertions, 662 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 75e4703..25aca79 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,792 @@ +2025-04-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119564 + * g++.dg/modules/gc-3_a.C: New test. + * g++.dg/modules/gc-3_b.C: New test. + +2025-04-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119608 + * g++.dg/modules/pr119608_a.C: New test. + * g++.dg/modules/pr119608_b.C: New test. + +2025-04-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119462 + * g++.dg/modules/noexcept-3_a.C: New test. + * g++.dg/modules/noexcept-3_b.C: New test. + * g++.dg/modules/noexcept-3_c.C: New test. + +2025-04-04 Bob Dubner <rdubner@symas.com> + + * cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob: New testcase. + * cobol.dg/group2/FUNCTION_ABS.cob: Likewise. + * cobol.dg/group2/FUNCTION_ACOS.cob: Likewise. + * cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob: Likewise. + * cobol.dg/group2/FUNCTION_ANNUITY.cob: Likewise. + * cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob: Likewise. + * cobol.dg/group2/FUNCTION_ASIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_ATAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob: Likewise. + * cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob: Likewise. + * cobol.dg/group2/FUNCTION_CHAR.cob: Likewise. + * cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_COS.cob: Likewise. + * cobol.dg/group2/FUNCTION_CURRENT-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob: Likewise. + * cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob: Likewise. + * cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob: Likewise. + * cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob: Likewise. + * cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob: Likewise. + * cobol.dg/group2/FUNCTION_E.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXP10.cob: Likewise. + * cobol.dg/group2/FUNCTION_EXP.cob: Likewise. + * cobol.dg/group2/FUNCTION_FACTORIAL.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_FRACTION-PART.cob: Likewise. + * cobol.dg/group2/FUNCTION_HEX-OF.cob: Likewise. + * cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_INTEGER-PART.cob: Likewise. + * cobol.dg/group2/FUNCTION_LENGTH__1_.cob: Likewise. + * cobol.dg/group2/FUNCTION_LENGTH__2_.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-DATE.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOG10.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOG.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOWER-CASE.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob: Likewise. + * cobol.dg/group2/FUNCTION_MAX.cob: Likewise. + * cobol.dg/group2/FUNCTION_MEAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_MEDIAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_MIDRANGE.cob: Likewise. + * cobol.dg/group2/FUNCTION_MIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_MOD__invalid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_MODULE-NAME.cob: Likewise. + * cobol.dg/group2/FUNCTION_MOD__valid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-C.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL.cob: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-F.cob: Likewise. + * cobol.dg/group2/FUNCTION_ORD.cob: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MAX.cob: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_PI.cob: Likewise. + * cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob: Likewise. + * cobol.dg/group2/FUNCTION_RANDOM.cob: Likewise. + * cobol.dg/group2/FUNCTION_RANGE.cob: Likewise. + * cobol.dg/group2/FUNCTION_REM__invalid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_REM__valid_.cob: Likewise. + * cobol.dg/group2/FUNCTION_REVERSE.cob: Likewise. + * cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob: Likewise. + * cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob: Likewise. + * cobol.dg/group2/FUNCTION_SIGN.cob: Likewise. + * cobol.dg/group2/FUNCTION_SIN.cob: Likewise. + * cobol.dg/group2/FUNCTION_SQRT.cob: Likewise. + * cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_SUM.cob: Likewise. + * cobol.dg/group2/FUNCTION_TAN.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob: Likewise. + * cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob: Likewise. + * cobol.dg/group2/FUNCTION_TRIM.cob: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_zero_length.cob: Likewise. + * cobol.dg/group2/FUNCTION_UPPER-CASE.cob: Likewise. + * cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob: Likewise. + * cobol.dg/group2/FUNCTION_VARIANCE.cob: Likewise. + * cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob: Likewise. + * cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob: Likewise. + * cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob: Likewise. + * cobol.dg/group2/Program-to-program_parameters_and_retvals.cob: Likewise. + * cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob: Likewise. + * cobol.dg/group2/Repository_functions_clause.cob: Likewise. + * cobol.dg/group2/UDF_fibonacci_recursion.cob: Likewise. + * cobol.dg/group2/UDF_in_COMPUTE.cob: Likewise. + * cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob: Likewise. + * cobol.dg/group2/UDF_with_recursion.cob: Likewise. + * cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out: New known-good file. + * cobol.dg/group2/FUNCTION_ABS.out: Likewise. + * cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out: Likewise. + * cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out: Likewise. + * cobol.dg/group2/FUNCTION_BIGGER-POINTER.out: Likewise. + * cobol.dg/group2/FUNCTION_BYTE-LENGTH.out: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out: Likewise. + * cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out: Likewise. + * cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out: Likewise. + * cobol.dg/group2/FUNCTION_HEX-OF.out: Likewise. + * cobol.dg/group2/FUNCTION_LENGTH__2_.out: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-DATE.out: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out: Likewise. + * cobol.dg/group2/FUNCTION_LOCALE-TIME.out: Likewise. + * cobol.dg/group2/FUNCTION_MAX.out: Likewise. + * cobol.dg/group2/FUNCTION_MEAN.out: Likewise. + * cobol.dg/group2/FUNCTION_MEDIAN.out: Likewise. + * cobol.dg/group2/FUNCTION_MIDRANGE.out: Likewise. + * cobol.dg/group2/FUNCTION_MIN.out: Likewise. + * cobol.dg/group2/FUNCTION_MODULE-NAME.out: Likewise. + * cobol.dg/group2/FUNCTION_NUMVAL-F.out: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MAX.out: Likewise. + * cobol.dg/group2/FUNCTION_ORD-MIN.out: Likewise. + * cobol.dg/group2/FUNCTION_ORD.out: Likewise. + * cobol.dg/group2/FUNCTION_PRESENT-VALUE.out: Likewise. + * cobol.dg/group2/FUNCTION_SUBSTITUTE.out: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out: Likewise. + * cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out: Likewise. + * cobol.dg/group2/FUNCTION_TRIM.out: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out: Likewise. + * cobol.dg/group2/FUNCTION_TRIM_zero_length.out: Likewise. + * cobol.dg/group2/Program-to-program_parameters_and_retvals.out: Likewise. + * cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out: Likewise. + * cobol.dg/group2/Repository_functions_clause.out: Likewise. + * cobol.dg/group2/UDF_fibonacci_recursion.out: Likewise. + * cobol.dg/group2/UDF_in_COMPUTE.out: Likewise. + * cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out: Likewise. + * cobol.dg/group2/UDF_with_recursion.out: Likewise. + +2025-04-04 Jason Merrill <jason@redhat.com> + + PR c++/99546 + PR c++/113925 + PR c++/106976 + PR c++/109961 + PR c++/117336 + * g++.dg/cpp2a/lambda-requires2.C: New test. + * g++.dg/cpp2a/lambda-requires3.C: New test. + * g++.dg/cpp2a/lambda-requires4.C: New test. + * g++.dg/cpp2a/lambda-requires5.C: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR gcov-profile/119618 + * c-c++-common/pr119618.c: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119616 + * c-c++-common/pr119616.c: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/119613 + * g++.dg/opt/pr119613.C: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR target/115910 + * gcc.target/i386/pr115910.c: New test. + +2025-04-04 Patrick Palka <ppalka@redhat.com> + + PR c++/117849 + * g++.dg/cpp2a/concepts-requires41.C: New test. + +2025-04-04 Andrew Pinski <quic_apinski@quicinc.com> + + PR ipa/119599 + * gcc.dg/torture/pr119599-1.c: New test. + * gcc.dg/builtin-apply5.c: New test. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/119391 + * g++.dg/cpp/pr119391.C: New test. + +2025-04-04 Richard Earnshaw <rearnsha@arm.com> + + * gcc.target/arm/mve/mve.exp: Save dg-do-what-default before + changing it. Restore it once done. + +2025-04-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119614 + * c-c++-common/pr119614-1.c: New test. + * c-c++-common/pr119614-2.c: New test. + * c-c++-common/pr119614-3.c: New test. + +2025-04-03 Thomas Schwinge <tschwinge@baylibre.com> + + PR target/119573 + * gcc.c-torture/compile/pr46534.c: Don't 'dg-skip-if' nvptx. + * gcc.target/nvptx/decl.c: Adjust. + +2025-04-03 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp2a/spaceship-rewrite6.C: New test. + +2025-04-03 Victor Do Nascimento <victor.donascimento@arm.com> + + PR testsuite/118597 + * gcc.dg/vect/vect-fncall-mask.c: Update test directives. + +2025-04-03 Bob Dubner <rdubner@symas.com> + + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob: New testcase. + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_NULL.cob: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_1.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_2.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_3.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_4.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-f.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-r.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_6.cob: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_7.cob: Likewise. + * cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob: Likewise. + * cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob: Likewise. + * cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_AFTER.cob: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob: Likewise. + * cobol.dg/group2/INSPECT_TRAILING.cob: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out: New known-good result. + * cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out: Likewise. + * cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out: Likewise. + * cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_1.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_2.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_3.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_4.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-f.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_5-r.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_6.out: Likewise. + * cobol.dg/group2/INSPECT_ISO_Example_7.out: Likewise. + * cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out: Likewise. + * cobol.dg/group2/INSPECT_TRAILING.out: Likewise. + +2025-04-03 Andrew Pinski <quic_apinski@quicinc.com> + Jakub Jelinek <jakub@redhat.com> + + PR c++/119563 + * g++.dg/cpp0x/pr119563.C: New test. + * g++.dg/cpp/embed-26.C: New test. + +2025-04-03 Christophe Lyon <christophe.lyon@linaro.org> + + * gcc.dg/guality/pr90074.c: Remove xfail for aarch64. + * gcc.dg/guality/pr90716.c: Likewise. + +2025-04-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.target/i386/pr111673.c (dg-options): Add + -fasynchronous-unwind-tables -fdwarf2-cfi-asm. + * gcc.target/i386/pr82142a.c: Likewise. + * gcc.target/i386/pr82142b.c (dg-options): Add -mno-stackrealign + -fasynchronous-unwind-tables -fdwarf2-cfi-asm. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/riscv/rvv/base/vwaddsub-1.c: Require rv64. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/riscv/mcpu-xiangshan-nanhu.c: Skip on non-rv64. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + PR tree-optimization/113281 + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-1.c: XFAIL. + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c: Likewise. + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-5.c: Likewise. + +2025-04-03 Alexandre Oliva <oliva@adacore.com> + + * gcc.dg/tree-ssa/ssa-dom-cse-2.c: XFAIL on riscv lp64. + +2025-04-03 Hongyu Wang <hongyu.wang@intel.com> + + PR target/119539 + * gcc.target/i386/apx-nf-pr119539.c: New test. + +2025-04-02 Jin Ma <jinma@linux.alibaba.com> + + * gcc.target/riscv/zba-shNadd-09.c: New test. + * gcc.target/riscv/zba-shNadd-10.c: New test. + +2025-04-02 John David Anglin <danglin@gcc.gnu.org> + + * g++.dg/modules/pr98893_b.C: xfail __tcf_ZL1b + assembler check on hppa*-*-hpux*. + +2025-04-02 John David Anglin <danglin@gcc.gnu.org> + + * g++.dg/abi/abi-tag18a.C: Skip on hppa*-*-hpux*. + +2025-04-02 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/119491 + * g++.dg/opt/musttail3.C: New test. + * g++.dg/opt/musttail4.C: New test. + * g++.dg/opt/musttail5.C: New test. + +2025-04-02 Jakub Jelinek <jakub@redhat.com> + + PR c/119582 + * gcc.dg/asan/pr119582.c: New test. + +2025-04-02 Sandra Loosemore <sloosemore@baylibre.com> + + PR middle-end/118965 + * c-c++-common/gomp/append-args-1.c: Add target/targetsync + modifiers so tests do what they were previously supposed to do. + Adjust expected output. + * c-c++-common/gomp/append-args-7.c: Likewise. + * c-c++-common/gomp/append-args-8.c: Likewise. + * c-c++-common/gomp/append-args-9.c: Likewise. + * c-c++-common/gomp/interop-1.c: Likewise. + * c-c++-common/gomp/interop-2.c: Likewise. + * c-c++-common/gomp/interop-3.c: Likewise. + * c-c++-common/gomp/interop-4.c: Likewise. + * c-c++-common/gomp/pr118965-1.c: New. + * c-c++-common/gomp/pr118965-2.c: New. + * g++.dg/gomp/append-args-1.C: Add target/targetsync modifiers + and adjust expected output. + * g++.dg/gomp/append-args-2.C: Likewise. + * g++.dg/gomp/append-args-6.C: Likewise. + * g++.dg/gomp/append-args-7.C: Likewise. + * g++.dg/gomp/append-args-8.C: Likewise. + * g++.dg/gomp/interop-5.C: Likewise. + * gfortran.dg/gomp/append_args-1.f90: Add target/targetsync + modifiers and adjust expected output. + * gfortran.dg/gomp/append_args-2.f90: Likewise. + * gfortran.dg/gomp/append_args-3.f90: Likewise. + * gfortran.dg/gomp/append_args-4.f90: Likewise. + * gfortran.dg/gomp/interop-1.f90: Likewise. + * gfortran.dg/gomp/interop-2.f90: Likewise. + * gfortran.dg/gomp/interop-3.f90: Likewise. + * gfortran.dg/gomp/interop-4.f90: Likewise. + * gfortran.dg/gomp/pr118965-1.f90: New. + * gfortran.dg/gomp/pr118965-2.f90: New. + +2025-04-02 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119586 + * gcc.dg/vect/pr119586.c: New testcase. + +2025-04-02 Jonathan Yong <10walls@gmail.com> + + * gcc.dg/analyzer/torture/switch-3.c: Fix llp64 warnings. + +2025-04-02 Jakub Jelinek <jakub@redhat.com> + + PR ipa/119376 + * c-c++-common/musttail8.c: Expect a warning rather than error in one + case. + (f4): Add int * argument. + * c-c++-common/musttail15.c: Don't disallow for C++98. + * c-c++-common/musttail16.c: Likewise. + * c-c++-common/musttail17.c: Likewise. + * c-c++-common/musttail18.c: Likewise. + * c-c++-common/musttail19.c: Likewise. Expect a warning rather than + error in one case. + (f4): Add int * argument. + * c-c++-common/musttail20.c: Don't disallow for C++98. + * c-c++-common/musttail21.c: Likewise. + * c-c++-common/musttail28.c: New test. + * c-c++-common/musttail29.c: New test. + * c-c++-common/musttail30.c: New test. + * c-c++-common/musttail31.c: New test. + * g++.dg/ext/musttail1.C: New test. + * g++.dg/ext/musttail2.C: New test. + * g++.dg/ext/musttail3.C: New test. + +2025-04-02 Christophe Lyon <christophe.lyon@linaro.org> + + PR target/119556 + * gcc.target/arm/short-vfp-1.c: Add missing spaces. + +2025-04-01 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/119551 + * 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. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3606.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3605.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3614.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3615.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3563.rs: New test. + +2025-03-31 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/macros/mbe/macro43.rs: Adjust test to pass with + name resolution 2.0. + * rust/compile/nr2/exclude: Remove macros/mbe/macro43.rs. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3588.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3552.rs: New test. + +2025-03-31 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/self_import_namespace.rs: New test. + +2025-03-31 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/nr2/exclude: Remove now passing tests from exclusion + list. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3554-1.rs: New test. + * rust/compile/issue-3554-2.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/nr2/exclude: nr2 puts out a different error multiple times + * rust/compile/issue-3568.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3566-1.rs: New test. + * rust/compile/issue-3566-2.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3553.rs: New test. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3567.rs: New test. + +2025-03-31 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/issue-2905-2.rs: Import from core library into a single + file misses the crate directives. + +2025-03-31 Philip Herron <herron.philip@googlemail.com> + + * rust/compile/issue-3242.rs: no longer skip the test + +2025-03-31 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/issue-3541-1.rs: New test. + * rust/compile/issue-3541-2.rs: Likewise. + +2025-03-31 Arthur Cohen <arthur.cohen@embecosm.com> + + * rust/compile/cfg-core1.rs: New test. + * rust/compile/cfg-core2.rs: New test. + +2025-03-31 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/issue-3549.rs: New test. + +2025-03-31 Owen Avery <powerboat9.gamer@gmail.com> + + * rust/compile/const_generics_3.rs: Modify test to run with name + resolution 2.0 only and to handle the absence of a bogus + resolution error. + * rust/compile/nr2/exclude: Remove const_generics_3.rs. + +2025-03-31 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/nr2/exclude: Remove test from exclusion list. + +2025-03-31 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/issue-2330.rs: Use complete path from crate root. + * rust/compile/issue-1901.rs: Likewise. + * rust/compile/issue-1981.rs: Likewise. + * rust/compile/iterators1.rs: Likewise. + * rust/compile/sizeof-stray-infer-var-bug.rs: Likewise. + * rust/compile/for-loop1.rs: Likewise. + * rust/compile/for-loop2.rs: Likewise. + * rust/compile/torture/builtin_abort.rs: Likewise. + * rust/compile/torture/uninit-intrinsic-1.rs: Likewise. + +2025-03-31 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> + + * rust/compile/feature_rust_attri0.rs: Add extern + function declaration and change name to printf. + * rust/compile/nr2/exclude: Remove now passing test from exclusion + list. + +2025-03-31 Iain Buclaw <ibuclaw@gdcproject.org> + + PR d/117002 + * gdc.dg/torture/pr117002.d: New test. + +2025-03-31 Marek Polacek <polacek@redhat.com> + + PR c++/116960 + PR c++/119303 + * g++.dg/cpp2a/lambda-uneval26.C: New test. + * g++.dg/warn/undefined2.C: New test. + +2025-03-31 Andre Simoes Dias Vieira <andre.simoesdiasvieira@arm.com> + + * gcc.target/aarch64/no-sve-with-sme-1.c: New. + * gcc.target/aarch64/no-sve-with-sme-2.c: New. + * gcc.target/aarch64/no-sve-with-sme-3.c: New. + * gcc.target/aarch64/no-sve-with-sme-4.c: New. + * gcc.target/aarch64/pragma_cpp_predefs_4.c: Pass +sve2 to existing + +sme pragma. + * gcc.target/aarch64/sve/acle/general-c/binary_int_opt_single_n_2.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_opt_single_n_2.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_single_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_int_opt_single_1.c: + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_2.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_3.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_4.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_2.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_3.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binary_za_slice_uint_opt_single_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/binaryxn_2.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/clamp_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/compare_scalar_count_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/dot_za_slice_int_lane_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_2.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/dot_za_slice_uint_lane_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/shift_right_imm_narrowxn_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/storexn_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_group_selection_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/ternary_qq_or_011_lane_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/unary_convertxn_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrow_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrowt_1.c: + Likewise. + * gcc.target/aarch64/sve/acle/general-c/unary_za_slice_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/unaryxn_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/write_za_1.c: Likewise. + * gcc.target/aarch64/sve/acle/general-c/write_za_slice_1.c: Likewise. + +2025-03-31 Jason Merrill <jason@redhat.com> + + PR c++/119401 + * g++.dg/cpp2a/lambda-targ11.C: New test. + * g++.dg/cpp2a/lambda-targ12.C: New file. + +2025-03-31 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119532 + * gcc.dg/torture/pr119532.c: New testcase. + +2025-03-31 Richard Earnshaw <rearnsha@arm.com> + + * gcc.target/arm/vect-fmaxmin-2.c: New compile test. Split from ... + * gcc.target/arm/vect-fmaxmin.c: ... here. Remove scan-assembler + subtests. For both, add -funsafe-math-optimizations. + +2025-03-31 Kyrylo Tkachov <ktkachov@nvidia.com> + + PR middle-end/119442 + * gcc.target/aarch64/vls_sve_vec_dup_1.c: New test. + +2025-03-31 Jakub Jelinek <jakub@redhat.com> + + PR c++/119518 + * g++.dg/opt/pr119518.C: New test. + 2025-03-30 Jan Hubicka <hubicka@ucw.cz> * g++.dg/tree-ssa/pr80331.C: 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/c-c++-common/pr119535.c b/gcc/testsuite/c-c++-common/pr119535.c new file mode 100644 index 0000000..fd88cc4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119535.c @@ -0,0 +1,31 @@ +/* PR gcov-profile/119535 +/* { dg-do compile { target musttail } } */ +/* { dg-options "-fprofile-generate -O2" } */ +/* { dg-require-profiling "-fprofile-generate" } */ + +[[gnu::noipa]] int +foo (int x) +{ + return 42 + x; +} + +int +bar (int x) +{ + foo (x); + foo (2); + [[clang::musttail]] return foo (3); +} + +int +baz (int x) +{ + if (x == 42) + return -1; + else if (x == 15) + return 25; + else if (x == 26) + [[clang::musttail]] return foo (4); + else + [[clang::musttail]] return foo (5); +} diff --git a/gcc/testsuite/c-c++-common/pr119537-1.c b/gcc/testsuite/c-c++-common/pr119537-1.c new file mode 100644 index 0000000..7959826 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119537-1.c @@ -0,0 +1,23 @@ +/* PR middle-end/119537 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +volatile int v; +void *bar (void *, void *); + +void +foo (bool z) +{ + if (z) + goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */ + [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */ + /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-2 } */ + [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */ + /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */ + goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-3 } */ +} diff --git a/gcc/testsuite/c-c++-common/pr119537-2.c b/gcc/testsuite/c-c++-common/pr119537-2.c new file mode 100644 index 0000000..7d65672 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119537-2.c @@ -0,0 +1,23 @@ +/* PR middle-end/119537 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +volatile int v; +void *bar (void *, void *); + +void +foo (bool z) +{ + if (z) + goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */ + [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */ + /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-2 } */ + [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */ + /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */ + goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-3 } */ +} 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/FUNCTION_ABS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.cob new file mode 100644 index 0000000..3f4049b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ABS.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.2345. + PROCEDURE DIVISION. + COMPUTE X = FUNCTION ABS( X ) + DISPLAY X + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.out new file mode 100644 index 0000000..ab39cfe --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ABS.out @@ -0,0 +1,2 @@ ++0001.2345 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ACOS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ACOS.cob new file mode 100644 index 0000000..73e192f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ACOS.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ACOS ( -0.2345 ) TO Z. + IF Z NOT = 1.807500521108243435101500438523210 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob new file mode 100644 index 0000000..276c33f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ALL_INTRINSIC_simple_test.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. phase0. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION ALL INTRINSIC. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 work-string pic X(80) VALUE " ABC ". + PROCEDURE DIVISION. + DISPLAY """" TRIM(work-string) """" + goback. + end program phase0. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out new file mode 100644 index 0000000..7b9bc93 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ALL_INTRINSIC_simple_test.out @@ -0,0 +1,2 @@ +"ABC" + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ANNUITY.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ANNUITY.cob new file mode 100644 index 0000000..29049dd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ANNUITY.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ANNUITY ( 3, 5 ) TO Z. + IF Z NOT = 3.002932551319648093841642228739003 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ASIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ASIN.cob new file mode 100644 index 0000000..b364a40 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ASIN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ASIN ( -0.2345 ) TO Y. + IF Y NOT = -0.236704194313346815870178746883458 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ATAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ATAN.cob new file mode 100644 index 0000000..1f884ce --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ATAN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION ATAN ( 1 ) TO Y. + IF Y NOT = 0.785398163397448309615660845819875 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob new file mode 100644 index 0000000..70b40ba --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob @@ -0,0 +1,40 @@ + *> { dg-do run } + *> { dg-options "-dialect ibm" } + *> { dg-output-file "group2/FUNCTION_BIGGER-POINTER.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 N PIC S9(8) COMP-5 value 0. + 01 P REDEFINES N POINTER. + 01 FILLER. + 05 X PIC A(4) VALUE "ABC". + 05 E REDEFINES X PIC A(1) OCCURS 4. + LINKAGE SECTION. + 77 B PIC A. + + PROCEDURE DIVISION. + set P to address of E(1). + + display FUNCTION trim(x) '.' + + set address of B to p. + perform until B = SPACE + display B no advancing + set p up by 1 + set address of B to p + end-perform + display '.' + + set P to address of E(1) + set address of B to p + perform until B = SPACES + display B no advancing + add 1 to N + set address of B to p + end-perform + display '.' + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.out new file mode 100644 index 0000000..d31e83b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.out @@ -0,0 +1,4 @@ +ABC. +ABC. +ABC. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob new file mode 100644 index 0000000..d6d04d1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + *> { dg-options "-dialect ibm" } + *> { dg-output-file "group2/FUNCTION_BIGGER-POINTER__2_.out" } + + identification division. + program-id. prog. + data division. + working-storage section. + 01 n4 pic s9(8) comp-5 value 0. + 01 p4 redefines n4 pointer. + 01 n8 pic s9(16) comp-5 value 0. + 01 p8 redefines n8 pointer. + procedure division. + move -1 to n8 + set p4 to p8 + display "P4 and P8 before: " p4 space p8 + display "Increment N4 and N8" + add 1 to n4 n8 + display "P4 and P8 after: " p4 space p8 + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out new file mode 100644 index 0000000..b15a754 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER__2_.out @@ -0,0 +1,4 @@ +P4 and P8 before: 0xffffffffffffffff 0xffffffffffffffff +Increment N4 and N8 +P4 and P8 after: 0x0000000000000000 0x0000000000000000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob new file mode 100644 index 0000000..9a5f384 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.cob @@ -0,0 +1,20 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_BYTE-LENGTH.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4). + 01 TEST-FLD PIC S9(04)V9(08). + PROCEDURE DIVISION. + MOVE FUNCTION BYTE-LENGTH ( TEST-FLD ) TO TEST-FLD. + DISPLAY "BYTE-LENGTH of PIC S9(04)V9(08) is " TEST-FLD + MOVE FUNCTION BYTE-LENGTH ( X ) TO TEST-FLD. + DISPLAY "BYTE-LENGTH of PIC X(4) is " TEST-FLD + MOVE FUNCTION BYTE-LENGTH ( '00128' ) TO TEST-FLD + DISPLAY "BYTE-LENGTH of PIC '00128' is " TEST-FLD + MOVE FUNCTION BYTE-LENGTH ( x'a0' ) TO TEST-FLD + DISPLAY "BYTE-LENGTH of PIC x'a0' is " TEST-FLD + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.out new file mode 100644 index 0000000..64ad515 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_BYTE-LENGTH.out @@ -0,0 +1,5 @@ +BYTE-LENGTH of PIC S9(04)V9(08) is +0012.00000000 +BYTE-LENGTH of PIC X(4) is +0004.00000000 +BYTE-LENGTH of PIC '00128' is +0005.00000000 +BYTE-LENGTH of PIC x'a0' is +0001.00000000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CHAR.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CHAR.cob new file mode 100644 index 0000000..955cc51 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CHAR.cob @@ -0,0 +1,29 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE 108. + 01 TEST-FLD. + 05 TEST-DATA PIC X(01). + 88 VALID-DATA VALUE 'k'. + 05 TEST-UNSET PIC X VALUE '_'. + 88 VALID-UNSET VALUE '_'. + PROCEDURE DIVISION. + STRING FUNCTION CHAR ( X ) + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING. + EVALUATE TRUE + WHEN NOT VALID-UNSET + DISPLAY "FUNCTION result too long" + END-DISPLAY + WHEN VALID-DATA + CONTINUE + WHEN OTHER + DISPLAY TEST-DATA + END-DISPLAY + END-EVALUATE. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob new file mode 100644 index 0000000..3f9c6e1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_COMBINED-DATETIME.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(04)V9(08). + PROCEDURE DIVISION. + MOVE FUNCTION COMBINED-DATETIME ( 987, 345.6 ) + TO TEST-FLD. + IF TEST-FLD NOT = 987.003456 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob new file mode 100644 index 0000000..d982432 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT___CONCATENATE.cob @@ -0,0 +1,36 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(4). + 01 TEST-FLD. + 05 TEST-DATA PIC X(14). + 88 VALID-DATA VALUE 'defxabczz55666'. + 05 TEST-UNSET PIC X VALUE '_'. + 88 VALID-UNSET VALUE '_'. + PROCEDURE DIVISION. + MOVE "defx" TO Y. + STRING FUNCTION CONCAT ( Y "abc" "zz" "55" "666" ) + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING. + EVALUATE TRUE + WHEN NOT VALID-UNSET + DISPLAY "FUNCTION result too long" + END-DISPLAY + WHEN TEST-DATA + <> FUNCTION CONCAT ( Y "abc" "zz" "55" "666" ) + DISPLAY "CONCAT issue, '" TEST-DATA + "' vs. '" + FUNCTION CONCAT ( Y "abc" "zz" "55" "666" ) "'" + END-DISPLAY + WHEN VALID-DATA + CONTINUE + WHEN OTHER + DISPLAY TEST-DATA + END-DISPLAY + END-EVALUATE. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob new file mode 100644 index 0000000..98f21c3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CONCAT_with_reference_modding.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(4). + 01 TEST-FLD PIC X(9) VALUE SPACES. + PROCEDURE DIVISION. + MOVE 'defx' TO Y. + MOVE FUNCTION CONCAT + ( Y "abc" "zz" "55" "666" ) (2 : 9) + TO TEST-FLD. + IF TEST-FLD NOT = 'efxabczz5' + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_COS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_COS.cob new file mode 100644 index 0000000..6651b9d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_COS.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION COS ( -0.2345 ) TO Y. + IF Y NOT = 0.972630641256258184713416962414561 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_CURRENT-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_CURRENT-DATE.cob new file mode 100644 index 0000000..429f247 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_CURRENT-DATE.cob @@ -0,0 +1,62 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD. + 02 WS-YEAR PIC 9(04). + 88 VALID-YEAR VALUE 1980 THRU 9999. + 02 WS-MONTH PIC 9(02). + 88 VALID-MONTH VALUE 01 THRU 12. + 02 WS-DAY PIC 9(02). + 88 VALID-DAY VALUE 01 THRU 31. + 02 WS-HOUR PIC 9(02). + 88 VALID-HOUR VALUE 00 THRU 23. + 02 WS-MIN PIC 9(02). + 88 VALID-MIN VALUE 00 THRU 59. + 02 WS-SEVALIDD PIC 9(02). + 88 VALID-SEC VALUE 00 THRU 59. + 02 WS-HUNDSEC PIC 9(02). + 88 VALID-HUNDSEC VALUE 00 THRU 99. + 02 WS-GREENW PIC X. + 88 VALID-GREENW VALUE "-", "+", "0". + 88 ZERO-GREENW VALUE "0". + 02 WS-OFFSET PIC 9(02). + 88 VALID-OFFSET VALUE 00 THRU 13. + 88 ZERO-OFFSET VALUE 00. + 02 WS-OFFSET2 PIC 9(02). + 88 VALID-OFFSET2 VALUE 00 THRU 59. + 88 ZERO-OFFSET2 VALUE 00. + 02 WS-UNSET PIC X VALUE '_'. + 88 VALID-UNSET VALUE '_'. + PROCEDURE DIVISION. + STRING FUNCTION CURRENT-DATE + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING. + EVALUATE TRUE + WHEN NOT VALID-UNSET + DISPLAY "FUNCTION result too long" + END-DISPLAY + WHEN VALID-YEAR AND + VALID-MONTH AND + VALID-DAY AND + VALID-HOUR AND + VALID-MIN AND + VALID-SEC AND + VALID-HUNDSEC AND + VALID-GREENW AND + VALID-OFFSET AND + VALID-OFFSET2 AND + VALID-UNSET AND + ((NOT ZERO-GREENW) OR (ZERO-OFFSET AND ZERO-OFFSET2)) + CONTINUE + WHEN OTHER + DISPLAY "CURRENT-DATE with wrong format: " + TEST-FLD (01:21) + END-DISPLAY + END-EVALUATE. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob new file mode 100644 index 0000000..708aa96 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-OF-INTEGER.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DATE-OF-INTEGER ( 146000 ) + TO TEST-FLD. + IF TEST-FLD NOT = 20000925 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob new file mode 100644 index 0000000..5b2bd43 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE-TO-YYYYMMDD.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DATE-TO-YYYYMMDD ( 981002, -10, 1994 ) + TO TEST-FLD. + IF TEST-FLD NOT = 018981002 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob new file mode 100644 index 0000000..bb48bb0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DATE___TIME_OMNIBUS.cob @@ -0,0 +1,334 @@ + *> { dg-do run } + + identification division. + program-id. test. + *> Tests all the DATE and TIME functions + *> + *> The various functions are used to test each other. + *> + *> COMBINED-DATETIME OK + *> CURRENT_DATE OK + *> DATE-OF-INTEGER OK + *> DATE-TO-YYYYMMDD OK + *> DAY-OF-INTEGER OK + *> DAY-TO-YYYYDDD OK + *> FORMATTED-CURRENT-DATE OK + *> FORMATTED-DATE OK + *> FORMATTED-DATETIME OK + *> FORMATTED-TIME OK + *> INTEGER-OF-DATE OK + *> INTEGER-OF-DAY OK + *> INTEGER-OF-FORMATTED-DATE OK + *> SECONDS-FROM-FORMATTED-TIME OK + *> SECONDS-PAST-MIDNIGHT OK + *> TEST-DATE-YYYYMMDD OK + *> TEST-DAY-YYYYDDD OK + *> TEST-FORMATTED-DATETIME OK + *> + data division. + working-storage section. + + 01 checking pic x(80). + 01 should-be pic x(32). + 01 but-is pic x(32). + 01 but-is-n redefines but-is pic 99999999.999999. + 01 but-is-integer_part pic 99999. + + 01 jd1601 pic 9(7). + 01 jd9999 pic 9(7). + 01 jd pic s9(7). + + 01 integer-date pic s9(7). + 01 integer-result pic 99. + 01 standard-date-form pic 9(8). + 01 julian-date-form PIC 9(8). + + 01 date1. + 02 YYYY pic 9999. + 02 MM pic 99. + 02 DD pic 99. + 01 date2. + 02 YYYY pic 9999. + 02 filler pic x value "-". + 02 MM pic 99. + 02 filler pic x value "-". + 02 DD pic 99. + 01 date3. + 02 YYYY pic 9999. + 02 DDD pic 999. + 01 date4. + 02 YYYY pic 9999. + 02 filler pic x value "-". + 02 DDD pic 999. + 01 date5. + 02 YYYY pic 9999. + 02 filler pic x value "W". + 02 ww pic 99. + 02 d pic 9. + 01 date6. + 02 YYYY pic 9999. + 02 filler pic xx value "-W". + 02 ww pic 99. + 02 filler pic x value "-". + 02 d pic 9. + + 01 yymmdd. + 02 YY pic 99. + 02 MM pic 99. + 02 DD pic 99. + + 01 minus10 pic s99 value -10. + + 01 forced_date_n pic X(64) VALUE Z"COB_CURRENT_DATE". + 01 forced_date_v pic X(64) VALUE Z"1945/06/01 12:34:56". + + procedure division. + CALL "setenv" using forced_date_n, forced_date_v + + move "SECONDS-PAST-MIDNIGHT" to checking + move "45296" to should-be + MOVE FUNCTION SECONDS-PAST-MIDNIGHT to but-is-integer_part + move but-is-integer_part to but-is + perform checkit + + *> Establish the initial date integer + move "integer-of-date" to checking + move function integer-of-date(19000101) to jd1601 + move "integer-of-date(19000101)" to checking + move 0109208 to should-be + move jd1601 to but-is + perform checkit + + *> Establish the final date integer + move "integer-of-date" to checking + move function integer-of-date(21011231) to jd9999 + move "integer-of-date(21001231)" to checking + move 0182986 to should-be + move jd9999 to but-is + perform checkit + + *> We are going to do the following tests over all valid dates: + perform varying jd from jd1601 by 1 until jd > jd9999 + + *> Convert JD to all six DATE types: + move FUNCTION FORMATTED-DATE("YYYYMMDD" jd) TO date1 + move FUNCTION FORMATTED-DATE("YYYY-MM-DD" jd) TO date2 + move FUNCTION FORMATTED-DATE("YYYYDDD" jd) TO date3 + move FUNCTION FORMATTED-DATE("YYYY-DDD" jd) TO date4 + move FUNCTION FORMATTED-DATE("YYYYWwwD" jd) TO date5 + move FUNCTION FORMATTED-DATE("YYYY-Www-D" jd) TO date6 + + *> Test the routines that check DATE types + move zero to should-be + move FUNCTION TEST-FORMATTED-DATETIME("YYYYMMDD" date1) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYYMMDD"" date1)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYY-MM-DD" date2) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYY-MM-DD"" date2)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYYDDD" date3) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYYDDD"" date3)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYY-DDD" date4) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYY-DDD"" date4)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYYWwwD" date5) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYYWwwD"" date5)" to checking + perform checkit + move FUNCTION TEST-FORMATTED-DATETIME("YYYY-Www-D" date6) TO but-is + move "TEST-FORMATTED-DATETIME(""YYYY-Www-D"" date6)" to checking + perform checkit + + *> Test the routines that extract the integer date + + move function INTEGER-OF-FORMATTED-DATE("YYYYMMDD" date1) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYYMMDD"" date1)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYY-MM-DD" date2) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYY-MM-DD"" date2)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYYDDD" date3) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYYDDD"" date3)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYY-DDD" date4) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYY-DDD"" date4)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYYWwwD" date5) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYYWwwD"" date5)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function INTEGER-OF-FORMATTED-DATE("YYYY-Www-D" date6) TO integer-date + move "INTEGER-OF-FORMATTED-DATE(""YYYY-Www-D"" date6)" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function DATE-OF-INTEGER(jd) to standard-date-form + move function INTEGER-OF-DATE(standard-date-form) to integer-date + move "DATE-OF-INTEGER and INTEGER-OF-DATE" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function TEST-DATE-YYYYMMDD(standard-date-form) to integer-result + move "TEST-DATE-YYYYMMDD" to checking + move zero to should-be + move integer-result to but-is + perform checkit + + move function DAY-OF-INTEGER(jd) to julian-date-form + move function INTEGER-OF-DAY(julian-date-form) to integer-date + move "DAY-OF-INTEGER and INTEGER-OF-DAY" to checking + move jd to should-be + move integer-date to but-is + perform checkit + + move function TEST-DAY-YYYYDDD(julian-date-form) to integer-result + move "TEST-DAY-YYYYDDD" to checking + move zero to should-be + move integer-result to but-is + perform checkit + end-perform. + + move function integer-of-date(19980101) to jd1601 + move function integer-of-date(19981231) to jd9999 + perform varying jd from jd1601 by 1 until jd > jd9999 + move FUNCTION FORMATTED-DATE("YYYYMMDD" jd) TO date1 + move FUNCTION FORMATTED-DATE("YYYYDDD" jd) TO date3 + + move FUNCTION MOD( YYYY of date1 100) to yy of yymmdd + move MM of date1 to MM of yymmdd + move DD of date1 to DD of yymmdd + + move FUNCTION DATE-TO-YYYYMMDD(yymmdd, minus10, 1994) + to standard-date-form + move "DATE-TO-YYYYMMDD" to checking + move "18" to date1(1:2) + move date1 to should-be + move standard-date-form to but-is + perform checkit + end-perform. + + move "DAY-TO-YYYYDDD" to checking + MOVE 1910004 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(10004 -20 2002) TO but-is + perform checkit + MOVE 1810004 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(10004 -120 2002) TO but-is + perform checkit + MOVE 2010004 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(10004 20 2002) TO but-is + perform checkit + MOVE 1995005 to should-be + MOVE FUNCTION DAY-TO-YYYYDDD(95005 -10 2013) TO but-is + perform checkit + + move "COMBINED-DATETIME" to checking + MOVE "19450601.123456" TO should-be + MOVE FUNCTION COMBINED-DATETIME(19450601 123456) TO but-is-n + perform checkit + + move "CURRENT_DATE" to checking + MOVE "1945060112345600+0000" TO should-be + MOVE FUNCTION CURRENT-DATE TO but-is + move "+0000" to but-is(17:5) + perform checkit + + move "FORMATTED-CURRENT-DATE (1)" to checking + MOVE "1945-06-01T12:34:56" TO should-be + MOVE FUNCTION FORMATTED-CURRENT-DATE("YYYY-MM-DDThh:mm:ss") TO but-is + perform blot-zulu + perform checkit + + move "FORMATTED-CURRENT-DATE (2)" to checking + MOVE "1945-06-01T12:34:56Z" TO should-be + MOVE FUNCTION FORMATTED-CURRENT-DATE("YYYY-MM-DDThh:mm:ssZ") TO but-is + perform blot-zulu + perform checkit + + move "FORMATTED-CURRENT-DATE (3)" to checking + MOVE "1945-06-01T12:34:56-05:00" TO should-be + MOVE FUNCTION FORMATTED-CURRENT-DATE("YYYY-MM-DDThh:mm:ss+hh:mm") TO but-is + perform blot-zulu + perform checkit + + move "formatted-time" to checking + move "01:12:34Z" to should-be + MOVE FUNCTION formatted-time("hh:mm:ssZ" 754 -60 ) to but-is + perform checkit. + + move "00:12:34Z" to should-be + MOVE FUNCTION formatted-time("hh:mm:ssZ" 754 0 ) to but-is + perform checkit. + + move "23:12:34Z" to should-be + MOVE FUNCTION formatted-time("hh:mm:ssZ" 754 60 ) to but-is + perform checkit. + + move "formatted-datetime" to checking + MOVE "1900-01-01T00:00:00-01:00" TO SHOULD-BE + MOVE FUNCTION formatted-datetime("YYYY-MM-DDThh:mm:ss+hh:mm" 0109208 0 -60 ) TO but-is + perform checkit. + + MOVE "1900-01-01T00:00:00+00:00" TO SHOULD-BE + MOVE FUNCTION formatted-datetime("YYYY-MM-DDThh:mm:ss+hh:mm" 0109208 0 -0 ) TO but-is + perform checkit. + + MOVE "1900-01-01T00:00:00+01:00" TO SHOULD-BE + MOVE FUNCTION formatted-datetime("YYYY-MM-DDThh:mm:ss+hh:mm" 0109208 0 +60 ) TO but-is + perform checkit. + + move "SECONDS-FROM-FORMATTED-TIME" to checking + MOVE "00043200.000000" TO SHOULD-BE + MOVE SPACE TO but-is + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME("hh:mm:ss" "12:00:00") TO but-is-n + perform checkit. + + stop run. + + checkit. + *> display "checkit " """" should-be """" space """" but-is """" + if FUNCTION TRIM(should-be) IS NUMERIC AND FUNCTION TRIM(but-is) IS NUMERIC + if FUNCTION NUMVAL(should-be) + not equal to FUNCTION NUMVAL(but-is) + and should-be not equal to but-is + then + display function trim (checking) ":" + " should be " """" function trim (should-be) """" + " but is " """" function trim (but-is) """" + move 1 to return-code + end-if + else + if should-be not equal to but-is + and should-be not equal to but-is + then + display function trim (checking) ":" + " should be " """" function trim (should-be) """" + " but is " """" function trim (but-is) """" + move 1 to return-code + end-if + . + blot-zulu. + move "hh:mm" TO but-is(12:5) + move "hh:mm" TO should-be(12:5) + if but-is(21:1) not equal to space + move "+hh:mm" TO but-is(20:6) + move "+hh:mm" TO should-be(20:6) + end-if + . + end program test. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob new file mode 100644 index 0000000..df70a82 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-OF-INTEGER.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DAY-OF-INTEGER ( 146000 ) + TO TEST-FLD. + IF TEST-FLD NOT = 2000269 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob new file mode 100644 index 0000000..5316a70 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_DAY-TO-YYYYDDD.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION DAY-TO-YYYYDDD ( 95005, -10, 2013 ) + TO TEST-FLD. + IF TEST-FLD NOT = 001995005 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_E.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_E.cob new file mode 100644 index 0000000..e07edf0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_E.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION E TO Y. + IF Y NOT = 2.718281828459045235360287471352662 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob new file mode 100644 index 0000000..e822708 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.cob @@ -0,0 +1,26 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_EXCEPTION-FILE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "NOTEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + DISPLAY FUNCTION EXCEPTION-FILE '|' + NO ADVANCING + END-DISPLAY. + OPEN INPUT TEST-FILE. + DISPLAY FUNCTION EXCEPTION-FILE + NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out new file mode 100644 index 0000000..ece5467 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-FILE.out @@ -0,0 +1 @@ +00|35TEST-FILE diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob new file mode 100644 index 0000000..d68261d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_EXCEPTION-STATEMENT.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "NOTEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + DISPLAY "EXCEPTION-STATEMENT before bad OPEN: " + """" FUNCTION EXCEPTION-STATEMENT """" + OPEN INPUT TEST-FILE. + DISPLAY "EXCEPTION-STATEMENT after bad OPEN: " + """" FUNCTION EXCEPTION-STATEMENT """" + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out new file mode 100644 index 0000000..5656102 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATEMENT.out @@ -0,0 +1,3 @@ +EXCEPTION-STATEMENT before bad OPEN: " " +EXCEPTION-STATEMENT after bad OPEN: "OPEN" + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob new file mode 100644 index 0000000..1ffa366 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_EXCEPTION-STATUS.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + INPUT-OUTPUT SECTION. + FILE-CONTROL. + SELECT TEST-FILE ASSIGN "NOTEXIST" + FILE STATUS IS TEST-STATUS. + DATA DIVISION. + FILE SECTION. + FD TEST-FILE. + 01 TEST-REC PIC X(4). + WORKING-STORAGE SECTION. + 01 TEST-STATUS PIC XX. + PROCEDURE DIVISION. + DISPLAY "EXCEPTION STATUS before bad open: " + """" FUNCTION EXCEPTION-STATUS """" + OPEN INPUT TEST-FILE. + DISPLAY "EXCEPTION STATUS after bad open: " + """" FUNCTION EXCEPTION-STATUS """" + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out new file mode 100644 index 0000000..02b4f84 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXCEPTION-STATUS.out @@ -0,0 +1,3 @@ +EXCEPTION STATUS before bad open: " " +EXCEPTION STATUS after bad open: "EC-I-O-PERMANENT-ERROR" + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP.cob new file mode 100644 index 0000000..756612c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S99V9(31). + PROCEDURE DIVISION. + MOVE FUNCTION EXP ( 3 ) TO Y. + IF Y NOT = 20.0855369231876677409285296545817 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP10.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP10.cob new file mode 100644 index 0000000..a76fcfb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_EXP10.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION EXP10 ( 4 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000010000 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FACTORIAL.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FACTORIAL.cob new file mode 100644 index 0000000..969663c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FACTORIAL.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION FACTORIAL ( 6 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000000720 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob new file mode 100644 index 0000000..cde5644 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE.cob @@ -0,0 +1,54 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(10). + PROCEDURE DIVISION. + *> Test normal inputs. + MOVE FUNCTION FORMATTED-DATE ( "YYYYMMDD", 1 ) TO str + IF str <> "16010101" + DISPLAY "Test 1 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYY-MM-DD", 1 ) TO str + IF str <> "1601-01-01" + DISPLAY "Test 2 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYYDDD", 1 ) TO str + IF str <> "1601001" + DISPLAY "Test 3 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYY-DDD", 1 ) TO str + IF str <> "1601-001" + DISPLAY "Test 4 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYYWwwD", 1 ) TO str + IF str <> "1601W011" + DISPLAY "Test 5 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATE ( "YYYY-Www-D", 1 ) TO str + IF str <> "1601-W01-1" + DISPLAY "Test 6 failed: " str END-DISPLAY + END-IF + + *> Test week number edge cases. + *> For 2012-01-01. + MOVE FUNCTION FORMATTED-DATE ( "YYYYWwwD", 150115 ) TO str + IF str <> "2011W527" + DISPLAY "Test 7 failed: " str END-DISPLAY + END-IF + + *> and for 2013-12-30. + MOVE FUNCTION FORMATTED-DATE ( "YYYYWwwD", 150844 ) TO str + IF str <> "2014W011" + DISPLAY "Test 8 failed: " str END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob new file mode 100644 index 0000000..47654cb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME.cob @@ -0,0 +1,48 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(40). + PROCEDURE DIVISION. + *> Test normal inputs. + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYMMDDThhmmss", 1, 45296) + TO str + IF str <> "16010101T123456" + DISPLAY "Test 1 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATETIME + ("YYYY-MM-DDThh:mm:ss", 1, 45296) + TO str + IF str <> "1601-01-01T12:34:56" + DISPLAY "Test 2 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYDDDThhmmss+hhmm", 1, 45296, -754) + TO str + IF str <> "1601001T123456-1234" + DISPLAY "Test 3 failed: " str END-DISPLAY + END-IF + + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYDDDThhmmss+hhmm", 1, 45296) + TO str + IF str <> "1601001T123456+0000" + DISPLAY "Test 4 failed: " str END-DISPLAY + END-IF + + *> Test underflow to next day due to offset + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYDDDThhmmss.sssssssssZ", 150846, 0, + 1) + TO str + IF str <> "2013365T235900.000000000Z" + DISPLAY "Test 5 failed: " str END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob new file mode 100644 index 0000000..c440755 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATETIME_with_ref_modding.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(04). + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-DATETIME + ("YYYYMMDDThhmmss", 1, 1) (3:4) + TO STR + IF STR NOT = '0101' + DISPLAY STR + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob new file mode 100644 index 0000000..c495e0d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.cob @@ -0,0 +1,69 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. datetime. + PROCEDURE DIVISION. + DISPLAY "FUNCTION FORMATTED-DATETIME - valid format strings" + DISPLAY " FORMATTED-DATE Basic" + DISPLAY FUNCTION FORMATTED-DATE("YYYYMMDD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYYDDD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYYWwwD" 128623). + DISPLAY " FORMATTED-DATE Extended" + DISPLAY FUNCTION FORMATTED-DATE("YYYY-MM-DD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYY-DDD" 128623). + DISPLAY FUNCTION FORMATTED-DATE("YYYY-Www-D" 128623). + DISPLAY " FORMATTED-TIME Basic" + DISPLAY FUNCTION FORMATTED-TIME("hhmmss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss+hhmm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss.ssss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss.ssss+hhmm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmss.ssssZ" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hhmmssZ" 45296.987654321 -300). + DISPLAY " FORMATTED-TIME Extended" + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss+hh:mm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss.ssss" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss.ssss+hh:mm" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ss.ssssZ" 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-TIME("hh:mm:ssZ" 45296.987654321 -300). + DISPLAY " FORMATTED-DATETIME Basic" + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss.ssss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYMMDDThhmmssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss.ssss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYDDDThhmmssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss.ssss+hhmm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYYWwwDThhmmssZ" 128623 45296.987654321 -300). + DISPLAY " FORMATTED-DATETIME Extended" + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss.ssss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-MM-DDThh:mm:ssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss.ssss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-DDDThh:mm:ssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss.ssss" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss.ssss+hh:mm" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ss.ssssZ" 128623 45296.987654321 -300). + DISPLAY FUNCTION FORMATTED-DATETIME("YYYY-Www-DThh:mm:ssZ" 128623 45296.987654321 -300). + END PROGRAM datetime. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out new file mode 100644 index 0000000..5395f4e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_TIME_DATETIME.out @@ -0,0 +1,62 @@ +FUNCTION FORMATTED-DATETIME - valid format strings + FORMATTED-DATE Basic +19530227 +1953058 +1953W095 + FORMATTED-DATE Extended +1953-02-27 +1953-058 +1953-W09-5 + FORMATTED-TIME Basic +123456 +123456-0500 +123456.9876 +123456.9876-0500 +173456.0000Z +173456Z + FORMATTED-TIME Extended +12:34:56 +12:34:56-05:00 +12:34:56.9876 +12:34:56.9876-05:00 +17:34:56.0000Z +17:34:56Z + FORMATTED-DATETIME Basic +19530227T123456 +19530227T123456-0500 +19530227T123456.9876 +19530227T123456.9876-0500 +19530227T173456.0000Z +19530227T173456Z +1953058T123456 +1953058T123456-0500 +1953058T123456.9876 +1953058T123456.9876-0500 +1953058T173456.0000Z +1953058T173456Z +1953W095T123456 +1953W095T123456-0500 +1953W095T123456.9876 +1953W095T123456.9876-0500 +1953W095T173456.0000Z +1953W095T173456Z + FORMATTED-DATETIME Extended +1953-02-27T12:34:56 +1953-02-27T12:34:56-05:00 +1953-02-27T12:34:56.9876 +1953-02-27T12:34:56.9876-05:00 +1953-02-27T17:34:56.0000Z +1953-02-27T17:34:56Z +1953-058T12:34:56 +1953-058T12:34:56-05:00 +1953-058T12:34:56.9876 +1953-058T12:34:56.9876-05:00 +1953-058T17:34:56.0000Z +1953-058T17:34:56Z +1953-W09-5T12:34:56 +1953-W09-5T12:34:56-05:00 +1953-W09-5T12:34:56.9876 +1953-W09-5T12:34:56.9876-05:00 +1953-W09-5T17:34:56.0000Z +1953-W09-5T17:34:56Z + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob new file mode 100644 index 0000000..ac5c828 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-DATE_with_ref_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(04). + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-DATE ("YYYYMMDD", 1) (3:4) + TO STR + IF STR NOT = '0101' + DISPLAY STR + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob new file mode 100644 index 0000000..1abd625 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_DP.COMMA.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(11). + + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-TIME ("hh:mm:ss,ss", 45296) TO str + IF str <> "12:34:56,00" + DISPLAY "Test 1 failed: " str END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob new file mode 100644 index 0000000..cfcf0c7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FORMATTED-TIME_with_ref_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(04). + PROCEDURE DIVISION. + MOVE FUNCTION FORMATTED-TIME ("hhmmss", 45296) (3:4) + TO STR + IF STR NOT = '3456' + DISPLAY STR + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_FRACTION-PART.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_FRACTION-PART.cob new file mode 100644 index 0000000..65f341b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_FRACTION-PART.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(04)V9(04). + PROCEDURE DIVISION. + MOVE FUNCTION FRACTION-PART ( 3.12345 ) + TO TEST-FLD. + IF TEST-FLD NOT = +0000.1234 + DISPLAY 'FRACTION-PART ( +3.12345 ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION FRACTION-PART ( -3.12345 ) + TO TEST-FLD. + IF TEST-FLD NOT = -0000.1234 + DISPLAY 'FRACTION-PART ( -3.12345 ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.cob new file mode 100644 index 0000000..ed31eb6 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.cob @@ -0,0 +1,13 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_HEX-OF.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 PAC PIC 9(5) COMP-3 VALUE 12345. + PROCEDURE DIVISION. + DISPLAY FUNCTION HEX-OF('Hello, world!') + DISPLAY FUNCTION HEX-OF(PAC). + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.out new file mode 100644 index 0000000..40892ac --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_HEX-OF.out @@ -0,0 +1,3 @@ +48656C6C6F2C20776F726C6421 +12345F + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob new file mode 100644 index 0000000..2e59df3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_HIGHEST-ALGEBRAIC.cob @@ -0,0 +1,76 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 F1 PIC S999. + 01 F2 PIC S9(4) BINARY. + 01 F3 PIC 99V9(3). + 01 F4 PIC $**,**9.99BCR. + 01 F5 PIC $**,**9.99. + 01 F6 USAGE BINARY-CHAR SIGNED. + 01 F7 USAGE BINARY-CHAR UNSIGNED. + 01 F8 PIC 999PPP. + 01 F9 PIC P99. + 01 TEST-FLD PIC S9(08)V9(04). + PROCEDURE DIVISION. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F1) + TO TEST-FLD. + IF TEST-FLD NOT = 999 + DISPLAY "Test 1 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F2) + TO TEST-FLD. + IF TEST-FLD NOT = 9999 + DISPLAY "Test 2 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F3) + TO TEST-FLD. + IF TEST-FLD NOT = 99.999 + DISPLAY "Test 3 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F4) + TO TEST-FLD. + IF TEST-FLD NOT = 99999.99 + DISPLAY "Test 4 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F5) + TO TEST-FLD. + IF TEST-FLD NOT = 99999.99 + DISPLAY "Test 5 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F6) + TO TEST-FLD. + IF TEST-FLD NOT = 127 + DISPLAY "Test 6 fail: " TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION HIGHEST-ALGEBRAIC (F7) + TO TEST-FLD. + IF TEST-FLD NOT = 255 + DISPLAY "Test 7 fail: " TEST-FLD + END-DISPLAY + END-IF. + + MOVE FUNCTION HIGHEST-ALGEBRAIC (F8) + TO TEST-FLD. + IF TEST-FLD NOT = 999000 + DISPLAY "Test 7 fail: " TEST-FLD + END-DISPLAY + END-IF. + + MOVE FUNCTION HIGHEST-ALGEBRAIC (F9) + TO TEST-FLD. + IF TEST-FLD NOT = 0.099 + DISPLAY "Test 7 fail: " TEST-FLD + END-DISPLAY + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob new file mode 100644 index 0000000..4632864 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DATE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER-OF-DATE ( 20000925 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000146000 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob new file mode 100644 index 0000000..38162bf --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-DAY.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TEST-FLD PIC S9(09)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER-OF-DAY ( 2000269 ) + TO TEST-FLD. + IF TEST-FLD NOT = 000146000 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob new file mode 100644 index 0000000..d580ea8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-OF-FORMATTED-DATE.cob @@ -0,0 +1,41 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 day-int PIC 9(9). + + PROCEDURE DIVISION. + *> The date 2013-12-30 is used as it can also be used to + *> check the conversion of dates in week form. + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-MM-DD", "2013-12-30") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 1 failed: " day-int END-DISPLAY + END-IF + + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-DDD", "2013-364") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 2 failed: " day-int END-DISPLAY + END-IF + + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-Www-D", "2014-W01-1") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 3 failed: " day-int END-DISPLAY + END-IF + + MOVE FUNCTION INTEGER-OF-FORMATTED-DATE + ("YYYY-MM-DDThh:mm:ss", "2013-12-30T12:34:56") + TO day-int + IF day-int <> 150844 + DISPLAY "Test 4 failed: " day-int END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-PART.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-PART.cob new file mode 100644 index 0000000..cc97765 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER-PART.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.5. + 01 TEST-FLD PIC S9(04)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER-PART ( X ) + TO TEST-FLD. + IF TEST-FLD NOT = -1 + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER.cob new file mode 100644 index 0000000..d43dd08 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_INTEGER.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.5. + 01 Y PIC 9(12) VALUE 600851475143. + 01 TEST-FLD PIC S9(14)V9(08). + PROCEDURE DIVISION. + MOVE FUNCTION INTEGER ( X ) + TO TEST-FLD. + IF TEST-FLD NOT = -2 + DISPLAY 'INTEGER ( X ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + MOVE FUNCTION INTEGER ( Y / 71 ) + TO TEST-FLD. + IF TEST-FLD NOT = 8462696833 + DISPLAY 'INTEGER ( Y / 71 ) wrong: ' TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__1_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__1_.cob new file mode 100644 index 0000000..8bbf689 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__1_.cob @@ -0,0 +1,38 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC S9(4)V9(4) VALUE -1.5. + 01 TEST-FLD PIC S9(04)V9(02). + PROCEDURE DIVISION. + MOVE FUNCTION LENGTH ( X ) TO TEST-FLD + IF TEST-FLD NOT = 8 + DISPLAY 'LENGTH "00128" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + MOVE FUNCTION LENGTH ( '00128' ) + TO TEST-FLD + IF TEST-FLD NOT = 5 + DISPLAY 'LENGTH "00128" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + MOVE FUNCTION LENGTH ( x'a0' ) + TO TEST-FLD + IF TEST-FLD NOT = 1 + DISPLAY 'LENGTH x"a0" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + MOVE FUNCTION LENGTH ( z'a0' ) + TO TEST-FLD + IF TEST-FLD NOT = 3 + DISPLAY 'LENGTH z"a0" wrong: ' TEST-FLD + END-DISPLAY + END-IF + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.cob new file mode 100644 index 0000000..9416ca0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.cob @@ -0,0 +1,139 @@ + *> { dg-do run } + *> { dg-options "-dialect ibm" } + *> { dg-output-file "group2/FUNCTION_LENGTH__2_.out" } + program-id. prog. + data division. + working-storage section. + 01 desc1. + 05 desc1-entry pic x(5) occurs 10. + + 01 desc2. + 05 desc2-table occurs 10 times. + 10 desc2-entry pic x(5). + + 01 desc3. + 05 desc3-outer occurs 1 to 5 times depending on desc3-lim. + 10 desc3-outer-txt pic x(7). + 10 desc3-inner occurs 11 times. + 15 desc3-inner-text pic x(13). + 77 desc3-lim binary-long. + + 77 msg pic x(64). + 77 should-be pic zzzz9. + 77 but-is pic zzzz9. + + procedure division. + + display "using FUNCTION LENGTH" + + move "function length(desc1)" to msg + move 50 to should-be + move function length(desc1) to but-is + perform result-is + + move "function length(desc1-entry)" to msg + move 50 to should-be + move function length(desc1-entry) to but-is + perform result-is + + move "function length(desc1-entry(1))" to msg + move 5 to should-be + move function length(desc1-entry(1)) to but-is + perform result-is + + move "function length(desc2)" to msg + move 50 to should-be + move function length(desc2) to but-is + perform result-is + + move "function length(desc2-table)" to msg + move 50 to should-be + move function length(desc2-table) to but-is + perform result-is + + move "function length(desc2-entry)" to msg + move 5 to should-be + move function length(desc2-entry) to but-is + perform result-is + + move "function length(desc2-entry(1))" to msg + move 5 to should-be + move function length(desc2-entry(1)) to but-is + perform result-is + + move 5 to desc3-lim + + move "function length(desc3)" to msg + move 750 to should-be + move function length(desc3) to but-is + perform result-is + + move "function length(desc3-outer)" to msg + move 750 to should-be + move function length(desc3-outer) to but-is + perform result-is + + move "function length(desc3-outer(1))" to msg + move 150 to should-be + move function length(desc3-outer(1)) to but-is + perform result-is + + move "function length(desc3-outer-txt)" to msg + move 7 to should-be + move function length(desc3-outer-txt) to but-is + perform result-is + + move "function length(desc3-inner)" to msg + move 143 to should-be + move function length(desc3-inner) to but-is + perform result-is + + move "function length(desc3-inner(1))" to msg + move 13 to should-be + move function length(desc3-inner(1)) to but-is + perform result-is + + display "After changing desc3-lim from 5 to 3..." + move 3 to desc3-lim + + move "function length(desc3)" to msg + move 450 to should-be + move function length(desc3) to but-is + perform result-is + + move "function length(desc3-outer)" to msg + move 450 to should-be + move function length(desc3-outer) to but-is + perform result-is + + move "function length(desc3-outer(1))" to msg + move 150 to should-be + move function length(desc3-outer(1)) to but-is + perform result-is + + move "function length(desc3-outer-txt)" to msg + move 7 to should-be + move function length(desc3-outer-txt) to but-is + perform result-is + + move "function length(desc3-inner)" to msg + move 143 to should-be + move function length(desc3-inner) to but-is + perform result-is + + move "function length(desc3-inner(1))" to msg + move 13 to should-be + move function length(desc3-inner(1)) to but-is + perform result-is + + goback. + result-is. + display function trim(msg) ": " with no advancing + if but-is equal to should-be + display function trim(but-is) + else + display "should be " function trim(should-be) + " but is " function trim(but-is) + end-if. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.out new file mode 100644 index 0000000..9d90261 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LENGTH__2_.out @@ -0,0 +1,22 @@ +using FUNCTION LENGTH +function length(desc1): 50 +function length(desc1-entry): 50 +function length(desc1-entry(1)): 5 +function length(desc2): 50 +function length(desc2-table): 50 +function length(desc2-entry): 5 +function length(desc2-entry(1)): 5 +function length(desc3): 750 +function length(desc3-outer): 750 +function length(desc3-outer(1)): 150 +function length(desc3-outer-txt): 7 +function length(desc3-inner): 143 +function length(desc3-inner(1)): 13 +After changing desc3-lim from 5 to 3... +function length(desc3): 450 +function length(desc3-outer): 450 +function length(desc3-outer(1)): 150 +function length(desc3-outer-txt): 7 +function length(desc3-inner): 143 +function length(desc3-inner(1)): 13 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob new file mode 100644 index 0000000..cb6d783 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-COMPARE.cob @@ -0,0 +1,21 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION LOCALE-COMPARE ("A", "B") NOT = "<" + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOCALE-COMPARE ("B", "A") NOT = ">" + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOCALE-COMPARE ("A", "A") NOT = "=" + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.cob new file mode 100644 index 0000000..35e0729 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_LOCALE-DATE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(32) VALUE SPACES. + PROCEDURE DIVISION. + MOVE FUNCTION LOCALE-DATE ( "19630302" ) TO X. + IF X NOT = SPACES + DISPLAY "OK" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-DATE.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob new file mode 100644 index 0000000..d04e7a9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(32) VALUE SPACES. + PROCEDURE DIVISION. + MOVE FUNCTION LOCALE-TIME-FROM-SECONDS ( 33012 ) TO X. + IF X NOT = SPACES + DISPLAY "OK" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME-FROM-SECONDS.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.cob new file mode 100644 index 0000000..aeba184 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_LOCALE-TIME.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(32) VALUE SPACES. + PROCEDURE DIVISION. + MOVE FUNCTION LOCALE-TIME ( "233012" ) TO X. + IF X NOT = SPACES + DISPLAY "OK" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOCALE-TIME.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG.cob new file mode 100644 index 0000000..f0ab0e7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION LOG ( 1.5 ) TO Y. + IF Y NOT = 0.405465108108164381978013115464349 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG10.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG10.cob new file mode 100644 index 0000000..e37210b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOG10.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION LOG10 ( 1.5 ) TO Y. + IF Y NOT = 0.176091259055681242081289008530622 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE.cob new file mode 100644 index 0000000..4cf24d5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 TEST-FLD PIC X(12) VALUE ALL '_'. + PROCEDURE DIVISION. + STRING FUNCTION LOWER-CASE ( X ) + DELIMITED BY SIZE + INTO TEST-FLD + END-STRING + IF TEST-FLD NOT = 'a#b.c%d+e$__' + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob new file mode 100644 index 0000000..eb53ca4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWER-CASE_with_reference_modding.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 TEST-FLD PIC X(03). + PROCEDURE DIVISION. + MOVE FUNCTION LOWER-CASE ( X ) (1 : 3) + TO TEST-FLD + IF TEST-FLD NOT = 'a#b' + DISPLAY TEST-FLD + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob new file mode 100644 index 0000000..4750c7e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_LOWEST-ALGEBRAIC.cob @@ -0,0 +1,55 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 F1 PIC S999. + 01 F2 PIC S9(4) BINARY. + 01 F3 PIC 99V9(3). + 01 F4 PIC $**,**9.99BCR. + 01 F5 PIC $**,**9.99. + 01 F6 USAGE BINARY-CHAR SIGNED. + 01 F7 USAGE BINARY-CHAR UNSIGNED. + 01 F8 PIC S999PPP. + 01 F9 PIC SP99. + PROCEDURE DIVISION. + IF FUNCTION LOWEST-ALGEBRAIC (F1) NOT = -999 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F2) NOT = -9999 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F3) NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F4) NOT = -99999.99 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F5) NOT = 0 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F6) NOT = -128 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F7) NOT = 0 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F8) NOT = -999000 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION LOWEST-ALGEBRAIC (F9) NOT = -0.099 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.cob new file mode 100644 index 0000000..99971a9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.cob @@ -0,0 +1,12 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MAX.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + DISPLAY FUNCTION MAX ( 3 -14 0 8 -3 ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.out new file mode 100644 index 0000000..2f95459 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MAX.out @@ -0,0 +1,2 @@ +8 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.cob new file mode 100644 index 0000000..007f235 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MEAN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 result PIC S999V999. + PROCEDURE DIVISION. + COMPUTE result = FUNCTION MEAN ( 3 -14 0 8 -3 ) + DISPLAY result + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.out new file mode 100644 index 0000000..7f05c89 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEAN.out @@ -0,0 +1,2 @@ +-001.200 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.cob new file mode 100644 index 0000000..ac2515d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.cob @@ -0,0 +1,12 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MEDIAN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + DISPLAY FUNCTION MEDIAN ( 3 -14 0 8 -3 ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.out new file mode 100644 index 0000000..77ac542 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MEDIAN.out @@ -0,0 +1,2 @@ +0 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.cob new file mode 100644 index 0000000..601cbc7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MIDRANGE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC S999V999. + PROCEDURE DIVISION. + COMPUTE RESULT = FUNCTION MIDRANGE ( 3 -14 0 8 -3 ) + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.out new file mode 100644 index 0000000..6945d25 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIDRANGE.out @@ -0,0 +1,2 @@ +-003.000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.cob new file mode 100644 index 0000000..85ef141 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.cob @@ -0,0 +1,12 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MIN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + DISPLAY FUNCTION MIN ( 3 -14 0 8 -3 ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.out new file mode 100644 index 0000000..1bd872a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MIN.out @@ -0,0 +1,2 @@ +-14 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.cob new file mode 100644 index 0000000..cbb445f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.cob @@ -0,0 +1,110 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_MODULE-NAME.out" } + + identification division. + program-id. level-1. + data division. + working-storage section. + procedure division. + display "From level-1:" + perform reportt. + call "level-2" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + end program level-1. + + identification division. + program-id. level-2. + data division. + working-storage section. + procedure division. + display "From level-2:" + perform reportt. + call "level-3" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + end program level-2. + + identification division. + program-id. level-3. + data division. + working-storage section. + procedure division. + display "From level-3:" + perform reportt. + call "level-3a" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + + identification division. + program-id. level-3a. + data division. + working-storage section. + procedure division. + display "From level-3a:" + perform reportt. + call "level-3b" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + + identification division. + program-id. level-3b. + data division. + working-storage section. + procedure division. + display "From level-3b:" + perform reportt. + call "level-3c" + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + + identification division. + program-id. level-3c. + data division. + working-storage section. + procedure division. + display "From level-3c:" + perform reportt. + goback. + reportt. + display " " "top-level: " """" function module-name(top-level) """" + display " " "current: " """" function module-name(current) """" + display " " "activating: " """" function module-name(activating) """" + display " " "nested: " """" function module-name(nested) """" + display " " "stack: " """" function module-name(stack) """" + continue. + end program level-3c. + end program level-3b. + end program level-3a. + end program level-3. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.out new file mode 100644 index 0000000..7be80f0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MODULE-NAME.out @@ -0,0 +1,37 @@ +From level-1: + top-level: "level-1" + current: "level-1" + activating: " " + nested: "level-1" + stack: "level-1; " +From level-2: + top-level: "level-1" + current: "level-2" + activating: "level-1" + nested: "level-2" + stack: "level-2;level-1; " +From level-3: + top-level: "level-1" + current: "level-3" + activating: "level-2" + nested: "level-3" + stack: "level-3;level-2;level-1; " +From level-3a: + top-level: "level-1" + current: "level-3" + activating: "level-3" + nested: "level-3a" + stack: "level-3a;level-3;level-2;level-1; " +From level-3b: + top-level: "level-1" + current: "level-3" + activating: "level-3a" + nested: "level-3b" + stack: "level-3b;level-3a;level-3;level-2;level-1; " +From level-3c: + top-level: "level-1" + current: "level-3" + activating: "level-3b" + nested: "level-3c" + stack: "level-3c;level-3b;level-3a;level-3;level-2;level-1; " + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__invalid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__invalid_.cob new file mode 100644 index 0000000..56ecbcd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__invalid_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC 9 VALUE 0. + 01 R PIC S9(4)V9(4) VALUE 1. + PROCEDURE DIVISION. + MOVE FUNCTION MOD ( -11 Z ) TO R + IF FUNCTION EXCEPTION-STATUS + NOT = 'EC-ARGUMENT-FUNCTION' + DISPLAY 'Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + IF R NOT = 0 + DISPLAY 'result is not zero: ' R + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__valid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__valid_.cob new file mode 100644 index 0000000..0db8679 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_MOD__valid_.cob @@ -0,0 +1,21 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9(12) VALUE 600851475143. + 01 R PIC S9(4)V9(4) VALUE 0. + PROCEDURE DIVISION. + MOVE FUNCTION MOD ( -11 5 ) TO R + IF R NOT = 4 + DISPLAY 'first one wrong: ' R + END-DISPLAY + END-IF + MOVE FUNCTION MOD ( Y, 71 ) TO R + IF R NOT = 0 + DISPLAY 'second one wrong: ' R + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C.cob new file mode 100644 index 0000000..2eb8eb9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X1 PIC X(14) VALUE " -% 9876.1234 ". + 01 X2 PIC X(20) VALUE " % 19,876.1234 DB". + 01 N PIC s9(5)v9(5). + PROCEDURE DIVISION. + MOVE FUNCTION NUMVAL-C ( X1 , "%" ) TO N + IF N NOT = -9876.1234 + DISPLAY N + END-DISPLAY + END-IF + MOVE FUNCTION NUMVAL-C ( X2 , "%" ) TO N + IF N NOT = -19876.1234 + DISPLAY N + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob new file mode 100644 index 0000000..bd57463 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-C_DP.COMMA.cob @@ -0,0 +1,21 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA + . + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X1 PIC X(20) VALUE " % 19.876,1234 DB". + 01 N PIC s9(5)v9(5). + PROCEDURE DIVISION. + MOVE FUNCTION NUMVAL-C ( X1 , "%" ) TO N + IF N NOT = -19876,1234 + DISPLAY N + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.cob new file mode 100644 index 0000000..522f810 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.cob @@ -0,0 +1,30 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_NUMVAL-F.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 result PIC S9(8)V9(9) COMP-5. + 01 vector. + 05 vd. + 10 FILLER PIC X(32) VALUE " - 123.456 E + 2 ". + 10 FILLER PIC X(32) VALUE "123". + 10 FILLER PIC X(32) VALUE ".456". + 10 FILLER PIC X(32) VALUE "123.456". + 10 FILLER PIC X(32) VALUE "-123.456". + 10 FILLER PIC X(32) VALUE "123.456E2". + 10 FILLER PIC X(32) VALUE "-123.456E-2". + 10 FILLER PIC X(32) VALUE "DONE". + 10 FILLER PIC X(32) OCCURS 100 TIMES. + 05 datat REDEFINES vd PIC X(32) OCCURS 100 TIMES INDEXED BY I. + PROCEDURE DIVISION. + SET I TO 1 + PERFORM UNTIL datat(I) EQUALS "DONE" + DISPLAY """"datat(I)"""" SPACE WITH NO ADVANCING + MOVE FUNCTION NUMVAL-F(datat(I)) TO result + DISPLAY result + ADD 1 TO I + END-PERFORM. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.out new file mode 100644 index 0000000..6d27dd2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL-F.out @@ -0,0 +1,8 @@ +" - 123.456 E + 2 " -00012345.600000000 +"123 " +00000123.000000000 +".456 " +00000000.456000000 +"123.456 " +00000123.456000000 +"-123.456 " -00000123.456000000 +"123.456E2 " +00012345.600000000 +"-123.456E-2 " -00000001.234560000 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL.cob new file mode 100644 index 0000000..9288331 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_NUMVAL.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X1 PIC X(12) VALUE " -9876.1234 ". + 01 X2 PIC X(18) VALUE " 19876.1234 CR". + 01 N PIC s9(5)v9(5). + PROCEDURE DIVISION. + MOVE FUNCTION NUMVAL ( X1 ) TO N + IF N NOT = -9876.1234 + DISPLAY N + END-DISPLAY + END-IF + MOVE FUNCTION NUMVAL ( X2 ) TO N + IF N NOT = -19876.1234 + DISPLAY N + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.cob new file mode 100644 index 0000000..0dd1053 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ORD-MAX.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION ORD-MAX ( 3 -14 0 8 -3 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.out new file mode 100644 index 0000000..c9ce4ea --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MAX.out @@ -0,0 +1,2 @@ +004 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.cob new file mode 100644 index 0000000..fd55396 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ORD-MIN.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION ORD-MIN ( 3 -14 0 8 -3 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.out new file mode 100644 index 0000000..4119821 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD-MIN.out @@ -0,0 +1,2 @@ +002 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.cob new file mode 100644 index 0000000..fe5e290 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_ORD.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION ORD ( "k" ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.out new file mode 100644 index 0000000..e55677a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_ORD.out @@ -0,0 +1,2 @@ +108 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_PI.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_PI.cob new file mode 100644 index 0000000..9792e03 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_PI.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9V9(32). + PROCEDURE DIVISION. + MOVE FUNCTION PI TO Y. + IF Y NOT = 3.14159265358979323846264338327950 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob new file mode 100644 index 0000000..5883abd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_PRESENT-VALUE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 9(5)V9(4). + PROCEDURE DIVISION. + MOVE FUNCTION PRESENT-VALUE ( 3 2 1 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.out new file mode 100644 index 0000000..52ce840 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_PRESENT-VALUE.out @@ -0,0 +1,2 @@ +00000.5625 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_RANDOM.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANDOM.cob new file mode 100644 index 0000000..0a3e151 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANDOM.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S99V99 COMP VALUE -1.0. + PROCEDURE DIVISION. + MOVE FUNCTION RANDOM ( ) TO Y. + IF Y < 0 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_RANGE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANGE.cob new file mode 100644 index 0000000..48a9511 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_RANGE.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9(4)V9(4) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION RANGE ( 3 -14 0 8 -3 ) TO Z. + IF Z NOT = 22 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__invalid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__invalid_.cob new file mode 100644 index 0000000..38298a8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__invalid_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 R PIC S9(4)V9(4) COMP-5 VALUE 4.1. + 01 Z PIC 9 COMP-5 VALUE 0. + PROCEDURE DIVISION. + MOVE FUNCTION REM ( -11 Z ) TO R + IF FUNCTION EXCEPTION-STATUS + NOT = 'EC-ARGUMENT-FUNCTION' + DISPLAY 'Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + IF R NOT = 0 + DISPLAY 'result is not zero: ' R + END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__valid_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__valid_.cob new file mode 100644 index 0000000..7ace4a2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REM__valid_.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 R PIC S9(4)V9(4) COMP-5 VALUE 0. + PROCEDURE DIVISION. + MOVE FUNCTION REM ( -11 5 ) TO R + IF R NOT = -1 + DISPLAY R END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE.cob new file mode 100644 index 0000000..b1b1690 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 Z PIC X(10). + PROCEDURE DIVISION. + MOVE FUNCTION REVERSE ( X ) TO Z. + IF Z NOT = "$E+D%C.B#A" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob new file mode 100644 index 0000000..98c28ad --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_REVERSE_with_reference_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "A#B.C%D+E$". + 01 Z PIC X(10). + PROCEDURE DIVISION. + MOVE FUNCTION REVERSE ( X ) (1 : 4) TO Z. + IF Z NOT = "$E+D " + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob new file mode 100644 index 0000000..2641e08 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-FROM-FORMATTED-TIME.cob @@ -0,0 +1,58 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 result PIC 9(8)V9(9) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmss", "010203") + TO result. + IF result NOT = 3723 + DISPLAY "Test 1 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hh:mm:ss", "01:02:03") + TO result. + IF result NOT = 3723 + DISPLAY "Test 2 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmss.ssssssss", "010203.04050607") + TO result. + IF result NOT = 3723.04050607 + DISPLAY "Test 3 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmssZ", "010203Z") + TO result. + IF result NOT = 3723 + DISPLAY "Test 4 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("hhmmss+hhmm", "010203+0405") + TO result. + IF result NOT = 3723 + DISPLAY "Test 5 failed: " result + END-DISPLAY + END-IF. + + MOVE FUNCTION SECONDS-FROM-FORMATTED-TIME + ("YYYYMMDDThhmmss", "16010101T010203") + TO result. + IF result NOT = 3723 + DISPLAY "Test 6 failed: " result + END-DISPLAY + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob new file mode 100644 index 0000000..b229ac3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SECONDS-PAST-MIDNIGHT.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC 9(8) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION SECONDS-PAST-MIDNIGHT TO Y. + IF Y NOT < 86402 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SIGN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIGN.cob new file mode 100644 index 0000000..f698d97 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIGN.cob @@ -0,0 +1,30 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z USAGE BINARY-LONG SIGNED. + PROCEDURE DIVISION. + MOVE FUNCTION SIGN ( 3.12345 ) TO Z. + IF Z NOT = 1 + DISPLAY "Sign 1 " Z + END-DISPLAY + END-IF. + MOVE FUNCTION SIGN ( -0.0 ) TO Z. + IF Z NOT = 0 + DISPLAY "Sign 2 " Z + END-DISPLAY + END-IF. + MOVE FUNCTION SIGN ( 0.0 ) TO Z. + IF Z NOT = 0 + DISPLAY "Sign 3 " Z + END-DISPLAY + END-IF. + MOVE FUNCTION SIGN ( -3.12345 ) TO Z. + IF Z NOT = -1 + DISPLAY "Sign 4 " Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SIN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIN.cob new file mode 100644 index 0000000..a72df35 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SIN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION SIN ( 1.5 ) TO Y. + IF Y NOT = 0.997494986604054430941723371141487 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT.cob new file mode 100644 index 0000000..ddf36da --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SQRT.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(33). + PROCEDURE DIVISION. + MOVE FUNCTION SQRT ( 1.5 ) TO Y. + IF Y NOT = 1.224744871391589049098642037352945 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob new file mode 100644 index 0000000..8deadc7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_STANDARD-DEVIATION.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S9V9(32). + PROCEDURE DIVISION. + MOVE FUNCTION STANDARD-DEVIATION ( 3 -14 0 8 -3 ) TO Y. + IF Y NOT = 7.35934779718963954877237043574538 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob new file mode 100644 index 0000000..850f1da --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(20). + 01 Z PIC X(20). + PROCEDURE DIVISION. + MOVE "ABC111444555defxxabc" TO Y. + MOVE FUNCTION SUBSTITUTE (Y anycase "abc" "zz" + anycase "55" "666") + TO Z. + IF Z NOT = "zz1114446665defxxzz" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob new file mode 100644 index 0000000..24ed1b8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE-CASE_with_reference_mod.cob @@ -0,0 +1,20 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(20). + 01 Z PIC X(20). + PROCEDURE DIVISION. + MOVE "abc111444555defxxabc" TO Y. + MOVE FUNCTION SUBSTITUTE + ( Y anycase "ABC" "zz" + anycase "55" "666" ) (2 : 9) + TO Z. + IF Z NOT = "z11144466" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.cob new file mode 100644 index 0000000..072c159 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.cob @@ -0,0 +1,24 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_SUBSTITUTE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(24). + PROCEDURE DIVISION. + MOVE "abc111444555defxxabc" TO Y + DISPLAY FUNCTION TRIM (FUNCTION SUBSTITUTE ( Y "abc" "zz" "55" "666" )) + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y "bob" "FILLER" "jim" "Z") + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y FIRST "bob" "FILLER" "jim" "Z") + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y LAST "bob" "FILLER" "jim" "Z") + + MOVE "bobBobjimJimbobBobjimJim" TO Y + DISPLAY FUNCTION SUBSTITUTE ( Y ANYCASE "bob" "FILLER" ANYCASE "jim" "Z") + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.out new file mode 100644 index 0000000..4f5f7a0 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE.out @@ -0,0 +1,6 @@ +zz1114446665defxxzz +FILLERBobZJimFILLERBobZJim +FILLERBobZJimbobBobZJim +bobBobZJimFILLERBobZJim +FILLERFILLERZZFILLERFILLERZZ + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob new file mode 100644 index 0000000..7894915 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUBSTITUTE_with_reference_modding.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC X(20). + 01 Z PIC X(20). + PROCEDURE DIVISION. + MOVE "abc111444555defxxabc" TO Y. + MOVE FUNCTION SUBSTITUTE + ( Y "abc" "zz" "55" "666" ) (2 : 9) + TO Z. + IF Z NOT = "z11144466" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_SUM.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUM.cob new file mode 100644 index 0000000..228e996 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_SUM.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z USAGE BINARY-LONG. + PROCEDURE DIVISION. + MOVE FUNCTION SUM ( 3 -14 0 8 -3 ) TO Z. + IF Z NOT = -6 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TAN.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TAN.cob new file mode 100644 index 0000000..f932157 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TAN.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Y PIC S99V9(31). + PROCEDURE DIVISION. + MOVE FUNCTION TAN ( 1.5 ) TO Y. + IF Y NOT = 14.1014199471717193876460836519877 + DISPLAY Y + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob new file mode 100644 index 0000000..8841f5a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TEST-DATE-YYYYMMDD.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION TEST-DATE-YYYYMMDD ( 20020231 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out new file mode 100644 index 0000000..56fa706 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DATE-YYYYMMDD.out @@ -0,0 +1,2 @@ +003 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob new file mode 100644 index 0000000..71fbdb9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 RESULT PIC 999. + PROCEDURE DIVISION. + MOVE FUNCTION TEST-DAY-YYYYDDD ( 2002400 ) TO RESULT + DISPLAY RESULT + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out new file mode 100644 index 0000000..4119821 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__1_.out @@ -0,0 +1,2 @@ +002 + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob new file mode 100644 index 0000000..24893ab --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-DAY-YYYYDDD__2_.cob @@ -0,0 +1,170 @@ + *> { dg-do run } + + identification division. + program-id. test. + data division. + working-storage section. + 01 datev pic 99999999. + 01 should_be pic 9999. + 01 result pic 9999. + procedure division. + move function test-day-yyyyddd(1945123) to result + move zero to should_be + if result not equal to should_be then + display "test-day-yyyyddd(1945123) should have been " + should_be " but was " result + move 1 to return-code + end-if. + move function test-day-yyyyddd(10000000) to result + move 1 to should_be + if result not equal to should_be then + display "test-day-yyyyddd(100000000) should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601000 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601001 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601364 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601366 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1601367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2000365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2000366 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2000367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2100365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2100366 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 2100367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988366 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1989365 to datev + move zero to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1989366 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1989367 to datev + move 2 to should_be + move function test-day-yyyyddd(datev) to result + if result not equal to should_be then + display "test-day-yyyyddd(" datev ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + end program test. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob new file mode 100644 index 0000000..b825198 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_DP.COMMA.cob @@ -0,0 +1,32 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss,ss", "000000,00") <> 0 + DISPLAY "Test 1 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss,ss", "16010101T000000,00") <> 0 + DISPLAY "Test 2 failed" END-DISPLAY + END-IF + + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss,ss", "000000.00") <> 7 + DISPLAY "Test 3 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss,ss", "16010101T000000.00") <> 16 + DISPLAY "Test 4 failed" END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob new file mode 100644 index 0000000..e782647 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_additional.cob @@ -0,0 +1,173 @@ + *> { dg-do run } + + identification division. + program-id. test. + data division. + working-storage section. + 01 datev pic 99999999. + 01 should_be pic 9999. + 01 result pic 9999. + 01 date-integer PIC 999999. + 01 i PIC 999. + 01 datex PIC X(8). + 01 xone PIC X. + 01 yyyydddv . + 02 yyyy PIC 9999. + 02 filler PIC X VALUE "-". + 02 ddd PIC 999. + procedure division. + *> TESTING YYYYMMDD + move "19000229" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + *> Test an entire year of YYYYMMDD: + move function integer-of-date(19880101) to date-integer + perform until date-integer >= function integer-of-date(19890101) + move function date-of-integer(date-integer) to datev + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datev) to RESULT + move zero to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + datev + ") should have been " + should_be " but was " result + move 1 to return-code + end-if + add 1 to date-integer + end-perform. + *> Make sure foreign characters trigger the correct gazinga in YYYYMMDD + move "19530227" to datex + perform varying i from 1 by 1 until i > 8 + move datex(i:1) to xone + move 'X' to datex(i:1) + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move i to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if + move xone to datex(i:1) + end-perform. + move "19000229" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "20000229" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 0 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "20007029" to datex + move function TEST-FORMATTED-DATETIME("YYYYMMDD", datex) to RESULT + move 5 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYMMDD""" + ", " + function trim(datex) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + *> TESTING YYYY-DDD + move "1988" to yyyy of yyyydddv + move "000" to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "1988" to yyyy of yyyydddv + move "367" to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 8 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move "1988" to yyyy of yyyydddv + move "399" to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 7 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988 to yyyy of yyyydddv + move 400 to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move 6 to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYYDDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if. + move 1988 to yyyy of yyyydddv + perform varying i from 1 by 1 until i > 366 + move i to ddd of yyyydddv + move function TEST-FORMATTED-DATETIME("YYYY-DDD", yyyydddv) to RESULT + move zero to should_be + if result not equal to should_be then + display "TEST-FORMATTED-DATETIME(" + """YYYY-DDD""" + ", " + function trim(yyyydddv) + ") should have been " + should_be " but was " result + move 1 to return-code + end-if + add 1 to date-integer + end-perform. + end program test. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob new file mode 100644 index 0000000..1b571f9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_dates.cob @@ -0,0 +1,118 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16010101") <> 0 + DISPLAY "Test 1 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-MM-DD", "1601-01-01") <> 0 + DISPLAY "Test 2 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601001") <> 0 + DISPLAY "Test 3 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-DDD", "1601-001") <> 0 + DISPLAY "Test 4 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W011") <> 0 + DISPLAY "Test 5 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-Www-D", "1601-W01-1") <> 0 + DISPLAY "Test 6 failed" END-DISPLAY + END-IF + + + *> How will this work with zero-length items? + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "1") <> 2 + DISPLAY "Test 7 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "160A0101") <> 4 + DISPLAY "Test 8 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "00000101") <> 1 + DISPLAY "Test 9 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16000101") <> 4 + DISPLAY "Test 10 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16010001") <> 6 + DISPLAY "Test 11 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16011301") <> 6 + DISPLAY "Test 12 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "16010190") <> 7 + DISPLAY "Test 13 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "18000229") <> 8 + DISPLAY "Test 14 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-MM-DD", "1601 01 01") <> 5 + DISPLAY "Test 15 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "160101010") <> 9 + DISPLAY "Test 16 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601A011") <> 5 + DISPLAY "Test 17 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W531") <> 7 + DISPLAY "Test 18 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W601") <> 6 + DISPLAY "Test 19 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "2009W531") <> 0 + DISPLAY "Test 20 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYWwwD", "1601W018") <> 8 + DISPLAY "Test 21 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601366") <> 7 + DISPLAY "Test 22 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601370") <> 6 + DISPLAY "Test 23 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYDDD", "1601400") <> 5 + DISPLAY "Test 24 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "01") <> 1 + DISPLAY "Test 25 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDD", "1601010") <> 8 + DISPLAY "Test 26 failed" END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob new file mode 100644 index 0000000..5591fbb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_datetimes.cob @@ -0,0 +1,44 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 RESULT PIC 9(02). + PROCEDURE DIVISION. + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", "16010101T000000") + TO RESULT + IF RESULT <> 0 + DISPLAY "Test 1 failed: " RESULT END-DISPLAY + END-IF + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYY-MM-DDThh:mm:ss.sssssssss+hh:mm", + "1601-01-01T00:00:00.000000000+00:00") + TO RESULT + IF RESULT <> 0 + DISPLAY "Test 2 failed: " RESULT END-DISPLAY + END-IF + + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", "16010101 000000") + TO RESULT + IF RESULT <> 9 + DISPLAY "Test 3 failed: " RESULT END-DISPLAY + END-IF + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", SPACE) + TO RESULT + IF RESULT <> 1 + DISPLAY "Test 4 failed: " RESULT END-DISPLAY + END-IF + MOVE FUNCTION TEST-FORMATTED-DATETIME + ("YYYYMMDDThhmmss", "16010101T ") + TO RESULT + IF RESULT <> 10 + DISPLAY "Test 5 failed: " RESULT END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob new file mode 100644 index 0000000..ded9551 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-FORMATTED-DATETIME_with_times.cob @@ -0,0 +1,72 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss.sssssssssZ", "000000.000000000Z") <> 0 + DISPLAY "Test 1 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hh:mm:ss.sssssssssZ", "00:00:00.000000000Z") <> 0 + DISPLAY "Test 2 failed" END-DISPLAY + END-IF + *> 0 instead of +/- valid in sending fields with offset of zero. + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss.sssssssss+hhmm", "000000.00000000000000") + <> 0 + DISPLAY "Test 3 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hh:mm:ss.sssssssss+hh:mm", + "00:00:00.000000000+00:00") + <> 0 + DISPLAY "Test 4 failed" END-DISPLAY + END-IF + + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "300000") <> 1 + DISPLAY "Test 5 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "250000") <> 2 + DISPLAY "Test 6 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "006000") <> 3 + DISPLAY "Test 7 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", "000060") <> 5 + DISPLAY "Test 8 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hh:mm:ss", "00-00-00") <> 3 + DISPLAY "Test 9 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss.ss", "000000,00") <> 7 + DISPLAY "Test 10 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss+hhmm", "000000 0000") <> 7 + DISPLAY "Test 11 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss+hhmm", "00000000001") <> 11 + DISPLAY "Test 12 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmssZ", "000000A") <> 7 + DISPLAY "Test 13 failed" END-DISPLAY + END-IF + IF FUNCTION TEST-FORMATTED-DATETIME + ("hhmmss", SPACE) <> 1 + DISPLAY "Test 14 failed" END-DISPLAY + END-IF + + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob new file mode 100644 index 0000000..e458f4a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-C.cob @@ -0,0 +1,89 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-NUMVAL-C ("+ 1") NOT = 0 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C (" + 1") NOT = 0 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- 1") NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C (" - 1") NOT = 0 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+- 1") NOT = 2 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 +") NOT = 0 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 -") NOT = 0 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 +-") NOT = 4 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1 -+") NOT = 4 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+ 1.1") NOT = 0 + DISPLAY "Test 10 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- 1.1") NOT = 0 + DISPLAY "Test 11 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 +") NOT = 0 + DISPLAY "Test 12 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 -") NOT = 0 + DISPLAY "Test 13 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 CR") NOT = 0 + DISPLAY "Test 14 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 DB") NOT = 0 + DISPLAY "Test 15 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("1.1 -CR") NOT = 6 + DISPLAY "Test 16 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+ $1.1 ") NOT = 0 + DISPLAY "Test 17 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- $1.1 ") NOT = 0 + DISPLAY "Test 18 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("+ X1.1 ", "X") NOT = 0 + DISPLAY "Test 19 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-C ("- X1.1 ", "X") NOT = 0 + DISPLAY "Test 20 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob new file mode 100644 index 0000000..3fcec0e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL-F.cob @@ -0,0 +1,89 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-NUMVAL-F ("+ 1") NOT = 0 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F (" + 1") NOT = 0 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("- 1") NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F (" - 1") NOT = 0 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("+- 1") NOT = 2 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 +") NOT = 3 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 -") NOT = 3 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 +-") NOT = 3 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1 -+") NOT = 3 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("+ 1.1") NOT = 0 + DISPLAY "Test 10 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("- 1.1") NOT = 0 + DISPLAY "Test 11 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 +") NOT = 5 + DISPLAY "Test 12 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 -") NOT = 5 + DISPLAY "Test 13 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 ") NOT = 0 + DISPLAY "Test 14 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 ") NOT = 0 + DISPLAY "Test 15 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 -CR") NOT = 5 + DISPLAY "Test 16 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 E+1") NOT = 0 + DISPLAY "Test 17 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 E -1") NOT = 0 + DISPLAY "Test 18 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("1.1 EE") NOT = 6 + DISPLAY "Test 19 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL-F ("+1.1 E+01") NOT = 0 + DISPLAY "Test 20 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob new file mode 100644 index 0000000..bc38b4e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TEST-NUMVAL.cob @@ -0,0 +1,89 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + IF FUNCTION TEST-NUMVAL ("+ 1") NOT = 0 + DISPLAY "Test 1 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL (" + 1") NOT = 0 + DISPLAY "Test 2 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("- 1") NOT = 0 + DISPLAY "Test 3 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL (" - 1") NOT = 0 + DISPLAY "Test 4 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+- 1") NOT = 2 + DISPLAY "Test 5 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 +") NOT = 0 + DISPLAY "Test 6 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 -") NOT = 0 + DISPLAY "Test 7 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 +-") NOT = 4 + DISPLAY "Test 8 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1 -+") NOT = 4 + DISPLAY "Test 9 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+ 1.1") NOT = 0 + DISPLAY "Test 10 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("- 1.1") NOT = 0 + DISPLAY "Test 11 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 +") NOT = 0 + DISPLAY "Test 12 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 -") NOT = 0 + DISPLAY "Test 13 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 CR") NOT = 0 + DISPLAY "Test 14 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 DB") NOT = 0 + DISPLAY "Test 15 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 -CR") NOT = 6 + DISPLAY "Test 16 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 +DB") NOT = 6 + DISPLAY "Test 17 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("1.1 CDB") NOT = 6 + DISPLAY "Test 18 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+1.1 CR") NOT = 6 + DISPLAY "Test 19 fail" + END-DISPLAY + END-IF. + IF FUNCTION TEST-NUMVAL ("+ ") NOT = 8 + DISPLAY "Test 20 fail" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.cob new file mode 100644 index 0000000..054b14a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TRIM.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(12) VALUE " a#b.c%d+e$ ". + PROCEDURE DIVISION. + DISPLAY FUNCTION TRIM ( X ) + END-DISPLAY. + DISPLAY FUNCTION TRIM ( X TRAILING ) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.out new file mode 100644 index 0000000..b0e4a72 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM.out @@ -0,0 +1,3 @@ +a#b.c%d+e$ + a#b.c%d+e$ + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob new file mode 100644 index 0000000..f14f0fa --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TRIM_with_reference_modding.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(12) VALUE " a#b.c%d+e$ ". + PROCEDURE DIVISION. + DISPLAY FUNCTION TRIM ( X ) (2 : 3) + END-DISPLAY. + DISPLAY FUNCTION TRIM ( X TRAILING ) (2 : 3) + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out new file mode 100644 index 0000000..f716581 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_with_reference_modding.out @@ -0,0 +1,3 @@ +#b. +a#b + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.cob new file mode 100644 index 0000000..d92a490 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_TRIM_zero_length.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 A2 PIC X(2) VALUE " ". + 01 A3 PIC X(3) VALUE " ". + 01 X PIC X(4) VALUE "NOOK". + PROCEDURE DIVISION. + MOVE FUNCTION TRIM ( A2 ) TO X. + DISPLAY ">" X "<" + END-DISPLAY. + DISPLAY ">" FUNCTION TRIM ( A3 ) "<" + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.out new file mode 100644 index 0000000..9aa7900 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_TRIM_zero_length.out @@ -0,0 +1,3 @@ +> < +>< + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE.cob new file mode 100644 index 0000000..9bf6a6b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "a#b.c%d+e$". + 01 Z PIC X(10). + PROCEDURE DIVISION. + MOVE FUNCTION UPPER-CASE ( X ) TO Z. + IF Z NOT = "A#B.C%D+E$" + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob new file mode 100644 index 0000000..2f96446 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_UPPER-CASE_with_reference_modding.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(10) VALUE "a#b.c%d+e$". + 01 Z PIC X(4). + PROCEDURE DIVISION. + MOVE FUNCTION UPPER-CASE ( X ) (1 : 3) TO Z. + IF Z NOT = "A#B " + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_VARIANCE.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_VARIANCE.cob new file mode 100644 index 0000000..0a08f5a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_VARIANCE.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC S9(4)V9(4) COMP-5. + PROCEDURE DIVISION. + MOVE FUNCTION VARIANCE ( 3 -14 0 8 -3 ) TO Z. + IF Z NOT = 54.16 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob new file mode 100644 index 0000000..d47967b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_WHEN-COMPILED.cob @@ -0,0 +1,45 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 compiled-datetime. + 03 compiled-date. + 05 millennium PIC X. + 05 FILLER PIC X(15). + 03 timezone PIC X(5). + PROCEDURE DIVISION. + *> Check millennium. + MOVE FUNCTION WHEN-COMPILED TO compiled-datetime. + IF millennium NOT = "2" + DISPLAY "Millennium NOT OK: " millennium + END-DISPLAY + END-IF. + + *> Check timezone. + IF timezone NOT = FUNCTION CURRENT-DATE (17:5) + DISPLAY "Timezone NOT OK: " timezone + END-DISPLAY + END-IF. + + *> Check date format. + INSPECT compiled-date CONVERTING "0123456789" + TO "9999999999". + IF compiled-date NOT = ALL "9" + DISPLAY "Date format NOT OK: " compiled-date + END-DISPLAY + END-IF. + + *> Check timezone format. + IF timezone NOT = "00000" + INSPECT timezone CONVERTING "0123456789" + TO "9999999999" + IF timezone NOT = "+9999" AND "-9999" + DISPLAY "Timezone format NOT OK: " timezone + END-DISPLAY + END-IF + END-IF. + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob new file mode 100644 index 0000000..ece8151 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_YEAR-TO-YYYY.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z USAGE BINARY-LONG. + PROCEDURE DIVISION. + MOVE FUNCTION YEAR-TO-YYYY ( 50 ) TO Z. + IF Z NOT = 2050 + DISPLAY Z + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob new file mode 100644 index 0000000..e25ac8b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + *> { dg-output-file "group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + PROCEDURE DIVISION. + PROG-MAIN. + CALL "subprog" USING BY CONTENT + FUNCTION CONCAT("Abc" "D") + STOP RUN. + + *> ***************************** + IDENTIFICATION DIVISION. + PROGRAM-ID. subprog. + + DATA DIVISION. + LINKAGE SECTION. + 01 TESTING PIC X ANY LENGTH. + + PROCEDURE DIVISION USING TESTING. + SUBPROG-MAIN. + DISPLAY TESTING + GOBACK. + END PROGRAM subprog. + END PROGRAM prog. *> bzzt + diff --git a/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out new file mode 100644 index 0000000..11f0477 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FUNCTION_as_CALL_parameter_BY_CONTENT.out @@ -0,0 +1,2 @@ +AbcD + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob new file mode 100644 index 0000000..bfe4b67 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.cob @@ -0,0 +1,43 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_BACKWARD_REPLACING_LEADING.out" } + identification division. + program-id. caller. + data division. + working-storage section. + 77 str pic x(19) value "AAAAsomeABthingBBBB". + procedure division. + display "Starting with " """" str """" "..." + + initialize str all value. + inspect str replacing all "A" by "X" + display "After inspect replacing ALL A by X: " """" str """" + + initialize str all value. + inspect str replacing leading "A" by "X" + display "After inspect replacing LEADING A by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "A" by "X" + display "After inspect backward replacing ALL A by X: " """" str """" + + initialize str all value. + inspect backward str replacing leading "A" by "X" + display "After inspect backward replacing LEADING A by X: " """" str """" + + initialize str all value. + inspect str replacing all "B" by "X" + display "After inspect replacing ALL B by X: " """" str """" + + initialize str all value. + inspect str replacing leading "B" by "X" + display "After inspect replacing LEADING B by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "B" by "X" + display "After inspect backward replacing ALL B by X: " """" str """" + + initialize str all value. + inspect backward str replacing leading "B" by "X" + display "After inspect backward replacing LEADING B by X: " """" str """" + goback. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out new file mode 100644 index 0000000..3e9c3c3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_LEADING.out @@ -0,0 +1,10 @@ +Starting with "AAAAsomeABthingBBBB"... +After inspect replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect replacing LEADING A by X: "XXXXsomeABthingBBBB" +After inspect backward replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect backward replacing LEADING A by X: "AAAAsomeABthingBBBB" +After inspect replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect replacing LEADING B by X: "AAAAsomeABthingBBBB" +After inspect backward replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect backward replacing LEADING B by X: "AAAAsomeABthingXXXX" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob new file mode 100644 index 0000000..c2e6a09 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.cob @@ -0,0 +1,44 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_REPLACING_TRAILING.out" } + identification division. + program-id. caller. + data division. + working-storage section. + 77 str pic x(19) value "AAAAsomeABthingBBBB". + procedure division. + display "Starting with " """" str """" "..." + + initialize str all value. + inspect str replacing all "A" by "X" + display "After inspect replacing ALL A by X: " """" str """" + + initialize str all value. + inspect str replacing trailing "A" by "X" + display "After inspect replacing TRAILING A by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "A" by "X" + display "After inspect backward replacing ALL A by X: " """" str """" + + initialize str all value. + inspect backward str replacing trailing "A" by "X" + display "After inspect backward replacing TRAILING A by X: " """" str """" + + initialize str all value. + inspect str replacing all "B" by "X" + display "After inspect replacing ALL B by X: " """" str """" + + initialize str all value. + inspect str replacing trailing "B" by "X" + display "After inspect replacing TRAILING B by X: " """" str """" + + initialize str all value. + inspect backward str replacing all "B" by "X" + display "After inspect backward replacing ALL B by X: " """" str """" + + initialize str all value. + inspect backward str replacing trailing "B" by "X" + display "After inspect backward replacing TRAILING B by X: " """" str """" + goback. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out new file mode 100644 index 0000000..c8f492d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_REPLACING_TRAILING.out @@ -0,0 +1,10 @@ +Starting with "AAAAsomeABthingBBBB"... +After inspect replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect replacing TRAILING A by X: "AAAAsomeABthingBBBB" +After inspect backward replacing ALL A by X: "XXXXsomeXBthingBBBB" +After inspect backward replacing TRAILING A by X: "XXXXsomeABthingBBBB" +After inspect replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect replacing TRAILING B by X: "AAAAsomeABthingXXXX" +After inspect backward replacing ALL B by X: "AAAAsomeAXthingXXXX" +After inspect backward replacing TRAILING B by X: "AAAAsomeABthingBBBB" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob new file mode 100644 index 0000000..fbf9e09d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.cob @@ -0,0 +1,105 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_simple_CONVERTING.out" } + + program-id. prog. + data division. + working-storage section. + 01 item pic x(64). + 01 should-be pic x(64). + procedure division. + display "Forward:" + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "jumps" + move "THE QUICK BROWN FOX jumps over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "nothing" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" + move "the quick brown fox JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" before "over" + move "the quick brown fox JUMPS over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" before "xyzzy" + move "the quick brown fox JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + display "Reverse:" + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "jumps" + move "the quick brown fox jumps OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "nothing" + move "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" after "fox" + move "THE QUICK BROWN fox jumps over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "fox" after "over" + move "the quick brown fox JUMPS over the lazy dog" to should-be + perform reportt + + move "the quick brown fox jumps over the lazy dog" to item + inspect backward item converting + "abcdefghijklmnopqrstuvwxyz" + TO "ABCDEFGHIJKLMNOPQRSTUVWXYZ" before "xyzzy" after "over" + move "THE QUICK BROWN FOX JUMPS over the lazy dog" to should-be + perform reportt + + goback. + reportt. + display " " function trim(item) + if item not equal to should-be + display "should have been " function trim(should-be) + end-if. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out new file mode 100644 index 0000000..0675c63 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_CONVERTING.out @@ -0,0 +1,15 @@ +Forward: + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + THE QUICK BROWN FOX jumps over the lazy dog + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + the quick brown fox JUMPS OVER THE LAZY DOG + the quick brown fox JUMPS over the lazy dog + the quick brown fox JUMPS OVER THE LAZY DOG +Reverse: + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + the quick brown fox jumps OVER THE LAZY DOG + THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG + THE QUICK BROWN fox jumps over the lazy dog + the quick brown fox JUMPS over the lazy dog + THE QUICK BROWN FOX JUMPS over the lazy dog + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob new file mode 100644 index 0000000..4714e5e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.cob @@ -0,0 +1,29 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_simple_REPLACING.out" } + + program-id. prog. + data division. + working-storage section. + 01 item pic x(64). + procedure division. + + move "AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc" to item + display function trim(item) + inspect backward item replacing all "Abc" by "Qrs" + display function trim(item) + + move "AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc" to item + display function trim(item) + inspect backward item replacing trailing "Abc" by "Qrs" + display function trim(item) + + move "AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc" to item + display function trim(item) + inspect backward item replacing all "Abc" by "Qrs" + after "Z" before "Y" + display function trim(item) + + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out new file mode 100644 index 0000000..230ab91 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_REPLACING.out @@ -0,0 +1,7 @@ +AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +QrsQrsXQrsQrsQrsYQrsQrsQrsQrsZQrsQrsQrsQrsQrs +AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +QrsQrsXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +AbcAbcXAbcAbcAbcYAbcAbcAbcAbcZAbcAbcAbcAbcAbc +AbcAbcXAbcAbcAbcYQrsQrsQrsQrsZAbcAbcAbcAbcAbc + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob new file mode 100644 index 0000000..7cd284f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.cob @@ -0,0 +1,78 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_BACKWARD_simple_TALLYING.out" } + + program-id. prog. + data division. + working-storage section. + 01 item pic x(64). + 01 counter pic 999. + procedure division. + + move "AAXAAAYAAAAZAAAAA" to item + display function trim(item) + display "Forward:" + + move zero to counter + inspect item tallying + counter for all "A" + display "FOR ALL A " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect item tallying + counter for all "A" after "X" + display "FOR ALL A after X " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect item tallying + counter for all "A" before "Z" + display "FOR ALL A before Z " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect item tallying + counter for all "A" after "X" before "Z" + display "FOR ALL A after X before Z " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" to item + inspect item tallying + counter for trailing "A" + display "FOR TRAILING A " counter + + + display "Backward:" + move zero to counter + inspect backward item tallying + counter for all "A" + display "FOR ALL A " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for all "A" after "X" + display "FOR ALL A after X " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for all "A" before "Z" + display "FOR ALL A before Z " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for all "A" after "Z" before "X" + display "FOR ALL A after Z before X " counter + + move zero to counter + move "AAXAAAYAAAAZAAAAA" to item + inspect backward item tallying + counter for trailing "A" + display "FOR TRAILING A " counter + + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out new file mode 100644 index 0000000..73d9006 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_BACKWARD_simple_TALLYING.out @@ -0,0 +1,14 @@ +AAXAAAYAAAAZAAAAA +Forward: +FOR ALL A 014 +FOR ALL A after X 012 +FOR ALL A before Z 009 +FOR ALL A after X before Z 007 +FOR TRAILING A 052 +Backward: +FOR ALL A 061 +FOR ALL A after X 002 +FOR ALL A before Z 005 +FOR ALL A after Z before X 007 +FOR TRAILING A 002 + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_NULL.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_NULL.cob new file mode 100644 index 0000000..26a760c1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_NULL.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE LOW-VALUES. + PROCEDURE DIVISION. + INSPECT X CONVERTING NULL TO "A". + IF X NOT = "AAA" + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob new file mode 100644 index 0000000..fe1605e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constant.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE "BCA". + PROCEDURE DIVISION. + INSPECT X CONVERTING "ABC" TO SPACES. + IF X NOT = SPACES + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob new file mode 100644 index 0000000..2983cce --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_CONVERTING_TO_figurative_constants.out" } + + identification division. + program-id. clouseau. + data division. + working-storage section. + 01 item pic x(12). + procedure division. + move all "abcd" to item + inspect item converting "abcd" to low-values + display "low-values " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to spaces + display "spaces " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to zeros + display "zeros " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to quotes + display "quotes " space """" item """" + move all "abcd" to item + inspect item converting "abcd" to high-values + display "high-values" space """" item """" + goback. + end program clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out new file mode 100644 index 0000000..7de6e48 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_CONVERTING_TO_figurative_constants.out @@ -0,0 +1,6 @@ +low-values "" +spaces " " +zeros "000000000000" +quotes """""""""""""" +high-values "ÿÿÿÿÿÿÿÿÿÿÿÿ" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob new file mode 100644 index 0000000..1bbdea4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.cob @@ -0,0 +1,83 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_1.out" } + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + 01 counts pic 99 value 5. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 5 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' EFABDBCGABEFGG 0301010005TUXYXVWRXYZZPZ' to row(1). + Move ' BABABC 0200000101SXYXYZ' to row(3). + Move ' BBBC 0001000200SSVW' to row(5). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 C2 C3 C4 OUTPUT' + Display ' -------------------- -- -- -- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB", ALL "D" + COUNT(counter + 1 2) FOR ALL "BC" + COUNT(counter + 1 3) FOR LEADING "EF" + COUNT(counter + 1 4) FOR LEADING "B" + COUNT(counter + 1 5) FOR CHARACTERS + INSPECT OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim (output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim (output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.out new file mode 100644 index 0000000..b3b354c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_1.out @@ -0,0 +1,9 @@ + INPUT C0 C1 C2 C3 C4 OUTPUT + -------------------- -- -- -- -- -- ---------------- + EFABDBCGABEFGG 03 01 01 00 05 TUXYXVWRXYZZPZ +* EFABDBCGABEFGG 03 01 01 00 05 TUXYXVWRXYZZPZ + BABABC 02 00 00 01 01 SXYXYZ +* BABABC 02 00 00 01 01 SXYXYZ + BBBC 00 01 00 02 00 SSVW +* BBBC 00 01 00 02 00 SSVW + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob new file mode 100644 index 0000000..a464101 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.cob @@ -0,0 +1,75 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_2.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 2. + 01 counts pic 99 value 2. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 4 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 2 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' BBB 0300ZZZ' to row(1). + Move ' ABA 0300ZZZ' to row(3). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 OUTPUT' + Display ' -------------------- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR CHARACTERS + COUNT(counter + 1 2) FOR ALL "A"; + INSPECT OUTPUT(COUNTER + 1)(1:len) REPLACING + CHARACTERS BY "Z" + ALL "A" BY "X" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.out new file mode 100644 index 0000000..65eb71c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_2.out @@ -0,0 +1,7 @@ + INPUT C0 C1 OUTPUT + -------------------- -- -- ---------------- + BBB 03 00 ZZZ +* BBB 03 00 ZZZ + ABA 03 00 ZZZ +* ABA 03 00 ZZZ + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob new file mode 100644 index 0000000..7111e9c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.cob @@ -0,0 +1,68 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_3.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 inputs. + 05 row occurs 10 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 3 times. + 10 output PIC X(20). + 77 len PIC 9(8). + + Procedure Division. + Move ' BBEABDABABBCABE 030002BBEXYZXYXYZCABV' to row(1). + Move ' ADDDDC 000004AZZZZC' to row(3). + Move ' ADDDDA 000005AZZZZZ' to row(5). + Move ' CDDDDC 000000CDDDDC' to row(7). + Move ' BDBBBDB 000300BDWWWDB' to row(9). +` + Display ' INPUT C0 C1 C2 OUTPUT' + Display ' -------------------- -- -- -- --------------------' + Perform Example-3 with test after + varying counter from 1 by 2 until counter = 9. + + Goback. + + Inspection Section. + Example-3. + Move row(counter) to row(counter + 1) + Move input(counter) to output(counter) + Move Zero to count(counter 1) + Move Zero to count(counter 2) + Move Zero to count(counter 3) + + Move function length( function trim(input(counter)) ) to len. + INSPECT OUTPUT(COUNTER)(1:len) TALLYING + COUNT(counter 1) FOR ALL "AB" BEFORE "BC" + COUNT(counter 2) FOR LEADING "B" AFTER "D" + COUNT(counter 3) FOR CHARACTERS AFTER "A" BEFORE "C"; + INSPECT OUTPUT(COUNTER)(1:len) REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "W" AFTER "D" + FIRST "E" BY "V" AFTER "D" + CHARACTERS BY "Z" AFTER "A" BEFORE "C" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' + count(counter 1) ' ' + count(counter 2) ' ' + count(counter 3) ' ' + function trim(output(counter)) + Display star(1 + counter) ' ' + input(1 + counter) ' ' + count(1 + counter 1) ' ' + count(1 + counter 2) ' ' + count(1 + counter 3) ' ' + function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.out new file mode 100644 index 0000000..268fa3e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_3.out @@ -0,0 +1,13 @@ + INPUT C0 C1 C2 OUTPUT + -------------------- -- -- -- -------------------- + BBEABDABABBCABE 03 00 02 BBEXYZXYXYZCABV +* BBEABDABABBCABE 03 00 02 BBEXYZXYXYZCABV + ADDDDC 00 00 04 AZZZZC +* ADDDDC 00 00 04 AZZZZC + ADDDDA 00 00 05 AZZZZZ +* ADDDDA 00 00 05 AZZZZZ + CDDDDC 00 00 00 CDDDDC +* CDDDDC 00 00 00 CDDDDC + BDBBBDB 00 03 00 BDWWWDB +* BDBBBDB 00 03 00 BDWWWDB + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob new file mode 100644 index 0000000..192e1a8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.cob @@ -0,0 +1,71 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_4.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 1. + 01 counts pic 99 value 1. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 2 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 1 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' ABABABABC 01ABABXYABC' to row(1). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 OUTPUT' + Display ' -------------------- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB" AFTER "BA" BEFORE "BC"; + INSPECT OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY" AFTER "BA" BEFORE "BC" + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.out new file mode 100644 index 0000000..a2ae6e5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_4.out @@ -0,0 +1,5 @@ + INPUT C0 C1 OUTPUT + -------------------- -- -- ---------------- + ABABABABC 01 ABABXYABC +* ABABABABC 01 ABABXYABC + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob new file mode 100644 index 0000000..0923720 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.cob @@ -0,0 +1,81 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_5-f.out" } + + Identification Division. + Program-Id. Clouseau. + *> Note: Although modeled on Example-5 in Appendix D of the ISO 2023 + *> specification, all three of the samples are incorrect. This code + *> modifies the problem to make it somewhat more interesting, and, of + *> course, changes the answers so that they are correct for the problem. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + 01 counts pic 99 value 3. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 3 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' ABABBCAB 000106ABABBCXY' to row(1). + Move ' ABDBABC 000001AVDBABC' to row(3). + Move ' BCABCABD 010000BCABCAVD' to row(5). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 C2 OUTPUT' + Display ' -------------------- -- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT BACKWARD INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB" BEFORE "BC" + COUNT(counter + 1 2) FOR LEADING "B" + COUNT(counter + 1 3) FOR CHARACTERS AFTER "A" BEFORE "D" + INSPECT BACKWARD OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.out new file mode 100644 index 0000000..dbfef10 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-f.out @@ -0,0 +1,9 @@ + INPUT C0 C1 C2 OUTPUT + -------------------- -- -- -- ---------------- + ABABBCAB 00 01 06 ABABBCXY +* ABABBCAB 00 01 06 ABABBCXY + ABDBABC 00 00 01 AVDBABC +* ABDBABC 00 00 01 AVDBABC + BCABCABD 01 00 00 BCABCAVD +* BCABCABD 01 00 00 BCABCAVD + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.cob new file mode 100644 index 0000000..bf9299a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.cob @@ -0,0 +1,77 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_5-r.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + 01 counts pic 99 value 3. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 count PIC 99 occurs 3 times. + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' BACBBABA 000004BACBBXYA' to row(1). + Move ' CBABDBA 000005CBAVDBA' to row(3). + Move ' DBACBACB 000100DBACBACB' to row(5). + + compute rowlim = 2*rows - 1 + + Display ' INPUT C0 C1 C2 C3 C4 OUTPUT' + Display ' -------------------- -- -- -- -- -- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + perform varying ncount from 1 by 1 until ncount > counts + Move Zero to count(counter + 1 ncount) + end-perform + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT BACKWARD INPUT(COUNTER)(1:len) TALLYING + COUNT(counter + 1 1) FOR ALL "AB" BEFORE "BC" + COUNT(counter + 1 2) FOR LEADING "B" + COUNT(counter + 1 3) FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD OUTPUT(COUNTER + 1)(1:len) REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(counter ncount) ' ' with no advancing + end-perform + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + perform varying ncount from 1 by 1 until ncount > counts + Display count(1 + counter ncount) ' ' with no advancing + end-perform + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.out new file mode 100644 index 0000000..02e8d67 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5-r.out @@ -0,0 +1,9 @@ + INPUT C0 C1 C2 C3 C4 OUTPUT + -------------------- -- -- -- -- -- ---------------- + BACBBABA 00 00 04 BACBBXYA +* BACBBABA 00 00 04 BACBBXYA + CBABDBA 00 00 05 CBAVDBA +* CBABDBA 00 00 05 CBAVDBA + DBACBACB 00 01 00 DBACBACB +* DBACBACB 00 01 00 DBACBACB + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.cob new file mode 100644 index 0000000..016777b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.cob @@ -0,0 +1,90 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_5.out" } + Identification Division. + Program-Id. Clouseau. + *> Note: Although modeled on Example-5 in Appendix D of the ISO 2023 + *> specification, all six of the samples are incorrect. + *> This code executes the examples as written, and the test suite checks + *> For the answers believed to be correct + Data Division. + Working-Storage Section. + 01 item-1 pic x(8) value "ABABBCAB". + 01 item-2 pic x(7) value "ABDBABC". + 01 item-3 pic x(8) value "BCABCABD". + 01 count-0 pic 9 value zero. + 01 count-1 pic 9 value zero. + 01 count-2 pic 9 value zero. + Procedure Division. + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + display item-1 " " with no advancing + INSPECT BACKWARD ITEM-1 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-1 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-1 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + display item-2 " " with no advancing + INSPECT BACKWARD ITEM-2 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-2 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-2 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + display item-3 " " with no advancing + INSPECT BACKWARD ITEM-3 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-3 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-3 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + MOVE FUNCTION REVERSE (ITEM-1) TO ITEM-1 + display item-1 " " with no advancing + INSPECT ITEM-1 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-1 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-1 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + MOVE FUNCTION REVERSE (ITEM-2) TO ITEM-2 + display item-2 " " with no advancing + INSPECT ITEM-2 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-2 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-2 + + initialize item-1 item-2 item-3 count-0 count-1 count-2 all value + MOVE FUNCTION REVERSE (ITEM-3) TO ITEM-3 + display item-3 " " with no advancing + INSPECT ITEM-3 TALLYING + COUNT-0 FOR ALL "AB" BEFORE "BC" + COUNT-1 FOR LEADING "B" + COUNT-2 FOR CHARACTERS AFTER "A" BEFORE "C" + INSPECT BACKWARD ITEM-3 REPLACING + ALL "AB" BY "XY" BEFORE "BC" + LEADING "B" BY "V" AFTER "D" + display count-0 space count-1 space count-2 space item-3 + + goback. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.out new file mode 100644 index 0000000..afcfb72 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_5.out @@ -0,0 +1,7 @@ +ABABBCAB 0 1 0 ABABBCXY +ABDBABC 0 0 0 AVDBABC +BCABCABD 1 0 0 BCABCAVD +BACBBABA 1 1 0 BACBBXYA +CBABDBA 1 0 0 CBAVDBA +DBACBACB 0 0 0 DBACBACB + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob new file mode 100644 index 0000000..75917a2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.cob @@ -0,0 +1,58 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_6.out" } + + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 1. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 output PIC X(20). + 77 len PIC 9(8). + Procedure Division. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' AC"AEBDFBCD#AB"D AC"XEYXFYZX#AB"D' to row(1). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT OUTPUT' + Display ' -------------------- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT OUTPUT(COUNTER + 1)(1:len) CONVERTING + "ABCD" TO "XYZX" AFTER QUOTE BEFORE "#". + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.out new file mode 100644 index 0000000..dfe5f4b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_6.out @@ -0,0 +1,5 @@ + INPUT OUTPUT + -------------------- ---------------- + AC"AEBDFBCD#AB"D AC"XEYXFYZX#AB"D +* AC"AEBDFBCD#AB"D AC"XEYXFYZX#AB"D + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob new file mode 100644 index 0000000..ca2ae71 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.cob @@ -0,0 +1,65 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_ISO_Example_7.out" } + Identification Division. + Program-Id. Clouseau. + Data Division. + Working-Storage Section. + 01 rows pic 99 value 3. + + 01 rowlim pic 99. + 01 ncount pic 99. + + 01 inputs. + 05 row occurs 6 times indexed by counter. + 10 star PIC X. + 10 input PIC X(20). + 10 output PIC X(20). + 77 len PIC 9(8). + + Linkage Section. + 77 result PIC 9(8) Value 0. + + Procedure Division returning result. + *> Odd-numbered rows are "read only" and contain the inputs and expected + *> outputs. + *> Even-numbered rows are modified by the INSPECT statements and contain + *> the observed outputs + Move ' 415-245-1212 415-245-1212' to row(1). + Move ' 415-CH5-1212 415-??5-1212' to row(3). + Move ' 20%Numeric 20%???????' to row(5). +` + compute rowlim = 2*rows - 1 + + Display ' INPUT OUTPUT' + Display ' -------------------- ----------------' + Perform Example-1 with test after + varying counter from 1 by 2 until counter >= rowlim. + + Goback. + + Inspection Section. + Example-1. + Move row(counter) to row(counter + 1) + + Move function length( function trim(input(counter)) ) to len. + MOVE INPUT(COUNTER) TO OUTPUT(COUNTER + 1) + INSPECT OUTPUT(COUNTER + 1)(1:len) CONVERTING + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + TO ALL "?" + + If row(counter) = row(counter + 1) then + Move '*' to star(counter + 1) + Else + Move 1 to result + Move '!' to star(counter + 1). + + Display star(counter) ' ' + input(counter) ' ' with no advancing + display function trim(output(counter)) + + Display star(1 + counter) ' ' + input(1 + counter) ' ' with no advancing + display function trim(output(1 + counter)) + continue. + end program Clouseau. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.out b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.out new file mode 100644 index 0000000..2418c36 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_ISO_Example_7.out @@ -0,0 +1,9 @@ + INPUT OUTPUT + -------------------- ---------------- + 415-245-1212 415-245-1212 +* 415-245-1212 415-245-1212 + 415-CH5-1212 415-??5-1212 +* 415-CH5-1212 415-??5-1212 + 20%Numeric 20%??????? +* 20%Numeric 20%??????? + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob new file mode 100644 index 0000000..358a1da --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_No_repeat_conversion_check.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE "BCA". + 01 Y PIC X(6) VALUE " BCA". + PROCEDURE DIVISION. + INSPECT X CONVERTING "ABC" TO "BCD". + IF X NOT = "CDB" + DISPLAY "X: " X. + INSPECT Y CONVERTING "ABC" TO "BCD". + IF Y NOT = " CDB" + DISPLAY "Y: " Y. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob new file mode 100644 index 0000000..d710292 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_LEADING_ZEROS_BY_SPACES.cob @@ -0,0 +1,13 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "0001". + PROCEDURE DIVISION. + INSPECT X REPLACING LEADING ZEROS BY SPACES. + IF X NOT = " 1" + DISPLAY "Should be ' 1' but is '" X "'". + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob new file mode 100644 index 0000000..5d706eb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_REPLACING_figurative_constant.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(3) VALUE "BCA". + PROCEDURE DIVISION. + INSPECT X REPLACING ALL "BC" BY SPACE. + IF X NOT = " A" + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_AFTER.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_AFTER.cob new file mode 100644 index 0000000..c8cd95e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_AFTER.cob @@ -0,0 +1,26 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "ABC ". + 01 TAL PIC 999 VALUE 0. + PROCEDURE DIVISION. + MOVE 0 TO TAL. + INSPECT X TALLYING TAL FOR CHARACTERS + AFTER INITIAL " ". + IF TAL NOT = 0 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + MOVE 0 TO TAL. + MOVE " ABC" TO X. + INSPECT X TALLYING TAL FOR CHARACTERS + AFTER INITIAL " ". + IF TAL NOT = 3 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob new file mode 100644 index 0000000..5640ff5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_BEFORE.cob @@ -0,0 +1,26 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "ABC ". + 01 TAL PIC 999 VALUE 0. + PROCEDURE DIVISION. + MOVE 0 TO TAL. + INSPECT X TALLYING TAL FOR CHARACTERS + BEFORE INITIAL " ". + IF TAL NOT = 3 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + MOVE 0 TO TAL. + MOVE " ABC" TO X. + INSPECT X TALLYING TAL FOR CHARACTERS + BEFORE INITIAL " ". + IF TAL NOT = 0 + DISPLAY TAL NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob new file mode 100644 index 0000000..ab1a4118 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.cob @@ -0,0 +1,142 @@ + *> { dg-do run } + *> { dg-output-file "group2/INSPECT_TALLYING_REPLACING_ISO_Example.out" } + + *> Example from ISO/IEC 2023 page 1151 + IDENTIFICATION DIVISION. + PROGRAM-ID. tests. + PROCEDURE DIVISION. + CALL "test1" + CALL "test2" + CALL "test3" + goback. + end program tests. + + IDENTIFICATION DIVISION. + PROGRAM-ID. test1. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ITEM PIC X(14) VALUE "EFABDBCGABEFGG". + 01 COUNT-0 PIC 99 VALUE 0. + 01 COUNT-1 PIC 99 VALUE 0. + 01 COUNT-2 PIC 99 VALUE 0. + 01 COUNT-3 PIC 99 VALUE 0. + 01 COUNT-4 PIC 99 VALUE 0. + PROCEDURE DIVISION. + INSPECT ITEM TALLYING + COUNT-0 FOR ALL "AB", ALL "D" + COUNT-1 FOR ALL "BC" + COUNT-2 FOR LEADING "EF" + COUNT-3 FOR LEADING "B" + COUNT-4 FOR CHARACTERS; + INSPECT ITEM REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + DISPLAY "Counts are: " + COUNT-0 SPACE + COUNT-1 SPACE + COUNT-2 SPACE + COUNT-3 SPACE + COUNT-4 + DISPLAY "Should be: " + "03" SPACE + "01" SPACE + "01" SPACE + "00" SPACE + "05" + DISPLAY "Result is " """" ITEM """" + MOVE "TUXYXVWRXYZZPZ" TO ITEM + DISPLAY "Should be " """" ITEM """" + GOBACK. + END PROGRAM test1. + + IDENTIFICATION DIVISION. + PROGRAM-ID. test2. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ITEM PIC X(6) VALUE "BABABC". + 01 COUNT-0 PIC 99 VALUE 0. + 01 COUNT-1 PIC 99 VALUE 0. + 01 COUNT-2 PIC 99 VALUE 0. + 01 COUNT-3 PIC 99 VALUE 0. + 01 COUNT-4 PIC 99 VALUE 0. + PROCEDURE DIVISION. + INSPECT ITEM TALLYING + COUNT-0 FOR ALL "AB", ALL "D" + COUNT-1 FOR ALL "BC" + COUNT-2 FOR LEADING "EF" + COUNT-3 FOR LEADING "B" + COUNT-4 FOR CHARACTERS; + INSPECT ITEM REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + DISPLAY "Counts are: " + COUNT-0 SPACE + COUNT-1 SPACE + COUNT-2 SPACE + COUNT-3 SPACE + COUNT-4 + DISPLAY "Should be: " + "02" SPACE + "00" SPACE + "00" SPACE + "01" SPACE + "01" + DISPLAY "Result is " """" ITEM """" + MOVE "SXYXYZ" TO ITEM + DISPLAY "Should be " """" ITEM """" + GOBACK. + END PROGRAM test2. + + IDENTIFICATION DIVISION. + PROGRAM-ID. test3. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ITEM PIC X(4) VALUE "BBBC". + 01 COUNT-0 PIC 99 VALUE 0. + 01 COUNT-1 PIC 99 VALUE 0. + 01 COUNT-2 PIC 99 VALUE 0. + 01 COUNT-3 PIC 99 VALUE 0. + 01 COUNT-4 PIC 99 VALUE 0. + PROCEDURE DIVISION. + INSPECT ITEM TALLYING + COUNT-0 FOR ALL "AB", ALL "D" + COUNT-1 FOR ALL "BC" + COUNT-2 FOR LEADING "EF" + COUNT-3 FOR LEADING "B" + COUNT-4 FOR CHARACTERS; + INSPECT ITEM REPLACING + ALL "AB" BY "XY", "D" BY "X" + ALL "BC" BY "VW" + LEADING "EF" BY "TU" + LEADING "B" BY "S" + FIRST "G" BY "R" + FIRST "G" BY "P" + CHARACTERS BY "Z" + DISPLAY "Counts are: " + COUNT-0 SPACE + COUNT-1 SPACE + COUNT-2 SPACE + COUNT-3 SPACE + COUNT-4 + DISPLAY "Should be: " + "00" SPACE + "01" SPACE + "00" SPACE + "02" SPACE + "00" + DISPLAY "Result is " """" ITEM """" + MOVE "SSVW" TO ITEM + DISPLAY "Should be " """" ITEM """" + GOBACK. + END PROGRAM test3. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out new file mode 100644 index 0000000..58f40fe --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TALLYING_REPLACING_ISO_Example.out @@ -0,0 +1,13 @@ +Counts are: 03 01 01 00 05 +Should be: 03 01 01 00 05 +Result is "TUXYXVWRXYZZPZ" +Should be "TUXYXVWRXYZZPZ" +Counts are: 02 00 00 01 01 +Should be: 02 00 00 01 01 +Result is "SXYXYZ" +Should be "SXYXYZ" +Counts are: 00 01 00 02 00 +Should be: 00 01 00 02 00 +Result is "SSVW" +Should be "SSVW" + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.cob b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.cob new file mode 100644 index 0000000..231913c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.cob @@ -0,0 +1,58 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/INSPECT_TRAILING.out" } + + identification division. + program-id. prog. + data division. + working-storage section. + 01 the-text pic x(30) value " middle". + 01 counter pic 9999. + 01 expected pic 9999. + 01 should-be pic zzz9. + 01 but-is pic zzz9. + 01 msg pic x(100). + procedure division. + + move "inspect for leading spaces" to msg + move zero to counter + inspect the-text tallying counter for leading spaces + move 4 to expected + perform result. + + move "inspect for trailing spaces with reverse" to msg + move zero to counter + inspect function reverse(the-text) tallying counter for leading spaces + move 20 to expected + perform result. + + move "inspect for trailing spaces with reversed variable" to msg + move function reverse(the-text) to the-text + move zero to counter + inspect the-text tallying counter for leading spaces + move 20 to expected + perform result. + + move "inspect for trailing spaces with INSPECT TRAILING extension" to msg + move function reverse(the-text) to the-text + move zero to counter + inspect the-text tallying counter for trailing spaces + move 20 to expected + perform result. + + inspect the-text replacing trailing space by "X" + display the-text + + stop run. + + result. + display function trim(msg) ": " with no advancing + move expected to should-be + if counter equal to expected + display function trim(should-be) + else + move counter to but-is + display "should be " function trim(should-be) + " but is " function trim(but-is) + end-if. + diff --git a/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.out b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.out new file mode 100644 index 0000000..e55c3e9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/INSPECT_TRAILING.out @@ -0,0 +1,6 @@ +inspect for leading spaces: 4 +inspect for trailing spaces with reverse: 20 +inspect for trailing spaces with reversed variable: 20 +inspect for trailing spaces with INSPECT TRAILING extension: 20 + middleXXXXXXXXXXXXXXXXXXXX + diff --git a/gcc/testsuite/cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob b/gcc/testsuite/cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob new file mode 100644 index 0000000..b94adf5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Intrinsics_without_FUNCTION_keyword__2_.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION PI + FUNCTION E. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC 99V99. + PROCEDURE DIVISION. + MOVE PI TO Z. + MOVE E TO Z. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.cob b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.cob new file mode 100644 index 0000000..6e0443d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.cob @@ -0,0 +1,237 @@ + *> { dg-do run } + *> { dg-output-file "group2/Program-to-program_parameters_and_retvals.out" } + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 var1 pic 9 VALUE 1. + 01 var2 BINARY-CHAR VALUE 22. + 01 var3 pic s999 COMP-3 VALUE -333. + 01 var4 pic 9999 BINARY VALUE 4444. + 01 var5 pic 99.99 VALUE "12.34". + 01 var6 pic s999V999 COMP-5 VALUE -123.456. + 01 var7 float-short VALUE 1.23E10. + 01 var8 float-long VALUE -1.23E20. + 01 var9 float-extended VALUE 1.23E40. + 01 var64 pic 9(15) VALUE 987654321098765. + 01 var128 pic s9(30) VALUE -987654321098765432109876543210. + 01 filler. + 02 varpd pic 9(18) comp-5 value 1250999747361. + 02 varp redefines varpd pointer. + 01 varg. + 02 varg1 pic x(7) VALUE "That's". + 02 varg2 pic x(5) VALUE "all," . + 02 varg3 pic x(7) VALUE "folks!". + + 01 var1r pic 9 . + 01 var2r BINARY-CHAR . + 01 var3r pic s999 COMP-3 . + 01 var4r pic 9999 BINARY . + 01 var5r pic 99.99 . + 01 var6r pic s999V999 COMP-5 . + 01 var7r float-short . + 01 var8r float-long . + 01 var9r float-extended . + 01 var64r pic 9(15) . + 01 var128r pic s9(30) . + 01 varpr pointer. + 01 vargr. + 02 varg1 pic x(7). + 02 varg2 pic x(5). + 02 varg3 pic x(7). + + PROCEDURE DIVISION. + display var1 + call "rvar1" USING by value var1 RETURNING var1r + display var1r + + display var2 + call "rvar2" USING by reference var2 RETURNING var2r + display var2r + + display var3 + call "rvar3" USING by content var3 RETURNING var3r + display var3r + + display var4 + call "rvar4" USING by value var4 RETURNING var4r + display var4r + + display var5 + call "rvar5" USING by reference var5 RETURNING var5r + display var5r + + display var6 + call "rvar6" USING by content var6 RETURNING var6r + display var6r + + display var7 + call "rvar7" USING by reference var7 RETURNING var7r + display var7r + + display var8 + call "rvar8" USING by value var8 RETURNING var8r + display var8r + + display var9 + call "rvar9" USING by content var9 RETURNING var9r + display var9r + + display var64 + call "rvar64" USING by value var64 RETURNING var64r + display var64r + + display var128 + call "rvar128" USING by reference var128 RETURNING var128r + display var128r + + display varp + call "rvarp" USING by reference varp RETURNING varpr + display varpr + + display """"varg"""" + call "rvarg" USING by reference varg RETURNING vargr + display """"vargr"""" + + GOBACK. + END PROGRAM prog. + + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar1. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 9 . + 01 varr pic 9 . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar1. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar2. + DATA DIVISION. + LINKAGE SECTION. + 01 var BINARY-CHAR . + 01 varr BINARY-CHAR . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar2. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar3. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic s999 COMP-3 . + 01 varr pic s999 COMP-3 . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar3. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar4. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 9999 BINARY . + 01 varr pic 9999 BINARY . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar4. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar5. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 99.99 . + 01 varr pic 99.99 . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar5. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar6. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic s999V999 COMP-5 . + 01 varr pic s999V999 COMP-5 . + PROCEDURE DIVISION USING reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar6. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar7. + DATA DIVISION. + LINKAGE SECTION. + 01 var float-short . + 01 varr float-short . + PROCEDURE DIVISION USING by reference VAR RETURNING varr. + MOVE var TO varr. + GOBACK. + END PROGRAM rvar7. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar8. + DATA DIVISION. + LINKAGE SECTION. + 01 var float-long . + 01 varr float-long . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar8. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar9. + DATA DIVISION. + LINKAGE SECTION. + 01 var float-extended . + 01 varr float-extended . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar9. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar64. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic 9(15) . + 01 varr pic 9(15) . + PROCEDURE DIVISION USING by value var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar64. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvar128. + DATA DIVISION. + LINKAGE SECTION. + 01 var pic s9(30) . + 01 varr pic s9(30) . + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvar128. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvarp. + DATA DIVISION. + LINKAGE SECTION. + 01 var pointer . + 01 varr pointer . + PROCEDURE DIVISION USING by reference var RETURNING varr. + SET varr TO var. + END PROGRAM rvarp. + + IDENTIFICATION DIVISION. + PROGRAM-ID. rvarg. + DATA DIVISION. + LINKAGE SECTION. + 01 var. + 02 varg1 pic x(7). + 02 varg2 pic x(5). + 02 varg3 pic x(7). + 01 varr. + 02 varg1 pic x(7). + 02 varg2 pic x(5). + 02 varg3 pic x(7). + PROCEDURE DIVISION USING by reference var RETURNING varr. + MOVE var TO varr. + END PROGRAM rvarg. + diff --git a/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.out b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.out new file mode 100644 index 0000000..ce543df --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Program-to-program_parameters_and_retvals.out @@ -0,0 +1,27 @@ +1 +1 ++022 ++022 +-333 +-333 +4444 +4444 +12.34 +12.34 +-123.456 +-123.456 +1.230000026E+10 +1.230000026E+10 +-1.23E+20 +-1.23E+20 +1.23E+40 +1.23E+40 +987654321098765 +987654321098765 +-987654321098765432109876543210 +-987654321098765432109876543210 +0x0000012345654321 +0x0000012345654321 +"That's all, folks! " +"That's all, folks! " + diff --git a/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob new file mode 100644 index 0000000..122aab7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.cob @@ -0,0 +1,38 @@ + *> { dg-do run } + *> { dg-output-file "group2/Recursive_FUNCTION_with_local-storage.out" } + IDENTIFICATION DIVISION. + FUNCTION-ID. callee. + DATA DIVISION. + LOCAL-STORAGE SECTION. + 01 LCL-X PIC 999 . + LINKAGE SECTION. + 01 parm PIC 999. + 01 retval PIC 999. + PROCEDURE DIVISION USING parm RETURNING retval. + display "On entry, parm is: " parm + move parm to lcl-x + move parm to retval + subtract 1 from parm + if parm > 0 + display "A The function returns " function callee(parm). + if lcl-x not equal to retval + display "On exit, lcl-s and retval are: " lcl-x " and " retval + display "But they should be equal to each other" + end-if + goback. + end function callee. + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 val PIC 999 VALUE 5. + PROCEDURE DIVISION. + DISPLAY "Starting value is: " val + display "B The function returns " function callee(val). + STOP RUN. + end program caller. + diff --git a/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out new file mode 100644 index 0000000..3ccd69a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Recursive_FUNCTION_with_local-storage.out @@ -0,0 +1,12 @@ +Starting value is: 005 +On entry, parm is: 005 +On entry, parm is: 004 +On entry, parm is: 003 +On entry, parm is: 002 +On entry, parm is: 001 +A The function returns 001 +A The function returns 002 +A The function returns 003 +A The function returns 004 +B The function returns 005 + diff --git a/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.cob b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.cob new file mode 100644 index 0000000..cc306b4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.cob @@ -0,0 +1,14 @@ + *> { dg-do run } + *> { dg-output-file "group2/Repository_functions_clause.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SOURCE-COMPUTER. a. + OBJECT-COMPUTER. a. + REPOSITORY. + FUNCTION ALL INTRINSIC. + PROCEDURE DIVISION. + DISPLAY "OK". + diff --git a/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.out b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.out new file mode 100644 index 0000000..885fd66 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Repository_functions_clause.out @@ -0,0 +1,2 @@ +OK + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob new file mode 100644 index 0000000..d4df058 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.cob @@ -0,0 +1,51 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_RETURNING_group_and_PIC_9_5_.out" } + + IDENTIFICATION DIVISION. + FUNCTION-ID. COPYPAR. + DATA DIVISION. + LINKAGE SECTION. + 01 PARSA. + 02 PAR1 PICTURE X(32). + 02 PAR2 PICTURE X(32). + 01 PARSB. + 02 PAR1 PICTURE X(32). + 02 PAR2 PICTURE X(32). + PROCEDURE DIVISION USING PARSA RETURNING PARSB. + MOVE PARSA TO PARSB + DISPLAY """" PARSB """" + GOBACK. + END FUNCTION COPYPAR. + IDENTIFICATION DIVISION. + FUNCTION-ID. COPYPAR2. + DATA DIVISION. + LINKAGE SECTION. + 01 PARSB PIC 99999. + 01 PAR5 PIC 99999. + PROCEDURE DIVISION USING PAR5 RETURNING PARSB. + MOVE PAR5 TO PARSB + DISPLAY PARSB + GOBACK. + END FUNCTION COPYPAR2. + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION COPYPAR, COPYPAR2. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 PARS1. + 02 PAR1 PICTURE X(32) VALUE "Santa". + 02 PAR2 PICTURE X(32) VALUE "Claus". + 01 PARS2. + 02 PAR1 PICTURE X(32). + 02 PAR2 PICTURE X(32). + 01 PAR5 PICTURE 99999 VALUE 54321. + PROCEDURE DIVISION. + MOVE COPYPAR(PARS1) TO PARS2 + DISPLAY """" PARS2 """". + DISPLAY COPYPAR2(PAR5) + STOP RUN. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out new file mode 100644 index 0000000..1361e9a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_RETURNING_group_and_PIC_9_5_.out @@ -0,0 +1,5 @@ +"Santa Claus " +"Santa Claus " +54321 +54321 + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.cob b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.cob new file mode 100644 index 0000000..71ef09b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.cob @@ -0,0 +1,39 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_fibonacci_recursion.out" } + + identification division. + function-id. fib-func. + data division. + working-storage section. + 01 instance pic 9999 value 0. + linkage section. + 01 n binary-char unsigned. + 01 f-n binary-long unsigned. + procedure division using n returning f-n. + evaluate true + when n = 0 + move 0 to f-n + when n = 1 + move 1 to f-n + when other + compute f-n = fib-func(n - 1) + fib-func(n - 2) + end-evaluate + goback . + end function fib-func. + + identification division. + program-id. pmain. + environment division. + configuration section. + repository. + function fib-func. + data division. + working-storage section. + 01 n binary-char unsigned. + procedure division. + perform varying n from 1 by 1 until n > 16 + display "fibonacci(" n "): " fib-func(n) + end-perform + stop run. + end program pmain. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.out b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.out new file mode 100644 index 0000000..34dabfb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_fibonacci_recursion.out @@ -0,0 +1,17 @@ +fibonacci(001): 1 +fibonacci(002): 1 +fibonacci(003): 2 +fibonacci(004): 3 +fibonacci(005): 5 +fibonacci(006): 8 +fibonacci(007): 13 +fibonacci(008): 21 +fibonacci(009): 34 +fibonacci(010): 55 +fibonacci(011): 89 +fibonacci(012): 144 +fibonacci(013): 233 +fibonacci(014): 377 +fibonacci(015): 610 +fibonacci(016): 987 + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.cob b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.cob new file mode 100644 index 0000000..74576b6 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.cob @@ -0,0 +1,33 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_in_COMPUTE.out" } + + IDENTIFICATION DIVISION. + FUNCTION-ID. func. + + DATA DIVISION. + LINKAGE SECTION. + 01 num PIC 999. + + PROCEDURE DIVISION RETURNING num. + MOVE 100 TO num + . + END FUNCTION func. + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION func. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 x PIC 999. + + PROCEDURE DIVISION. + COMPUTE x = 101 + FUNCTION func + DISPLAY x + . + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.out b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.out new file mode 100644 index 0000000..d757a46 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_in_COMPUTE.out @@ -0,0 +1,2 @@ +201 + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.cob b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.cob new file mode 100644 index 0000000..1e9b378 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.cob @@ -0,0 +1,49 @@ + *> { dg-do run } + *> { dg-output-file "group2/UDF_with_recursion.out" } + + IDENTIFICATION DIVISION. + FUNCTION-ID. foo. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 ttl PIC 9 VALUE 1. + + LOCAL-STORAGE SECTION. + 01 num PIC 9. + + LINKAGE SECTION. + 01 arg PIC 9. + 01 ret PIC 9. + + PROCEDURE DIVISION USING arg RETURNING ret. + IF arg < 5 + ADD 1 TO arg GIVING num END-ADD + MOVE FUNCTION foo (num) TO ret + ELSE + MOVE arg TO ret + END-IF + DISPLAY "Step: " ttl ", Arg: " arg ", Return: " ret + END-DISPLAY + ADD 1 to ttl END-ADD + GOBACK. + END FUNCTION foo. + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + REPOSITORY. + FUNCTION foo. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 num PIC 9 VALUE 1. + + PROCEDURE DIVISION. + DISPLAY "Return value '" FUNCTION foo (num) "'" + WITH NO ADVANCING + END-DISPLAY + GOBACK. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.out b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.out new file mode 100644 index 0000000..13bd1e9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UDF_with_recursion.out @@ -0,0 +1,6 @@ +Step: 1, Arg: 5, Return: 5 +Step: 2, Arg: 4, Return: 5 +Step: 3, Arg: 3, Return: 5 +Step: 4, Arg: 2, Return: 5 +Step: 5, Arg: 1, Return: 5 +Return value '5' diff --git a/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob new file mode 100644 index 0000000..3753e7a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.cob @@ -0,0 +1,36 @@ + *> { dg-do run } + *> { dg-output-file "group2/call_subprogram_using_pointer__passing_pointer.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 varp program-pointer. + PROCEDURE DIVISION. + SET varp TO ENTRY "ref". + CALL "sub" USING BY VALUE varp. + end program prog. + + IDENTIFICATION DIVISION. + PROGRAM-ID. sub. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 param pic x(12) value "hi". + LINKAGE SECTION. + 77 varp program-pointer. + PROCEDURE DIVISION USING BY VALUE varp. + DISPLAY "About to call 'ref hi' directly" + CALL "ref" USING param. + DISPLAY "About to call 'ref hi' indirectly" + CALL varp USING param. + end program sub. + + IDENTIFICATION DIVISION. + PROGRAM-ID. ref. + DATA DIVISION. + LINKAGE SECTION. + 77 greeting pic x(12). + PROCEDURE DIVISION using greeting. + DISPLAY """" greeting """". + end program ref. + diff --git a/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out new file mode 100644 index 0000000..7a12ec1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/call_subprogram_using_pointer__passing_pointer.out @@ -0,0 +1,5 @@ +About to call 'ref hi' directly +"hi " +About to call 'ref hi' indirectly +"hi " + diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18a.C b/gcc/testsuite/g++.dg/abi/abi-tag18a.C index c6fb160..392abf7 100644 --- a/gcc/testsuite/g++.dg/abi/abi-tag18a.C +++ b/gcc/testsuite/g++.dg/abi/abi-tag18a.C @@ -1,4 +1,4 @@ -// { dg-skip-if "PR 70349" { hppa*-*-hpux* && { ! lp64 } } } +// { dg-skip-if "PR 70349" { hppa*-*-hpux* } } // { dg-options "-fabi-version=9 -fno-implicit-constexpr" } // { dg-final { scan-assembler "_Z1fB7__test1v" } } // { dg-final { scan-assembler "_ZZ1fB7__test1vEN1T1gB7__test2Ev" } } diff --git a/gcc/testsuite/g++.dg/abi/pure-virtual1.C b/gcc/testsuite/g++.dg/abi/pure-virtual1.C index ce7cd70..2df6133 100644 --- a/gcc/testsuite/g++.dg/abi/pure-virtual1.C +++ b/gcc/testsuite/g++.dg/abi/pure-virtual1.C @@ -4,6 +4,7 @@ // { dg-additional-options "-fno-rtti -nostdlib++" } // { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } } // { dg-xfail-if "AIX weak" { powerpc-ibm-aix* } } +// { dg-xfail-if PR119369 { amdgcn-*-* } } struct A { 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/lambda/lambda-__func__3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__3.C new file mode 100644 index 0000000..50ad6e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-__func__3.C @@ -0,0 +1,6 @@ +// PR c++/118629 +// { dg-do compile { target c++11 } } + +void foo() { + []() -> decltype(+__FUNCTION__) { return nullptr; }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr119563.C b/gcc/testsuite/g++.dg/cpp0x/pr119563.C new file mode 100644 index 0000000..9363a09 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr119563.C @@ -0,0 +1,79 @@ +// PR c++/119563 +// { dg-do run { target c++11 } } +// { dg-options "-O2" } + +namespace std { +template <typename T> +struct initializer_list { +private: + T *_M_array; + decltype (sizeof 0) _M_len; +public: + constexpr decltype (sizeof 0) + size () const noexcept { return _M_len; } + constexpr const T * + begin () const noexcept { return _M_array; } + constexpr const T * + end () const noexcept { return begin () + size (); } +}; +} + +struct A {} a; + +struct B { + constexpr B (int x) : B (a, x) {} + template <typename... T> + constexpr B (A, T... x) : b(x...) {} + int b; +}; + +struct C { + C (std::initializer_list<B> x) + { + if (x.size () != 130 + 1024 + 130) + __builtin_abort (); + unsigned int i = 1, j = 0; + for (auto a = x.begin (); a < x.end (); ++a) + if (a->b != i) + __builtin_abort (); + else + { + if (j == 129 || j == 129 + 1024) + i = 0; + i = (i & 15) + 1; + ++j; + } + c = true; + } + bool c; +}; + +#define D 1 + 0, 2 + 0, 3 + 0, 4 + 0, 5 + 0, 6 + 0, 7 + 0, 8 + 0, \ + 9 + 0, 10 + 0, 11 + 0, 12 + 0, 13 + 0, 14 + 0, 15 + 0, 16 + 0 +#define E D, D, D, D, D, D, D, D + +C c { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, E, E, E, E, E, E, E, E, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 1, 2 }; + +int +main () +{ + if (!c.c) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr84497.C b/gcc/testsuite/g++.dg/cpp0x/pr84497.C index be5a9d3..8a9478b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr84497.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr84497.C @@ -3,6 +3,7 @@ // { dg-require-weak "" } // { dg-require-alias "" } // { dg-skip-if "No .weak" { { hppa*-*-hpux* } && { ! lp64 } } } +// { dg-skip-if PR119369 { amdgcn-*-* } } struct Base { diff --git a/gcc/testsuite/g++.dg/cpp0x/temp-extend3.C b/gcc/testsuite/g++.dg/cpp0x/temp-extend3.C new file mode 100644 index 0000000..3eab88d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/temp-extend3.C @@ -0,0 +1,32 @@ +// PR c++/119383 +// { dg-do run { target c++11 } } + +int g; + +struct base { + virtual base *clone() const = 0; + ~base() { } +}; + +struct impl : virtual base { + base *clone() const { return new impl; } // #1 + impl() { ++g; } + ~impl() { --g; } +}; + +const base * +make_a_clone () +{ + const base &base = impl{}; // #2 + return base.clone(); +} + +int +main () +{ + make_a_clone (); + // impl::impl() is called twice (#1 and #2), impl::~impl() once, + // at the end of make_a_clone. + if (g != 1) + __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/lambda-targ11.C b/gcc/testsuite/g++.dg/cpp2a/lambda-targ11.C new file mode 100644 index 0000000..9f2f743 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ11.C @@ -0,0 +1,13 @@ +// PR c++/119401 +// { dg-do compile { target c++20 } } + +template <auto> +struct B {}; +template <int N> +struct A { + void f(B<[]{}>) {} +}; +auto t = &A<0>::f; + +// A<0>::f(B<A<0>::{lambda()#1}{}>) +// { dg-final { scan-assembler "_ZN1AILi0EE1fE1BIXtlNS0_UlvE_EEEE" { xfail *-*-* } } } diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ12.C b/gcc/testsuite/g++.dg/cpp2a/lambda-targ12.C new file mode 100644 index 0000000..bb3f701 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ12.C @@ -0,0 +1,13 @@ +// PR c++/119401 +// { dg-do compile { target c++20 } } + +template <class> +struct B {}; +template <int N> +struct A { + void f(B<decltype([]{})>) {} +}; +auto t = &A<0>::f; + +// A<0>::f(B<A<0>::{lambda()#1}>) +// { dg-final { scan-assembler "_ZN1AILi0EE1fE1BINS0_UlvE_EE" { xfail *-*-* } } } diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-uneval26.C b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval26.C new file mode 100644 index 0000000..3e3097b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-uneval26.C @@ -0,0 +1,10 @@ +// PR c++/116960 +// { dg-do compile { target c++20 } } + +template<auto> +using Foo = decltype([](auto) { return 0; }(0)); + +template<typename...> +Foo<[] {}> foo() {} // { dg-warning "no return statement" } + +auto t = foo(); 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/ext/weak2.C b/gcc/testsuite/g++.dg/ext/weak2.C index 1bf2ddc..e1665cf 100644 --- a/gcc/testsuite/g++.dg/ext/weak2.C +++ b/gcc/testsuite/g++.dg/ext/weak2.C @@ -2,6 +2,7 @@ // { dg-do compile } // { dg-require-weak "" } // { dg-options "" } +// { dg-skip-if PR119369 { amdgcn-*-* } } // { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?_Z3foov" } } 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/gc-3_a.C b/gcc/testsuite/g++.dg/modules/gc-3_a.C new file mode 100644 index 0000000..b4adb2a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/gc-3_a.C @@ -0,0 +1,7 @@ +// PR c++/119564 +// { dg-additional-options "-fmodules -Wtemplate-names-tu-local" } +// { dg-module-cmi M } + +export module M; +static void foo() {}; // { dg-message "declared" } +template <typename> void bar() { foo(); } // { dg-warning "TU-local" } diff --git a/gcc/testsuite/g++.dg/modules/gc-3_b.C b/gcc/testsuite/g++.dg/modules/gc-3_b.C new file mode 100644 index 0000000..1d1dc87 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/gc-3_b.C @@ -0,0 +1,4 @@ +// PR c++/119564 +// { dg-additional-options "-fmodules -fno-module-lazy --param=ggc-min-expand=0 --param=ggc-min-heapsize=0" } + +import M; diff --git a/gcc/testsuite/g++.dg/modules/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/noexcept-3_a.C b/gcc/testsuite/g++.dg/modules/noexcept-3_a.C new file mode 100644 index 0000000..00494d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-3_a.C @@ -0,0 +1,14 @@ +// PR c++/119462 +// { dg-additional-options "-fmodules -std=c++20 -Wno-global-module" } +// { dg-module-cmi M:part } + +module; +struct exception_ptr { + // implicitly noexcept and constexpr + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; +export module M:part; +export template <typename = int> void enqueue() { + exception_ptr e; + e == e; +} diff --git a/gcc/testsuite/g++.dg/modules/noexcept-3_b.C b/gcc/testsuite/g++.dg/modules/noexcept-3_b.C new file mode 100644 index 0000000..f26f8f0 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-3_b.C @@ -0,0 +1,12 @@ +// PR c++/119462 +// { dg-additional-options "-fmodules -std=c++20 -Wno-global-module" } +// { dg-module-cmi M } + +module; +struct exception_ptr { + // implicitly noexcept and constexpr, but this isn't known yet + friend bool operator==(const exception_ptr&, const exception_ptr&) = default; +}; +export module M; +export import :part; +export using ::exception_ptr; diff --git a/gcc/testsuite/g++.dg/modules/noexcept-3_c.C b/gcc/testsuite/g++.dg/modules/noexcept-3_c.C new file mode 100644 index 0000000..a1e98a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/noexcept-3_c.C @@ -0,0 +1,11 @@ +// PR c++/119462 +// { dg-additional-options "-fmodules -std=c++20" } + +import M; +int main() { + enqueue(); + + constexpr exception_ptr e; + static_assert(e == e); + static_assert(noexcept(e == e)); +} diff --git a/gcc/testsuite/g++.dg/modules/pr119608_a.C b/gcc/testsuite/g++.dg/modules/pr119608_a.C new file mode 100644 index 0000000..4e7b359 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr119608_a.C @@ -0,0 +1,16 @@ +// PR c++/119608 +// { dg-additional-options "-fmodules" } +// { dg-module-cmi repro } + +export module repro; + +export template<class Visitor> +auto +visit( + Visitor v +) -> decltype( + v); + +export template<class Visitor> auto visit(Visitor v) -> decltype(v) { + return {}; +} diff --git a/gcc/testsuite/g++.dg/modules/pr119608_b.C b/gcc/testsuite/g++.dg/modules/pr119608_b.C new file mode 100644 index 0000000..023d20a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr119608_b.C @@ -0,0 +1,8 @@ +// PR c++/119608 +// { dg-additional-options "-fmodules" } + +import repro; + +int main() { + visit(123); +} diff --git a/gcc/testsuite/g++.dg/modules/pr98893_b.C b/gcc/testsuite/g++.dg/modules/pr98893_b.C index 9065589..692eafb 100644 --- a/gcc/testsuite/g++.dg/modules/pr98893_b.C +++ b/gcc/testsuite/g++.dg/modules/pr98893_b.C @@ -7,4 +7,4 @@ int main() { } // { dg-final { scan-assembler {__tcf_ZZ3foovE1a:} } } -// { dg-final { scan-assembler {__tcf_ZL1b:} } } +// { dg-final { scan-assembler {__tcf_ZL1b:} { xfail hppa*-*-hpux* } } } diff --git a/gcc/testsuite/g++.dg/opt/musttail3.C b/gcc/testsuite/g++.dg/opt/musttail3.C new file mode 100644 index 0000000..1c4e549 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/musttail3.C @@ -0,0 +1,41 @@ +// PR tree-optimization/119491 +// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-options "-O2" } + +struct A { + struct B {}; + A () {} +}; +void qux (); +unsigned char v; +A w; +void foo (A); + +template <typename T> +[[gnu::always_inline]] static inline void +bar (int &) +{ +} + +[[gnu::always_inline]] static inline void +baz (int *) +{ + int r = 0; + bar<int> (r); +} + +[[gnu::always_inline]] inline void +corge (A) +{ + if (v) + qux (); + [[gnu::musttail]] return foo (w); +} + +void +freddy (A) +{ + int t; + baz (&t); + [[gnu::musttail]] return corge (A{}); +} diff --git a/gcc/testsuite/g++.dg/opt/musttail4.C b/gcc/testsuite/g++.dg/opt/musttail4.C new file mode 100644 index 0000000..ede2959 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/musttail4.C @@ -0,0 +1,35 @@ +// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-options "-O2 -fexceptions" } + +struct S { ~S (); }; +volatile int v; +struct T { ~T () { v = v + 1; } }; +struct U { ~U () {} }; +int foo (); + +int +bar () noexcept +{ + [[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: call may throw exception that does not propagate" } +} + +int +baz () +{ + S s; + [[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: other reasons" } +} + +int +qux () +{ + T t; + [[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: other reasons" } +} + +int +corge () +{ + U u; + [[gnu::musttail]] return foo (); +} diff --git a/gcc/testsuite/g++.dg/opt/musttail5.C b/gcc/testsuite/g++.dg/opt/musttail5.C new file mode 100644 index 0000000..604dd69 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/musttail5.C @@ -0,0 +1,41 @@ +// PR tree-optimization/119491 +// { dg-do compile { target { external_musttail && c++11 } } } +// { dg-options "-O2" } + +struct A { + struct B {}; + A () {} +}; +void qux (); +unsigned char v; +A w; +[[noreturn]] void foo (A); + +template <typename T> +[[gnu::always_inline]] static inline void +bar (int &) +{ +} + +[[gnu::always_inline]] static inline void +baz (int *) +{ + int r = 0; + bar<int> (r); +} + +[[gnu::always_inline]] inline void +corge (A) +{ + if (v) + qux (); + [[gnu::musttail]] return foo (w); +} + +void +freddy (A) +{ + int t; + baz (&t); + [[gnu::musttail]] return corge (A{}); +} diff --git a/gcc/testsuite/g++.dg/opt/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/g++.dg/warn/undefined2.C b/gcc/testsuite/g++.dg/warn/undefined2.C new file mode 100644 index 0000000..1b2ec35 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/undefined2.C @@ -0,0 +1,14 @@ +// PR c++/119303 + +template <class> struct c { + enum { d = 4 }; +}; +template <bool> struct e { + typedef void g; +}; +template <class _Tp> +inline typename e<!c<_Tp>::d>::g bar(_Tp); // { dg-warning "used but never defined" } + +int x; + +void foo() { bar(x); } 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/attr-weakref-1.c b/gcc/testsuite/gcc.dg/attr-weakref-1.c index f13aee4..1d25d9c 100644 --- a/gcc/testsuite/gcc.dg/attr-weakref-1.c +++ b/gcc/testsuite/gcc.dg/attr-weakref-1.c @@ -6,6 +6,7 @@ // is not available on the following targets. The test is skipped rather than // xfailed to suppress the warning that would otherwise arise. // { dg-skip-if "" { "hppa*-*-hpux*" "*-*-aix*" "nvptx-*-*" } } +// { dg-skip-if PR119369 { amdgcn-*-* } } // For kernel modules and static RTPs, the loader treats undefined weak // symbols in the same way as undefined strong symbols. The test 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/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/pr119493-2.c b/gcc/testsuite/gcc.dg/pr119493-2.c new file mode 100644 index 0000000..951529f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr119493-2.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/119493 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2 -fdump-tree-tailr1-details" } */ +/* { dg-final { scan-tree-dump-times "tail recursion with accumulation mixed with musttail non-recursive call" 2 "tailr1" } } */ + +[[gnu::noipa]] int +bar (int x, int y) +{ + return x + y; +} + +[[gnu::noinline, gnu::noclone]] int +foo (int x, int y) +{ + if (x < 10) + [[gnu::musttail]] return bar (x, y); + if (y & 2) + return foo (x - 1, y) * 2; + if (y & 1) + [[gnu::musttail]] return foo (x - 1, y); + return foo (x - 1, y) * 3; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr119532.c b/gcc/testsuite/gcc.dg/torture/pr119532.c new file mode 100644 index 0000000..bba2e45 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr119532.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target fixed_point } */ + +extern _Fract sinuhk_deg (unsigned short _Accum); + +_Fract cosuhk_deg (unsigned short _Accum deg) +{ + unsigned short _Accum _90_deg = 90uhk; + __asm ("" : "+r" (_90_deg)); + + return deg <= _90_deg + ? sinuhk_deg (_90_deg - deg) + : -sinuhk_deg (deg - _90_deg); +} 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/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.dg/weak/weak-1.c b/gcc/testsuite/gcc.dg/weak/weak-1.c index 6bbc669..9566ee0 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-1.c +++ b/gcc/testsuite/gcc.dg/weak/weak-1.c @@ -4,6 +4,7 @@ /* { dg-skip-if "" { *-*-mingw* } } */ /* NVPTX's definition of weak looks different to normal. */ /* { dg-skip-if "" { nvptx-*-* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?b" } } */ diff --git a/gcc/testsuite/gcc.dg/weak/weak-12.c b/gcc/testsuite/gcc.dg/weak/weak-12.c index d26fde6..fd18e59 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-12.c +++ b/gcc/testsuite/gcc.dg/weak/weak-12.c @@ -4,6 +4,7 @@ /* { dg-options "" } */ /* NVPTX's weak is applied to the definition, not declaration. */ /* { dg-skip-if "" { nvptx-*-* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?foo" } } */ diff --git a/gcc/testsuite/gcc.dg/weak/weak-15.c b/gcc/testsuite/gcc.dg/weak/weak-15.c index 6364baf..425a700 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-15.c +++ b/gcc/testsuite/gcc.dg/weak/weak-15.c @@ -4,6 +4,7 @@ /* { dg-skip-if "" { x86_64-*-mingw* } } */ /* NVPTX's weak is applied to the definition, not declaration. */ /* { dg-skip-if "" { nvptx-*-* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?a" } } */ /* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?b" } } */ diff --git a/gcc/testsuite/gcc.dg/weak/weak-16.c b/gcc/testsuite/gcc.dg/weak/weak-16.c index 2c58d65..44741c5 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-16.c +++ b/gcc/testsuite/gcc.dg/weak/weak-16.c @@ -7,6 +7,7 @@ /* { dg-skip-if "" { x86_64-*-mingw* } } */ /* NVPTX's weak is applied to the definition, not declaration. */ /* { dg-skip-if "" { nvptx-*-* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ extern int kallsyms_token_index[] __attribute__((weak)); extern int kallsyms_token_table[] __attribute__((weak)); diff --git a/gcc/testsuite/gcc.dg/weak/weak-2.c b/gcc/testsuite/gcc.dg/weak/weak-2.c index 67171cf..f0f55f5 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-2.c +++ b/gcc/testsuite/gcc.dg/weak/weak-2.c @@ -4,6 +4,7 @@ /* { dg-skip-if "" { x86_64-*-mingw* } } */ /* NVPTX's definition of weak looks different to normal. */ /* { dg-skip-if "" { nvptx-*-* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1b" } } */ diff --git a/gcc/testsuite/gcc.dg/weak/weak-3.c b/gcc/testsuite/gcc.dg/weak/weak-3.c index 5fdf029..2046f1e 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-3.c +++ b/gcc/testsuite/gcc.dg/weak/weak-3.c @@ -3,6 +3,7 @@ /* { dg-require-weak "" } */ /* { dg-options "-fno-common -Waddress" } */ /* { dg-skip-if "" { x86_64-*-mingw* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1b" } } */ diff --git a/gcc/testsuite/gcc.dg/weak/weak-4.c b/gcc/testsuite/gcc.dg/weak/weak-4.c index d0f3283..70e63d2 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-4.c +++ b/gcc/testsuite/gcc.dg/weak/weak-4.c @@ -4,6 +4,7 @@ /* { dg-skip-if "" { x86_64-*-mingw* } } */ /* NVPTX's definition of weak looks different to normal. */ /* { dg-skip-if "" { nvptx-*-* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */ diff --git a/gcc/testsuite/gcc.dg/weak/weak-5.c b/gcc/testsuite/gcc.dg/weak/weak-5.c index 6f80bb0..3b23971 100644 --- a/gcc/testsuite/gcc.dg/weak/weak-5.c +++ b/gcc/testsuite/gcc.dg/weak/weak-5.c @@ -3,6 +3,7 @@ /* { dg-require-alias "" } */ /* { dg-options "-fno-common" } */ /* { dg-skip-if "" { x86_64-*-mingw* } } */ +/* { dg-skip-if PR119369 { amdgcn-*-* } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1a" } } */ /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?vfoo1b" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-1.c b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-1.c new file mode 100644 index 0000000..e5bb2d9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-skip-if "Do not override mcpu or march" { *-*-* } { -mcpu=* -march=* } { "" } } */ +/* { dg-options { "-march=armv8-a+sme" } } */ +/* { dg-message "sorry, unimplemented: no support for 'sme' without 'sve2'" "" { target *-*-* } 0 } */ +int main (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-2.c b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-2.c new file mode 100644 index 0000000..13f09b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-message "sorry, unimplemented: no support for 'sme' without 'sve2'" "" { target *-*-* } 0 } */ + +#pragma GCC target ("arch=armv8.2-a+ssve-fp8fma") + +int main (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-3.c b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-3.c new file mode 100644 index 0000000..9e3cbeb --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-message "sorry, unimplemented: no support for 'sme' without 'sve2'" "" { target *-*-* } 0 } */ + +int __attribute__ ((target( "arch=armv8.2-a+ssve-fp8fma"))) main (void) +{ + return 0; +} + diff --git a/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-4.c b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-4.c new file mode 100644 index 0000000..04a33a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/no-sve-with-sme-4.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "Do not override mcpu or march" { *-*-* } { -mcpu=* -march=* } { "" } } */ +/* { dg-options { "-march=armv8-a" } } */ +/* { dg-message "sorry, unimplemented: no support for 'sme' without 'sve2'" "" { target *-*-* } 0 } */ + +#pragma GCC target "+sme" + +int main (void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c index 97d68b9..dcac6d5 100644 --- a/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c +++ b/gcc/testsuite/gcc.target/aarch64/pragma_cpp_predefs_4.c @@ -46,7 +46,7 @@ #error Foo #endif -#pragma GCC target "+sme" +#pragma GCC target "+sve2+sme" #ifndef __ARM_FEATURE_SME #error Foo #endif @@ -66,7 +66,7 @@ #error Foo #endif -#pragma GCC target "+nothing+sme" +#pragma GCC target "+nothing+sve2+sme" #ifdef __ARM_FEATURE_SME_I16I64 #error Foo #endif @@ -80,7 +80,7 @@ #error Foo #endif -#pragma GCC target "+nothing+sme-i16i64" +#pragma GCC target "+nothing+sve2+sme-i16i64" #ifndef __ARM_FEATURE_SME_I16I64 #error Foo #endif @@ -91,7 +91,7 @@ #error Foo #endif -#pragma GCC target "+nothing+sme-b16b16" +#pragma GCC target "+nothing+sve2+sme-b16b16" #ifndef __ARM_FEATURE_SME_B16B16 #error Foo #endif @@ -105,7 +105,7 @@ #error Foo #endif -#pragma GCC target "+nothing+sme-f16f16" +#pragma GCC target "+nothing+sve2+sme-f16f16" #ifndef __ARM_FEATURE_SME_F16F16 #error Foo #endif @@ -116,7 +116,7 @@ #error Foo #endif -#pragma GCC target "+nothing+sme-f64f64" +#pragma GCC target "+nothing+sve2+sme-f64f64" #ifndef __ARM_FEATURE_SME_F64F64 #error Foo #endif @@ -160,7 +160,7 @@ #error Foo #endif -#pragma GCC target "+nothing+sve-b16b16+sme2" +#pragma GCC target "+nothing+sve2+sve-b16b16+sme2" #ifndef __ARM_FEATURE_SVE_B16B16 #error Foo #endif @@ -168,7 +168,7 @@ #error Foo #endif -#pragma GCC target "+nothing+sme2p1" +#pragma GCC target "+nothing+sve2+sme2p1" #ifndef __ARM_FEATURE_SME #error Foo #endif diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_int_opt_single_n_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_int_opt_single_n_2.c index 976d5af..7150d37 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_int_opt_single_n_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_int_opt_single_n_2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" #include <arm_sve.h> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_opt_single_n_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_opt_single_n_2.c index 5cc8a4c..2823264 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_opt_single_n_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_opt_single_n_2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" #include <arm_sve.h> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_single_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_single_1.c index aa7633b..52f2c09 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_single_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_single_1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" #include <arm_sve.h> diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_int_opt_single_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_int_opt_single_1.c index 01cd88f..0e88c14 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_int_opt_single_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_int_opt_single_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint16_t s16, svint8_t s8, svuint8_t u8, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_1.c index 937d992..2c60d50 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint16_t s16, svuint16_t u16, svint32_t s32, svuint32_t u32, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_2.c index 126a764..dd90ebc 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_2.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint16_t s16, svuint16_t u16, svint32_t s32, svuint32_t u32, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_3.c index 17bed0c..f53cc55 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_3.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint16_t s16, svuint16_t u16, svint32_t s32, svuint32_t u32, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_4.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_4.c index d2a67c6..83c659d 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_lane_4.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svint8_t s8, svuint8_t u8, svint16_t s16, svuint16_t u16, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_1.c index 8307a28..a361f7f 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint16_t s16, svint32_t s32, svuint32_t u32, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_2.c index 181f509..959e222 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_2.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint16_t s16, svint32_t s32, svuint32_t u32, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_3.c index 8c8414e..9cc42c0 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_opt_single_3.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2+nosme-i16i64") +#pragma GCC target ("+sve2+sme2+nosme-i16i64") void f1 (svint32x2_t s32x2, svuint32x2_t u32x2, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_uint_opt_single_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_uint_opt_single_1.c index b00c043..b289c9c 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_uint_opt_single_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binary_za_slice_uint_opt_single_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svuint16_t u16, svint8_t s8, svuint8_t u8, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binaryxn_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binaryxn_2.c index 600b7fc..4f8ebf8 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binaryxn_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/binaryxn_2.c @@ -2,7 +2,7 @@ #include <arm_sve.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" void f1 (svbool_t pg, svcount_t pn, svuint8_t u8, svint16_t s16, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c index 07e22d2..958c40a 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/clamp_1.c @@ -2,7 +2,7 @@ #include <arm_sve.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" void f1 (svcount_t pn, svfloat16_t f16, svint16_t s16, svfloat32_t f32, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/compare_scalar_count_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/compare_scalar_count_1.c index 47077f7..4a4222c 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/compare_scalar_count_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/compare_scalar_count_1.c @@ -3,7 +3,7 @@ #include <arm_sve.h> #include <stdbool.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" enum signed_enum { SA = -1, SB }; enum unsigned_enum { UA, UB }; diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_int_lane_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_int_lane_1.c index ca2a039..aed92b5 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_int_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_int_lane_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint8_t s8, svuint8_t u8, svint16_t s16, svuint16_t u16, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_1.c index e37d24a..bb40868 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint8_t s8, svuint8_t u8, svint16_t s16, svuint16_t u16, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_2.c index 7af3c6f..7d57bd1 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_lane_2.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint8_t s8, svuint8_t u8, svint16_t s16, svuint16_t u16, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_uint_lane_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_uint_lane_1.c index 2efa2eb..cba11a4 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_uint_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/dot_za_slice_uint_lane_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint8_t s8, svuint8_t u8, svint16_t s16, svuint16_t u16, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/shift_right_imm_narrowxn_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/shift_right_imm_narrowxn_1.c index ab5602f..685d070 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/shift_right_imm_narrowxn_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/shift_right_imm_narrowxn_1.c @@ -2,7 +2,7 @@ #include <arm_sve.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svboolx2_t pgx2, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/storexn_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/storexn_1.c index 7ad4ca8..ba0096b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/storexn_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/storexn_1.c @@ -3,7 +3,7 @@ #include <arm_sve.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" struct s { signed char x; }; diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_1.c index 6bdd3c0..c01710f 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_1.c @@ -2,7 +2,7 @@ #include <arm_sve.h> -#pragma GCC target ("arch=armv8.2-a+ssve-fp8fma") +#pragma GCC target ("arch=armv8.2-a+sve2+ssve-fp8fma") void f1 (svfloat16_t f16, svmfloat8_t f8, fpm_t fpm, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_group_selection_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_group_selection_1.c index f6fce2f..fecaf98 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_group_selection_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_mfloat8_lane_group_selection_1.c @@ -2,7 +2,7 @@ #include <arm_sve.h> -#pragma GCC target ("arch=armv8.2-a+ssve-fp8fma+ssve-fp8dot4+ssve-fp8dot2") +#pragma GCC target ("arch=armv8.2-a+sve2+ssve-fp8fma+ssve-fp8dot4+ssve-fp8dot2") void f1 (svfloat16_t f16, svmfloat8_t f8, fpm_t fpm, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_qq_or_011_lane_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_qq_or_011_lane_1.c index b8968c8..5579e0d 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_qq_or_011_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_qq_or_011_lane_1.c @@ -2,7 +2,7 @@ #include <arm_sve.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" void f1 (svbool_t pg, svint8_t s8, svuint8_t u8, svint16_t s16, svuint16_t u16, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_1.c index 85f8b45..e14ec71 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_1.c @@ -1,6 +1,6 @@ #include <arm_sve.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" void test (svbool_t pg, float f, svint8_t s8, svfloat32_t f32, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrow_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrow_1.c index d312e85..e93cc64 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrow_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrow_1.c @@ -1,6 +1,6 @@ #include <arm_sve.h> -#pragma GCC target "+sme2+fp8" +#pragma GCC target "+sve2+sme2+fp8" void test (svfloat16x2_t f16x2, svbfloat16x2_t bf16x2, svfloat32x2_t f32x2, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrowt_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrowt_1.c index ab97eef..da828f0 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrowt_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_convertxn_narrowt_1.c @@ -1,6 +1,6 @@ #include <arm_sve.h> -#pragma GCC target "+sme2+fp8" +#pragma GCC target "+sve2+sme2+fp8" void test (svmfloat8_t f8, svfloat32x2_t f32x2, fpm_t fpm0, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_za_slice_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_za_slice_1.c index e02fe54..c3052a0 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_za_slice_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unary_za_slice_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target ("+sme2") +#pragma GCC target ("+sve2+sme2") void f1 (svbool_t pg, svint32_t s32, svint16x2_t s16x2, svint32x2_t s32x2, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unaryxn_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unaryxn_1.c index f478945..e9656bc 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unaryxn_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/unaryxn_1.c @@ -1,6 +1,6 @@ #include <arm_sve.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" void test (svfloat32_t f32, svfloat32x2_t f32x2, svfloat32x3_t f32x3, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_1.c index 3a45b58..95ead96 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" void f1 (svint8_t s8, svint8x2_t s8x2, svint8x3_t s8x3, svint8x4_t s8x4, diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_slice_1.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_slice_1.c index dedd4b1..dae8892 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_slice_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/write_za_slice_1.c @@ -2,7 +2,7 @@ #include <arm_sme.h> -#pragma GCC target "+sme2" +#pragma GCC target "+sve2+sme2" void f1 (svint8_t s8, svint8x2_t s8x2, svint8x3_t s8x3, svint8x4_t s8x4, diff --git a/gcc/testsuite/gcc.target/arm/mve/mve.exp b/gcc/testsuite/gcc.target/arm/mve/mve.exp index a5d8511..9dc56c9 100644 --- a/gcc/testsuite/gcc.target/arm/mve/mve.exp +++ b/gcc/testsuite/gcc.target/arm/mve/mve.exp @@ -35,6 +35,7 @@ global dg_runtest_extra_prunes set dg_runtest_extra_prunes "" lappend dg_runtest_extra_prunes "warning: switch '-m(cpu|arch)=.*' conflicts with switch '-m(cpu|arch)=.*'" +set saved-dg-do-what-default ${dg-do-what-default} set dg-do-what-default "assemble" # Initialize `dg'. @@ -53,6 +54,8 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/general-c/*.\[cCS\]]] \ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ "" $DEFAULT_CFLAGS +set dg-do-what-default ${saved-dg-do-what-default} + # All done. set dg_runtest_extra_prunes "" dg-finish diff --git a/gcc/testsuite/gcc.target/arm/short-vfp-1.c b/gcc/testsuite/gcc.target/arm/short-vfp-1.c index 18d38a5..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/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/pr119473.c b/gcc/testsuite/gcc.target/i386/pr119473.c new file mode 100644 index 0000000..574c921 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119473.c @@ -0,0 +1,26 @@ +/* PR target/119473 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mapxf -m64 -mvaes" } */ + +typedef char __v32qi __attribute__ ((__vector_size__(32))); +typedef long long __m256i __attribute__((__vector_size__(32), __aligned__(32))); + +typedef union +{ + __v32qi qi[8]; +} tmp_u; + + +void foo () +{ + register tmp_u *tdst __asm__("%rdx"); + register tmp_u *src1 __asm__("%rcx"); + register tmp_u *src2 __asm__("%r26"); + + tdst->qi[0] = __builtin_ia32_vaesdec_v32qi(src1->qi[0], src2->qi[0]); + tdst->qi[0] = __builtin_ia32_vaesdeclast_v32qi(src1->qi[0], src2->qi[0]); + tdst->qi[0] = __builtin_ia32_vaesenc_v32qi(src1->qi[0], src2->qi[0]); + tdst->qi[0] = __builtin_ia32_vaesenclast_v32qi(src1->qi[0], src2->qi[0]); +} + +/* { dg-final { scan-assembler-not "\\\(%r26\\\), " } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr119549.c b/gcc/testsuite/gcc.target/i386/pr119549.c new file mode 100644 index 0000000..a465bec --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119549.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-msse4" } */ + +typedef long long v2di __attribute__((vector_size(16))); + +static inline __attribute__((always_inline)) +int rte_trace_feature_is_enabled() { return 1; } /* { dg-error "inlining failed" } */ + +void __attribute__((target ("no-sse3"))) __attribute__((target ("no-sse4"))) +rte_eal_trace_generic_void_init(void) +{ + if (!rte_trace_feature_is_enabled()) return; + __asm__ volatile ("" : : : "memory"); +} + 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/cmo-zicbop-1.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c index e40874f..581b5db 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-1.c @@ -1,4 +1,4 @@ -/* { dg-do compile target { { rv64-*-*}} } */ +/* { dg-do compile { target rv64-*-* } } */ /* { dg-options "-march=rv64gc_zicbop -mabi=lp64" } */ void foo (char *p) diff --git a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c index dd6e1ea..3f7c1a4 100644 --- a/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c +++ b/gcc/testsuite/gcc.target/riscv/cmo-zicbop-2.c @@ -1,4 +1,4 @@ -/* { dg-do compile target { { rv32-*-*}} } */ +/* { dg-do compile { target rv64-*-* } } */ /* { dg-options "-march=rv32gc_zicbop -mabi=ilp32" } */ void foo (char *p) 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/prefetch-zicbop.c b/gcc/testsuite/gcc.target/riscv/prefetch-zicbop.c index 250f9ec..44da4b2 100644 --- a/gcc/testsuite/gcc.target/riscv/prefetch-zicbop.c +++ b/gcc/testsuite/gcc.target/riscv/prefetch-zicbop.c @@ -1,4 +1,4 @@ -/* { dg-do compile target { { rv64-*-*}} } */ +/* { dg-do compile { target rv64-*-* } } */ /* { dg-options "-march=rv64gc_zicbop -mabi=lp64" } */ void foo (char *p) diff --git a/gcc/testsuite/gcc.target/riscv/prefetch-zihintntl.c b/gcc/testsuite/gcc.target/riscv/prefetch-zihintntl.c index 54e809f..43439d7 100644 --- a/gcc/testsuite/gcc.target/riscv/prefetch-zihintntl.c +++ b/gcc/testsuite/gcc.target/riscv/prefetch-zihintntl.c @@ -1,4 +1,4 @@ -/* { dg-do compile target { { rv64-*-*}} } */ +/* { dg-do compile { target rv64-*-* } } */ /* { dg-options "-march=rv64gc_zicbop_zihintntl -mabi=lp64" } */ void foo (char *p) 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/autovec/pr111391-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111391-2.c index 1f170c9..32db3a6 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111391-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111391-2.c @@ -3,7 +3,7 @@ #include "pr111391-1.c" -/* { dg-final { scan-assembler-times {vsetivli\s+zero,\s*2,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 1 } } +/* { dg-final { scan-assembler-times {vsetivli\s+zero,\s*2,\s*e32,\s*m1,\s*t[au],\s*m[au]} 1 } } */ /* { dg-final { scan-assembler-times {vmv\.x\.s} 2 } } */ /* { dg-final { scan-assembler-times {vslidedown.vi\s+v[0-9]+,\s*v[0-9]+,\s*1} 1 } } */ /* { dg-final { scan-assembler-times {slli\s+[a-x0-9]+,[a-x0-9]+,32} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-14.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-14.c index 163152a..222d8c2 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-14.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-14.c @@ -1,20 +1,20 @@ /* { dg-do compile } */ /* { dg-options "-O3 -march=rv32gc_zve32x_zvl64b -mabi=ilp32d" } */ -void f___rvv_int8mf8x2_t () {__rvv_int8mf8x2_t t;} -void f___rvv_uint8mf8x2_t () {__rvv_uint8mf8x2_t t;} -void f___rvv_int8mf8x3_t () {__rvv_int8mf8x3_t t;} -void f___rvv_uint8mf8x3_t () {__rvv_uint8mf8x3_t t;} -void f___rvv_int8mf8x4_t () {__rvv_int8mf8x4_t t;} -void f___rvv_uint8mf8x4_t () {__rvv_uint8mf8x4_t t;} -void f___rvv_int8mf8x5_t () {__rvv_int8mf8x5_t t;} -void f___rvv_uint8mf8x5_t () {__rvv_uint8mf8x5_t t;} -void f___rvv_int8mf8x6_t () {__rvv_int8mf8x6_t t;} -void f___rvv_uint8mf8x6_t () {__rvv_uint8mf8x6_t t;} -void f___rvv_int8mf8x7_t () {__rvv_int8mf8x7_t t;} -void f___rvv_uint8mf8x7_t () {__rvv_uint8mf8x7_t t;} -void f___rvv_int8mf8x8_t () {__rvv_int8mf8x8_t t;} -void f___rvv_uint8mf8x8_t () {__rvv_uint8mf8x8_t t;} +void f___rvv_int8mf8x2_t () {__rvv_int8mf8x2_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x2_t'} } */ +void f___rvv_uint8mf8x2_t () {__rvv_uint8mf8x2_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x2_t'} } */ +void f___rvv_int8mf8x3_t () {__rvv_int8mf8x3_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x3_t'} } */ +void f___rvv_uint8mf8x3_t () {__rvv_uint8mf8x3_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x3_t'} } */ +void f___rvv_int8mf8x4_t () {__rvv_int8mf8x4_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x4_t'} } */ +void f___rvv_uint8mf8x4_t () {__rvv_uint8mf8x4_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x4_t'} } */ +void f___rvv_int8mf8x5_t () {__rvv_int8mf8x5_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x5_t'} } */ +void f___rvv_uint8mf8x5_t () {__rvv_uint8mf8x5_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x5_t'} } */ +void f___rvv_int8mf8x6_t () {__rvv_int8mf8x6_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x6_t'} } */ +void f___rvv_uint8mf8x6_t () {__rvv_uint8mf8x6_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x6_t'} } */ +void f___rvv_int8mf8x7_t () {__rvv_int8mf8x7_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x7_t'} } */ +void f___rvv_uint8mf8x7_t () {__rvv_uint8mf8x7_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x7_t'} } */ +void f___rvv_int8mf8x8_t () {__rvv_int8mf8x8_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x8_t'} } */ +void f___rvv_uint8mf8x8_t () {__rvv_uint8mf8x8_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x8_t'} } */ void f___rvv_int8mf4x2_t () {__rvv_int8mf4x2_t t;} void f___rvv_uint8mf4x2_t () {__rvv_uint8mf4x2_t t;} void f___rvv_int8mf4x3_t () {__rvv_int8mf4x3_t t;} @@ -65,20 +65,20 @@ void f___rvv_int8m2x4_t () {__rvv_int8m2x4_t t;} void f___rvv_uint8m2x4_t () {__rvv_uint8m2x4_t t;} void f___rvv_int8m4x2_t () {__rvv_int8m4x2_t t;} void f___rvv_uint8m4x2_t () {__rvv_uint8m4x2_t t;} -void f___rvv_int16mf4x2_t () {__rvv_int16mf4x2_t t;} -void f___rvv_uint16mf4x2_t () {__rvv_uint16mf4x2_t t;} -void f___rvv_int16mf4x3_t () {__rvv_int16mf4x3_t t;} -void f___rvv_uint16mf4x3_t () {__rvv_uint16mf4x3_t t;} -void f___rvv_int16mf4x4_t () {__rvv_int16mf4x4_t t;} -void f___rvv_uint16mf4x4_t () {__rvv_uint16mf4x4_t t;} -void f___rvv_int16mf4x5_t () {__rvv_int16mf4x5_t t;} -void f___rvv_uint16mf4x5_t () {__rvv_uint16mf4x5_t t;} -void f___rvv_int16mf4x6_t () {__rvv_int16mf4x6_t t;} -void f___rvv_uint16mf4x6_t () {__rvv_uint16mf4x6_t t;} -void f___rvv_int16mf4x7_t () {__rvv_int16mf4x7_t t;} -void f___rvv_uint16mf4x7_t () {__rvv_uint16mf4x7_t t;} -void f___rvv_int16mf4x8_t () {__rvv_int16mf4x8_t t;} -void f___rvv_uint16mf4x8_t () {__rvv_uint16mf4x8_t t;} +void f___rvv_int16mf4x2_t () {__rvv_int16mf4x2_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x2_t'} } */ +void f___rvv_uint16mf4x2_t () {__rvv_uint16mf4x2_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x2_t'} } */ +void f___rvv_int16mf4x3_t () {__rvv_int16mf4x3_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x3_t'} } */ +void f___rvv_uint16mf4x3_t () {__rvv_uint16mf4x3_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x3_t'} } */ +void f___rvv_int16mf4x4_t () {__rvv_int16mf4x4_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x4_t'} } */ +void f___rvv_uint16mf4x4_t () {__rvv_uint16mf4x4_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x4_t'} } */ +void f___rvv_int16mf4x5_t () {__rvv_int16mf4x5_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x5_t'} } */ +void f___rvv_uint16mf4x5_t () {__rvv_uint16mf4x5_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x5_t'} } */ +void f___rvv_int16mf4x6_t () {__rvv_int16mf4x6_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x6_t'} } */ +void f___rvv_uint16mf4x6_t () {__rvv_uint16mf4x6_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x6_t'} } */ +void f___rvv_int16mf4x7_t () {__rvv_int16mf4x7_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x7_t'} } */ +void f___rvv_uint16mf4x7_t () {__rvv_uint16mf4x7_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x7_t'} } */ +void f___rvv_int16mf4x8_t () {__rvv_int16mf4x8_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x8_t'} } */ +void f___rvv_uint16mf4x8_t () {__rvv_uint16mf4x8_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x8_t'} } */ void f___rvv_int16mf2x2_t () {__rvv_int16mf2x2_t t;} void f___rvv_uint16mf2x2_t () {__rvv_uint16mf2x2_t t;} void f___rvv_int16mf2x3_t () {__rvv_int16mf2x3_t t;} @@ -115,20 +115,20 @@ void f___rvv_int16m2x4_t () {__rvv_int16m2x4_t t;} void f___rvv_uint16m2x4_t () {__rvv_uint16m2x4_t t;} void f___rvv_int16m4x2_t () {__rvv_int16m4x2_t t;} void f___rvv_uint16m4x2_t () {__rvv_uint16m4x2_t t;} -void f___rvv_int32mf2x2_t () {__rvv_int32mf2x2_t t;} -void f___rvv_uint32mf2x2_t () {__rvv_uint32mf2x2_t t;} -void f___rvv_int32mf2x3_t () {__rvv_int32mf2x3_t t;} -void f___rvv_uint32mf2x3_t () {__rvv_uint32mf2x3_t t;} -void f___rvv_int32mf2x4_t () {__rvv_int32mf2x4_t t;} -void f___rvv_uint32mf2x4_t () {__rvv_uint32mf2x4_t t;} -void f___rvv_int32mf2x5_t () {__rvv_int32mf2x5_t t;} -void f___rvv_uint32mf2x5_t () {__rvv_uint32mf2x5_t t;} -void f___rvv_int32mf2x6_t () {__rvv_int32mf2x6_t t;} -void f___rvv_uint32mf2x6_t () {__rvv_uint32mf2x6_t t;} -void f___rvv_int32mf2x7_t () {__rvv_int32mf2x7_t t;} -void f___rvv_uint32mf2x7_t () {__rvv_uint32mf2x7_t t;} -void f___rvv_int32mf2x8_t () {__rvv_int32mf2x8_t t;} -void f___rvv_uint32mf2x8_t () {__rvv_uint32mf2x8_t t;} +void f___rvv_int32mf2x2_t () {__rvv_int32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x2_t'} } */ +void f___rvv_uint32mf2x2_t () {__rvv_uint32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x2_t'} } */ +void f___rvv_int32mf2x3_t () {__rvv_int32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x3_t'} } */ +void f___rvv_uint32mf2x3_t () {__rvv_uint32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x3_t'} } */ +void f___rvv_int32mf2x4_t () {__rvv_int32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x4_t'} } */ +void f___rvv_uint32mf2x4_t () {__rvv_uint32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x4_t'} } */ +void f___rvv_int32mf2x5_t () {__rvv_int32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x5_t'} } */ +void f___rvv_uint32mf2x5_t () {__rvv_uint32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x5_t'} } */ +void f___rvv_int32mf2x6_t () {__rvv_int32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x6_t'} } */ +void f___rvv_uint32mf2x6_t () {__rvv_uint32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x6_t'} } */ +void f___rvv_int32mf2x7_t () {__rvv_int32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x7_t'} } */ +void f___rvv_uint32mf2x7_t () {__rvv_uint32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x7_t'} } */ +void f___rvv_int32mf2x8_t () {__rvv_int32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x8_t'} } */ +void f___rvv_uint32mf2x8_t () {__rvv_uint32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x8_t'} } */ void f___rvv_int32m1x2_t () {__rvv_int32m1x2_t t;} void f___rvv_uint32m1x2_t () {__rvv_uint32m1x2_t t;} void f___rvv_int32m1x3_t () {__rvv_int32m1x3_t t;} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-16.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-16.c index 9e962a7..2762b7a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-16.c @@ -1,20 +1,20 @@ /* { dg-do compile } */ /* { dg-options "-O3 -march=rv32gc_zve32f_zvl64b -mabi=ilp32d" } */ -void f___rvv_int8mf8x2_t () {__rvv_int8mf8x2_t t;} -void f___rvv_uint8mf8x2_t () {__rvv_uint8mf8x2_t t;} -void f___rvv_int8mf8x3_t () {__rvv_int8mf8x3_t t;} -void f___rvv_uint8mf8x3_t () {__rvv_uint8mf8x3_t t;} -void f___rvv_int8mf8x4_t () {__rvv_int8mf8x4_t t;} -void f___rvv_uint8mf8x4_t () {__rvv_uint8mf8x4_t t;} -void f___rvv_int8mf8x5_t () {__rvv_int8mf8x5_t t;} -void f___rvv_uint8mf8x5_t () {__rvv_uint8mf8x5_t t;} -void f___rvv_int8mf8x6_t () {__rvv_int8mf8x6_t t;} -void f___rvv_uint8mf8x6_t () {__rvv_uint8mf8x6_t t;} -void f___rvv_int8mf8x7_t () {__rvv_int8mf8x7_t t;} -void f___rvv_uint8mf8x7_t () {__rvv_uint8mf8x7_t t;} -void f___rvv_int8mf8x8_t () {__rvv_int8mf8x8_t t;} -void f___rvv_uint8mf8x8_t () {__rvv_uint8mf8x8_t t;} +void f___rvv_int8mf8x2_t () {__rvv_int8mf8x2_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x2_t'} } */ +void f___rvv_uint8mf8x2_t () {__rvv_uint8mf8x2_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x2_t'} } */ +void f___rvv_int8mf8x3_t () {__rvv_int8mf8x3_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x3_t'} } */ +void f___rvv_uint8mf8x3_t () {__rvv_uint8mf8x3_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x3_t'} } */ +void f___rvv_int8mf8x4_t () {__rvv_int8mf8x4_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x4_t'} } */ +void f___rvv_uint8mf8x4_t () {__rvv_uint8mf8x4_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x4_t'} } */ +void f___rvv_int8mf8x5_t () {__rvv_int8mf8x5_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x5_t'} } */ +void f___rvv_uint8mf8x5_t () {__rvv_uint8mf8x5_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x5_t'} } */ +void f___rvv_int8mf8x6_t () {__rvv_int8mf8x6_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x6_t'} } */ +void f___rvv_uint8mf8x6_t () {__rvv_uint8mf8x6_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x6_t'} } */ +void f___rvv_int8mf8x7_t () {__rvv_int8mf8x7_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x7_t'} } */ +void f___rvv_uint8mf8x7_t () {__rvv_uint8mf8x7_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x7_t'} } */ +void f___rvv_int8mf8x8_t () {__rvv_int8mf8x8_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x8_t'} } */ +void f___rvv_uint8mf8x8_t () {__rvv_uint8mf8x8_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x8_t'} } */ void f___rvv_int8mf4x2_t () {__rvv_int8mf4x2_t t;} void f___rvv_uint8mf4x2_t () {__rvv_uint8mf4x2_t t;} void f___rvv_int8mf4x3_t () {__rvv_int8mf4x3_t t;} @@ -65,20 +65,20 @@ void f___rvv_int8m2x4_t () {__rvv_int8m2x4_t t;} void f___rvv_uint8m2x4_t () {__rvv_uint8m2x4_t t;} void f___rvv_int8m4x2_t () {__rvv_int8m4x2_t t;} void f___rvv_uint8m4x2_t () {__rvv_uint8m4x2_t t;} -void f___rvv_int16mf4x2_t () {__rvv_int16mf4x2_t t;} -void f___rvv_uint16mf4x2_t () {__rvv_uint16mf4x2_t t;} -void f___rvv_int16mf4x3_t () {__rvv_int16mf4x3_t t;} -void f___rvv_uint16mf4x3_t () {__rvv_uint16mf4x3_t t;} -void f___rvv_int16mf4x4_t () {__rvv_int16mf4x4_t t;} -void f___rvv_uint16mf4x4_t () {__rvv_uint16mf4x4_t t;} -void f___rvv_int16mf4x5_t () {__rvv_int16mf4x5_t t;} -void f___rvv_uint16mf4x5_t () {__rvv_uint16mf4x5_t t;} -void f___rvv_int16mf4x6_t () {__rvv_int16mf4x6_t t;} -void f___rvv_uint16mf4x6_t () {__rvv_uint16mf4x6_t t;} -void f___rvv_int16mf4x7_t () {__rvv_int16mf4x7_t t;} -void f___rvv_uint16mf4x7_t () {__rvv_uint16mf4x7_t t;} -void f___rvv_int16mf4x8_t () {__rvv_int16mf4x8_t t;} -void f___rvv_uint16mf4x8_t () {__rvv_uint16mf4x8_t t;} +void f___rvv_int16mf4x2_t () {__rvv_int16mf4x2_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x2_t'} } */ +void f___rvv_uint16mf4x2_t () {__rvv_uint16mf4x2_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x2_t'} } */ +void f___rvv_int16mf4x3_t () {__rvv_int16mf4x3_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x3_t'} } */ +void f___rvv_uint16mf4x3_t () {__rvv_uint16mf4x3_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x3_t'} } */ +void f___rvv_int16mf4x4_t () {__rvv_int16mf4x4_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x4_t'} } */ +void f___rvv_uint16mf4x4_t () {__rvv_uint16mf4x4_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x4_t'} } */ +void f___rvv_int16mf4x5_t () {__rvv_int16mf4x5_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x5_t'} } */ +void f___rvv_uint16mf4x5_t () {__rvv_uint16mf4x5_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x5_t'} } */ +void f___rvv_int16mf4x6_t () {__rvv_int16mf4x6_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x6_t'} } */ +void f___rvv_uint16mf4x6_t () {__rvv_uint16mf4x6_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x6_t'} } */ +void f___rvv_int16mf4x7_t () {__rvv_int16mf4x7_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x7_t'} } */ +void f___rvv_uint16mf4x7_t () {__rvv_uint16mf4x7_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x7_t'} } */ +void f___rvv_int16mf4x8_t () {__rvv_int16mf4x8_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x8_t'} } */ +void f___rvv_uint16mf4x8_t () {__rvv_uint16mf4x8_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x8_t'} } */ void f___rvv_int16mf2x2_t () {__rvv_int16mf2x2_t t;} void f___rvv_uint16mf2x2_t () {__rvv_uint16mf2x2_t t;} void f___rvv_int16mf2x3_t () {__rvv_int16mf2x3_t t;} @@ -115,20 +115,20 @@ void f___rvv_int16m2x4_t () {__rvv_int16m2x4_t t;} void f___rvv_uint16m2x4_t () {__rvv_uint16m2x4_t t;} void f___rvv_int16m4x2_t () {__rvv_int16m4x2_t t;} void f___rvv_uint16m4x2_t () {__rvv_uint16m4x2_t t;} -void f___rvv_int32mf2x2_t () {__rvv_int32mf2x2_t t;} -void f___rvv_uint32mf2x2_t () {__rvv_uint32mf2x2_t t;} -void f___rvv_int32mf2x3_t () {__rvv_int32mf2x3_t t;} -void f___rvv_uint32mf2x3_t () {__rvv_uint32mf2x3_t t;} -void f___rvv_int32mf2x4_t () {__rvv_int32mf2x4_t t;} -void f___rvv_uint32mf2x4_t () {__rvv_uint32mf2x4_t t;} -void f___rvv_int32mf2x5_t () {__rvv_int32mf2x5_t t;} -void f___rvv_uint32mf2x5_t () {__rvv_uint32mf2x5_t t;} -void f___rvv_int32mf2x6_t () {__rvv_int32mf2x6_t t;} -void f___rvv_uint32mf2x6_t () {__rvv_uint32mf2x6_t t;} -void f___rvv_int32mf2x7_t () {__rvv_int32mf2x7_t t;} -void f___rvv_uint32mf2x7_t () {__rvv_uint32mf2x7_t t;} -void f___rvv_int32mf2x8_t () {__rvv_int32mf2x8_t t;} -void f___rvv_uint32mf2x8_t () {__rvv_uint32mf2x8_t t;} +void f___rvv_int32mf2x2_t () {__rvv_int32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x2_t'} } */ +void f___rvv_uint32mf2x2_t () {__rvv_uint32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x2_t'} } */ +void f___rvv_int32mf2x3_t () {__rvv_int32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x3_t'} } */ +void f___rvv_uint32mf2x3_t () {__rvv_uint32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x3_t'} } */ +void f___rvv_int32mf2x4_t () {__rvv_int32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x4_t'} } */ +void f___rvv_uint32mf2x4_t () {__rvv_uint32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x4_t'} } */ +void f___rvv_int32mf2x5_t () {__rvv_int32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x5_t'} } */ +void f___rvv_uint32mf2x5_t () {__rvv_uint32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x5_t'} } */ +void f___rvv_int32mf2x6_t () {__rvv_int32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x6_t'} } */ +void f___rvv_uint32mf2x6_t () {__rvv_uint32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x6_t'} } */ +void f___rvv_int32mf2x7_t () {__rvv_int32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x7_t'} } */ +void f___rvv_uint32mf2x7_t () {__rvv_uint32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x7_t'} } */ +void f___rvv_int32mf2x8_t () {__rvv_int32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x8_t'} } */ +void f___rvv_uint32mf2x8_t () {__rvv_uint32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x8_t'} } */ void f___rvv_int32m1x2_t () {__rvv_int32m1x2_t t;} void f___rvv_uint32m1x2_t () {__rvv_uint32m1x2_t t;} void f___rvv_int32m1x3_t () {__rvv_int32m1x3_t t;} @@ -179,13 +179,13 @@ void f___rvv_float16m1_t () {__rvv_float16m1_t t;} /* { dg-error {unknown type n void f___rvv_float16m2_t () {__rvv_float16m2_t t;} /* { dg-error {unknown type name '__rvv_float16m2_t'} } */ void f___rvv_float16m4_t () {__rvv_float16m4_t t;} /* { dg-error {unknown type name '__rvv_float16m4_t'} } */ void f___rvv_float16m8_t () {__rvv_float16m8_t t;} /* { dg-error {unknown type name '__rvv_float16m8_t'} } */ -void f___rvv_float32mf2x2_t () {__rvv_float32mf2x2_t t;} -void f___rvv_float32mf2x3_t () {__rvv_float32mf2x3_t t;} -void f___rvv_float32mf2x4_t () {__rvv_float32mf2x4_t t;} -void f___rvv_float32mf2x5_t () {__rvv_float32mf2x5_t t;} -void f___rvv_float32mf2x6_t () {__rvv_float32mf2x6_t t;} -void f___rvv_float32mf2x7_t () {__rvv_float32mf2x7_t t;} -void f___rvv_float32mf2x8_t () {__rvv_float32mf2x8_t t;} +void f___rvv_float32mf2x2_t () {__rvv_float32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x2_t'} } */ +void f___rvv_float32mf2x3_t () {__rvv_float32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x3_t'} } */ +void f___rvv_float32mf2x4_t () {__rvv_float32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x4_t'} } */ +void f___rvv_float32mf2x5_t () {__rvv_float32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x5_t'} } */ +void f___rvv_float32mf2x6_t () {__rvv_float32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x6_t'} } */ +void f___rvv_float32mf2x7_t () {__rvv_float32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x7_t'} } */ +void f___rvv_float32mf2x8_t () {__rvv_float32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x8_t'} } */ void f___rvv_float32m1x2_t () {__rvv_float32m1x2_t t;} void f___rvv_float32m1x3_t () {__rvv_float32m1x3_t t;} void f___rvv_float32m1x4_t () {__rvv_float32m1x4_t t;} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-18.c b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-18.c index 402e8f6..95b760f 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/abi-18.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/abi-18.c @@ -1,20 +1,20 @@ /* { dg-do compile } */ /* { dg-options "-O3 -march=rv32gc_zve32x_zvl64b_zvfhmin -mabi=ilp32d" } */ -void f___rvv_int8mf8x2_t () {__rvv_int8mf8x2_t t;} -void f___rvv_uint8mf8x2_t () {__rvv_uint8mf8x2_t t;} -void f___rvv_int8mf8x3_t () {__rvv_int8mf8x3_t t;} -void f___rvv_uint8mf8x3_t () {__rvv_uint8mf8x3_t t;} -void f___rvv_int8mf8x4_t () {__rvv_int8mf8x4_t t;} -void f___rvv_uint8mf8x4_t () {__rvv_uint8mf8x4_t t;} -void f___rvv_int8mf8x5_t () {__rvv_int8mf8x5_t t;} -void f___rvv_uint8mf8x5_t () {__rvv_uint8mf8x5_t t;} -void f___rvv_int8mf8x6_t () {__rvv_int8mf8x6_t t;} -void f___rvv_uint8mf8x6_t () {__rvv_uint8mf8x6_t t;} -void f___rvv_int8mf8x7_t () {__rvv_int8mf8x7_t t;} -void f___rvv_uint8mf8x7_t () {__rvv_uint8mf8x7_t t;} -void f___rvv_int8mf8x8_t () {__rvv_int8mf8x8_t t;} -void f___rvv_uint8mf8x8_t () {__rvv_uint8mf8x8_t t;} +void f___rvv_int8mf8x2_t () {__rvv_int8mf8x2_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x2_t'} } */ +void f___rvv_uint8mf8x2_t () {__rvv_uint8mf8x2_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x2_t'} } */ +void f___rvv_int8mf8x3_t () {__rvv_int8mf8x3_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x3_t'} } */ +void f___rvv_uint8mf8x3_t () {__rvv_uint8mf8x3_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x3_t'} } */ +void f___rvv_int8mf8x4_t () {__rvv_int8mf8x4_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x4_t'} } */ +void f___rvv_uint8mf8x4_t () {__rvv_uint8mf8x4_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x4_t'} } */ +void f___rvv_int8mf8x5_t () {__rvv_int8mf8x5_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x5_t'} } */ +void f___rvv_uint8mf8x5_t () {__rvv_uint8mf8x5_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x5_t'} } */ +void f___rvv_int8mf8x6_t () {__rvv_int8mf8x6_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x6_t'} } */ +void f___rvv_uint8mf8x6_t () {__rvv_uint8mf8x6_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x6_t'} } */ +void f___rvv_int8mf8x7_t () {__rvv_int8mf8x7_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x7_t'} } */ +void f___rvv_uint8mf8x7_t () {__rvv_uint8mf8x7_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x7_t'} } */ +void f___rvv_int8mf8x8_t () {__rvv_int8mf8x8_t t;} /* { dg-error {unknown type name '__rvv_int8mf8x8_t'} } */ +void f___rvv_uint8mf8x8_t () {__rvv_uint8mf8x8_t t;} /* { dg-error {unknown type name '__rvv_uint8mf8x8_t'} } */ void f___rvv_int8mf4x2_t () {__rvv_int8mf4x2_t t;} void f___rvv_uint8mf4x2_t () {__rvv_uint8mf4x2_t t;} void f___rvv_int8mf4x3_t () {__rvv_int8mf4x3_t t;} @@ -65,20 +65,20 @@ void f___rvv_int8m2x4_t () {__rvv_int8m2x4_t t;} void f___rvv_uint8m2x4_t () {__rvv_uint8m2x4_t t;} void f___rvv_int8m4x2_t () {__rvv_int8m4x2_t t;} void f___rvv_uint8m4x2_t () {__rvv_uint8m4x2_t t;} -void f___rvv_int16mf4x2_t () {__rvv_int16mf4x2_t t;} -void f___rvv_uint16mf4x2_t () {__rvv_uint16mf4x2_t t;} -void f___rvv_int16mf4x3_t () {__rvv_int16mf4x3_t t;} -void f___rvv_uint16mf4x3_t () {__rvv_uint16mf4x3_t t;} -void f___rvv_int16mf4x4_t () {__rvv_int16mf4x4_t t;} -void f___rvv_uint16mf4x4_t () {__rvv_uint16mf4x4_t t;} -void f___rvv_int16mf4x5_t () {__rvv_int16mf4x5_t t;} -void f___rvv_uint16mf4x5_t () {__rvv_uint16mf4x5_t t;} -void f___rvv_int16mf4x6_t () {__rvv_int16mf4x6_t t;} -void f___rvv_uint16mf4x6_t () {__rvv_uint16mf4x6_t t;} -void f___rvv_int16mf4x7_t () {__rvv_int16mf4x7_t t;} -void f___rvv_uint16mf4x7_t () {__rvv_uint16mf4x7_t t;} -void f___rvv_int16mf4x8_t () {__rvv_int16mf4x8_t t;} -void f___rvv_uint16mf4x8_t () {__rvv_uint16mf4x8_t t;} +void f___rvv_int16mf4x2_t () {__rvv_int16mf4x2_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x2_t'} } */ +void f___rvv_uint16mf4x2_t () {__rvv_uint16mf4x2_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x2_t'} } */ +void f___rvv_int16mf4x3_t () {__rvv_int16mf4x3_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x3_t'} } */ +void f___rvv_uint16mf4x3_t () {__rvv_uint16mf4x3_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x3_t'} } */ +void f___rvv_int16mf4x4_t () {__rvv_int16mf4x4_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x4_t'} } */ +void f___rvv_uint16mf4x4_t () {__rvv_uint16mf4x4_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x4_t'} } */ +void f___rvv_int16mf4x5_t () {__rvv_int16mf4x5_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x5_t'} } */ +void f___rvv_uint16mf4x5_t () {__rvv_uint16mf4x5_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x5_t'} } */ +void f___rvv_int16mf4x6_t () {__rvv_int16mf4x6_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x6_t'} } */ +void f___rvv_uint16mf4x6_t () {__rvv_uint16mf4x6_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x6_t'} } */ +void f___rvv_int16mf4x7_t () {__rvv_int16mf4x7_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x7_t'} } */ +void f___rvv_uint16mf4x7_t () {__rvv_uint16mf4x7_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x7_t'} } */ +void f___rvv_int16mf4x8_t () {__rvv_int16mf4x8_t t;} /* { dg-error {unknown type name '__rvv_int16mf4x8_t'} } */ +void f___rvv_uint16mf4x8_t () {__rvv_uint16mf4x8_t t;} /* { dg-error {unknown type name '__rvv_uint16mf4x8_t'} } */ void f___rvv_int16mf2x2_t () {__rvv_int16mf2x2_t t;} void f___rvv_uint16mf2x2_t () {__rvv_uint16mf2x2_t t;} void f___rvv_int16mf2x3_t () {__rvv_int16mf2x3_t t;} @@ -115,20 +115,20 @@ void f___rvv_int16m2x4_t () {__rvv_int16m2x4_t t;} void f___rvv_uint16m2x4_t () {__rvv_uint16m2x4_t t;} void f___rvv_int16m4x2_t () {__rvv_int16m4x2_t t;} void f___rvv_uint16m4x2_t () {__rvv_uint16m4x2_t t;} -void f___rvv_int32mf2x2_t () {__rvv_int32mf2x2_t t;} -void f___rvv_uint32mf2x2_t () {__rvv_uint32mf2x2_t t;} -void f___rvv_int32mf2x3_t () {__rvv_int32mf2x3_t t;} -void f___rvv_uint32mf2x3_t () {__rvv_uint32mf2x3_t t;} -void f___rvv_int32mf2x4_t () {__rvv_int32mf2x4_t t;} -void f___rvv_uint32mf2x4_t () {__rvv_uint32mf2x4_t t;} -void f___rvv_int32mf2x5_t () {__rvv_int32mf2x5_t t;} -void f___rvv_uint32mf2x5_t () {__rvv_uint32mf2x5_t t;} -void f___rvv_int32mf2x6_t () {__rvv_int32mf2x6_t t;} -void f___rvv_uint32mf2x6_t () {__rvv_uint32mf2x6_t t;} -void f___rvv_int32mf2x7_t () {__rvv_int32mf2x7_t t;} -void f___rvv_uint32mf2x7_t () {__rvv_uint32mf2x7_t t;} -void f___rvv_int32mf2x8_t () {__rvv_int32mf2x8_t t;} -void f___rvv_uint32mf2x8_t () {__rvv_uint32mf2x8_t t;} +void f___rvv_int32mf2x2_t () {__rvv_int32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x2_t'} } */ +void f___rvv_uint32mf2x2_t () {__rvv_uint32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x2_t'} } */ +void f___rvv_int32mf2x3_t () {__rvv_int32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x3_t'} } */ +void f___rvv_uint32mf2x3_t () {__rvv_uint32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x3_t'} } */ +void f___rvv_int32mf2x4_t () {__rvv_int32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x4_t'} } */ +void f___rvv_uint32mf2x4_t () {__rvv_uint32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x4_t'} } */ +void f___rvv_int32mf2x5_t () {__rvv_int32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x5_t'} } */ +void f___rvv_uint32mf2x5_t () {__rvv_uint32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x5_t'} } */ +void f___rvv_int32mf2x6_t () {__rvv_int32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x6_t'} } */ +void f___rvv_uint32mf2x6_t () {__rvv_uint32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x6_t'} } */ +void f___rvv_int32mf2x7_t () {__rvv_int32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x7_t'} } */ +void f___rvv_uint32mf2x7_t () {__rvv_uint32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x7_t'} } */ +void f___rvv_int32mf2x8_t () {__rvv_int32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_int32mf2x8_t'} } */ +void f___rvv_uint32mf2x8_t () {__rvv_uint32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_uint32mf2x8_t'} } */ void f___rvv_int32m1x2_t () {__rvv_int32m1x2_t t;} void f___rvv_uint32m1x2_t () {__rvv_uint32m1x2_t t;} void f___rvv_int32m1x3_t () {__rvv_int32m1x3_t t;} @@ -173,13 +173,13 @@ void f___rvv_int64m2x4_t () {__rvv_int64m2x4_t t;} /* { dg-error {unknown type n void f___rvv_uint64m2x4_t () {__rvv_uint64m2x4_t t;} /* { dg-error {unknown type name '__rvv_uint64m2x4_t'} } */ void f___rvv_int64m4x2_t () {__rvv_int64m4x2_t t;} /* { dg-error {unknown type name '__rvv_int64m4x2_t'} } */ void f___rvv_uint64m4x2_t () {__rvv_uint64m4x2_t t;} /* { dg-error {unknown type name '__rvv_uint64m4x2_t'} } */ -void f___rvv_float16mf4x2_t () {__rvv_float16mf4x2_t t;} -void f___rvv_float16mf4x3_t () {__rvv_float16mf4x3_t t;} -void f___rvv_float16mf4x4_t () {__rvv_float16mf4x4_t t;} -void f___rvv_float16mf4x5_t () {__rvv_float16mf4x5_t t;} -void f___rvv_float16mf4x6_t () {__rvv_float16mf4x6_t t;} -void f___rvv_float16mf4x7_t () {__rvv_float16mf4x7_t t;} -void f___rvv_float16mf4x8_t () {__rvv_float16mf4x8_t t;} +void f___rvv_float16mf4x2_t () {__rvv_float16mf4x2_t t;} /* { dg-error {unknown type name '__rvv_float16mf4x2_t'} } */ +void f___rvv_float16mf4x3_t () {__rvv_float16mf4x3_t t;} /* { dg-error {unknown type name '__rvv_float16mf4x3_t'} } */ +void f___rvv_float16mf4x4_t () {__rvv_float16mf4x4_t t;} /* { dg-error {unknown type name '__rvv_float16mf4x4_t'} } */ +void f___rvv_float16mf4x5_t () {__rvv_float16mf4x5_t t;} /* { dg-error {unknown type name '__rvv_float16mf4x5_t'} } */ +void f___rvv_float16mf4x6_t () {__rvv_float16mf4x6_t t;} /* { dg-error {unknown type name '__rvv_float16mf4x6_t'} } */ +void f___rvv_float16mf4x7_t () {__rvv_float16mf4x7_t t;} /* { dg-error {unknown type name '__rvv_float16mf4x7_t'} } */ +void f___rvv_float16mf4x8_t () {__rvv_float16mf4x8_t t;} /* { dg-error {unknown type name '__rvv_float16mf4x8_t'} } */ void f___rvv_float16mf2x2_t () {__rvv_float16mf2x2_t t;} void f___rvv_float16mf2x3_t () {__rvv_float16mf2x3_t t;} void f___rvv_float16mf2x4_t () {__rvv_float16mf2x4_t t;} @@ -198,13 +198,13 @@ void f___rvv_float16m2x2_t () {__rvv_float16m2x2_t t;} void f___rvv_float16m2x3_t () {__rvv_float16m2x3_t t;} void f___rvv_float16m2x4_t () {__rvv_float16m2x4_t t;} void f___rvv_float16m4x2_t () {__rvv_float16m4x2_t t;} -void f___rvv_float32mf2x2_t () {__rvv_float32mf2x2_t t;} -void f___rvv_float32mf2x3_t () {__rvv_float32mf2x3_t t;} -void f___rvv_float32mf2x4_t () {__rvv_float32mf2x4_t t;} -void f___rvv_float32mf2x5_t () {__rvv_float32mf2x5_t t;} -void f___rvv_float32mf2x6_t () {__rvv_float32mf2x6_t t;} -void f___rvv_float32mf2x7_t () {__rvv_float32mf2x7_t t;} -void f___rvv_float32mf2x8_t () {__rvv_float32mf2x8_t t;} +void f___rvv_float32mf2x2_t () {__rvv_float32mf2x2_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x2_t'} } */ +void f___rvv_float32mf2x3_t () {__rvv_float32mf2x3_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x3_t'} } */ +void f___rvv_float32mf2x4_t () {__rvv_float32mf2x4_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x4_t'} } */ +void f___rvv_float32mf2x5_t () {__rvv_float32mf2x5_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x5_t'} } */ +void f___rvv_float32mf2x6_t () {__rvv_float32mf2x6_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x6_t'} } */ +void f___rvv_float32mf2x7_t () {__rvv_float32mf2x7_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x7_t'} } */ +void f___rvv_float32mf2x8_t () {__rvv_float32mf2x8_t t;} /* { dg-error {unknown type name '__rvv_float32mf2x8_t'} } */ void f___rvv_float32m1x2_t () {__rvv_float32m1x2_t t;} void f___rvv_float32m1x3_t () {__rvv_float32m1x3_t t;} void f___rvv_float32m1x4_t () {__rvv_float32m1x4_t t;} 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/vsetvl_zve32-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vsetvl_zve32-1.c new file mode 100644 index 0000000..f6899c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vsetvl_zve32-1.c @@ -0,0 +1,73 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32imafc_zve32f_zvl128b -mabi=ilp32 -O2" } */ + +struct S0 +{ + unsigned a : 15; + int b; + int c; +}; + +struct S1 +{ + struct S0 s0; + int e; +}; + +struct Z +{ + char c; + int z; +} __attribute__((packed)); + +union U +{ + struct S1 s1; + struct Z z; +}; + +int __attribute__((noinline, noclone)) +return_zero (void) +{ + return 0; +} + +volatile union U gu; +struct S0 gs; + +int __attribute__((noinline, noclone)) +check_outcome () +{ + if (gs.a != 6 + || gs.b != 80000) + __builtin_abort (); +} + +int +main (int argc, char *argv[]) +{ + union U u; + struct S1 m; + struct S0 l; + + if (return_zero ()) + u.z.z = 20000; + else + { + u.s1.s0.a = 6; + u.s1.s0.b = 80000; + u.s1.e = 2; + + m = u.s1; + m.s0.c = 0; + l = m.s0; + gs = l; + } + + gu = u; + check_outcome (); + return 0; +} + +/* { dg-final { scan-assembler {vsetivli\s+zero,\s*2,\s*e32,\s*m1,\s*t[au],\s*m[au]} } } */ +/* { dg-final { scan-assembler {vsetivli\s+zero,\s*4,\s*e32,\s*m1,\s*t[au],\s*m[au]} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vsetvl_zve32-2.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vsetvl_zve32-2.c new file mode 100644 index 0000000..dd81f8b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vsetvl_zve32-2.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64g_zve32x_zvl128b -mabi=lp64d -O3" } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +typedef unsigned int V2SI __attribute__((vector_size(8))); + +V2SI v1, v2; + +/* Make sure we won't use mf2 mode even vector register is OK to hold for + ELEN=32. */ +void foo1() +{ +/* +** foo1: +** ... +** vsetivli zero,2,e32,m1,ta,ma +** ... +** vle32\.v v[0-9]+,0\([a-x][0-9]+\) +** ... +** vse32\.v v[0-9]+,0\([a-x][0-9]+\) +** ... +** ret +*/ + v1 = v2; +} 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.dg/torture/pr117002.d b/gcc/testsuite/gdc.dg/torture/pr117002.d new file mode 100644 index 0000000..5b8c19e --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/pr117002.d @@ -0,0 +1,28 @@ +// { dg-do compile } +// { dg-additional-options "-Warray-bounds" } +extern(C++) class C117002 +{ + ubyte[4] not_multiple_of_8; +} + +int pr117002a(void *p) +{ + auto init = __traits(initSymbol, C117002); + if (init.ptr + init.length <= p) + return 1; + return 0; +} + +void pr117002b(void *p) +{ + auto init = __traits(initSymbol, C117002); + p[0 .. init.length] = init[]; +} + +void pr117002c() +{ + scope var = new C117002; + void *p = cast(void*)var; + auto init = __traits(initSymbol, C117002); + p[0 .. __traits(classInstanceSize, C117002)] = init[]; +} 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 diff --git a/gcc/testsuite/rust/compile/cfg-core1.rs b/gcc/testsuite/rust/compile/cfg-core1.rs new file mode 100644 index 0000000..7780cc9 --- /dev/null +++ b/gcc/testsuite/rust/compile/cfg-core1.rs @@ -0,0 +1,12 @@ +// { dg-additional-options "-frust-cfg=A -frust-cfg=B" } + +#[cfg_attr(A, cfg(B))] +struct Foo0; + +#[cfg_attr(A, cfg(C))] +struct Bar0; + +fn main() { + let a = Foo0; + let a = Bar0; // { dg-error "cannot find value" } +} diff --git a/gcc/testsuite/rust/compile/cfg-core2.rs b/gcc/testsuite/rust/compile/cfg-core2.rs new file mode 100644 index 0000000..e346edd --- /dev/null +++ b/gcc/testsuite/rust/compile/cfg-core2.rs @@ -0,0 +1,12 @@ +// { dg-additional-options "-frust-cfg=B" } + +#[cfg(not(any(A, B)))] +struct Foo0; + +#[cfg(not(any(A, C)))] +struct Bar0; + +fn main() { + let a = Foo0; // { dg-error "cannot find value" } + let a = Bar0; +} diff --git a/gcc/testsuite/rust/compile/const_generics_3.rs b/gcc/testsuite/rust/compile/const_generics_3.rs index e4e9008..524d48d 100644 --- a/gcc/testsuite/rust/compile/const_generics_3.rs +++ b/gcc/testsuite/rust/compile/const_generics_3.rs @@ -1,10 +1,12 @@ -// { dg-additional-options "-w" } +// { dg-additional-options "-w -frust-name-resolution-2.0" } + +#[lang = "sized"] +trait Sized {} const M: usize = 4; struct Foo<T, const N: usize = 1> { - // FIXME: This error is bogus. But having it means parsing is valid! - value: [i32; N], // { dg-error "cannot find value .N. in this scope" } + value: [T; N], } fn main() { diff --git a/gcc/testsuite/rust/compile/feature_rust_attri0.rs b/gcc/testsuite/rust/compile/feature_rust_attri0.rs index 9c11f56..1937acf 100644 --- a/gcc/testsuite/rust/compile/feature_rust_attri0.rs +++ b/gcc/testsuite/rust/compile/feature_rust_attri0.rs @@ -1,3 +1,7 @@ +extern "C" { + fn printf(s: *const i8, ...); +} + #[rustc_builtin_macro] //{ dg-error "internal implementation detail. " "" { target *-*-* } } macro_rules! line { () => {{}}; @@ -5,7 +9,7 @@ macro_rules! line { fn main() -> i32 { let a = line!(); - print(a); + printf("%d\0" as *const str as *const i8, a); 0 } diff --git a/gcc/testsuite/rust/compile/for-loop1.rs b/gcc/testsuite/rust/compile/for-loop1.rs index 1023ecd..21e0399 100644 --- a/gcc/testsuite/rust/compile/for-loop1.rs +++ b/gcc/testsuite/rust/compile/for-loop1.rs @@ -102,30 +102,30 @@ mod ptr { #[lang = "const_ptr"] impl<T> *const T { pub unsafe fn offset(self, count: isize) -> *const T { - intrinsics::offset(self, count) + crate::intrinsics::offset(self, count) } } #[lang = "mut_ptr"] impl<T> *mut T { pub unsafe fn offset(self, count: isize) -> *mut T { - intrinsics::offset(self, count) as *mut T + crate::intrinsics::offset(self, count) as *mut T } } pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) { let x = x as *mut u8; let y = y as *mut u8; - let len = mem::size_of::<T>() * count; + let len = crate::mem::size_of::<T>() * count; swap_nonoverlapping_bytes(x, y, len) } pub unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) { // For types smaller than the block optimization below, // just swap directly to avoid pessimizing codegen. - if mem::size_of::<T>() < 32 { + if crate::mem::size_of::<T>() < 32 { let z = read(x); - intrinsics::copy_nonoverlapping(y, x, 1); + crate::intrinsics::copy_nonoverlapping(y, x, 1); write(y, z); } else { swap_nonoverlapping(x, y, 1); @@ -133,12 +133,12 @@ mod ptr { } pub unsafe fn write<T>(dst: *mut T, src: T) { - intrinsics::move_val_init(&mut *dst, src) + crate::intrinsics::move_val_init(&mut *dst, src) } pub unsafe fn read<T>(src: *const T) -> T { - let mut tmp: T = mem::uninitialized(); - intrinsics::copy_nonoverlapping(src, &mut tmp, 1); + let mut tmp: T = crate::mem::uninitialized(); + crate::intrinsics::copy_nonoverlapping(src, &mut tmp, 1); tmp } @@ -146,7 +146,7 @@ mod ptr { struct Block(u64, u64, u64, u64); struct UnalignedBlock(u64, u64, u64, u64); - let block_size = mem::size_of::<Block>(); + let block_size = crate::mem::size_of::<Block>(); // Loop through x & y, copying them `Block` at a time // The optimizer should unroll the loop fully for most types @@ -155,31 +155,31 @@ mod ptr { while i + block_size <= len { // Create some uninitialized memory as scratch space // Declaring `t` here avoids aligning the stack when this loop is unused - let mut t: Block = mem::uninitialized(); + let mut t: Block = crate::mem::uninitialized(); let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); // Swap a block of bytes of x & y, using t as a temporary buffer // This should be optimized into efficient SIMD operations where available - intrinsics::copy_nonoverlapping(x, t, block_size); - intrinsics::copy_nonoverlapping(y, x, block_size); - intrinsics::copy_nonoverlapping(t, y, block_size); + crate::intrinsics::copy_nonoverlapping(x, t, block_size); + crate::intrinsics::copy_nonoverlapping(y, x, block_size); + crate::intrinsics::copy_nonoverlapping(t, y, block_size); i += block_size; } if i < len { // Swap any remaining bytes - let mut t: UnalignedBlock = mem::uninitialized(); + let mut t: UnalignedBlock = crate::mem::uninitialized(); let rem = len - i; let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); - intrinsics::copy_nonoverlapping(x, t, rem); - intrinsics::copy_nonoverlapping(y, x, rem); - intrinsics::copy_nonoverlapping(t, y, rem); + crate::intrinsics::copy_nonoverlapping(x, t, rem); + crate::intrinsics::copy_nonoverlapping(y, x, rem); + crate::intrinsics::copy_nonoverlapping(t, y, rem); } } } @@ -194,7 +194,7 @@ mod mem { pub fn swap<T>(x: &mut T, y: &mut T) { unsafe { - ptr::swap_nonoverlapping_one(x, y); + crate::ptr::swap_nonoverlapping_one(x, y); } } @@ -204,7 +204,7 @@ mod mem { } pub unsafe fn uninitialized<T>() -> T { - intrinsics::uninit() + crate::intrinsics::uninit() } } @@ -214,25 +214,25 @@ macro_rules! impl_uint { impl $ty { pub fn wrapping_add(self, rhs: Self) -> Self { unsafe { - intrinsics::wrapping_add(self, rhs) + crate::intrinsics::wrapping_add(self, rhs) } } pub fn wrapping_sub(self, rhs: Self) -> Self { unsafe { - intrinsics::wrapping_sub(self, rhs) + crate::intrinsics::wrapping_sub(self, rhs) } } pub fn rotate_left(self, n: u32) -> Self { unsafe { - intrinsics::rotate_left(self, n as Self) + crate::intrinsics::rotate_left(self, n as Self) } } pub fn rotate_right(self, n: u32) -> Self { unsafe { - intrinsics::rotate_right(self, n as Self) + crate::intrinsics::rotate_right(self, n as Self) } } @@ -243,7 +243,7 @@ macro_rules! impl_uint { } } - pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { + pub const fn from_le_bytes(bytes: [u8; crate::mem::size_of::<Self>()]) -> Self { Self::from_le(Self::from_ne_bytes(bytes)) } @@ -254,8 +254,8 @@ macro_rules! impl_uint { } } - pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - unsafe { mem::transmute(bytes) } + pub const fn from_ne_bytes(bytes: [u8; crate::mem::size_of::<Self>()]) -> Self { + unsafe { crate::mem::transmute(bytes) } } pub fn checked_add(self, rhs: Self) -> Option<Self> { @@ -268,7 +268,7 @@ macro_rules! impl_uint { } pub fn overflowing_add(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { intrinsics::add_with_overflow(self as $ty, rhs as $ty) }; + let (a, b) = unsafe { crate::intrinsics::add_with_overflow(self as $ty, rhs as $ty) }; (a as Self, b) } } @@ -384,12 +384,12 @@ macro_rules! step_identical_methods { () => { #[inline] fn replace_one(&mut self) -> Self { - mem::replace(self, 1) + crate::mem::replace(self, 1) } #[inline] fn replace_zero(&mut self) -> Self { - mem::replace(self, 0) + crate::mem::replace(self, 0) } #[inline] @@ -505,7 +505,7 @@ impl<A: Step> Iterator for Range<A> { // and this won't actually result in an extra check in an optimized build. match self.start.add_usize(1) { Option::Some(mut n) => { - mem::swap(&mut n, &mut self.start); + crate::mem::swap(&mut n, &mut self.start); Option::Some(n) } Option::None => Option::None, diff --git a/gcc/testsuite/rust/compile/for-loop2.rs b/gcc/testsuite/rust/compile/for-loop2.rs index d18bddd..a0ad066 100644 --- a/gcc/testsuite/rust/compile/for-loop2.rs +++ b/gcc/testsuite/rust/compile/for-loop2.rs @@ -102,30 +102,30 @@ mod ptr { #[lang = "const_ptr"] impl<T> *const T { pub unsafe fn offset(self, count: isize) -> *const T { - intrinsics::offset(self, count) + crate::intrinsics::offset(self, count) } } #[lang = "mut_ptr"] impl<T> *mut T { pub unsafe fn offset(self, count: isize) -> *mut T { - intrinsics::offset(self, count) as *mut T + crate::intrinsics::offset(self, count) as *mut T } } pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) { let x = x as *mut u8; let y = y as *mut u8; - let len = mem::size_of::<T>() * count; + let len = crate::mem::size_of::<T>() * count; swap_nonoverlapping_bytes(x, y, len) } pub unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) { // For types smaller than the block optimization below, // just swap directly to avoid pessimizing codegen. - if mem::size_of::<T>() < 32 { + if crate::mem::size_of::<T>() < 32 { let z = read(x); - intrinsics::copy_nonoverlapping(y, x, 1); + crate::intrinsics::copy_nonoverlapping(y, x, 1); write(y, z); } else { swap_nonoverlapping(x, y, 1); @@ -133,12 +133,12 @@ mod ptr { } pub unsafe fn write<T>(dst: *mut T, src: T) { - intrinsics::move_val_init(&mut *dst, src) + crate::intrinsics::move_val_init(&mut *dst, src) } pub unsafe fn read<T>(src: *const T) -> T { - let mut tmp: T = mem::uninitialized(); - intrinsics::copy_nonoverlapping(src, &mut tmp, 1); + let mut tmp: T = crate::mem::uninitialized(); + crate::intrinsics::copy_nonoverlapping(src, &mut tmp, 1); tmp } @@ -146,7 +146,7 @@ mod ptr { struct Block(u64, u64, u64, u64); struct UnalignedBlock(u64, u64, u64, u64); - let block_size = mem::size_of::<Block>(); + let block_size = crate::mem::size_of::<Block>(); // Loop through x & y, copying them `Block` at a time // The optimizer should unroll the loop fully for most types @@ -155,31 +155,31 @@ mod ptr { while i + block_size <= len { // Create some uninitialized memory as scratch space // Declaring `t` here avoids aligning the stack when this loop is unused - let mut t: Block = mem::uninitialized(); + let mut t: Block = crate::mem::uninitialized(); let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); // Swap a block of bytes of x & y, using t as a temporary buffer // This should be optimized into efficient SIMD operations where available - intrinsics::copy_nonoverlapping(x, t, block_size); - intrinsics::copy_nonoverlapping(y, x, block_size); - intrinsics::copy_nonoverlapping(t, y, block_size); + crate::intrinsics::copy_nonoverlapping(x, t, block_size); + crate::intrinsics::copy_nonoverlapping(y, x, block_size); + crate::intrinsics::copy_nonoverlapping(t, y, block_size); i += block_size; } if i < len { // Swap any remaining bytes - let mut t: UnalignedBlock = mem::uninitialized(); + let mut t: UnalignedBlock = crate::mem::uninitialized(); let rem = len - i; let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); - intrinsics::copy_nonoverlapping(x, t, rem); - intrinsics::copy_nonoverlapping(y, x, rem); - intrinsics::copy_nonoverlapping(t, y, rem); + crate::intrinsics::copy_nonoverlapping(x, t, rem); + crate::intrinsics::copy_nonoverlapping(y, x, rem); + crate::intrinsics::copy_nonoverlapping(t, y, rem); } } } @@ -194,7 +194,7 @@ mod mem { pub fn swap<T>(x: &mut T, y: &mut T) { unsafe { - ptr::swap_nonoverlapping_one(x, y); + crate::ptr::swap_nonoverlapping_one(x, y); } } @@ -204,7 +204,7 @@ mod mem { } pub unsafe fn uninitialized<T>() -> T { - intrinsics::uninit() + crate::intrinsics::uninit() } } @@ -214,25 +214,25 @@ macro_rules! impl_uint { impl $ty { pub fn wrapping_add(self, rhs: Self) -> Self { unsafe { - intrinsics::wrapping_add(self, rhs) + crate::intrinsics::wrapping_add(self, rhs) } } pub fn wrapping_sub(self, rhs: Self) -> Self { unsafe { - intrinsics::wrapping_sub(self, rhs) + crate::intrinsics::wrapping_sub(self, rhs) } } pub fn rotate_left(self, n: u32) -> Self { unsafe { - intrinsics::rotate_left(self, n as Self) + crate::intrinsics::rotate_left(self, n as Self) } } pub fn rotate_right(self, n: u32) -> Self { unsafe { - intrinsics::rotate_right(self, n as Self) + crate::intrinsics::rotate_right(self, n as Self) } } @@ -243,7 +243,7 @@ macro_rules! impl_uint { } } - pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { + pub const fn from_le_bytes(bytes: [u8; crate::mem::size_of::<Self>()]) -> Self { Self::from_le(Self::from_ne_bytes(bytes)) } @@ -254,8 +254,8 @@ macro_rules! impl_uint { } } - pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - unsafe { mem::transmute(bytes) } + pub const fn from_ne_bytes(bytes: [u8; crate::mem::size_of::<Self>()]) -> Self { + unsafe { crate::mem::transmute(bytes) } } pub fn checked_add(self, rhs: Self) -> Option<Self> { @@ -268,7 +268,7 @@ macro_rules! impl_uint { } pub fn overflowing_add(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { intrinsics::add_with_overflow(self as $ty, rhs as $ty) }; + let (a, b) = unsafe { crate::intrinsics::add_with_overflow(self as $ty, rhs as $ty) }; (a as Self, b) } } @@ -384,12 +384,12 @@ macro_rules! step_identical_methods { () => { #[inline] fn replace_one(&mut self) -> Self { - mem::replace(self, 1) + crate::mem::replace(self, 1) } #[inline] fn replace_zero(&mut self) -> Self { - mem::replace(self, 0) + crate::mem::replace(self, 0) } #[inline] @@ -505,7 +505,7 @@ impl<A: Step> Iterator for Range<A> { // and this won't actually result in an extra check in an optimized build. match self.start.add_usize(1) { Option::Some(mut n) => { - mem::swap(&mut n, &mut self.start); + crate::mem::swap(&mut n, &mut self.start); Option::Some(n) } Option::None => Option::None, @@ -536,10 +536,12 @@ impl<I: Iterator> IntoIterator for I { pub fn main() { // make sure we can desugar for-loops inside other blocks - + if true { for _ in 20usize..40usize { - unsafe { puts("loop\0" as *const str as *const i8); } + unsafe { + puts("loop\0" as *const str as *const i8); + } } } } diff --git a/gcc/testsuite/rust/compile/issue-1901.rs b/gcc/testsuite/rust/compile/issue-1901.rs index cfd8ef4..b43e34f 100644 --- a/gcc/testsuite/rust/compile/issue-1901.rs +++ b/gcc/testsuite/rust/compile/issue-1901.rs @@ -13,14 +13,14 @@ mod ptr { #[lang = "const_ptr"] impl<T> *const T { pub unsafe fn offset(self, count: isize) -> *const T { - intrinsics::offset(self, count) + crate::intrinsics::offset(self, count) } } #[lang = "mut_ptr"] impl<T> *mut T { pub unsafe fn offset(self, count: isize) -> *mut T { - intrinsics::offset(self, count) as *mut T + crate::intrinsics::offset(self, count) as *mut T } } } diff --git a/gcc/testsuite/rust/compile/issue-1981.rs b/gcc/testsuite/rust/compile/issue-1981.rs index bfd8d2c..de9588c 100644 --- a/gcc/testsuite/rust/compile/issue-1981.rs +++ b/gcc/testsuite/rust/compile/issue-1981.rs @@ -16,30 +16,30 @@ mod ptr { #[lang = "const_ptr"] impl<T> *const T { pub unsafe fn offset(self, count: isize) -> *const T { - intrinsics::offset(self, count) + crate::intrinsics::offset(self, count) } } #[lang = "mut_ptr"] impl<T> *mut T { pub unsafe fn offset(self, count: isize) -> *mut T { - intrinsics::offset(self, count) as *mut T + crate::intrinsics::offset(self, count) as *mut T } } pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) { let x = x as *mut u8; let y = y as *mut u8; - let len = mem::size_of::<T>() * count; + let len = crate::mem::size_of::<T>() * count; swap_nonoverlapping_bytes(x, y, len) } pub unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) { // For types smaller than the block optimization below, // just swap directly to avoid pessimizing codegen. - if mem::size_of::<T>() < 32 { + if crate::mem::size_of::<T>() < 32 { let z = read(x); - intrinsics::copy_nonoverlapping(y, x, 1); + crate::intrinsics::copy_nonoverlapping(y, x, 1); write(y, z); } else { swap_nonoverlapping(x, y, 1); @@ -47,12 +47,12 @@ mod ptr { } pub unsafe fn write<T>(dst: *mut T, src: T) { - intrinsics::move_val_init(&mut *dst, src) + crate::intrinsics::move_val_init(&mut *dst, src) } pub unsafe fn read<T>(src: *const T) -> T { - let mut tmp: T = mem::uninitialized(); - intrinsics::copy_nonoverlapping(src, &mut tmp, 1); + let mut tmp: T = crate::mem::uninitialized(); + crate::intrinsics::copy_nonoverlapping(src, &mut tmp, 1); tmp } @@ -60,7 +60,7 @@ mod ptr { struct Block(u64, u64, u64, u64); struct UnalignedBlock(u64, u64, u64, u64); - let block_size = mem::size_of::<Block>(); + let block_size = crate::mem::size_of::<Block>(); // Loop through x & y, copying them `Block` at a time // The optimizer should unroll the loop fully for most types @@ -69,31 +69,31 @@ mod ptr { while i + block_size <= len { // Create some uninitialized memory as scratch space // Declaring `t` here avoids aligning the stack when this loop is unused - let mut t: Block = mem::uninitialized(); + let mut t: Block = crate::mem::uninitialized(); let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); // Swap a block of bytes of x & y, using t as a temporary buffer // This should be optimized into efficient SIMD operations where available - intrinsics::copy_nonoverlapping(x, t, block_size); - intrinsics::copy_nonoverlapping(y, x, block_size); - intrinsics::copy_nonoverlapping(t, y, block_size); + crate::intrinsics::copy_nonoverlapping(x, t, block_size); + crate::intrinsics::copy_nonoverlapping(y, x, block_size); + crate::intrinsics::copy_nonoverlapping(t, y, block_size); i += block_size; } if i < len { // Swap any remaining bytes - let mut t: UnalignedBlock = mem::uninitialized(); + let mut t: UnalignedBlock = crate::mem::uninitialized(); let rem = len - i; let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); - intrinsics::copy_nonoverlapping(x, t, rem); - intrinsics::copy_nonoverlapping(y, x, rem); - intrinsics::copy_nonoverlapping(t, y, rem); + crate::intrinsics::copy_nonoverlapping(x, t, rem); + crate::intrinsics::copy_nonoverlapping(y, x, rem); + crate::intrinsics::copy_nonoverlapping(t, y, rem); } } } @@ -106,7 +106,7 @@ mod mem { pub fn swap<T>(x: &mut T, y: &mut T) { unsafe { - ptr::swap_nonoverlapping_one(x, y); + crate::ptr::swap_nonoverlapping_one(x, y); } } @@ -116,7 +116,7 @@ mod mem { } pub unsafe fn uninitialized<T>() -> T { - intrinsics::uninit() + crate::intrinsics::uninit() } } @@ -126,7 +126,7 @@ trait Step { impl Step for i32 { fn replace_zero(&mut self) -> Self { - mem::replace(self, 0) + crate::mem::replace(self, 0) } } diff --git a/gcc/testsuite/rust/compile/issue-2330.rs b/gcc/testsuite/rust/compile/issue-2330.rs index 97c1503..6ab46c7 100644 --- a/gcc/testsuite/rust/compile/issue-2330.rs +++ b/gcc/testsuite/rust/compile/issue-2330.rs @@ -95,30 +95,30 @@ mod ptr { #[lang = "const_ptr"] impl<T> *const T { pub unsafe fn offset(self, count: isize) -> *const T { - intrinsics::offset(self, count) + crate::intrinsics::offset(self, count) } } #[lang = "mut_ptr"] impl<T> *mut T { pub unsafe fn offset(self, count: isize) -> *mut T { - intrinsics::offset(self, count) as *mut T + crate::intrinsics::offset(self, count) as *mut T } } pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) { let x = x as *mut u8; let y = y as *mut u8; - let len = mem::size_of::<T>() * count; + let len = crate::mem::size_of::<T>() * count; swap_nonoverlapping_bytes(x, y, len) } pub unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) { // For types smaller than the block optimization below, // just swap directly to avoid pessimizing codegen. - if mem::size_of::<T>() < 32 { + if crate::mem::size_of::<T>() < 32 { let z = read(x); - intrinsics::copy_nonoverlapping(y, x, 1); + crate::intrinsics::copy_nonoverlapping(y, x, 1); write(y, z); } else { swap_nonoverlapping(x, y, 1); @@ -126,12 +126,12 @@ mod ptr { } pub unsafe fn write<T>(dst: *mut T, src: T) { - intrinsics::move_val_init(&mut *dst, src) + crate::intrinsics::move_val_init(&mut *dst, src) } pub unsafe fn read<T>(src: *const T) -> T { - let mut tmp: T = mem::uninitialized(); - intrinsics::copy_nonoverlapping(src, &mut tmp, 1); + let mut tmp: T = crate::mem::uninitialized(); + crate::intrinsics::copy_nonoverlapping(src, &mut tmp, 1); tmp } @@ -139,7 +139,7 @@ mod ptr { struct Block(u64, u64, u64, u64); struct UnalignedBlock(u64, u64, u64, u64); - let block_size = mem::size_of::<Block>(); + let block_size = crate::mem::size_of::<Block>(); // Loop through x & y, copying them `Block` at a time // The optimizer should unroll the loop fully for most types @@ -148,31 +148,31 @@ mod ptr { while i + block_size <= len { // Create some uninitialized memory as scratch space // Declaring `t` here avoids aligning the stack when this loop is unused - let mut t: Block = mem::uninitialized(); + let mut t: Block = crate::mem::uninitialized(); let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); // Swap a block of bytes of x & y, using t as a temporary buffer // This should be optimized into efficient SIMD operations where available - intrinsics::copy_nonoverlapping(x, t, block_size); - intrinsics::copy_nonoverlapping(y, x, block_size); - intrinsics::copy_nonoverlapping(t, y, block_size); + crate::intrinsics::copy_nonoverlapping(x, t, block_size); + crate::intrinsics::copy_nonoverlapping(y, x, block_size); + crate::intrinsics::copy_nonoverlapping(t, y, block_size); i += block_size; } if i < len { // Swap any remaining bytes - let mut t: UnalignedBlock = mem::uninitialized(); + let mut t: UnalignedBlock = crate::mem::uninitialized(); let rem = len - i; let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); - intrinsics::copy_nonoverlapping(x, t, rem); - intrinsics::copy_nonoverlapping(y, x, rem); - intrinsics::copy_nonoverlapping(t, y, rem); + crate::intrinsics::copy_nonoverlapping(x, t, rem); + crate::intrinsics::copy_nonoverlapping(y, x, rem); + crate::intrinsics::copy_nonoverlapping(t, y, rem); } } } @@ -185,7 +185,7 @@ mod mem { pub fn swap<T>(x: &mut T, y: &mut T) { unsafe { - ptr::swap_nonoverlapping_one(x, y); + crate::ptr::swap_nonoverlapping_one(x, y); } } @@ -195,6 +195,6 @@ mod mem { } pub unsafe fn uninitialized<T>() -> T { - intrinsics::uninit() + crate::intrinsics::uninit() } } diff --git a/gcc/testsuite/rust/compile/issue-2905-2.rs b/gcc/testsuite/rust/compile/issue-2905-2.rs index 83c54ed..1c9516d 100644 --- a/gcc/testsuite/rust/compile/issue-2905-2.rs +++ b/gcc/testsuite/rust/compile/issue-2905-2.rs @@ -17,10 +17,10 @@ pub mod core { } pub mod slice { - use core::marker::PhantomData; - use core::option::Option; + use crate::core::marker::PhantomData; + use crate::core::option::Option; - impl<T> core::iter::IntoIterator for &[T] { + impl<T> crate::core::iter::IntoIterator for &[T] { type Item = &T; type IntoIter = Weird<T>; @@ -108,7 +108,7 @@ pub mod core { } pub mod iter { - use option::Option; + use crate::core::option::Option; pub trait IntoIterator { type Item; diff --git a/gcc/testsuite/rust/compile/issue-3242.rs b/gcc/testsuite/rust/compile/issue-3242.rs index 468497a..a4542aea0 100644 --- a/gcc/testsuite/rust/compile/issue-3242.rs +++ b/gcc/testsuite/rust/compile/issue-3242.rs @@ -1,5 +1,4 @@ #[lang = "sized"] -// { dg-skip-if "" { *-*-* } } pub trait Sized {} trait Foo<T> { diff --git a/gcc/testsuite/rust/compile/issue-3541-1.rs b/gcc/testsuite/rust/compile/issue-3541-1.rs new file mode 100644 index 0000000..6b47b7e --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3541-1.rs @@ -0,0 +1,5 @@ +impl B for u32 { + const BAR: i32; // { dg-error "associated constant in .impl." } +} + +trait B {} diff --git a/gcc/testsuite/rust/compile/issue-3541-2.rs b/gcc/testsuite/rust/compile/issue-3541-2.rs new file mode 100644 index 0000000..9f17eed --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3541-2.rs @@ -0,0 +1,3 @@ +trait B { + const BAR: i32; +} diff --git a/gcc/testsuite/rust/compile/issue-3549.rs b/gcc/testsuite/rust/compile/issue-3549.rs new file mode 100644 index 0000000..cedbb5a --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3549.rs @@ -0,0 +1,3 @@ +fn main() { + r#""#; +} diff --git a/gcc/testsuite/rust/compile/issue-3552.rs b/gcc/testsuite/rust/compile/issue-3552.rs new file mode 100644 index 0000000..9a4451b14b --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3552.rs @@ -0,0 +1,14 @@ +trait Foo { + const BAR: u32; +} + +const TRAIT_REF_BAR: u32 = <Foo>::BAR; +// { dg-error "no default expression on trait constant" "" { target *-*-* } .-1 } + +struct GlobalTraitRef; + +impl Foo for GlobalTraitRef { + const BAR: u32 = TRAIT_REF_BAR; +} + +fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-3553.rs b/gcc/testsuite/rust/compile/issue-3553.rs new file mode 100644 index 0000000..546f3c1 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3553.rs @@ -0,0 +1,18 @@ +trait Foo { + fn f(&self) -> isize; +} + +trait Bar: Foo { + fn g(&self) -> isize; +} + +struct A { + x: isize, +} + +impl Bar for A { + // { dg-error "the trait bound .A: Foo. is not satisfied .E0277." "" { target *-*-* } .-1 } + fn g(&self) -> isize { + self.f() + } +} diff --git a/gcc/testsuite/rust/compile/issue-3554-1.rs b/gcc/testsuite/rust/compile/issue-3554-1.rs new file mode 100644 index 0000000..a66be35 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3554-1.rs @@ -0,0 +1,8 @@ +trait Tr { + fn foo(); + + fn bar(&self) { + self.foo() + // { dg-error "no method named .foo. found in the current scope .E0599." "" { target *-*-* } .-1 } + } +} diff --git a/gcc/testsuite/rust/compile/issue-3554-2.rs b/gcc/testsuite/rust/compile/issue-3554-2.rs new file mode 100644 index 0000000..e455a8b --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3554-2.rs @@ -0,0 +1,18 @@ +#[lang = "sized"] +pub trait Sized {} + +#[lang = "fn_once"] +pub trait FnOnce<Args> { + #[lang = "fn_once_output"] + type Output; + + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} +trait Tr { + fn foo(); + + fn bar(&self) { + (|| self.foo())() + // { dg-error "no method named .foo. found in the current scope .E0599." "" { target *-*-* } .-1 } + } +} diff --git a/gcc/testsuite/rust/compile/issue-3563.rs b/gcc/testsuite/rust/compile/issue-3563.rs new file mode 100644 index 0000000..46e7624 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3563.rs @@ -0,0 +1,17 @@ +pub struct AA { + pub data: [u8; 10], +} + +impl AA { + pub const fn new() -> Self { + let mut res: AA = AA { data: [0; 10] }; + res.data[0] = 5; + res + } +} + +static mut BB: AA = AA::new(); + +fn main() { + let _ptr = unsafe { &mut BB }; +} diff --git a/gcc/testsuite/rust/compile/issue-3566-1.rs b/gcc/testsuite/rust/compile/issue-3566-1.rs new file mode 100644 index 0000000..b7e5be0 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3566-1.rs @@ -0,0 +1,8 @@ +mod a { + pub mod b { + + pub fn f(x: [u8; { 100 }]) -> [u8; { 100 }] { + x + } + } +} diff --git a/gcc/testsuite/rust/compile/issue-3566-2.rs b/gcc/testsuite/rust/compile/issue-3566-2.rs new file mode 100644 index 0000000..3f3ea73 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3566-2.rs @@ -0,0 +1,22 @@ +// run-pass + +#![allow(H8)] +#![allow(dead_code)] + + +// pretty-expanded FIXME #23616 + +mod a { + pub mod b { + pub type t = isize; + + pub fn f(x: [u8; { let s = 17; 100 }]) -> [u8; { let z = 18; 100 }] { + //~^ WARN unused variable: `s` + //~| WARN unused variable: `z` + x +} + } +} + +pub fn main() { //~ ERROR cannot move out + } diff --git a/gcc/testsuite/rust/compile/issue-3567.rs b/gcc/testsuite/rust/compile/issue-3567.rs new file mode 100644 index 0000000..021d9c2 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3567.rs @@ -0,0 +1,4 @@ +fn main() { + let _: &[i8] = &[i8]; + // { dg-error "expected value .E0423." "" { target *-*-* } .-1 } +} diff --git a/gcc/testsuite/rust/compile/issue-3568.rs b/gcc/testsuite/rust/compile/issue-3568.rs new file mode 100644 index 0000000..222a174 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3568.rs @@ -0,0 +1,7 @@ +pub type T = (); +mod foo { + pub use super::T; +} + +pub use foo::super::foo::S as T; +// { dg-error ".super. can only be used in start position" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/rust/compile/issue-3588.rs b/gcc/testsuite/rust/compile/issue-3588.rs new file mode 100644 index 0000000..744d967 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3588.rs @@ -0,0 +1,5 @@ +const FOO: i32 = if true { [1, 2, 3] } else { [2, 3, 4] }[0]; + +pub fn test() -> i32 { + FOO +} diff --git a/gcc/testsuite/rust/compile/issue-3605.rs b/gcc/testsuite/rust/compile/issue-3605.rs new file mode 100644 index 0000000..05e6e48 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3605.rs @@ -0,0 +1,5 @@ +enum Foo<'a> {} + +enum Bar<'a> { + in_band_def_explicit_impl(Foo<'a>), +} diff --git a/gcc/testsuite/rust/compile/issue-3606.rs b/gcc/testsuite/rust/compile/issue-3606.rs new file mode 100644 index 0000000..73b0bd6 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3606.rs @@ -0,0 +1,6 @@ +// { dg-options "-w" } +#[repr()] +pub struct Coord { + x: u32, + y: u32, +} diff --git a/gcc/testsuite/rust/compile/issue-3613.rs b/gcc/testsuite/rust/compile/issue-3613.rs new file mode 100644 index 0000000..f2e1092 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3613.rs @@ -0,0 +1,18 @@ +mod m1 { + pub enum Baz4 { + foo1, + foo2, + } +} + +fn bar(x: m1::foo) { + // { dg-error "unknown reference for resolved name: .foo." "" { target *-*-* } .-1 } + match x { + m1::foo::foo1 => {} + // { dg-error "failed to type resolve root segment" "" { target *-*-* } .-1 } + m1::NodePosition::foo2 => {} + // { dg-error "failed to type resolve root segment" "" { target *-*-* } .-1 } + } +} + +pub fn main() {} diff --git a/gcc/testsuite/rust/compile/issue-3614.rs b/gcc/testsuite/rust/compile/issue-3614.rs new file mode 100644 index 0000000..350a7e4 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3614.rs @@ -0,0 +1,3 @@ +#[repr] // { dg-error "malformed .repr. attribute" } + +struct _B {} diff --git a/gcc/testsuite/rust/compile/issue-3615.rs b/gcc/testsuite/rust/compile/issue-3615.rs new file mode 100644 index 0000000..e5c5072 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3615.rs @@ -0,0 +1,7 @@ +pub trait Trait { + pub fn nrvo(init: fn()) -> [u8; 4096] { + let mut buf = [0; 4096]; + + buf + } +} diff --git a/gcc/testsuite/rust/compile/iterators1.rs b/gcc/testsuite/rust/compile/iterators1.rs index 1141758..2ea3d74 100644 --- a/gcc/testsuite/rust/compile/iterators1.rs +++ b/gcc/testsuite/rust/compile/iterators1.rs @@ -98,30 +98,30 @@ mod ptr { #[lang = "const_ptr"] impl<T> *const T { pub unsafe fn offset(self, count: isize) -> *const T { - intrinsics::offset(self, count) + crate::intrinsics::offset(self, count) } } #[lang = "mut_ptr"] impl<T> *mut T { pub unsafe fn offset(self, count: isize) -> *mut T { - intrinsics::offset(self, count) as *mut T + crate::intrinsics::offset(self, count) as *mut T } } pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) { let x = x as *mut u8; let y = y as *mut u8; - let len = mem::size_of::<T>() * count; + let len = crate::mem::size_of::<T>() * count; swap_nonoverlapping_bytes(x, y, len) } pub unsafe fn swap_nonoverlapping_one<T>(x: *mut T, y: *mut T) { // For types smaller than the block optimization below, // just swap directly to avoid pessimizing codegen. - if mem::size_of::<T>() < 32 { + if crate::mem::size_of::<T>() < 32 { let z = read(x); - intrinsics::copy_nonoverlapping(y, x, 1); + crate::intrinsics::copy_nonoverlapping(y, x, 1); write(y, z); } else { swap_nonoverlapping(x, y, 1); @@ -129,12 +129,12 @@ mod ptr { } pub unsafe fn write<T>(dst: *mut T, src: T) { - intrinsics::move_val_init(&mut *dst, src) + crate::intrinsics::move_val_init(&mut *dst, src) } pub unsafe fn read<T>(src: *const T) -> T { - let mut tmp: T = mem::uninitialized(); - intrinsics::copy_nonoverlapping(src, &mut tmp, 1); + let mut tmp: T = crate::mem::uninitialized(); + crate::intrinsics::copy_nonoverlapping(src, &mut tmp, 1); tmp } @@ -142,7 +142,7 @@ mod ptr { struct Block(u64, u64, u64, u64); struct UnalignedBlock(u64, u64, u64, u64); - let block_size = mem::size_of::<Block>(); + let block_size = crate::mem::size_of::<Block>(); // Loop through x & y, copying them `Block` at a time // The optimizer should unroll the loop fully for most types @@ -151,31 +151,31 @@ mod ptr { while i + block_size <= len { // Create some uninitialized memory as scratch space // Declaring `t` here avoids aligning the stack when this loop is unused - let mut t: Block = mem::uninitialized(); + let mut t: Block = crate::mem::uninitialized(); let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); // Swap a block of bytes of x & y, using t as a temporary buffer // This should be optimized into efficient SIMD operations where available - intrinsics::copy_nonoverlapping(x, t, block_size); - intrinsics::copy_nonoverlapping(y, x, block_size); - intrinsics::copy_nonoverlapping(t, y, block_size); + crate::intrinsics::copy_nonoverlapping(x, t, block_size); + crate::intrinsics::copy_nonoverlapping(y, x, block_size); + crate::intrinsics::copy_nonoverlapping(t, y, block_size); i += block_size; } if i < len { // Swap any remaining bytes - let mut t: UnalignedBlock = mem::uninitialized(); + let mut t: UnalignedBlock = crate::mem::uninitialized(); let rem = len - i; let t = &mut t as *mut _ as *mut u8; let x = x.offset(i as isize); let y = y.offset(i as isize); - intrinsics::copy_nonoverlapping(x, t, rem); - intrinsics::copy_nonoverlapping(y, x, rem); - intrinsics::copy_nonoverlapping(t, y, rem); + crate::intrinsics::copy_nonoverlapping(x, t, rem); + crate::intrinsics::copy_nonoverlapping(y, x, rem); + crate::intrinsics::copy_nonoverlapping(t, y, rem); } } } @@ -190,7 +190,7 @@ mod mem { pub fn swap<T>(x: &mut T, y: &mut T) { unsafe { - ptr::swap_nonoverlapping_one(x, y); + crate::ptr::swap_nonoverlapping_one(x, y); } } @@ -200,7 +200,7 @@ mod mem { } pub unsafe fn uninitialized<T>() -> T { - intrinsics::uninit() + crate::intrinsics::uninit() } } @@ -210,30 +210,30 @@ macro_rules! impl_uint { impl $ty { pub fn wrapping_add(self, rhs: Self) -> Self { unsafe { - intrinsics::wrapping_add(self, rhs) + crate::intrinsics::wrapping_add(self, rhs) } } pub fn wrapping_sub(self, rhs: Self) -> Self { unsafe { - intrinsics::wrapping_sub(self, rhs) + crate::intrinsics::wrapping_sub(self, rhs) } } pub fn rotate_left(self, n: u32) -> Self { unsafe { - intrinsics::rotate_left(self, n as Self) + crate::intrinsics::rotate_left(self, n as Self) } } pub fn rotate_right(self, n: u32) -> Self { unsafe { - intrinsics::rotate_right(self, n as Self) + crate::intrinsics::rotate_right(self, n as Self) } } - pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { - unsafe { mem::transmute(bytes) } + pub const fn from_ne_bytes(bytes: [u8; crate::mem::size_of::<Self>()]) -> Self { + unsafe { crate::mem::transmute(bytes) } } pub fn checked_add(self, rhs: Self) -> Option<Self> { @@ -246,7 +246,7 @@ macro_rules! impl_uint { } pub fn overflowing_add(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { intrinsics::add_with_overflow(self as $ty, rhs as $ty) }; + let (a, b) = unsafe { crate::intrinsics::add_with_overflow(self as $ty, rhs as $ty) }; (a as Self, b) } } @@ -362,12 +362,12 @@ macro_rules! step_identical_methods { () => { #[inline] fn replace_one(&mut self) -> Self { - mem::replace(self, 1) + crate::mem::replace(self, 1) } #[inline] fn replace_zero(&mut self) -> Self { - mem::replace(self, 0) + crate::mem::replace(self, 0) } #[inline] @@ -482,7 +482,7 @@ impl<A: Step> Iterator for Range<A> { // and this won't actually result in an extra check in an optimized build. match self.start.add_usize(1) { Option::Some(mut n) => { - mem::swap(&mut n, &mut self.start); + crate::mem::swap(&mut n, &mut self.start); Option::Some(n) } Option::None => Option::None, diff --git a/gcc/testsuite/rust/compile/macros/mbe/macro43.rs b/gcc/testsuite/rust/compile/macros/mbe/macro43.rs index fbc36a9..0a7f038 100644 --- a/gcc/testsuite/rust/compile/macros/mbe/macro43.rs +++ b/gcc/testsuite/rust/compile/macros/mbe/macro43.rs @@ -1,3 +1,10 @@ +use Option::{None, Some}; + +enum Option<T> { + None, + Some(T) +} + macro_rules! nonzero_integers { ( $( $Ty: ident($Int: ty); )+ ) => { $( @@ -14,7 +21,7 @@ macro_rules! nonzero_integers { // not all derive macros are implemented yet, and this test does not test these anyways // #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] #[repr(transparent)] - pub struct $Ty(NonZero<$Int>); + pub struct $Ty($Int); impl $Ty { /// Create a non-zero without checking the value. @@ -25,7 +32,7 @@ macro_rules! nonzero_integers { #[stable(feature = "nonzero", since = "1.28.0")] #[inline] pub const unsafe fn new_unchecked(n: $Int) -> Self { - $Ty(NonZero(n)) + $Ty(n) } /// Create a non-zero if the given value is not zero. @@ -33,7 +40,7 @@ macro_rules! nonzero_integers { #[inline] pub fn new(n: $Int) -> Option<Self> { if n != 0 { - Some($Ty(NonZero(n))) + Some($Ty(n)) } else { None } @@ -43,7 +50,7 @@ macro_rules! nonzero_integers { #[stable(feature = "nonzero", since = "1.28.0")] #[inline] pub fn get(self) -> $Int { - self.0 .0 + self.0 } } diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index fed7bde..19bf6f8 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -1,19 +1,10 @@ canonical_paths1.rs cfg1.rs -const_generics_3.rs -feature_rust_attri0.rs generics9.rs -issue-1901.rs -issue-1981.rs issue-2043.rs -issue-2330.rs issue-2812.rs -issue-850.rs -issue-855.rs issue-3315-2.rs -iterators1.rs lookup_err1.rs -macros/mbe/macro43.rs macros/mbe/macro6.rs multiple_bindings1.rs multiple_bindings2.rs @@ -22,7 +13,6 @@ privacy8.rs pub_restricted_1.rs pub_restricted_2.rs pub_restricted_3.rs -sizeof-stray-infer-var-bug.rs undeclared_label.rs use_1.rs while_break_expr.rs @@ -32,15 +22,12 @@ derive_clone_enum3.rs derive-debug1.rs derive-default1.rs issue-3402-1.rs -for-loop1.rs -for-loop2.rs issue-3403.rs derive-eq-invalid.rs derive-hash1.rs torture/alt_patterns1.rs -torture/builtin_abort.rs torture/loop4.rs torture/loop8.rs torture/name_resolve1.rs -torture/uninit-intrinsic-1.rs +issue-3568.rs # please don't delete the trailing newline diff --git a/gcc/testsuite/rust/compile/self_import_namespace.rs b/gcc/testsuite/rust/compile/self_import_namespace.rs new file mode 100644 index 0000000..2d9b2ed --- /dev/null +++ b/gcc/testsuite/rust/compile/self_import_namespace.rs @@ -0,0 +1,14 @@ +// { dg-additional-options "-frust-name-resolution-2.0" } + +mod bar { + pub mod foo {} + pub fn foo() {} +} + +// This only imports the module `foo`. The function `foo` lives in +// the value namespace and is not imported. +use bar::foo::{self}; + +fn main() { + foo(); // { dg-error "expected value" } +} diff --git a/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs b/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs index 8275691..c46a97d 100644 --- a/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs +++ b/gcc/testsuite/rust/compile/sizeof-stray-infer-var-bug.rs @@ -14,6 +14,6 @@ mod ptr { pub unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) { let x = x as *mut T; let y = y as *mut T; - let len = mem::size_of::<T>() * count; + let len = crate::mem::size_of::<T>() * count; } } diff --git a/gcc/testsuite/rust/compile/torture/builtin_abort.rs b/gcc/testsuite/rust/compile/torture/builtin_abort.rs index 3112cdc..919caa4 100644 --- a/gcc/testsuite/rust/compile/torture/builtin_abort.rs +++ b/gcc/testsuite/rust/compile/torture/builtin_abort.rs @@ -12,7 +12,7 @@ mod intrinsics { } } -pub fn main () -> i32 { - abort(); +pub fn main() -> i32 { + crate::intrinsics::abort(); 0 } diff --git a/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs b/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs index fa329c6..af1cb54 100644 --- a/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs +++ b/gcc/testsuite/rust/compile/torture/uninit-intrinsic-1.rs @@ -11,7 +11,7 @@ mod intrinsics { mod mem { pub unsafe fn uninitialized<T>() -> T { - intrinsics::uninit() + crate::intrinsics::uninit() } } @@ -21,6 +21,6 @@ struct Foo(i32, i32); impl Foo { pub fn new() -> Self { - unsafe { mem::uninitialized::<Foo>() } + unsafe { crate::mem::uninitialized::<Foo>() } } } |