aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/ChangeLog.omp7
-rwxr-xr-xcontrib/gcc-changelog/git_repository.py9
-rwxr-xr-xcontrib/gcc-changelog/git_update_version.py28
-rw-r--r--gcc/ChangeLog239
-rw-r--r--gcc/ChangeLog.omp87
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/DATESTAMP.omp2
-rw-r--r--gcc/ada/ChangeLog266
-rw-r--r--gcc/ada/checks.adb15
-rw-r--r--gcc/ada/contracts.adb103
-rw-r--r--gcc/ada/doc/gnat_rm/gnat_language_extensions.rst156
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst6
-rw-r--r--gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst17
-rw-r--r--gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst59
-rw-r--r--gcc/ada/einfo.ads2
-rw-r--r--gcc/ada/exp_aggr.adb514
-rw-r--r--gcc/ada/exp_attr.adb52
-rw-r--r--gcc/ada/exp_ch3.adb11
-rw-r--r--gcc/ada/exp_ch4.adb80
-rw-r--r--gcc/ada/exp_ch5.adb24
-rw-r--r--gcc/ada/exp_ch6.adb107
-rw-r--r--gcc/ada/exp_ch7.adb15
-rw-r--r--gcc/ada/exp_util.adb176
-rw-r--r--gcc/ada/exp_util.ads18
-rw-r--r--gcc/ada/freeze.adb11
-rw-r--r--gcc/ada/gnat_rm.texi271
-rw-r--r--gcc/ada/gnat_ugn.texi102
-rw-r--r--gcc/ada/libgnarl/s-stusta.adb5
-rw-r--r--gcc/ada/sem_attr.adb5
-rw-r--r--gcc/ada/sem_case.adb8
-rw-r--r--gcc/ada/sem_ch10.adb2
-rw-r--r--gcc/ada/sem_ch12.adb15
-rw-r--r--gcc/ada/sem_ch3.adb31
-rw-r--r--gcc/ada/sem_ch4.adb911
-rw-r--r--gcc/ada/sem_prag.adb9
-rw-r--r--gcc/ada/sem_res.adb2
-rw-r--r--gcc/ada/sem_util.adb140
-rw-r--r--gcc/ada/usage.adb10
-rw-r--r--gcc/builtins.def6
-rw-r--r--gcc/c/ChangeLog26
-rw-r--r--gcc/c/ChangeLog.omp9
-rw-r--r--gcc/c/c-parser.cc104
-rw-r--r--gcc/cgraph.cc2
-rw-r--r--gcc/cgraph.h2
-rw-r--r--gcc/cgraphclones.cc4
-rw-r--r--gcc/config.gcc12
-rw-r--r--gcc/config/aarch64/aarch64-cores.def2
-rw-r--r--gcc/config/alpha/alpha.cc23
-rw-r--r--gcc/config/avr/avr.md35
-rw-r--r--gcc/config/gcn/gcn-devices.def33
-rw-r--r--gcc/config/gcn/gcn-opts.h13
-rw-r--r--gcc/config/gcn/gcn-tables.opt9
-rw-r--r--gcc/config/gcn/gcn-valu.md8
-rw-r--r--gcc/config/gcn/gcn.cc8
-rw-r--r--gcc/config/gcn/gcn.h2
-rw-r--r--gcc/config/gcn/gcn.md168
-rw-r--r--gcc/config/i386/i386.cc10
-rw-r--r--gcc/config/microblaze/microblaze.cc4
-rw-r--r--gcc/config/nvptx/mkoffload.cc12
-rw-r--r--gcc/cp/ChangeLog122
-rw-r--r--gcc/cp/ChangeLog.omp12
-rw-r--r--gcc/cp/class.cc6
-rw-r--r--gcc/cp/constexpr.cc3
-rw-r--r--gcc/cp/cp-gimplify.cc21
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/decl2.cc50
-rw-r--r--gcc/cp/lambda.cc5
-rw-r--r--gcc/cp/module.cc50
-rw-r--r--gcc/cp/optimize.cc4
-rw-r--r--gcc/cp/parser.cc37
-rw-r--r--gcc/cp/pt.cc36
-rw-r--r--gcc/cp/rtti.cc1
-rw-r--r--gcc/cp/semantics.cc11
-rw-r--r--gcc/doc/extend.texi2
-rw-r--r--gcc/doc/gm2.texi2
-rw-r--r--gcc/doc/install.texi17
-rw-r--r--gcc/doc/invoke.texi10
-rw-r--r--gcc/dse.cc5
-rw-r--r--gcc/dwarf2out.cc3
-rw-r--r--gcc/ext-dce.cc17
-rw-r--r--gcc/fortran/ChangeLog184
-rw-r--r--gcc/fortran/ChangeLog.omp13
-rw-r--r--gcc/fortran/check.cc115
-rw-r--r--gcc/fortran/data.cc8
-rw-r--r--gcc/fortran/dependency.cc6
-rw-r--r--gcc/fortran/dump-parse-tree.cc7
-rw-r--r--gcc/fortran/expr.cc110
-rw-r--r--gcc/fortran/f95-lang.cc3
-rw-r--r--gcc/fortran/gfortran.h9
-rw-r--r--gcc/fortran/interface.cc9
-rw-r--r--gcc/fortran/io.cc6
-rw-r--r--gcc/fortran/misc.cc3
-rw-r--r--gcc/fortran/options.cc4
-rw-r--r--gcc/fortran/primary.cc64
-rw-r--r--gcc/fortran/resolve.cc15
-rw-r--r--gcc/fortran/trans-expr.cc26
-rw-r--r--gcc/fortran/trans-intrinsic.cc51
-rw-r--r--gcc/fortran/trans-openmp.cc20
-rw-r--r--gcc/fortran/trans-types.cc31
-rw-r--r--gcc/gimple-fold.cc40
-rw-r--r--gcc/ipa-cp.cc2
-rw-r--r--gcc/ipa-prop.cc28
-rw-r--r--gcc/ipa-sra.cc8
-rw-r--r--gcc/lto-streamer-out.cc3
-rw-r--r--gcc/m2/ChangeLog57
-rw-r--r--gcc/m2/gm2-compiler/M2Check.mod21
-rw-r--r--gcc/m2/gm2-compiler/M2GenGCC.mod3
-rw-r--r--gcc/m2/gm2-compiler/M2Quads.mod10
-rw-r--r--gcc/m2/gm2-compiler/M2Range.mod43
-rw-r--r--gcc/m2/gm2-compiler/PCSymBuild.mod13
-rw-r--r--gcc/m2/gm2-compiler/SymbolTable.def16
-rw-r--r--gcc/m2/gm2-compiler/SymbolTable.mod138
-rw-r--r--gcc/m2/gm2-libs/FormatStrings.mod4
-rw-r--r--gcc/omp-builtins.def9
-rw-r--r--gcc/omp-general.cc14
-rw-r--r--gcc/omp-offload.cc3
-rw-r--r--gcc/po/ChangeLog16
-rw-r--r--gcc/po/es.po193
-rw-r--r--gcc/po/sv.po24
-rw-r--r--gcc/po/zh_CN.po341
-rw-r--r--gcc/real.cc27
-rw-r--r--gcc/symtab.cc4
-rw-r--r--gcc/testsuite/ChangeLog473
-rw-r--r--gcc/testsuite/ChangeLog.omp41
-rw-r--r--gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/declare-variant-2.c15
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-3.c7
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c13
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-condition.c25
-rw-r--r--gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c25
-rw-r--r--gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c29
-rw-r--r--gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c32
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr120180.c22
-rw-r--r--gcc/testsuite/g++.dg/abi/base-defaulted2.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-if39.C30
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-lambda24.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-prvalue2.C26
-rw-r--r--gcc/testsuite/g++.dg/gomp/metadirective-condition-class.C43
-rw-r--r--gcc/testsuite/g++.dg/gomp/metadirective-condition-template.C41
-rw-r--r--gcc/testsuite/g++.dg/gomp/target-4.C22
-rw-r--r--gcc/testsuite/g++.dg/modules/clone-4_a.C12
-rw-r--r--gcc/testsuite/g++.dg/modules/clone-4_b.C12
-rw-r--r--gcc/testsuite/g++.dg/modules/openmp-1.C9
-rw-r--r--gcc/testsuite/g++.dg/modules/partial-8.h8
-rw-r--r--gcc/testsuite/g++.dg/modules/partial-8_a.C10
-rw-r--r--gcc/testsuite/g++.dg/modules/partial-8_b.C8
-rw-r--r--gcc/testsuite/g++.dg/modules/partial-8_c.C7
-rw-r--r--gcc/testsuite/g++.dg/modules/partial-8_d.C9
-rw-r--r--gcc/testsuite/g++.dg/modules/tinfo-3_a.H7
-rw-r--r--gcc/testsuite/g++.dg/modules/tinfo-3_b.C8
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-1_a.H (renamed from gcc/testsuite/g++.dg/modules/pr113292_a.H)0
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-1_b.C (renamed from gcc/testsuite/g++.dg/modules/pr113292_b.C)2
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-1_c.C (renamed from gcc/testsuite/g++.dg/modules/pr113292_c.C)2
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-2_a.C12
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-2_b.C5
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-2_c.C11
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-3.h42
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-3_a.H4
-rw-r--r--gcc/testsuite/g++.dg/modules/tls-3_b.C4
-rw-r--r--gcc/testsuite/g++.dg/modules/using-31_a.C18
-rw-r--r--gcc/testsuite/g++.dg/modules/using-31_b.C5
-rw-r--r--gcc/testsuite/g++.dg/template/unify13.C18
-rw-r--r--gcc/testsuite/gcc.dg/bitint-123.c26
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120044-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120044-2.c17
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr120295.c66
-rw-r--r--gcc/testsuite/gcc.dg/pr120480.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr120638.c31
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr117811.c5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120182.c42
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120341-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr120341-2.c13
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr114864.c15
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c19
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c13
-rw-r--r--gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c76
-rw-r--r--gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c64
-rw-r--r--gcc/testsuite/gcc.target/avr/torture/pr120423-1.c29
-rw-r--r--gcc/testsuite/gcc.target/avr/torture/pr120423-116389.c22
-rw-r--r--gcc/testsuite/gcc.target/avr/torture/pr120423-2.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-epilogues-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-epilogues-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-epilogues-3.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-epilogues-4.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/vect-epilogues-5.c13
-rw-r--r--gcc/testsuite/gcc.target/nvptx/abi-struct-arg.c10
-rw-r--r--gcc/testsuite/gcc.target/nvptx/abi-struct-ret.c11
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f904
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_class_3.f033
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_class_4.f035
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_with_source_14.f032
-rw-r--r--gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_data_2.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/comma_format_extension_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/comma_format_extension_3.f2
-rw-r--r--gcc/testsuite/gfortran.dg/continuation_13.f902
-rw-r--r--gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/derived_result_5.f90123
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/guality/pr120193.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/inquiry_type_ref_7.f9062
-rw-r--r--gcc/testsuite/gfortran.dg/inquiry_type_ref_8.f90214
-rw-r--r--gcc/testsuite/gfortran.dg/interface_61.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/interface_62.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/pr119856.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/pr120049_2.f9062
-rw-r--r--gcc/testsuite/gfortran.dg/pr120049_a.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/pr120049_b.f906
-rw-r--r--gcc/testsuite/gfortran.dg/pr120191_1.f90614
-rw-r--r--gcc/testsuite/gfortran.dg/pr120191_2.f9084
-rw-r--r--gcc/testsuite/gfortran.dg/pr120191_3.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/pr120196.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/save_8.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/transfer_array_subref.f9048
-rw-r--r--gcc/testsuite/gm2.dg/doc/examples/plugin/fail/assignvalue.mod25
-rw-r--r--gcc/testsuite/gm2.dg/doc/examples/plugin/fail/doc-examples-plugin-fail.exp25
-rw-r--r--gcc/testsuite/gm2/pim/fail/constintarraybyte.mod10
-rw-r--r--gcc/testsuite/gm2/pim/pass/highbit.mod13
-rw-r--r--gcc/testsuite/gm2/pim/pass/highbit2.mod13
-rw-r--r--gcc/testsuite/gm2/pimlib/run/pass/format2.mod63
-rw-r--r--gcc/testsuite/gnat.dg/specs/opt7.ads15
-rw-r--r--gcc/testsuite/gnat.dg/specs/opt7_pkg.adb15
-rw-r--r--gcc/testsuite/gnat.dg/specs/opt7_pkg.ads9
-rw-r--r--gcc/testsuite/gnat.dg/sso19.adb13
-rw-r--r--gcc/testsuite/gnat.dg/sso19_pkg.adb13
-rw-r--r--gcc/testsuite/gnat.dg/sso19_pkg.ads24
-rw-r--r--gcc/testsuite/lib/gm2-dg.exp37
-rw-r--r--gcc/tree-chrec.cc2
-rw-r--r--gcc/tree-nrv.cc19
-rw-r--r--gcc/tree-sra.cc4
-rw-r--r--gcc/tree-ssa-loop-im.cc3
-rw-r--r--gcc/tree-ssa-math-opts.cc1
-rw-r--r--gcc/tree-ssa-phiopt.cc5
-rw-r--r--gcc/tree-ssa-threadbackward.cc8
-rw-r--r--gcc/tree-streamer-in.cc12
-rw-r--r--gcc/tree-streamer-out.cc3
-rw-r--r--gcc/tree-vect-data-refs.cc3
-rw-r--r--gcc/tree-vect-loop.cc3
-rw-r--r--gcc/tree-vect-slp.cc110
-rw-r--r--gcc/tree-vectorizer.h21
-rw-r--r--gcc/tree.h2
-rw-r--r--include/ChangeLog.omp8
-rw-r--r--include/cuda/cuda.h3
-rw-r--r--libcpp/po/ChangeLog16
-rw-r--r--libcpp/po/es.po66
-rw-r--r--libcpp/po/zh_CN.po61
-rw-r--r--libgcc/config/avr/libf7/ChangeLog21
-rw-r--r--libgcc/config/avr/libf7/f7-renames.h1
-rw-r--r--libgcc/config/avr/libf7/f7-wraps.h14
-rwxr-xr-xlibgcc/config/avr/libf7/f7renames.sh12
-rw-r--r--libgcc/config/avr/libf7/libf7-common.mk6
-rw-r--r--libgcc/config/avr/libf7/libf7.c19
-rw-r--r--libgcc/config/avr/libf7/libf7.h1
-rw-r--r--libgfortran/ChangeLog65
-rw-r--r--libgfortran/generated/findloc2_s1.c4
-rw-r--r--libgfortran/generated/findloc2_s4.c4
-rw-r--r--libgfortran/generated/maxloc1_16_s1.c5
-rw-r--r--libgfortran/generated/maxloc1_16_s4.c5
-rw-r--r--libgfortran/generated/maxloc1_4_s1.c5
-rw-r--r--libgfortran/generated/maxloc1_4_s4.c5
-rw-r--r--libgfortran/generated/maxloc1_8_s1.c5
-rw-r--r--libgfortran/generated/maxloc1_8_s4.c5
-rw-r--r--libgfortran/generated/maxloc2_16_s1.c4
-rw-r--r--libgfortran/generated/maxloc2_16_s4.c4
-rw-r--r--libgfortran/generated/maxloc2_4_s1.c4
-rw-r--r--libgfortran/generated/maxloc2_4_s4.c4
-rw-r--r--libgfortran/generated/maxloc2_8_s1.c4
-rw-r--r--libgfortran/generated/maxloc2_8_s4.c4
-rw-r--r--libgfortran/generated/minloc1_16_s1.c5
-rw-r--r--libgfortran/generated/minloc1_16_s4.c5
-rw-r--r--libgfortran/generated/minloc1_4_s1.c5
-rw-r--r--libgfortran/generated/minloc1_4_s4.c5
-rw-r--r--libgfortran/generated/minloc1_8_s1.c5
-rw-r--r--libgfortran/generated/minloc1_8_s4.c5
-rw-r--r--libgfortran/generated/minloc2_16_s1.c4
-rw-r--r--libgfortran/generated/minloc2_16_s4.c4
-rw-r--r--libgfortran/generated/minloc2_4_s1.c4
-rw-r--r--libgfortran/generated/minloc2_4_s4.c4
-rw-r--r--libgfortran/generated/minloc2_8_s1.c4
-rw-r--r--libgfortran/generated/minloc2_8_s4.c4
-rw-r--r--libgfortran/io/format.c10
-rw-r--r--libgfortran/m4/ifindloc2.m44
-rw-r--r--libgfortran/m4/ifunction-s.m45
-rw-r--r--libgfortran/m4/maxloc2s.m44
-rw-r--r--libgfortran/m4/minloc2s.m44
-rw-r--r--libgm2/ChangeLog44
-rw-r--r--libgm2/config.h.in53
-rwxr-xr-xlibgm2/configure371
-rw-r--r--libgm2/configure.ac44
-rw-r--r--libgm2/libm2iso/wraptime.cc60
-rw-r--r--libgomp/ChangeLog149
-rw-r--r--libgomp/ChangeLog.omp265
-rw-r--r--libgomp/libgomp-plugin.h3
-rw-r--r--libgomp/libgomp.h7
-rw-r--r--libgomp/libgomp.map12
-rw-r--r--libgomp/libgomp.texi151
-rw-r--r--libgomp/oacc-mem.c44
-rw-r--r--libgomp/omp.h.in4
-rw-r--r--libgomp/omp_lib.f90.in23
-rw-r--r--libgomp/omp_lib.h.in25
-rw-r--r--libgomp/openacc.f9022
-rw-r--r--libgomp/openacc.h4
-rw-r--r--libgomp/openacc_lib.h24
-rw-r--r--libgomp/plugin/cuda-lib.def1
-rw-r--r--libgomp/plugin/plugin-gcn.c97
-rw-r--r--libgomp/plugin/plugin-nvptx.c52
-rw-r--r--libgomp/target.c97
-rw-r--r--libgomp/testsuite/libgomp.c++/declare_target-2.C25
-rw-r--r--libgomp/testsuite/libgomp.c++/pr119692-1-4.C3
-rw-r--r--libgomp/testsuite/libgomp.c++/pr119692-1-5.C3
-rw-r--r--libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-1.C3
-rw-r--r--libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-2.C3
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-10.C215
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-100.C210
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-101.C136
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-11.C444
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-12.C736
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-2000.C32
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-2001.C61
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-2002.C97
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-2003.C176
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-30.C51
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-300.C51
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-31.C80
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-32.C50
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-33.C52
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-41.C94
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-60.C48
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-61.C56
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-62.C52
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-70.C26
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-80.C49
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-81.C77
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-90.C107
-rw-r--r--libgomp/testsuite/libgomp.c++/target-flex-common.h40
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C62
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C69
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__cmath.C340
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__complex.C175
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C64
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__flat_map-concurrent.C71
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C70
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C60
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__flat_set-concurrent.C67
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C83
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C83
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C70
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C68
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C62
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__numbers.C93
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C68
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C7
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C66
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent.C66
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C65
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C59
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent.C66
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__valarray-1.C179
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__valarray-1.output22
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C66
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C63
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/metadirective-1.c8
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-2.c62
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-3.c80
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/omp_target_memset.c62
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c3
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1.c1
-rw-r--r--libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c8
-rw-r--r--libgomp/testsuite/libgomp.c/declare-variant-4.h8
-rw-r--r--libgomp/testsuite/libgomp.c/interop-hsa.c4
-rw-r--r--libgomp/testsuite/libgomp.c/target-map-zero-sized-3.c7
-rw-r--r--libgomp/testsuite/libgomp.fortran/alloc-comp-4.f9075
-rw-r--r--libgomp/testsuite/libgomp.fortran/map-alloc-comp-9-usm.f9011
-rw-r--r--libgomp/testsuite/libgomp.fortran/map-alloc-comp-9.f9019
-rw-r--r--libgomp/testsuite/libgomp.fortran/metadirective-1.f909
-rw-r--r--libgomp/testsuite/libgomp.fortran/omp_target_memset-2.f9067
-rw-r--r--libgomp/testsuite/libgomp.fortran/omp_target_memset.f9039
-rw-r--r--libgomp/testsuite/libgomp.fortran/target-enter-data-8.f90532
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C3
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C3
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c125
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/acc_memcpy_device-1.c96
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/acc_memcpy_device-1.f90113
-rw-r--r--libstdc++-v3/ChangeLog254
-rw-r--r--libstdc++-v3/doc/html/faq.html2
-rw-r--r--libstdc++-v3/doc/html/manual/containers.html2
-rw-r--r--libstdc++-v3/doc/html/manual/ext_numerics.html2
-rw-r--r--libstdc++-v3/doc/html/manual/ext_sgi.html4
-rw-r--r--libstdc++-v3/doc/html/manual/using_concurrency.html10
-rw-r--r--libstdc++-v3/doc/html/manual/utilities.html4
-rw-r--r--libstdc++-v3/doc/xml/faq.xml2
-rw-r--r--libstdc++-v3/doc/xml/manual/containers.xml2
-rw-r--r--libstdc++-v3/doc/xml/manual/extensions.xml6
-rw-r--r--libstdc++-v3/doc/xml/manual/using.xml10
-rw-r--r--libstdc++-v3/doc/xml/manual/utilities.xml4
-rw-r--r--libstdc++-v3/include/bits/chrono.h2
-rw-r--r--libstdc++-v3/include/bits/chrono_io.h6
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h3
-rw-r--r--libstdc++-v3/include/bits/version.def2
-rw-r--r--libstdc++-v3/include/bits/version.h2
-rw-r--r--libstdc++-v3/include/c_global/ccomplex2
-rw-r--r--libstdc++-v3/include/c_global/ciso64618
-rw-r--r--libstdc++-v3/include/c_global/cstdalign2
-rw-r--r--libstdc++-v3/include/c_global/cstdbool2
-rw-r--r--libstdc++-v3/include/c_global/ctgmath2
-rw-r--r--libstdc++-v3/include/std/flat_map16
-rw-r--r--libstdc++-v3/include/std/format48
-rw-r--r--libstdc++-v3/include/std/mutex2
-rw-r--r--libstdc++-v3/include/std/ranges12
-rw-r--r--libstdc++-v3/src/c++17/fs_path.cc10
-rw-r--r--libstdc++-v3/testsuite/18_support/headers/ciso646/macros-2.cc7
-rw-r--r--libstdc++-v3/testsuite/18_support/headers/ciso646/macros.cc1
-rw-r--r--libstdc++-v3/testsuite/20_util/system_clock/99832.cc14
-rw-r--r--libstdc++-v3/testsuite/23_containers/flat_map/1.cc13
-rw-r--r--libstdc++-v3/testsuite/23_containers/flat_multimap/1.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc22
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/concat/120029.cc72
-rw-r--r--libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc28
-rw-r--r--libstdc++-v3/testsuite/experimental/filesystem/path/concat/120029.cc74
-rw-r--r--libstdc++-v3/testsuite/std/format/formatter/120625.cc19
-rw-r--r--libstdc++-v3/testsuite/std/format/functions/format.cc10
-rw-r--r--libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc15
-rw-r--r--libstdc++-v3/testsuite/std/time/clock/local/io.cc3
-rw-r--r--libstdc++-v3/testsuite/util/pstl/test_utils.h6
438 files changed, 16802 insertions, 2218 deletions
diff --git a/contrib/ChangeLog.omp b/contrib/ChangeLog.omp
index 024f5ba..3158ef2 100644
--- a/contrib/ChangeLog.omp
+++ b/contrib/ChangeLog.omp
@@ -1,3 +1,10 @@
+2025-05-22 Tobias Burnus <tburnus@baylibre.com>
+
+ * gcc-changelog/git_update_version.py (update_current_branch): Fix
+ handling of merges.
+ * gcc-changelog/git_repository.py (parse_git_revisions): Skip over
+ merge commits for merges from exclude branch.
+
2025-05-15 Tobias Burnus <tburnus@baylibre.com>
* gcc-changelog/git_repository.py (parse_git_revisions): Optional
diff --git a/contrib/gcc-changelog/git_repository.py b/contrib/gcc-changelog/git_repository.py
index dc658af..c70307d 100755
--- a/contrib/gcc-changelog/git_repository.py
+++ b/contrib/gcc-changelog/git_repository.py
@@ -77,8 +77,13 @@ def parse_git_revisions(repo_path, revisions, ref_name=None,
commits = [repo.commit(revisions)]
for commit in commits:
- if exclude_branch is not None and repo.is_ancestor(commit, exclude_branch):
- continue
+ if exclude_branch is not None:
+ if repo.is_ancestor(commit, exclude_branch):
+ continue
+ # Exlude merge commit
+ if (len(commit.parents) == 2
+ and repo.is_ancestor(commit.parents[1], exclude_branch)):
+ continue
git_commit = GitCommit(commit_to_info(commit.hexsha),
commit_to_info_hook=commit_to_info,
ref_name=ref_name)
diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py
index ec5951c..ae2630e 100755
--- a/contrib/gcc-changelog/git_update_version.py
+++ b/contrib/gcc-changelog/git_update_version.py
@@ -124,21 +124,19 @@ def update_current_branch(ref_name=None, suffix="", last_commit_ref=None,
exclude_branch=None):
commit = repo.head.commit
commit_count = 1
- last_commit = (repo.commit(last_commit_ref)
- if last_commit_ref is not None else None)
- while commit:
- if last_commit is not None:
- if last_commit == commit:
+ if last_commit_ref is not None:
+ commit = repo.commit(last_commit_ref)
+ else:
+ while commit:
+ if (commit.author.email == 'gccadmin@gcc.gnu.org'
+ and commit.message.strip() == 'Daily bump.'):
break
- elif (commit.author.email == 'gccadmin@gcc.gnu.org'
- and commit.message.strip() == 'Daily bump.'):
- break
- # We support merge commits but only with 2 parensts
- assert len(commit.parents) <= 2
- commit = commit.parents[-1]
- commit_count += 1
-
- logging.info('%d revisions since last Daily bump' % commit_count)
+ # We support merge commits but only with 2 parensts
+ assert len(commit.parents) <= 2
+ commit = commit.parents[-1]
+ commit_count += 1
+ logging.info('%d revisions since last Daily bump' % commit_count)
+
datestamp_path = os.path.join(args.git_path, 'gcc/DATESTAMP')
if suffix != "":
if not os.path.exists(datestamp_path + suffix):
@@ -158,6 +156,8 @@ def update_current_branch(ref_name=None, suffix="", last_commit_ref=None,
% (commit.hexsha, head.hexsha), ref_name,
exclude_branch)
commits = [c for c in commits if c.info.hexsha not in ignored_commits]
+ if last_commit_ref is not None:
+ logging.info('%d revisions since last Daily bump' % len(commits))
for git_commit in reversed(commits):
prepend_to_changelog_files(repo, args.git_path, git_commit,
not args.dry_mode, args.suffix)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f52642..99eef0d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,242 @@
+2025-06-14 Georg-Johann Lay <avr@gjlay.de>
+
+ PR rtl-optimization/120423
+ PR rtl-optimization/116389
+ * config/avr/avr.md [-mno-lra]: Add pre-reload split to transform
+ (left shift of) a paradoxical subreg to a (left shift of) zero-extend.
+
+2025-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/120638
+ * tree-ssa-math-opts.cc (pass_cse_reciprocals::execute): Call
+ reset_flow_sensitive_info on arg1.
+
+2025-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-06-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120547
+ * real.cc (real_from_integer): Remove maxbitlen variable, use
+ len instead of that. When shifting right, or in 1 if any of the
+ shifted away bits are non-zero. Formatting fix.
+
+2025-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-20 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-chrec.cc (convert_affine_scev): Use signed_type_for instead of
+ build_nonstandard_integer_type.
+
+2025-06-12 Martin Jambor <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-29 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/120295
+ * ipa-prop.cc (update_jump_functions_after_inlining): Do not
+ combine pass-through jump functions with type-casts changing
+ signedness.
+
+2025-06-10 Andrew Pinski <quic_apinski@quicinc.com>
+
+ Backported from master:
+ 2025-04-30 Andrew Pinski <quic_apinski@quicinc.com>
+
+ PR target/120042
+ * tree-vectorizer.h: Include dominance.h.
+
+2025-06-10 Xi Ruoyao <xry111@xry111.site>
+
+ Backported from master:
+ 2025-06-04 Xi Ruoyao <xry111@xry111.site>
+
+ PR rtl-optimization/120050
+ * ext-dce.cc (ext_dce_process_uses): Break early if a SUBREG in
+ rhs is promoted and the truncation from the inner mode to the
+ outer mode is not a noop when handling SETs.
+
+2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-05 Tobias Burnus <tburnus@baylibre.com>
+
+ * config.gcc (--with-{arch,tune}): Use .def file to validate gcn
+ processor names.
+ * doc/install.texi (amdgcn*-*-*): Update list of devices supported
+ by --with-arch/--with-tune.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120357
+ * tree-vect-loop.cc (vect_create_epilog_for_reduction): Create
+ the conditional reduction induction IV increment before the
+ main IV exit.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120341
+ * tree-ssa-loop-im.cc (can_sm_ref_p): STRING_CSTs are readonly.
+ * tree-ssa-phiopt.cc (cond_store_replacement): Likewise.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-09 Richard Biener <rguenther@suse.de>
+
+ PR rtl-optimization/120182
+ * dse.cc (canon_address): Constant addresses have no
+ separate store group.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-04-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120003
+ * tree-ssa-threadbackward.cc (back_threader::find_paths_to_names):
+ Allow block re-use but do not enlarge the path beyond such a
+ re-use.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/119960
+ * tree-vect-slp.cc (vect_slp_can_convert_to_external):
+ Handle cases where defs from multiple BBs are ordered
+ by their dominance relation.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/116352
+ * tree-vect-slp.cc (vect_build_slp_tree_2): When compressing
+ operands from a two-operator node make sure the resulting
+ operation does not mix defs from different basic-blocks.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-04-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/119960
+ * tree-vect-slp.cc (vect_schedule_slp_node): Sanity
+ check dominance check on operand defs.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-04-30 Richard Biener <rguenther@suse.de>
+
+ * tree-vectorizer.h (get_later_stmt): Robustify against
+ stmts in different BBs, assert when they are unordered.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-15 Richard Biener <rguenther@suse.de>
+
+ * config/i386/i386.cc (ix86_vector_costs::finish_cost):
+ Do not suggest a first epilogue mode for AVX512 sized
+ main loops with X86_TUNE_AVX512_TWO_EPILOGUES as that
+ interferes with using a masked epilogue.
+
+2025-06-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-vect-data-refs.cc (vect_can_force_dr_alignment_p): Return
+ false if the variable has no symtab node.
+
+2025-05-29 Yuta Mukai <mukai.yuta@fujitsu.com>
+
+ Backported from master:
+ 2025-05-28 Yuta Mukai <mukai.yuta@fujitsu.com>
+
+ * config/aarch64/aarch64-cores.def (fujitsu-monaka): Update ISA
+ features.
+
+2025-05-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ * ipa-sra.cc (scan_expr_access): Also disqualify storage order
+ barriers from splitting.
+ * tree.h (storage_order_barrier_p): Also return false if the
+ operand of the VIEW_CONVERT_EXPR has reverse storage order.
+
+2025-05-27 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-27 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/extend.texi (Common Variable Attributes): Fix typo in
+ description of nonstring.
+
+2025-05-25 Michael J. Eager <eager@eagercon.com>
+
+ PR target/86772
+ Tracking CVE-2017-5753
+ * config/microblaze/microblaze.cc (TARGET_HAVE_SPECULATION_SAFE_VALUE):
+ Define to speculation_save_value_not_needed
+
+2025-05-20 Martin Jambor <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-14 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/111873
+ * tree-sra.cc (sra_modify_expr): When processing a load which has
+ a type-incompatible replacement, do not store the contents of the
+ replacement into the original aggregate when that aggregate is
+ const.
+
+2025-05-20 Martin Jambor <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-16 Martin Jambor <mjambor@suse.cz>
+ Michal Jires <mjires@suse.cz>
+
+ * cgraph.h (symtab_node): Make member function get_uid const.
+ * cgraphclones.cc (dump_callgraph_transformation): Dump m_uid of the
+ call graph nodes instead of order.
+ * cgraph.cc (cgraph_node::remove): Likewise.
+ * ipa-cp.cc (ipcp_lattice<valtype>::print): Likewise.
+ * ipa-sra.cc (ipa_sra_summarize_function): Likewise.
+ * symtab.cc (symtab_node::dump_base): Likewise.
+
+2025-05-16 Maciej W. Rozycki <macro@orcam.me.uk>
+
+ Backported from master:
+ 2025-04-19 Maciej W. Rozycki <macro@orcam.me.uk>
+
+ * config/alpha/alpha.cc
+ (alpha_get_mem_rtx_alignment_and_offset): Recurse into
+ COMPONENT_REF nodes.
+
+2025-05-14 Kyle Huey <me@kylehuey.com>
+
+ * dwarf2out.cc (resolve_addr_in_expr): Propagate dtprel into the address
+ table when appropriate.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-05-12 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/120188
+ * doc/gm2.texi (Semantic checking): Add -fm2-plugin command line option.
+
2025-05-11 Richard Biener <rguenther@suse.de>
PR tree-optimization/120211
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index d522b49..69162ef 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,90 @@
+2025-06-17 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-17 Tobias Burnus <tburnus@baylibre.com>
+
+ * omp-offload.cc (omp_discover_declare_target_tgt_fn_r): Also
+ walk external functions that are declare inline (and have a
+ DECL_SAVED_TREE).
+
+2025-06-10 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-10 Tobias Burnus <tburnus@baylibre.com>
+
+ * config/gcn/gcn-devices.def: Add gfx942, gfx950 and gfx9-4-generic.
+ * config/gcn/gcn-opts.h (TARGET_CDNA3, TARGET_CDNA3_PLUS,
+ TARGET_GLC_NAME, TARGET_TARGET_SC_CACHE): Define.
+ (TARGET_ARCHITECTED_FLAT_SCRATCH): Use also for CDNA3.
+ * config/gcn/gcn.h (gcn_isa): Add ISA_CDNA3 to the enum.
+ * config/gcn/gcn.cc (print_operand): Update 'g' to use
+ TARGET_GLC_NAME; add 'G' to print TARGET_GLC_NAME unconditionally.
+ * config/gcn/gcn-valu.md (scatter, gather): Use TARGET_GLC_NAME.
+ * config/gcn/gcn.md: Use %G<num> instead of glc; use 'buffer_inv sc1'
+ for TARGET_TARGET_SC_CACHE.
+ * doc/invoke.texi (march): Add gfx942, gfx950 and gfx9-4-generic.
+ * doc/install.texi (amdgcn*-*-*): Add gfx942, gfx950 and gfx9-4-generic.
+ * config/gcn/gcn-tables.opt: Regenerate.
+
+2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+ Sandra Loosemore <sloosemore@baylibre.com>
+
+ * gimple-fold.cc (gimple_fold_builtin_omp_get_initial_device,
+ gimple_fold_builtin_omp_get_num_devices): New.
+ (gimple_fold_builtin): Call them.
+ * omp-builtins.def (BUILT_IN_OMP_GET_INITIAL_DEVICE): Add
+ (BUILT_IN_OMP_GET_NUM_DEVICES): Make uservisible + pure.
+
+2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ * builtins.def (DEF_GOACC_BUILTIN_COMPILER, DEF_GOMP_BUILTIN_COMPILER):
+ Set NONANSI_P = false to enable those also with -fno-nonansi-builtins.
+
+2025-06-05 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-06-04 Sandra Loosemore <sloosemore@baylibre.com>
+
+ PR c++/120518
+ * omp-general.cc (omp_device_num_check): Look inside a
+ CLEANUP_POINT_EXPR when trying to optimize special cases.
+
+2025-06-04 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-06-04 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * config/nvptx/mkoffload.cc (process): Use an 'auto_vec' for
+ 'file_idx'.
+
+2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR middle-end/119835
+ * tree-nrv.cc (pass_nrv::execute): Defuse 'RESULT_DECL' check.
+
+2025-05-22 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-19 Thomas Schwinge <tschwinge@baylibre.com>
+
+ PR lto/120308
+ * lto-streamer-out.cc (hash_tree): Don't handle 'TYPE_EMPTY_P' for
+ 'lto_stream_offload_p'.
+ * tree-streamer-in.cc (unpack_ts_type_common_value_fields):
+ Likewise.
+ * tree-streamer-out.cc (pack_ts_type_common_value_fields):
+ Likewise.
+
2025-05-15 Sandra Loosemore <sloosemore@baylibre.com>
Tobias Burnus <tburnus@baylibre.com>
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 823f45b..aaa22e3 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250512
+20250617
diff --git a/gcc/DATESTAMP.omp b/gcc/DATESTAMP.omp
index e01bdfb..6952979 100644
--- a/gcc/DATESTAMP.omp
+++ b/gcc/DATESTAMP.omp
@@ -1 +1 @@
-20250516
+20250703
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 89cb7d4..aee2253 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,269 @@
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/gnat_language_extensions.rst
+ (Generalized Finalization): Document the actual implementation.
+ (No_Raise): Move to separate section.
+ * gnat_rm.texi: Regenerate.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Private_Type): Fix test.
+ (Build_Derived_Record_Type): Adjust error recovery paths.
+
+2025-06-12 Ronan Desplanques <desplanques@adacore.com>
+
+ * exp_util.adb (Insert_Actions): Refine test.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler
+ switches) <-O>: Fix long line.
+ * gnat_ugn.texi: Regenerate.
+
+2025-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * usage.adb (Usage): Justify the documentation of common switches
+ like that of other switches. Rework that of the -O switch.
+ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler
+ switches) <-O>: Rework and document 'z' and 'g' operands.
+ * doc/gnat_ugn/gnat_and_program_execution.rst (Optimization Levels):
+ Rework and document -Oz and -Og switches.
+ * gnat_ugn.texi: Regenerate.
+
+2025-06-10 Gary Dismukes <dismukes@adacore.com>
+
+ * einfo.ads: Revise comment about Dynamic_Predicate flag to make it
+ more accurate.
+ * sem_case.adb (Check_Choices): Test "not Has_Static_Predicate_Aspect"
+ as additional guard for error about use of subtype with nonstatic
+ predicate as a case choice. Improve related error message.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * freeze.adb (Freeze_Static_Object): Do not issue any error message
+ for compiler-generated entities.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Insert_Conditional_Object_Declaration): Deal with a
+ transient scope being created around the declaration.
+ * freeze.adb (Freeze_Entity): Do not call Freeze_Static_Object for
+ a renaming declaration.
+
+2025-06-10 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_aggr.adb (Build_Container_Aggr_Code.To_Int): Apply Enumeration_Pos
+ to Entity (Expr) rather than Expr.
+
+2025-06-10 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find
+ the root type of an aggregate of a derived tagged type.
+
+2025-06-10 Ronan Desplanques <desplanques@adacore.com>
+
+ * libgnarl/s-stusta.adb (Compute_All_Tasks): Skip terminated tasks.
+
+2025-06-09 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch3.adb (Constrain_Index): In the case of a fixed-lower-bound index,
+ set Etype of the newly created itype's Scalar_Range from the index's Etype.
+ * sem_ch12.adb (Validate_Array_Type_Instance): If the actual subtype is
+ a fixed-lower-bound type, then check again the Etype of its Scalar_Range.
+
+2025-06-09 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma): Fix conditions for legality checks on
+ formal type declarations.
+
+2025-06-09 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma): If pragmas apply to a formal array
+ type, then set the flags on the base type.
+
+2025-06-09 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_aggr.adb (Expand_Container_Aggregate): Use the Base_Type of the
+ subtype provided by the context as the subtype of the temporary object
+ initialized by the aggregate.
+
+2025-06-09 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference): When expanding attribute
+ Valid, use signedness from the validated view, not from its base type.
+
+2025-06-09 Gary Dismukes <dismukes@adacore.com>
+
+ * contracts.adb (Inherit_Condition): Remove Assoc_List and its uses
+ along with function Check_Condition, since mapping of formals will
+ effectively be done in Build_Class_Wide_Expression (by Replace_Entity).
+ * exp_util.adb (Replace_Entity): Only rewrite entity references in
+ function calls that qualify according to the result of calling the
+ new function Call_To_Parent_Dispatching_Op_Must_Be_Mapped.
+ (Call_To_Parent_Dispatching_Op_Must_Be_Mapped): New function that
+ determines whether a function call to a primitive of Par_Subp
+ associated tagged type needs to be mapped (according to whether
+ it has any actuals that reference controlling formals of the
+ primitive).
+
+2025-06-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Insert_Conditional_Object_Declaration): Remove Decl
+ formal parameter, add Typ and Const formal parameters.
+ (Expand_N_Case_Expression): Fix pasto in comment. Adjust call to
+ Insert_Conditional_Object_Declaration and tidy up surrounding code.
+ (Expand_N_If_Expression): Adjust couple of calls to
+ Insert_Conditional_Object_Declaration.
+
+2025-06-06 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch4.adb (Constant_Indexing_OK): Add missing support for
+ RM 4.1.6(13/3), and improve performance to avoid climbing more
+ than needed. Add documentation.
+ (Try_Indexing_Function): New subprogram.
+ (Expr_Matches_In_Formal): Added new formals.
+ (Handle_Selected_Component): New subprogram.
+ (Has_IN_Mode): New subprogram.
+ (Try_Container_Indexing): Add documentation, code reorganization
+ and extend its functionality to improve its support for prefixed
+ notation calls.
+
+2025-06-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_ch10.adb (Install_Siblings.In_Context): Add missing guard.
+
+2025-06-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Insert_Conditional_Object_Declaration): Make sure the
+ object is allocated properly by the code generator at library level.
+
+2025-06-06 Steve Baird <baird@adacore.com>
+
+ * sem_ch4.adb
+ (Find_Unary_Types): Because we reanalyze names in an instance,
+ we sometimes have to take steps to filter out extraneous name
+ resolution candidates that happen to be visible at the point of the
+ instance declaration. Remove some code that appears to have been
+ written with this in mind. This is done for two reasons. First, the
+ code sometimes doesn't work (possibly because the In_Instance test
+ is not specific enough - it probably should be testing to see whether
+ we are in an instance of the particular generic in which the result
+ of calling Corresponding_Generic_Type was declared) and causes correct
+ code to be rejected. Second, the code seems to no longer be necessary
+ (possibly because of subsequent fixes in this area which are not
+ specific to unary operators).
+
+2025-06-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_aggr.adb (Expand_Record_Aggregate): Use the named form for the
+ second actual parameter in the call to Duplicate_Subexpr.
+ * exp_attr.adb (Expand_Size_Attribute): Likewise.
+ * exp_ch5.adb (Expand_Assign_Array): Likewise.
+ (Expand_Assign_Array_Bitfield): Likewise.
+ (Expand_Assign_Array_Bitfield_Fast): Likewise.
+ * exp_util.ads (Duplicate_Subexpr): Add New_Scope formal parameter.
+ (Duplicate_Subexpr_No_Checks): Likewise.
+ (Duplicate_Subexpr_Move_Checks): Likewise.
+ * exp_util.adb (Build_Allocate_Deallocate_Proc): Pass Proc_Id as the
+ actual for New_Scope in the calls to Duplicate_Subexpr_No_Checks.
+ (Duplicate_Subexpr): Add New_Scope formal parameter and forward it
+ in the call to New_Copy_Tree.
+ (Duplicate_Subexpr_No_Checks): Likewise.
+ (Duplicate_Subexpr_Move_Checks): Likewise.
+
+2025-06-06 Piotr Trojanek <trojanek@adacore.com>
+
+ * checks.adb (Insert_Valid_Check): Set flag Assignment_OK in the object
+ declaration inserted for the validity checks.
+
+2025-06-05 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch7.adb (Process_Object_Declaration): Avoid generating
+ duplicate names for master nodes.
+
+2025-06-05 Steve Baird <baird@adacore.com>
+
+ * sem_util.adb
+ (Side_Effect_Free_Statements): Return False if the statement list
+ includes an explicit (i.e. Comes_From_Source) raise statement.
+
+2025-06-05 Ronan Desplanques <desplanques@adacore.com>
+
+ * exp_ch4.adb (Tagged_Membership): Fix for protected types.
+
+2025-06-05 Ronan Desplanques <desplanques@adacore.com>
+
+ * exp_attr.adb (Interunit_Ref_OK): Tweak categorization of compilation
+ units.
+
+2025-06-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_aggr.adb (Build_Two_Pass_Aggr_Code): New function containing
+ most of the code initially present in Two_Pass_Aggregate_Expansion.
+ (Two_Pass_Aggregate_Expansion): Remove redundant N parameter.
+ Implement built-in-place expansion for (static) object declarations
+ and allocators, using Build_Two_Pass_Aggr_Code for the main work.
+ (Expand_Array_Aggregate): Adjust Two_Pass_Aggregate_Expansion call.
+ Replace Etype (N) by Typ in a couple of places.
+ * exp_ch3.adb (Expand_Freeze_Array_Type): Remove special case for
+ two-pass array aggregates.
+ (Expand_N_Object_Declaration): Do not adjust the object when it is
+ initialized by a two-pass array aggregate.
+ * exp_ch4.adb (Expand_Allocator_Expression): Apply the processing
+ used for container aggregates to two-pass array aggregates.
+ * exp_ch6.adb (Validate_Subprogram_Calls): Skip calls present in
+ initialization expressions of N_Object_Declaration nodes that have
+ No_Initialization set.
+ * sem_ch3.adb (Analyze_Object_Declaration): Detect the cases of an
+ array originally initialized by an aggregate consistently.
+
+2025-06-05 Viljar Indus <indus@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_attributes.rst: Update the
+ documentation for Valid_Value.
+ * sem_attr.adb (Analyze_Attribute): Reject types where
+ the root type originates from Standard.
+ * gnat_rm.texi: Regenerate.
+
+2025-06-05 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_aggr.adb (Two_Pass_Aggregate_Expansion): Change call to Make_Assignment
+ for the indexed aggregate object to call Change_Make_OK_Assignment instead.
+
+2025-06-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch6.adb (Expand_Actuals): Remove obsolete comment.
+ (Make_Build_In_Place_Call_In_Anonymous_Context): Always use a proper
+ object declaration initialized with the function call in the cases
+ where a temporary is needed, with Assignment_OK set on it.
+ * sem_util.adb (Entity_Of): Deal with rewritten function call first.
+
+2025-06-05 Steve Baird <baird@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference): When accessing the
+ maps declared in package Cached_Attribute_Ops, the key value
+ passed to Get or to Set should never be the entity node for a
+ subtype. Use the entity of the corresponding type declaration
+ instead.
+
+2025-06-05 Steve Baird <baird@adacore.com>
+
+ * sem_res.adb
+ (Set_Mixed_Mode_Operand): If we are about to call Resolve
+ passing in Any_Fixed as the expected type, then instead pass in
+ the fixed point type of the other operand (i.e., B_Typ).
+
+2025-06-05 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_util.adb (Check_Function_Writable_Actuals): Add handling for
+ N_Iterated_Component_Association and N_Iterated_Element_Association.
+ Fix a typo in an RM reference (6.4.1(20/3) => 6.4.1(6.20/3)).
+ (Collect_Expression_Ids): New procedure factoring code for collecting
+ identifiers from expressions of aggregate associations.
+ (Handle_Association_Choices): New procedure factoring code for handling
+ id collection for expressions of aggregate associations with multiple
+ choices. Removed redundant test of Box_Present from original code.
+
2025-05-05 Eric Botcazou <ebotcazou@adacore.com>
PR ada/120104
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index dcfcaa3..6a98292 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -8163,6 +8163,7 @@ package body Checks is
end if;
declare
+ Decl : Node_Id;
CE : Node_Id;
PV : Node_Id;
Var_Id : Entity_Id;
@@ -8215,12 +8216,20 @@ package body Checks is
Mutate_Ekind (Var_Id, E_Variable);
Set_Etype (Var_Id, Typ);
- Insert_Action (Exp,
+ Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Var_Id,
Object_Definition => New_Occurrence_Of (Typ, Loc),
- Expression => New_Copy_Tree (Exp)),
- Suppress => Validity_Check);
+ Expression => New_Copy_Tree (Exp));
+
+ -- We might be validity-checking object whose type is declared as
+ -- limited but completion is a scalar type. We need to explicitly
+ -- flag its assignment as OK, as otherwise it would be rejected by
+ -- the language rules.
+
+ Set_Assignment_OK (Decl);
+
+ Insert_Action (Exp, Decl, Suppress => Validity_Check);
Set_Validated_Object (Var_Id, New_Copy_Tree (Exp));
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 8b94a67..e0eb26e 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -4389,10 +4389,10 @@ package body Contracts is
Seen : Subprogram_List (Subps'Range) := (others => Empty);
function Inherit_Condition
- (Par_Subp : Entity_Id;
- Subp : Entity_Id) return Node_Id;
- -- Inherit the class-wide condition from Par_Subp to Subp and adjust
- -- all the references to formals in the inherited condition.
+ (Par_Subp : Entity_Id) return Node_Id;
+ -- Inherit the class-wide condition from Par_Subp. Simply makes
+ -- a copy of the condition in preparation for later mapping of
+ -- referenced formals and functions by Build_Class_Wide_Expression.
procedure Merge_Conditions (From : Node_Id; Into : Node_Id);
-- Merge two class-wide preconditions or postconditions (the former
@@ -4407,92 +4407,11 @@ package body Contracts is
-----------------------
function Inherit_Condition
- (Par_Subp : Entity_Id;
- Subp : Entity_Id) return Node_Id
- is
- function Check_Condition (Expr : Node_Id) return Boolean;
- -- Used in assertion to check that Expr has no reference to the
- -- formals of Par_Subp.
-
- ---------------------
- -- Check_Condition --
- ---------------------
-
- function Check_Condition (Expr : Node_Id) return Boolean is
- Par_Formal_Id : Entity_Id;
-
- function Check_Entity (N : Node_Id) return Traverse_Result;
- -- Check occurrence of Par_Formal_Id
-
- ------------------
- -- Check_Entity --
- ------------------
-
- function Check_Entity (N : Node_Id) return Traverse_Result is
- begin
- if Nkind (N) = N_Identifier
- and then Present (Entity (N))
- and then Entity (N) = Par_Formal_Id
- then
- return Abandon;
- end if;
-
- return OK;
- end Check_Entity;
-
- function Check_Expression is new Traverse_Func (Check_Entity);
-
- -- Start of processing for Check_Condition
-
- begin
- Par_Formal_Id := First_Formal (Par_Subp);
-
- while Present (Par_Formal_Id) loop
- if Check_Expression (Expr) = Abandon then
- return False;
- end if;
-
- Next_Formal (Par_Formal_Id);
- end loop;
-
- return True;
- end Check_Condition;
-
- -- Local variables
-
- Assoc_List : constant Elist_Id := New_Elmt_List;
- Par_Formal_Id : Entity_Id := First_Formal (Par_Subp);
- Subp_Formal_Id : Entity_Id := First_Formal (Subp);
- New_Condition : Node_Id;
-
+ (Par_Subp : Entity_Id) return Node_Id is
begin
- while Present (Par_Formal_Id) loop
- Append_Elmt (Par_Formal_Id, Assoc_List);
- Append_Elmt (Subp_Formal_Id, Assoc_List);
-
- Next_Formal (Par_Formal_Id);
- Next_Formal (Subp_Formal_Id);
- end loop;
-
- -- Check that Parent field of all the nodes have their correct
- -- decoration; required because otherwise mapped nodes with
- -- wrong Parent field are left unmodified in the copied tree
- -- and cause reporting wrong errors at later stages.
-
- pragma Assert
- (Check_Parents (Class_Condition (Kind, Par_Subp), Assoc_List));
-
- New_Condition :=
+ return
New_Copy_Tree
- (Source => Class_Condition (Kind, Par_Subp),
- Map => Assoc_List);
-
- -- Ensure that the inherited condition has no reference to the
- -- formals of the parent subprogram.
-
- pragma Assert (Check_Condition (New_Condition));
-
- return New_Condition;
+ (Source => Class_Condition (Kind, Par_Subp));
end Inherit_Condition;
----------------------
@@ -4606,9 +4525,7 @@ package body Contracts is
Par_Prim := Subp_Id;
Par_Iface_Prims := Covered_Interface_Primitives (Par_Prim);
- Cond := Inherit_Condition
- (Subp => Spec_Id,
- Par_Subp => Subp_Id);
+ Cond := Inherit_Condition (Par_Subp => Subp_Id);
if Present (Class_Cond) then
Merge_Conditions (Cond, Class_Cond);
@@ -4652,9 +4569,7 @@ package body Contracts is
then
Seen (Index) := Subp_Id;
- Cond := Inherit_Condition
- (Subp => Spec_Id,
- Par_Subp => Subp_Id);
+ Cond := Inherit_Condition (Par_Subp => Subp_Id);
Check_Class_Condition
(Cond => Cond,
diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
index ee2df66..45d7a66 100644
--- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
+++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
@@ -1453,97 +1453,60 @@ that the record type must be a root type, in other words not a derived type.
The aspect additionally makes it possible to specify relaxed semantics for
the finalization operations by means of the ``Relaxed_Finalization`` setting.
-
-Example:
+Here is the archetypal example:
.. code-block:: ada
- type Ctrl is record
- Id : Natural := 0;
+ type T is record
+ ...
end record
with Finalizable => (Initialize => Initialize,
Adjust => Adjust,
Finalize => Finalize,
Relaxed_Finalization => True);
- procedure Adjust (Obj : in out Ctrl);
- procedure Finalize (Obj : in out Ctrl);
- procedure Initialize (Obj : in out Ctrl);
-
-The three procedures have the same profile, taking a single ``in out T``
-parameter.
+ procedure Adjust (Obj : in out T);
+ procedure Finalize (Obj : in out T);
+ procedure Initialize (Obj : in out T);
-We follow the same dynamic semantics as controlled objects:
+The three procedures have the same profile, with a single ``in out`` parameter,
+and also have the same dynamic semantics as for controlled types:
- ``Initialize`` is called when an object of type ``T`` is declared without
- default expression.
+ initialization expression.
- ``Adjust`` is called after an object of type ``T`` is assigned a new value.
- ``Finalize`` is called when an object of type ``T`` goes out of scope (for
- stack-allocated objects) or is explicitly deallocated (for heap-allocated
- objects). It is also called when on the value being replaced in an
- assignment.
-
-However the following differences are enforced by default when compared to the
-current Ada controlled-objects finalization model:
-
-* No automatic finalization of heap allocated objects: ``Finalize`` is only
- called when an object is implicitly deallocated. As a consequence, no-runtime
- support is needed for the implicit case, and no header will be maintained for
- this in heap-allocated controlled objects.
-
- Heap-allocated objects allocated through a nested access type definition will
- hence **not** be deallocated either. The result is simply that memory will be
- leaked in those cases.
-
-* The ``Finalize`` procedure should have have the :ref:`No_Raise_Aspect` specified.
- If that's not the case, a compilation error will be raised.
-
-Additionally, two other configuration aspects are added,
-``Legacy_Heap_Finalization`` and ``Exceptions_In_Finalize``:
-
-* ``Legacy_Heap_Finalization``: Uses the legacy automatic finalization of
- heap-allocated objects
-
-* ``Exceptions_In_Finalize``: Allow users to have a finalizer that raises exceptions
- **NB!** note that using this aspect introduces execution time penalities.
-
-.. _No_Raise_Aspect:
-
-No_Raise aspect
-----------------
+ stack-allocated objects) or is deallocated (for heap-allocated objects).
+ It is also called when the value is replaced by an assignment.
-The ``No_Raise`` aspect can be applied to a subprogram to declare that this subprogram is not
-expected to raise any exceptions. Should an exception still occur during the execution of
-this subprogram, ``Program_Error`` is raised.
+However, when ``Relaxed_Finalization`` is either ``True`` or not explicitly
+specified, the following differences are implemented relative to the semantics
+of controlled types:
-New specification for ``Ada.Finalization.Controlled``
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+* The compiler has permission to perform no automatic finalization of
+ heap-allocated objects: ``Finalize`` is only called when such an object
+ is explicitly deallocated, or when the designated object is assigned a new
+ value. As a consequence, no runtime support is needed for performing
+ implicit deallocation. In particular, no per-object header data is needed
+ for heap-allocated objects.
-``Ada.Finalization.Controlled`` is now specified as:
-
-.. code-block:: ada
-
- type Controlled is abstract tagged null record
- with Initialize => Initialize,
- Adjust => Adjust,
- Finalize => Finalize,
- Legacy_Heap_Finalization, Exceptions_In_Finalize;
-
- procedure Initialize (Self : in out Controlled) is abstract;
- procedure Adjust (Self : in out Controlled) is abstract;
- procedure Finalize (Self : in out Controlled) is abstract;
+ Heap-allocated objects allocated through a nested access type will therefore
+ **not** be deallocated either. The result is simply that memory will be leaked
+ in this case.
+* The ``Adjust`` and ``Finalize`` procedures are automatically considered as
+ having the :ref:`No_Raise_Aspect` specified for them. In particular, the
+ compiler has permission to enforce none of the guarantees specified by the
+ RM 7.6.1 (14/1) and subsequent subclauses.
-### Examples
-
-A simple example of a ref-counted type:
+Simple example of ref-counted type:
.. code-block:: ada
type T is record
- Value : Integer;
+ Value : Integer;
Ref_Count : Natural := 0;
end record;
@@ -1555,8 +1518,8 @@ A simple example of a ref-counted type:
type T_Ref is record
Value : T_Access;
end record
- with Adjust => Adjust,
- Finalize => Finalize;
+ with Finalizable => (Adjust => Adjust,
+ Finalize => Finalize);
procedure Adjust (Ref : in out T_Ref) is
begin
@@ -1568,8 +1531,7 @@ A simple example of a ref-counted type:
Def_Ref (Ref.Value);
end Finalize;
-
-A simple file handle that ensures resources are properly released:
+Simple file handle that ensures resources are properly released:
.. code-block:: ada
@@ -1579,51 +1541,47 @@ A simple file handle that ensures resources are properly released:
function Open (Path : String) return File;
procedure Close (F : in out File);
+
private
type File is limited record
Handle : ...;
end record
- with Finalize => Close;
-
-
-Finalized tagged types
-^^^^^^^^^^^^^^^^^^^^^^^
+ with Finalizable (Finalize => Close);
+ end P;
-Aspects are inherited by derived types and optionally overriden by those. The
-compiler-generated calls to the user-defined operations are then
-dispatching whenever it makes sense, i.e. the object in question is of
-class-wide type and the class includes at least one finalized tagged type.
+Finalizable tagged types
+^^^^^^^^^^^^^^^^^^^^^^^^
-However note that for simplicity, it is forbidden to change the value of any of
-those new aspects in derived types.
+The aspect is inherited by derived types and the primitives may be overridden
+by the derivation. The compiler-generated calls to these operations are then
+dispatching whenever it makes sense, i.e. when the object in question is of a
+class-wide type and the class includes at least one finalizable tagged type.
Composite types
^^^^^^^^^^^^^^^
-When a finalized type is used as a component of a composite type, the latter
-becomes finalized as well. The three primitives are derived automatically
-in order to call the primitives of their components.
-
-If that composite type was already user-finalized, then the compiler
-calls the primitives of the components so as to stay consistent with today's
-controlled types's behavior.
-
-So, ``Initialize`` and ``Adjust`` are called on components before they
-are called on the composite object, but ``Finalize`` is called on the composite
-object first.
+When a finalizable type is used as a component of a composite type, the latter
+becomes finalizable as well. The three primitives are derived automatically
+in order to call the primitives of their components. The dynamic semantics is
+the same as for controlled components of composite types.
Interoperability with controlled types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-As a consequence of the redefinition of the ``Controlled`` type as a base type
-with the new aspects defined, interoperability with controlled type naturally
-follows the definition of the above rules. In particular:
+Finalizable types are fully interoperable with controlled types, in particular
+it is possible for a finalizable type to have a controlled component and vice
+versa, but the stricter dynamic semantics, in other words that of controlled
+types, is applied in this case.
-* It is possible to have a new finalized type have a controlled type
- component
-* It is possible to have a controlled type have a finalized type
- component
+.. _No_Raise_Aspect:
+
+No_Raise aspect
+----------------
+The ``No_Raise`` aspect can be applied to a subprogram to declare that this
+subprogram is not expected to raise an exception. Should an exception still
+be raised during the execution of the subprogram, it is caught at the end of
+this execution and ``Program_Error`` is propagated to the caller.
Inference of Dependent Types in Generic Instantiations
------------------------------------------------------
diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
index f051810..86d2a81 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
@@ -1629,9 +1629,9 @@ Attribute Valid_Value
.. index:: Valid_Value
The ``'Valid_Value`` attribute is defined for enumeration types other than
-those in package Standard. This attribute is a function that takes
-a String, and returns Boolean. ``T'Valid_Value (S)`` returns True
-if and only if ``T'Value (S)`` would not raise Constraint_Error.
+those in package Standard or types derived from those types. This attribute is
+a function that takes a String, and returns Boolean. ``T'Valid_Value (S)``
+returns True if and only if ``T'Value (S)`` would not raise Constraint_Error.
Attribute Valid_Scalars
=======================
diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
index 4f46fba..4bdd213 100644
--- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
+++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
@@ -2259,15 +2259,16 @@ Alphabetical List of All Switches
======= ==================================================================
*n* Effect
------- ------------------------------------------------------------------
- *0* No optimization, the default setting if no :switch:`-O` appears
- *1* Normal optimization, the default if you specify :switch:`-O` without an
- operand. A good compromise between code quality and compilation
- time.
- *2* Extensive optimization, may improve execution time, possibly at
+ *0* No optimization, the default setting if no :switch:`-O` appears.
+ *1* Moderate optimization, same as :switch:`-O` without an operand.
+ A good compromise between code quality and compilation time.
+ *2* Extensive optimization, should improve execution time, possibly at
the cost of substantially increased compilation time.
- *3* Same as :switch:`-O2`, and also includes inline expansion for small
- subprograms in the same unit.
- *s* Optimize space usage
+ *3* Full optimization, may further improve execution time, possibly at
+ the cost of substantially larger generated code.
+ *s* Optimize for size (code and data) rather than speed.
+ *z* Optimize aggressively for size (code and data) rather than speed.
+ *g* Optimize for debugging experience rather than speed.
======= ==================================================================
See also :ref:`Optimization_Levels`.
diff --git a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
index 756bc74..4ecb3cf 100644
--- a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
+++ b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
@@ -1584,18 +1584,16 @@ Turning on optimization makes the compiler attempt to improve the
performance and/or code size at the expense of compilation time and
possibly the ability to debug the program.
-If you use multiple :switch:`-O` switches, with or without level
-numbers, the last such switch is the one that's used.
-
-You can use the
-:switch:`-O` switch (the permitted forms are :switch:`-O0`, :switch:`-O1`
-:switch:`-O2`, :switch:`-O3`, and :switch:`-Os`)
-to ``gcc`` to control the optimization level:
+You can pass the :switch:`-O` switch, with or without an operand
+(the permitted forms with an operand are :switch:`-O0`, :switch:`-O1`,
+:switch:`-O2`, :switch:`-O3`, :switch:`-Os`, :switch:`-Oz`, and
+:switch:`-Og`) to ``gcc`` to control the optimization level. If you
+pass multiple :switch:`-O` switches, with or without an operand,
+the last such switch is the one that's used:
* :switch:`-O0`
- No optimization (the default);
- generates unoptimized code but has
+ No optimization (the default); generates unoptimized code but has
the fastest compilation time. Debugging is easiest with this switch.
Note that many other compilers do substantial optimization even if
@@ -1606,32 +1604,45 @@ to ``gcc`` to control the optimization level:
mind when doing performance comparisons.
* :switch:`-O1`
- Moderate optimization; optimizes reasonably well but does not
- degrade compilation time significantly. You may not be able to see
- some variables in the debugger and changing the value of some
- variables in the debugger may not have the effect you desire.
+ Moderate optimization (same as :switch:`-O` without an operand);
+ optimizes reasonably well but does not degrade compilation time
+ significantly. You may not be able to see some variables in the
+ debugger, and changing the value of some variables in the debugger
+ may not have the effect you desire.
* :switch:`-O2`
- Full optimization;
- generates highly optimized code and has
- the slowest compilation time. You may see significant impacts on
+ Extensive optimization; generates highly optimized code but has
+ an increased compilation time. You may see significant impacts on
your ability to display and modify variables in the debugger.
* :switch:`-O3`
- Full optimization as in :switch:`-O2`;
- also uses more aggressive automatic inlining of subprograms within a unit
- (:ref:`Inlining_of_Subprograms`) and attempts to vectorize loops.
-
+ Full optimization; attempts more sophisticated transformations, in
+ particular on loops, possibly at the cost of larger generated code.
+ You may be hardly able to use the debugger at this optimization level.
* :switch:`-Os`
- Optimize space usage (code and data) of resulting program.
+ Optimize for size (code and data) of resulting binary rather than
+ speed; based on the :switch:`-O2` optimization level, but disables
+ some of its transformations that often increase code size, as well
+ as performs further optimizations designed to reduce code size.
+
+* :switch:`-Oz`
+ Optimize aggressively for size (code and data) of resulting binary
+ rather than speed; may increase the number of instructions executed
+ if these instructions require fewer bytes to be encoded.
+
+* :switch:`-Og`
+ Optimize for debugging experience rather than speed; based on the
+ :switch:`-O1` optimization level, but attempts to eliminate all the
+ negative effects of optimization on debugging.
+
Higher optimization levels perform more global transformations on the
program and apply more expensive analysis algorithms in order to generate
faster and more compact code. The price in compilation time, and the
-resulting improvement in execution time,
-both depend on the particular application and the hardware environment.
-You should experiment to find the best level for your application.
+resulting improvement in execution time, both depend on the particular
+application and the hardware environment. You should experiment to find
+the best level for your application.
Since the precise set of optimizations done at each level will vary from
release to release (and sometime from target to target), it is best to think
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index f154e7f..7c05e53 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -1623,7 +1623,7 @@ package Einfo is
-- Has_Dynamic_Predicate_Aspect
-- Defined in all types and subtypes. Set if a Dynamic_Predicate aspect
--- was explicitly applied to the type. Generally we treat predicates as
+-- was applied to the type or subtype. Generally we treat predicates as
-- static if possible, regardless of whether they are specified using
-- Predicate, Static_Predicate, or Dynamic_Predicate. And if a predicate
-- can be treated as static (i.e. its expression is predicate-static),
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 7cb26ce..b6c1605 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -4956,6 +4956,14 @@ package body Exp_Aggr is
-- type using the computable sizes of the aggregate and its sub-
-- aggregates.
+ function Build_Two_Pass_Aggr_Code
+ (Lhs : Node_Id;
+ Aggr_Typ : out Entity_Id) return List_Id;
+ -- The aggregate consists only of iterated associations and Lhs is an
+ -- expression containing the location of the anonymous object, which
+ -- may be built in place. Returns the dynamic subtype of the aggregate
+ -- in Aggr_Typ and the list of statements needed to build it.
+
procedure Check_Bounds (Aggr_Bounds_Node, Index_Bounds_Node : Node_Id);
-- Checks that the bounds of Aggr_Bounds are within the bounds defined
-- by Index_Bounds. For null array aggregate (Ada 2022) check that the
@@ -4983,7 +4991,7 @@ package body Exp_Aggr is
-- built directly into the target of an assignment, the target must
-- be free of side effects. N is the target of the assignment.
- procedure Two_Pass_Aggregate_Expansion (N : Node_Id);
+ procedure Two_Pass_Aggregate_Expansion;
-- If the aggregate consists only of iterated associations then the
-- aggregate is constructed in two steps:
-- a) Build an expression to compute the number of elements
@@ -5053,6 +5061,221 @@ package body Exp_Aggr is
Freeze_Itype (Agg_Type, N);
end Build_Constrained_Type;
+ ------------------------------
+ -- Build_Two_Pass_Aggr_Code --
+ ------------------------------
+
+ function Build_Two_Pass_Aggr_Code
+ (Lhs : Node_Id;
+ Aggr_Typ : out Entity_Id) return List_Id
+ is
+ Index_Id : constant Entity_Id := Make_Temporary (Loc, 'I', N);
+ Index_Type : constant Entity_Id := Etype (First_Index (Typ));
+ Index_Base : constant Entity_Id := Base_Type (Index_Type);
+ Size_Id : constant Entity_Id := Make_Temporary (Loc, 'I', N);
+ Size_Type : constant Entity_Id :=
+ Integer_Type_For
+ (Esize (Index_Base), Is_Unsigned_Type (Index_Base));
+
+ Assoc : Node_Id;
+ Incr : Node_Id;
+ Iter : Node_Id;
+ New_Comp : Node_Id;
+ One_Loop : Node_Id;
+ Iter_Id : Entity_Id;
+
+ Aggr_Code : List_Id;
+ Size_Expr_Code : List_Id;
+
+ begin
+ Size_Expr_Code := New_List (
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Size_Id,
+ Object_Definition => New_Occurrence_Of (Size_Type, Loc),
+ Expression => Make_Integer_Literal (Loc, 0)));
+
+ -- First pass: execute the iterators to count the number of elements
+ -- that will be generated.
+
+ Assoc := First (Component_Associations (N));
+ while Present (Assoc) loop
+ Iter := Iterator_Specification (Assoc);
+ Iter_Id := Defining_Identifier (Iter);
+ Incr :=
+ Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Size_Id, Loc),
+ Expression =>
+ Make_Op_Add (Loc,
+ Left_Opnd => New_Occurrence_Of (Size_Id, Loc),
+ Right_Opnd => Make_Integer_Literal (Loc, 1)));
+
+ -- Avoid using the same iterator definition in both loops by
+ -- creating a new iterator for each loop and mapping it over the
+ -- original iterator references.
+
+ One_Loop :=
+ Make_Implicit_Loop_Statement (N,
+ Iteration_Scheme =>
+ Make_Iteration_Scheme (Loc,
+ Iterator_Specification =>
+ New_Copy_Tree (Iter,
+ Map => New_Elmt_List (Iter_Id, New_Copy (Iter_Id)))),
+ Statements => New_List (Incr));
+
+ Append (One_Loop, Size_Expr_Code);
+ Next (Assoc);
+ end loop;
+
+ Insert_Actions (N, Size_Expr_Code);
+
+ -- Build a constrained subtype with the bounds deduced from
+ -- the size computed above and declare the aggregate object.
+ -- The index type is some discrete type, so the bounds of the
+ -- constrained subtype are computed as T'Val (integer bounds).
+
+ declare
+ -- Pos_Lo := Index_Type'Pos (Index_Type'First)
+
+ Pos_Lo : constant Node_Id :=
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Index_Type, Loc),
+ Attribute_Name => Name_Pos,
+ Expressions => New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Index_Type, Loc),
+ Attribute_Name => Name_First)));
+
+ -- Corresponding index value, i.e. Index_Type'First
+
+ Aggr_Lo : constant Node_Id :=
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Index_Type, Loc),
+ Attribute_Name => Name_First);
+
+ -- Pos_Hi := Pos_Lo + Size - 1
+
+ Pos_Hi : constant Node_Id :=
+ Make_Op_Add (Loc,
+ Left_Opnd => Pos_Lo,
+ Right_Opnd =>
+ Make_Op_Subtract (Loc,
+ Left_Opnd => New_Occurrence_Of (Size_Id, Loc),
+ Right_Opnd => Make_Integer_Literal (Loc, 1)));
+
+ -- Corresponding index value
+
+ Aggr_Hi : constant Node_Id :=
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Index_Type, Loc),
+ Attribute_Name => Name_Val,
+ Expressions => New_List (Pos_Hi));
+
+ begin
+ Aggr_Typ := Make_Temporary (Loc, 'T');
+
+ Insert_Action (N,
+ Make_Subtype_Declaration (Loc,
+ Defining_Identifier => Aggr_Typ,
+ Subtype_Indication =>
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark =>
+ New_Occurrence_Of (Base_Type (Typ), Loc),
+ Constraint =>
+ Make_Index_Or_Discriminant_Constraint
+ (Loc,
+ Constraints =>
+ New_List (Make_Range (Loc, Aggr_Lo, Aggr_Hi))))));
+ end;
+
+ -- Second pass: use the iterators to generate the elements of the
+ -- aggregate. We assume that the second evaluation of each iterator
+ -- generates the same number of elements as the first pass, and thus
+ -- consider that the execution is erroneous (even if the RM does not
+ -- state this explicitly) if the number of elements generated differs
+ -- between first and second pass.
+
+ Assoc := First (Component_Associations (N));
+
+ -- Initialize insertion position to first array component
+
+ Aggr_Code := New_List (
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Index_Id,
+ Object_Definition =>
+ New_Occurrence_Of (Index_Type, Loc),
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Copy_Tree (Lhs),
+ Attribute_Name => Name_First)));
+
+ while Present (Assoc) loop
+ Iter := Iterator_Specification (Assoc);
+ Iter_Id := Defining_Identifier (Iter);
+ New_Comp :=
+ Make_OK_Assignment_Statement (Loc,
+ Name =>
+ Make_Indexed_Component (Loc,
+ Prefix => New_Copy_Tree (Lhs),
+ Expressions =>
+ New_List (New_Occurrence_Of (Index_Id, Loc))),
+ Expression => Copy_Separate_Tree (Expression (Assoc)));
+
+ -- Arrange for the component to be adjusted if need be (the call
+ -- will be generated by Make_Tag_Ctrl_Assignment).
+
+ if Needs_Finalization (Ctyp)
+ and then not Is_Inherently_Limited_Type (Ctyp)
+ then
+ Set_No_Finalize_Actions (New_Comp);
+ else
+ Set_No_Ctrl_Actions (New_Comp);
+ end if;
+
+ -- Advance index position for insertion
+
+ Incr :=
+ Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Index_Id, Loc),
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Index_Type, Loc),
+ Attribute_Name => Name_Succ,
+ Expressions =>
+ New_List (New_Occurrence_Of (Index_Id, Loc))));
+
+ -- Add guard to skip last increment when upper bound is reached
+
+ Incr :=
+ Make_If_Statement (Loc,
+ Condition =>
+ Make_Op_Ne (Loc,
+ Left_Opnd => New_Occurrence_Of (Index_Id, Loc),
+ Right_Opnd =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Index_Type, Loc),
+ Attribute_Name => Name_Last)),
+ Then_Statements => New_List (Incr));
+
+ -- Avoid using the same iterator definition in both loops by
+ -- creating a new iterator for each loop and mapping it over
+ -- the original iterator references.
+
+ One_Loop :=
+ Make_Implicit_Loop_Statement (N,
+ Iteration_Scheme =>
+ Make_Iteration_Scheme (Loc,
+ Iterator_Specification =>
+ New_Copy_Tree (Iter,
+ Map => New_Elmt_List (Iter_Id, New_Copy (Iter_Id)))),
+ Statements => New_List (New_Comp, Incr));
+
+ Append (One_Loop, Aggr_Code);
+ Next (Assoc);
+ end loop;
+
+ return Aggr_Code;
+ end Build_Two_Pass_Aggr_Code;
+
------------------
-- Check_Bounds --
------------------
@@ -5596,214 +5819,98 @@ package body Exp_Aggr is
-- Two_Pass_Aggregate_Expansion --
----------------------------------
- procedure Two_Pass_Aggregate_Expansion (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Comp_Type : constant Entity_Id := Etype (N);
- Index_Id : constant Entity_Id := Make_Temporary (Loc, 'I', N);
- Index_Type : constant Entity_Id := Etype (First_Index (Etype (N)));
- Index_Base : constant Entity_Id := Base_Type (Index_Type);
- Size_Id : constant Entity_Id := Make_Temporary (Loc, 'I', N);
- Size_Type : constant Entity_Id :=
- Integer_Type_For
- (Esize (Index_Base), Is_Unsigned_Type (Index_Base));
- TmpE : constant Entity_Id := Make_Temporary (Loc, 'A', N);
-
- Assoc : Node_Id := First (Component_Associations (N));
- Incr : Node_Id;
- Iter : Node_Id;
- New_Comp : Node_Id;
- One_Loop : Node_Id;
- Iter_Id : Entity_Id;
-
- Size_Expr_Code : List_Id;
- Insertion_Code : List_Id := New_List;
+ procedure Two_Pass_Aggregate_Expansion is
+ Aggr_Code : List_Id;
+ Aggr_Typ : Entity_Id;
+ Lhs : Node_Id;
+ Obj_Id : Entity_Id;
+ Par : Node_Id;
begin
- Size_Expr_Code := New_List (
- Make_Object_Declaration (Loc,
- Defining_Identifier => Size_Id,
- Object_Definition => New_Occurrence_Of (Size_Type, Loc),
- Expression => Make_Integer_Literal (Loc, 0)));
-
- -- First pass: execute the iterators to count the number of elements
- -- that will be generated.
-
- while Present (Assoc) loop
- Iter := Iterator_Specification (Assoc);
- Iter_Id := Defining_Identifier (Iter);
- Incr := Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Size_Id, Loc),
- Expression =>
- Make_Op_Add (Loc,
- Left_Opnd => New_Occurrence_Of (Size_Id, Loc),
- Right_Opnd => Make_Integer_Literal (Loc, 1)));
-
- -- Avoid using the same iterator definition in both loops by
- -- creating a new iterator for each loop and mapping it over the
- -- original iterator references.
-
- One_Loop := Make_Implicit_Loop_Statement (N,
- Iteration_Scheme =>
- Make_Iteration_Scheme (Loc,
- Iterator_Specification =>
- New_Copy_Tree (Iter,
- Map => New_Elmt_List (Iter_Id, New_Copy (Iter_Id)))),
- Statements => New_List (Incr));
-
- Append (One_Loop, Size_Expr_Code);
- Next (Assoc);
+ Par := Parent (N);
+ while Nkind (Par) = N_Qualified_Expression loop
+ Par := Parent (Par);
end loop;
- Insert_Actions (N, Size_Expr_Code);
-
- -- Build a constrained subtype with the bounds deduced from
- -- the size computed above and declare the aggregate object.
- -- The index type is some discrete type, so the bounds of the
- -- constrained subtype are computed as T'Val (integer bounds).
-
- declare
- -- Pos_Lo := Index_Type'Pos (Index_Type'First)
-
- Pos_Lo : constant Node_Id :=
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Type, Loc),
- Attribute_Name => Name_Pos,
- Expressions => New_List (
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Type, Loc),
- Attribute_Name => Name_First)));
-
- -- Corresponding index value, i.e. Index_Type'First
-
- Aggr_Lo : constant Node_Id :=
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Type, Loc),
- Attribute_Name => Name_First);
-
- -- Pos_Hi := Pos_Lo + Size - 1
-
- Pos_Hi : constant Node_Id :=
- Make_Op_Add (Loc,
- Left_Opnd => Pos_Lo,
- Right_Opnd =>
- Make_Op_Subtract (Loc,
- Left_Opnd => New_Occurrence_Of (Size_Id, Loc),
- Right_Opnd => Make_Integer_Literal (Loc, 1)));
-
- -- Corresponding index value
-
- Aggr_Hi : constant Node_Id :=
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Type, Loc),
- Attribute_Name => Name_Val,
- Expressions => New_List (Pos_Hi));
+ -- If the aggregate is the initialization expression of an object
+ -- declaration, we always build the aggregate in place, although
+ -- this is required only for immutably limited types and types
+ -- that need finalization, see RM 7.6(17.2/3-17.3/3).
- SubE : constant Entity_Id := Make_Temporary (Loc, 'T');
- SubD : constant Node_Id :=
- Make_Subtype_Declaration (Loc,
- Defining_Identifier => SubE,
- Subtype_Indication =>
- Make_Subtype_Indication (Loc,
- Subtype_Mark =>
- New_Occurrence_Of (Etype (Comp_Type), Loc),
- Constraint =>
- Make_Index_Or_Discriminant_Constraint
- (Loc,
- Constraints =>
- New_List (Make_Range (Loc, Aggr_Lo, Aggr_Hi)))));
-
- -- Create a temporary array of the above subtype which
- -- will be used to capture the aggregate assignments.
-
- TmpD : constant Node_Id :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => TmpE,
- Object_Definition => New_Occurrence_Of (SubE, Loc));
-
- begin
- Insert_Actions (N, New_List (SubD, TmpD));
- end;
-
- -- Second pass: use the iterators to generate the elements of the
- -- aggregate. Insertion index starts at Index_Type'First. We
- -- assume that the second evaluation of each iterator generates
- -- the same number of elements as the first pass, and consider
- -- that the execution is erroneous (even if the RM does not state
- -- this explicitly) if the number of elements generated differs
- -- between first and second pass.
-
- Assoc := First (Component_Associations (N));
+ if Nkind (Par) = N_Object_Declaration then
+ Obj_Id := Defining_Identifier (Par);
+ Lhs := New_Occurrence_Of (Obj_Id, Loc);
+ Set_Assignment_OK (Lhs);
+ Aggr_Code := Build_Two_Pass_Aggr_Code (Lhs, Aggr_Typ);
- -- Initialize insertion position to first array component.
+ -- Save the last assignment statement associated with the
+ -- aggregate when building a controlled object. This last
+ -- assignment is used by the finalization machinery when
+ -- marking an object as successfully initialized.
- Insertion_Code := New_List (
- Make_Object_Declaration (Loc,
- Defining_Identifier => Index_Id,
- Object_Definition =>
- New_Occurrence_Of (Index_Type, Loc),
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Type, Loc),
- Attribute_Name => Name_First)));
+ if Needs_Finalization (Typ) then
+ Mutate_Ekind (Obj_Id, E_Variable);
+ Set_Last_Aggregate_Assignment (Obj_Id, Last (Aggr_Code));
+ end if;
- while Present (Assoc) loop
- Iter := Iterator_Specification (Assoc);
- Iter_Id := Defining_Identifier (Iter);
- New_Comp := Make_Assignment_Statement (Loc,
- Name =>
- Make_Indexed_Component (Loc,
- Prefix => New_Occurrence_Of (TmpE, Loc),
- Expressions =>
- New_List (New_Occurrence_Of (Index_Id, Loc))),
- Expression => Copy_Separate_Tree (Expression (Assoc)));
+ -- If a transient scope has been created around the declaration,
+ -- we need to attach the code to it so that finalization actions
+ -- of the declaration will be inserted after it; otherwise, we
+ -- directly insert it after the declaration. In both cases, the
+ -- code will be analyzed after the declaration is processed, i.e.
+ -- once the actual subtype of the object is established.
- -- Advance index position for insertion.
+ if Scope_Is_Transient and then Par = Node_To_Be_Wrapped then
+ Store_After_Actions_In_Scope_Without_Analysis (Aggr_Code);
+ else
+ Insert_List_After (Par, Aggr_Code);
+ end if;
- Incr := Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Index_Id, Loc),
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix =>
- New_Occurrence_Of (Index_Type, Loc),
- Attribute_Name => Name_Succ,
- Expressions =>
- New_List (New_Occurrence_Of (Index_Id, Loc))));
+ Set_Etype (N, Aggr_Typ);
+ Set_No_Initialization (Par);
- -- Add guard to skip last increment when upper bound is reached.
+ -- Likewise if it is the qualified expression of an allocator but,
+ -- in this case, we wait until after Expand_Allocator_Expression
+ -- rewrites the allocator as the initialization expression of an
+ -- object declaration, so that we have the left-hand side.
- Incr := Make_If_Statement (Loc,
- Condition =>
- Make_Op_Ne (Loc,
- Left_Opnd => New_Occurrence_Of (Index_Id, Loc),
- Right_Opnd =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Type, Loc),
- Attribute_Name => Name_Last)),
- Then_Statements => New_List (Incr));
+ elsif Nkind (Par) = N_Allocator then
+ if Nkind (Parent (Par)) = N_Object_Declaration
+ and then
+ not Comes_From_Source (Defining_Identifier (Parent (Par)))
+ then
+ Obj_Id := Defining_Identifier (Parent (Par));
+ Lhs :=
+ Make_Explicit_Dereference (Loc,
+ Prefix => New_Occurrence_Of (Obj_Id, Loc));
+ Set_Assignment_OK (Lhs);
+ Aggr_Code := Build_Two_Pass_Aggr_Code (Lhs, Aggr_Typ);
- -- Avoid using the same iterator definition in both loops by
- -- creating a new iterator for each loop and mapping it over the
- -- original iterator references.
+ Insert_Actions_After (Parent (Par), Aggr_Code);
- One_Loop := Make_Implicit_Loop_Statement (N,
- Iteration_Scheme =>
- Make_Iteration_Scheme (Loc,
- Iterator_Specification =>
- New_Copy_Tree (Iter,
- Map => New_Elmt_List (Iter_Id, New_Copy (Iter_Id)))),
- Statements => New_List (New_Comp, Incr));
+ Set_Expression (Par, New_Occurrence_Of (Aggr_Typ, Loc));
+ Set_No_Initialization (Par);
+ end if;
- Append (One_Loop, Insertion_Code);
- Next (Assoc);
- end loop;
+ -- Otherwise we create a temporary for the anonymous object and
+ -- replace the aggregate with the temporary.
- Insert_Actions (N, Insertion_Code);
+ else
+ Obj_Id := Make_Temporary (Loc, 'A', N);
+ Lhs := New_Occurrence_Of (Obj_Id, Loc);
+ Set_Assignment_OK (Lhs);
- -- Depending on context this may not work for build-in-place
- -- arrays ???
+ Aggr_Code := Build_Two_Pass_Aggr_Code (Lhs, Aggr_Typ);
+ Prepend_To (Aggr_Code,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Obj_Id,
+ Object_Definition => New_Occurrence_Of (Aggr_Typ, Loc)));
- Rewrite (N, New_Occurrence_Of (TmpE, Loc));
+ Insert_Actions (N, Aggr_Code);
+ Rewrite (N, Lhs);
+ Analyze_And_Resolve (N, Aggr_Typ);
+ end if;
end Two_Pass_Aggregate_Expansion;
-- Local variables
@@ -5829,7 +5936,7 @@ package body Exp_Aggr is
-- Aggregates that require a two-pass expansion are handled separately
elsif Is_Two_Pass_Aggregate (N) then
- Two_Pass_Aggregate_Expansion (N);
+ Two_Pass_Aggregate_Expansion;
return;
-- Do not attempt expansion if error already detected. We may reach this
@@ -6002,12 +6109,11 @@ package body Exp_Aggr is
-- static type imposed by the context.
declare
- Itype : constant Entity_Id := Etype (N);
Index : Node_Id;
Needs_Type : Boolean := False;
begin
- Index := First_Index (Itype);
+ Index := First_Index (Typ);
while Present (Index) loop
if not Is_OK_Static_Subtype (Etype (Index)) then
Needs_Type := True;
@@ -6019,7 +6125,7 @@ package body Exp_Aggr is
if Needs_Type then
Build_Constrained_Type (Positional => True);
- Rewrite (N, Unchecked_Convert_To (Itype, N));
+ Rewrite (N, Unchecked_Convert_To (Typ, N));
Analyze (N);
end if;
end;
@@ -6147,7 +6253,7 @@ package body Exp_Aggr is
then
Tmp := Name (Parent_Node);
- if Etype (Tmp) /= Etype (N) then
+ if Etype (Tmp) /= Typ then
Apply_Length_Check (N, Etype (Tmp));
if Nkind (N) = N_Raise_Constraint_Error then
@@ -6904,7 +7010,7 @@ package body Exp_Aggr is
begin
return UI_To_Int ((if Nkind (Expr) = N_Integer_Literal
then Intval (Expr)
- else Enumeration_Pos (Expr)));
+ else Enumeration_Pos (Entity (Expr))));
end To_Int;
-- Local variables
@@ -7362,7 +7468,7 @@ package body Exp_Aggr is
-- Likewise if the aggregate is the qualified expression of an allocator
-- but, in this case, we wait until after Expand_Allocator_Expression
-- rewrites the allocator as the initialization expression of an object
- -- declaration to have the left hand side.
+ -- declaration, so that we have the left-hand side.
elsif Nkind (Par) = N_Allocator then
if Nkind (Parent (Par)) = N_Object_Declaration
@@ -7390,10 +7496,19 @@ package body Exp_Aggr is
Set_Assignment_OK (Lhs);
Aggr_Code := Build_Container_Aggr_Code (N, Typ, Lhs, Init);
+
+ -- Use the unconstrained base subtype of the subtype provided by
+ -- the context for declaring the temporary object (which may come
+ -- from a constrained assignment target), to ensure that the
+ -- aggregate can be successfully expanded and assigned to the
+ -- temporary without exceeding its capacity. (Later assignment
+ -- of the temporary to a target object may result in failing
+ -- a discriminant check.)
+
Prepend_To (Aggr_Code,
Make_Object_Declaration (Loc,
Defining_Identifier => Obj_Id,
- Object_Definition => New_Occurrence_Of (Typ, Loc),
+ Object_Definition => New_Occurrence_Of (Base_Type (Typ), Loc),
Expression => Init));
Insert_Actions (N, Aggr_Code);
@@ -7971,7 +8086,8 @@ package body Exp_Aggr is
Make_Selected_Component (Loc,
Prefix =>
Unchecked_Convert_To (Typ,
- Duplicate_Subexpr (Parent_Expr, True)),
+ Duplicate_Subexpr
+ (Parent_Expr, Name_Req => True)),
Selector_Name => New_Occurrence_Of (Comp, Loc));
Append_To (Comps,
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index b896228..18179d3 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -88,8 +88,10 @@ package body Exp_Attr is
function Attribute_Op_Hash (Id : Entity_Id) return Header_Num is
(Header_Num (Id mod Map_Size));
- -- Cache used to avoid building duplicate subprograms for a single
- -- type/streaming-attribute pair.
+ -- Caches used to avoid building duplicate subprograms for a single
+ -- type/attribute pair (where the attribute is either Put_Image or
+ -- one of the four streaming attributes). The type used as a key in
+ -- in accessing these maps should not be the entity of a subtype.
package Read_Map is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
@@ -282,8 +284,8 @@ package body Exp_Attr is
(In_Same_Extended_Unit (Subp_Unit, Attr_Ref_Unit)
-- If subp declared in unit body, then we don't want to refer
-- to it from within unit spec so return False in that case.
- and then not (Body_Required (Attr_Ref_Unit)
- and not Body_Required (Subp_Unit)));
+ and then not (not Is_Body (Unit (Attr_Ref_Unit))
+ and Is_Body (Unit (Subp_Unit))));
-- Returns True if it is ok to refer to a cached subprogram declared in
-- Subp_Unit from the point of an attribute reference occurring in
-- Attr_Ref_Unit. Both arguments are usually N_Compilation_Nodes,
@@ -4669,7 +4671,7 @@ package body Exp_Attr is
end if;
if not Is_Tagged_Type (P_Type) then
- Cached_Attribute_Ops.Input_Map.Set (P_Type, Fname);
+ Cached_Attribute_Ops.Input_Map.Set (U_Type, Fname);
end if;
end Input;
@@ -5750,7 +5752,7 @@ package body Exp_Attr is
Rewrite_Attribute_Proc_Call (Pname);
if not Is_Tagged_Type (P_Type) then
- Cached_Attribute_Ops.Output_Map.Set (P_Type, Pname);
+ Cached_Attribute_Ops.Output_Map.Set (U_Type, Pname);
end if;
end Output;
@@ -6669,7 +6671,7 @@ package body Exp_Attr is
Rewrite_Attribute_Proc_Call (Pname);
if not Is_Tagged_Type (P_Type) then
- Cached_Attribute_Ops.Read_Map.Set (P_Type, Pname);
+ Cached_Attribute_Ops.Read_Map.Set (U_Type, Pname);
end if;
end Read;
@@ -7870,9 +7872,8 @@ package body Exp_Attr is
else
declare
Uns : constant Boolean :=
- Is_Unsigned_Type (Ptyp)
- or else (Is_Private_Type (Ptyp)
- and then Is_Unsigned_Type (PBtyp));
+ Is_Unsigned_Type (Validated_View (Ptyp));
+
Size : Uint;
P : Node_Id := Pref;
@@ -8349,7 +8350,7 @@ package body Exp_Attr is
Rewrite_Attribute_Proc_Call (Pname);
if not Is_Tagged_Type (P_Type) then
- Cached_Attribute_Ops.Write_Map.Set (P_Type, Pname);
+ Cached_Attribute_Ops.Write_Map.Set (U_Type, Pname);
end if;
end Write;
@@ -8600,10 +8601,10 @@ package body Exp_Attr is
Rewrite (N,
Make_Op_Multiply (Loc,
Make_Attribute_Reference (Loc,
- Prefix => Duplicate_Subexpr (Pref, True),
+ Prefix => Duplicate_Subexpr (Pref, Name_Req => True),
Attribute_Name => Name_Length),
Make_Attribute_Reference (Loc,
- Prefix => Duplicate_Subexpr (Pref, True),
+ Prefix => Duplicate_Subexpr (Pref, Name_Req => True),
Attribute_Name => Name_Component_Size)));
Analyze_And_Resolve (N, Typ);
end if;
@@ -8951,15 +8952,22 @@ package body Exp_Attr is
return Empty;
end if;
- if Nam = TSS_Stream_Read then
- Ent := Cached_Attribute_Ops.Read_Map.Get (Typ);
- elsif Nam = TSS_Stream_Write then
- Ent := Cached_Attribute_Ops.Write_Map.Get (Typ);
- elsif Nam = TSS_Stream_Input then
- Ent := Cached_Attribute_Ops.Input_Map.Get (Typ);
- elsif Nam = TSS_Stream_Output then
- Ent := Cached_Attribute_Ops.Output_Map.Get (Typ);
- end if;
+ declare
+ function U_Base return Entity_Id is
+ (Underlying_Type (Base_Type (Typ)));
+ -- Return the right type node for use in a C_A_O map lookup.
+ -- In particular, we do not want the entity for a subtype.
+ begin
+ if Nam = TSS_Stream_Read then
+ Ent := Cached_Attribute_Ops.Read_Map.Get (U_Base);
+ elsif Nam = TSS_Stream_Write then
+ Ent := Cached_Attribute_Ops.Write_Map.Get (U_Base);
+ elsif Nam = TSS_Stream_Input then
+ Ent := Cached_Attribute_Ops.Input_Map.Get (U_Base);
+ elsif Nam = TSS_Stream_Output then
+ Ent := Cached_Attribute_Ops.Output_Map.Get (U_Base);
+ end if;
+ end;
Cached_Attribute_Ops.Validate_Cached_Candidate
(Subp => Ent, Attr_Ref => Attr_Ref);
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index bc46fd3..fa87149 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -5423,18 +5423,12 @@ package body Exp_Ch3 is
-- with an initial value, its Init_Proc will never be called. The
-- initial value itself may have been expanded into assignments,
-- in which case the declaration has the No_Initialization flag.
- -- The exception is when the initial value is a 2-pass aggregate,
- -- because the special expansion used for it creates a temporary
- -- that needs a fully-fledged initialization.
if Is_Itype (Base)
and then Nkind (Associated_Node_For_Itype (Base)) =
N_Object_Declaration
and then
- ((Present (Expression (Associated_Node_For_Itype (Base)))
- and then not
- Is_Two_Pass_Aggregate
- (Expression (Associated_Node_For_Itype (Base))))
+ (Present (Expression (Associated_Node_For_Itype (Base)))
or else No_Initialization (Associated_Node_For_Itype (Base)))
then
null;
@@ -8293,12 +8287,15 @@ package body Exp_Ch3 is
-- where the object has been initialized by a call to a function
-- returning on the primary stack (see Expand_Ctrl_Function_Call)
-- since no copy occurred, given that the type is by-reference.
+ -- Likewise if it is initialized by a 2-pass aggregate, since the
+ -- actual initialization will only occur during the second pass.
-- Similarly, no adjustment is needed if we are going to rewrite
-- the object declaration into a renaming declaration.
if Needs_Finalization (Typ)
and then not Is_Inherently_Limited_Type (Typ)
and then Nkind (Expr_Q) /= N_Function_Call
+ and then not Is_Two_Pass_Aggregate (Expr_Q)
and then not Rewrite_As_Renaming
then
Adj_Call :=
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 82978c7..0cf605c 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -193,12 +193,12 @@ package body Exp_Ch4 is
procedure Insert_Conditional_Object_Declaration
(Obj_Id : Entity_Id;
+ Typ : Entity_Id;
Expr : Node_Id;
- Decl : Node_Id);
- -- Expr is the dependent expression of a conditional expression and Decl
- -- is the declaration of an object whose initialization expression is the
- -- conditional expression. Insert in the actions of Expr the declaration
- -- of Obj_Id modeled on Decl and with Expr as initialization expression.
+ Const : Boolean);
+ -- Expr is the dependent expression of a conditional expression. Insert in
+ -- the actions of Expr the declaration of Obj_Id with type Typ and Expr as
+ -- initialization expression. Const is True when Obj_Id is a constant.
procedure Insert_Dereference_Action (N : Node_Id);
-- N is an expression whose type is an access. When the type of the
@@ -769,7 +769,6 @@ package body Exp_Ch4 is
-- Local variables
Aggr_In_Place : Boolean;
- Container_Aggr : Boolean;
Delayed_Cond_Expr : Boolean;
TagT : Entity_Id := Empty;
@@ -865,13 +864,15 @@ package body Exp_Ch4 is
Aggr_In_Place := Is_Delayed_Aggregate (Exp);
Delayed_Cond_Expr := Is_Delayed_Conditional_Expression (Exp);
- Container_Aggr := Nkind (Exp) = N_Aggregate
- and then Has_Aspect (T, Aspect_Aggregate);
- -- An allocator with a container aggregate as qualified expression must
- -- be rewritten into the form expected by Expand_Container_Aggregate.
+ -- An allocator with a container aggregate, resp. a 2-pass aggregate,
+ -- as qualified expression must be rewritten into the form expected by
+ -- Expand_Container_Aggregate, resp. Two_Pass_Aggregate_Expansion.
- if Container_Aggr then
+ if Nkind (Exp) = N_Aggregate
+ and then (Has_Aspect (T, Aspect_Aggregate)
+ or else Is_Two_Pass_Aggregate (Exp))
+ then
Temp := Make_Temporary (Loc, 'P', N);
Set_Analyzed (Exp, False);
Insert_Action (N,
@@ -5303,7 +5304,7 @@ package body Exp_Ch4 is
-- 'Unrestricted_Access.
-- Generate:
- -- type Ptr_Typ is not null access all [constant] Typ;
+ -- type Target_Typ is not null access all [constant] Typ;
else
Target_Typ := Make_Temporary (Loc, 'P');
@@ -5401,20 +5402,16 @@ package body Exp_Ch4 is
elsif Optimize_Object_Decl then
Obj := Make_Temporary (Loc, 'C', Alt_Expr);
- Insert_Conditional_Object_Declaration (Obj, Alt_Expr, Par);
-
- Alt_Expr :=
- Make_Attribute_Reference (Alt_Loc,
- Prefix => New_Occurrence_Of (Obj, Alt_Loc),
- Attribute_Name => Name_Unrestricted_Access);
-
- LHS := New_Occurrence_Of (Target, Loc);
- Set_Assignment_OK (LHS);
+ Insert_Conditional_Object_Declaration
+ (Obj, Typ, Alt_Expr, Const => Constant_Present (Par));
Stmts := New_List (
Make_Assignment_Statement (Alt_Loc,
- Name => LHS,
- Expression => Alt_Expr));
+ Name => New_Occurrence_Of (Target, Loc),
+ Expression =>
+ Make_Attribute_Reference (Alt_Loc,
+ Prefix => New_Occurrence_Of (Obj, Alt_Loc),
+ Attribute_Name => Name_Unrestricted_Access)));
-- Take the unrestricted access of the expression value for non-
-- scalar types. This approach avoids big copies and covers the
@@ -6012,8 +6009,10 @@ package body Exp_Ch4 is
Target : constant Entity_Id := Make_Temporary (Loc, 'C', N);
begin
- Insert_Conditional_Object_Declaration (Then_Obj, Thenx, Par);
- Insert_Conditional_Object_Declaration (Else_Obj, Elsex, Par);
+ Insert_Conditional_Object_Declaration
+ (Then_Obj, Typ, Thenx, Const => Constant_Present (Par));
+ Insert_Conditional_Object_Declaration
+ (Else_Obj, Typ, Elsex, Const => Constant_Present (Par));
-- Generate:
-- type Ptr_Typ is not null access all [constant] Typ;
@@ -13284,17 +13283,20 @@ package body Exp_Ch4 is
procedure Insert_Conditional_Object_Declaration
(Obj_Id : Entity_Id;
+ Typ : Entity_Id;
Expr : Node_Id;
- Decl : Node_Id)
+ Const : Boolean)
is
Loc : constant Source_Ptr := Sloc (Expr);
Obj_Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Obj_Id,
- Aliased_Present => Aliased_Present (Decl),
- Constant_Present => Constant_Present (Decl),
- Object_Definition => New_Copy_Tree (Object_Definition (Decl)),
+ Aliased_Present => True,
+ Constant_Present => Const,
+ Object_Definition => New_Occurrence_Of (Typ, Loc),
Expression => Relocate_Node (Expr));
+ -- We make the object unconditionally aliased to avoid dangling bound
+ -- issues when its nominal subtype is an unconstrained array type.
Master_Node_Decl : Node_Id;
Master_Node_Id : Entity_Id;
@@ -13309,6 +13311,21 @@ package body Exp_Ch4 is
Insert_Action (Expr, Obj_Decl);
+ -- The object can never be local to an elaboration routine at library
+ -- level since we will take 'Unrestricted_Access of it. Beware that
+ -- Is_Library_Level_Entity always returns False when called from within
+ -- a transient scope, but the associated block will not be materialized
+ -- when the transient scope is finally closed in the case of an object
+ -- declaration (see Exp.Ch7.Wrap_Transient_Declaration).
+
+ if Scope (Obj_Id) = Current_Scope and then Scope_Is_Transient then
+ Set_Is_Statically_Allocated
+ (Obj_Id, Is_Library_Level_Entity (Scope (Obj_Id)));
+ else
+ Set_Is_Statically_Allocated
+ (Obj_Id, Is_Library_Level_Entity (Obj_Id));
+ end if;
+
-- If the object needs finalization, we need to insert its Master_Node
-- manually because 1) the machinery in Exp_Ch7 will not pick it since
-- it will be declared in the arm of a conditional statement and 2) we
@@ -15035,10 +15052,11 @@ package body Exp_Ch4 is
-- Handle entities from the limited view
- Orig_Right_Type : constant Entity_Id := Available_View (Etype (Right));
+ Orig_Right_Type : constant Entity_Id :=
+ Base_Type (Available_View (Etype (Right)));
Full_R_Typ : Entity_Id;
- Left_Type : Entity_Id := Available_View (Etype (Left));
+ Left_Type : Entity_Id := Base_Type (Available_View (Etype (Left)));
Right_Type : Entity_Id := Orig_Right_Type;
Obj_Tag : Node_Id;
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 06616ea..3d8a542 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -1039,7 +1039,8 @@ package body Exp_Ch5 is
Prefix =>
Make_Indexed_Component (Loc,
Prefix =>
- Duplicate_Subexpr_Move_Checks (Larray, True),
+ Duplicate_Subexpr_Move_Checks
+ (Larray, Name_Req => True),
Expressions => New_List (
Make_Attribute_Reference (Loc,
Prefix =>
@@ -1054,7 +1055,8 @@ package body Exp_Ch5 is
Prefix =>
Make_Indexed_Component (Loc,
Prefix =>
- Duplicate_Subexpr_Move_Checks (Rarray, True),
+ Duplicate_Subexpr_Move_Checks
+ (Rarray, Name_Req => True),
Expressions => New_List (
Make_Attribute_Reference (Loc,
Prefix =>
@@ -1396,7 +1398,7 @@ package body Exp_Ch5 is
Prefix =>
Make_Indexed_Component (Loc,
Prefix =>
- Duplicate_Subexpr (Larray, True),
+ Duplicate_Subexpr (Larray, Name_Req => True),
Expressions => New_List (New_Copy_Tree (Left_Lo))),
Attribute_Name => Name_Address);
@@ -1405,7 +1407,7 @@ package body Exp_Ch5 is
Prefix =>
Make_Indexed_Component (Loc,
Prefix =>
- Duplicate_Subexpr (Larray, True),
+ Duplicate_Subexpr (Larray, Name_Req => True),
Expressions => New_List (New_Copy_Tree (Left_Lo))),
Attribute_Name => Name_Bit);
@@ -1414,7 +1416,7 @@ package body Exp_Ch5 is
Prefix =>
Make_Indexed_Component (Loc,
Prefix =>
- Duplicate_Subexpr (Rarray, True),
+ Duplicate_Subexpr (Rarray, Name_Req => True),
Expressions => New_List (New_Copy_Tree (Right_Lo))),
Attribute_Name => Name_Address);
@@ -1423,7 +1425,7 @@ package body Exp_Ch5 is
Prefix =>
Make_Indexed_Component (Loc,
Prefix =>
- Duplicate_Subexpr (Rarray, True),
+ Duplicate_Subexpr (Rarray, Name_Req => True),
Expressions => New_List (New_Copy_Tree (Right_Lo))),
Attribute_Name => Name_Bit);
@@ -1439,11 +1441,11 @@ package body Exp_Ch5 is
Make_Op_Multiply (Loc,
Make_Attribute_Reference (Loc,
Prefix =>
- Duplicate_Subexpr (Name (N), True),
+ Duplicate_Subexpr (Name (N), Name_Req => True),
Attribute_Name => Name_Length),
Make_Attribute_Reference (Loc,
Prefix =>
- Duplicate_Subexpr (Name (N), True),
+ Duplicate_Subexpr (Name (N), Name_Req => True),
Attribute_Name => Name_Component_Size));
begin
@@ -1527,11 +1529,11 @@ package body Exp_Ch5 is
Make_Op_Multiply (Loc,
Make_Attribute_Reference (Loc,
Prefix =>
- Duplicate_Subexpr (Name (N), True),
+ Duplicate_Subexpr (Name (N), Name_Req => True),
Attribute_Name => Name_Length),
Make_Attribute_Reference (Loc,
Prefix =>
- Duplicate_Subexpr (Larray, True),
+ Duplicate_Subexpr (Larray, Name_Req => True),
Attribute_Name => Name_Component_Size));
L_Arg, R_Arg, Call : Node_Id;
@@ -1582,7 +1584,7 @@ package body Exp_Ch5 is
end if;
return Make_Assignment_Statement (Loc,
- Name => Duplicate_Subexpr (Larray, True),
+ Name => Duplicate_Subexpr (Larray, Name_Req => True),
Expression => Unchecked_Convert_To (L_Typ, Call));
end Expand_Assign_Array_Bitfield_Fast;
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 7e46454..f85d977 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -2470,11 +2470,6 @@ package body Exp_Ch6 is
-- (and ensure that we have an activation chain defined for tasks
-- and a Master variable).
- -- Currently we limit such functions to those with inherently
- -- limited result subtypes, but eventually we plan to expand the
- -- functions that are treated as build-in-place to include other
- -- composite result types.
-
-- But do not do it here for intrinsic subprograms since this will
-- be done properly after the subprogram is expanded.
@@ -8562,12 +8557,10 @@ package body Exp_Ch6 is
procedure Make_Build_In_Place_Call_In_Anonymous_Context
(Function_Call : Node_Id)
is
- Loc : constant Source_Ptr := Sloc (Function_Call);
- Func_Call : constant Node_Id := Unqual_Conv (Function_Call);
- Function_Id : Entity_Id;
- Result_Subt : Entity_Id;
- Return_Obj_Id : Entity_Id;
- Return_Obj_Decl : Entity_Id;
+ Loc : constant Source_Ptr := Sloc (Function_Call);
+ Func_Call : constant Node_Id := Unqual_Conv (Function_Call);
+ Function_Id : Entity_Id;
+ Result_Subt : Entity_Id;
begin
-- If the call has already been processed to add build-in-place actuals
@@ -8580,10 +8573,6 @@ package body Exp_Ch6 is
return;
end if;
- -- Mark the call as processed as a build-in-place call
-
- Set_Is_Expanded_Build_In_Place_Call (Func_Call);
-
if Is_Entity_Name (Name (Func_Call)) then
Function_Id := Entity (Name (Func_Call));
@@ -8601,8 +8590,13 @@ package body Exp_Ch6 is
-- If the build-in-place function returns a controlled object, then the
-- object needs to be finalized immediately after the context. Since
-- this case produces a transient scope, the servicing finalizer needs
- -- to name the returned object. Create a temporary which is initialized
- -- with the function call:
+ -- to name the returned object.
+
+ -- If the build-in-place function returns a definite subtype, then an
+ -- object also needs to be created and an access value designating it
+ -- passed as an actual.
+
+ -- Create a temporary which is initialized with the function call:
--
-- Temp_Id : Func_Type := BIP_Func_Call;
--
@@ -8610,75 +8604,25 @@ package body Exp_Ch6 is
-- the expander using the appropriate mechanism in Make_Build_In_Place_
-- Call_In_Object_Declaration.
- if Needs_Finalization (Result_Subt) then
+ if Needs_Finalization (Result_Subt)
+ or else Caller_Known_Size (Func_Call, Result_Subt)
+ then
declare
Temp_Id : constant Entity_Id := Make_Temporary (Loc, 'R');
- Temp_Decl : Node_Id;
-
- begin
- -- Reset the guard on the function call since the following does
- -- not perform actual call expansion.
-
- Set_Is_Expanded_Build_In_Place_Call (Func_Call, False);
-
- Temp_Decl :=
+ Temp_Decl : constant Node_Id :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp_Id,
- Object_Definition =>
- New_Occurrence_Of (Result_Subt, Loc),
- Expression =>
- New_Copy_Tree (Function_Call));
+ Aliased_Present => True,
+ Object_Definition => New_Occurrence_Of (Result_Subt, Loc),
+ Expression => Relocate_Node (Function_Call));
+ begin
+ Set_Assignment_OK (Temp_Decl);
Insert_Action (Function_Call, Temp_Decl);
-
Rewrite (Function_Call, New_Occurrence_Of (Temp_Id, Loc));
Analyze (Function_Call);
end;
- -- When the result subtype is definite, an object of the subtype is
- -- declared and an access value designating it is passed as an actual.
-
- elsif Caller_Known_Size (Func_Call, Result_Subt) then
-
- -- Create a temporary object to hold the function result
-
- Return_Obj_Id := Make_Temporary (Loc, 'R');
- Set_Etype (Return_Obj_Id, Result_Subt);
-
- Return_Obj_Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Return_Obj_Id,
- Aliased_Present => True,
- Object_Definition => New_Occurrence_Of (Result_Subt, Loc));
-
- Set_No_Initialization (Return_Obj_Decl);
-
- Insert_Action (Func_Call, Return_Obj_Decl);
-
- -- When the function has a controlling result, an allocation-form
- -- parameter must be passed indicating that the caller is allocating
- -- the result object. This is needed because such a function can be
- -- called as a dispatching operation and must be treated similarly
- -- to functions with unconstrained result subtypes.
-
- Add_Unconstrained_Actuals_To_Build_In_Place_Call
- (Func_Call, Function_Id, Alloc_Form => Caller_Allocation);
-
- Add_Collection_Actual_To_Build_In_Place_Call
- (Func_Call, Function_Id);
-
- Add_Task_Actuals_To_Build_In_Place_Call
- (Func_Call, Function_Id, Make_Identifier (Loc, Name_uMaster));
-
- -- Add an implicit actual to the function call that provides access
- -- to the caller's return object.
-
- Add_Access_Actual_To_Build_In_Place_Call
- (Func_Call, Function_Id, New_Occurrence_Of (Return_Obj_Id, Loc));
-
- pragma Assert (Check_Number_Of_Actuals (Func_Call, Function_Id));
- pragma Assert (Check_BIP_Actuals (Func_Call, Function_Id));
-
-- When the result subtype is unconstrained, the function must allocate
-- the return object in the secondary stack, so appropriate implicit
-- parameters are added to the call to indicate that. A transient
@@ -8703,6 +8647,10 @@ package body Exp_Ch6 is
Add_Access_Actual_To_Build_In_Place_Call
(Func_Call, Function_Id, Empty);
+ -- Mark the call as processed as a build-in-place call
+
+ Set_Is_Expanded_Build_In_Place_Call (Func_Call);
+
pragma Assert (Check_Number_Of_Actuals (Func_Call, Function_Id));
pragma Assert (Check_BIP_Actuals (Func_Call, Function_Id));
end if;
@@ -9909,6 +9857,13 @@ package body Exp_Ch6 is
return Skip;
end if;
+ -- Skip calls placed in unexpanded initialization expressions
+
+ when N_Object_Declaration =>
+ if No_Initialization (Nod) then
+ return Skip;
+ end if;
+
-- Skip calls placed in subprogram specifications since function
-- calls initializing default parameter values will be processed
-- when the call to the subprogram is found (if the default actual
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 67af1d7..905094c 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -2783,16 +2783,31 @@ package body Exp_Ch7 is
Master_Node_Id :=
Make_Defining_Identifier (Master_Node_Loc,
Chars => New_External_Name (Chars (Obj_Id), Suffix => "MN"));
+
Master_Node_Decl :=
Make_Master_Node_Declaration (Master_Node_Loc,
Master_Node_Id, Obj_Id);
Push_Scope (Scope (Obj_Id));
+
+ -- Avoid generating duplicate names for master nodes
+
+ if Ekind (Obj_Id) = E_Loop_Parameter
+ and then
+ Present (Current_Entity_In_Scope (Chars (Master_Node_Id)))
+ then
+ Set_Chars (Master_Node_Id,
+ New_External_Name (Chars (Obj_Id),
+ Suffix => "MN",
+ Suffix_Index => -1));
+ end if;
+
if not Has_Strict_Ctrl_Objs or else Count = 1 then
Prepend_To (Decls, Master_Node_Decl);
else
Insert_Before (Decl, Master_Node_Decl);
end if;
+
Analyze (Master_Node_Decl);
Pop_Scope;
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index b8c6a9f..5fc4ed8 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -1081,10 +1081,12 @@ package body Exp_Util is
Make_Attribute_Reference (Loc,
Prefix =>
(if Is_Allocate then
- Duplicate_Subexpr_No_Checks (Expression (Alloc_Expr))
+ Duplicate_Subexpr_No_Checks
+ (Expression (Alloc_Expr), New_Scope => Proc_Id)
else
Make_Explicit_Dereference (Loc,
- Duplicate_Subexpr_No_Checks (Expr))),
+ Duplicate_Subexpr_No_Checks
+ (Expr, New_Scope => Proc_Id))),
Attribute_Name => Name_Alignment)));
end if;
@@ -1137,7 +1139,9 @@ package body Exp_Util is
if Is_RTE (Etype (Temp), RE_Tag_Ptr) then
Param :=
Make_Explicit_Dereference (Loc,
- Prefix => Duplicate_Subexpr_No_Checks (Temp));
+ Prefix =>
+ Duplicate_Subexpr_No_Checks
+ (Temp, New_Scope => Proc_Id));
-- In the default case, obtain the tag of the object about
-- to be allocated / deallocated. Generate:
@@ -1157,7 +1161,9 @@ package body Exp_Util is
Param :=
Make_Attribute_Reference (Loc,
- Prefix => Duplicate_Subexpr_No_Checks (Temp),
+ Prefix =>
+ Duplicate_Subexpr_No_Checks
+ (Temp, New_Scope => Proc_Id),
Attribute_Name => Name_Tag);
end if;
@@ -1517,7 +1523,118 @@ package body Exp_Util is
New_E := Type_Map.Get (Entity (N));
if Present (New_E) then
- Rewrite (N, New_Occurrence_Of (New_E, Sloc (N)));
+ declare
+
+ Ctrl_Type : constant Entity_Id
+ := Find_Dispatching_Type (Par_Subp);
+
+ function Call_To_Parent_Dispatching_Op_Must_Be_Mapped
+ (Call_Node : Node_Id) return Boolean;
+ -- If Call_Node is a call to a primitive function F of the
+ -- tagged type T associated with Par_Subp that either has
+ -- any actuals that are controlling formals of Par_Subp,
+ -- or else the call to F is an actual parameter of an
+ -- enclosing call to a primitive of T that has any actuals
+ -- that are controlling formals of Par_Subp (and recursively
+ -- up the tree of enclosing function calls), returns True;
+ -- otherwise returns False. Returning True implies that the
+ -- call to F must be mapped to a call that instead targets
+ -- the corresponding function F of the tagged type for which
+ -- Subp is a primitive function.
+
+ --------------------------------------------------
+ -- Call_To_Parent_Dispatching_Op_Must_Be_Mapped --
+ --------------------------------------------------
+
+ function Call_To_Parent_Dispatching_Op_Must_Be_Mapped
+ (Call_Node : Node_Id) return Boolean
+ is
+ pragma Assert (Nkind (Call_Node) = N_Function_Call);
+
+ Actual : Node_Id := First_Actual (Call_Node);
+ Actual_Type : Entity_Id;
+ Actual_Or_Prefix : Node_Id;
+
+ begin
+ if Is_Entity_Name (Name (Call_Node))
+ and then Is_Dispatching_Operation
+ (Entity (Name (Call_Node)))
+ and then
+ Is_Ancestor
+ (Ctrl_Type,
+ Find_Dispatching_Type
+ (Entity (Name (Call_Node))))
+ then
+ while Present (Actual) loop
+
+ -- Account for 'Old and explicit dereferences,
+ -- picking up the prefix object in those cases.
+
+ if (Nkind (Actual) = N_Attribute_Reference
+ and then Attribute_Name (Actual) = Name_Old)
+ or else Nkind (Actual) = N_Explicit_Dereference
+ then
+ Actual_Or_Prefix := Prefix (Actual);
+ else
+ Actual_Or_Prefix := Actual;
+ end if;
+
+ Actual_Type := Etype (Actual);
+
+ if Is_Anonymous_Access_Type (Actual_Type) then
+ Actual_Type := Designated_Type (Actual_Type);
+ end if;
+
+ if Nkind (Actual_Or_Prefix)
+ in N_Identifier
+ | N_Expanded_Name
+ | N_Operator_Symbol
+
+ and then Is_Formal (Entity (Actual_Or_Prefix))
+
+ and then Covers (Ctrl_Type, Actual_Type)
+ then
+ -- At least one actual is a formal parameter of
+ -- Par_Subp with type Ctrl_Type.
+
+ return True;
+ end if;
+
+ Next_Actual (Actual);
+ end loop;
+
+ if Nkind (Parent (Call_Node)) = N_Function_Call then
+ return
+ Call_To_Parent_Dispatching_Op_Must_Be_Mapped
+ (Parent (Call_Node));
+ end if;
+
+ return False;
+
+ else
+ return False;
+ end if;
+ end Call_To_Parent_Dispatching_Op_Must_Be_Mapped;
+
+ begin
+ -- If N's entity is in the map, then the entity is either
+ -- a formal of the parent subprogram that should necessarily
+ -- be mapped, or it's a function call's target entity that
+ -- that should be mapped if the call involves any actuals
+ -- that reference formals of the parent subprogram (or the
+ -- function call is part of an enclosing call that similarly
+ -- qualifies for mapping). Rewrite a node that references
+ -- any such qualified entity to a new node referencing the
+ -- corresponding entity associated with the derived type.
+
+ if not Is_Subprogram (Entity (N))
+ or else Nkind (Parent (N)) /= N_Function_Call
+ or else
+ Call_To_Parent_Dispatching_Op_Must_Be_Mapped (Parent (N))
+ then
+ Rewrite (N, New_Occurrence_Of (New_E, Sloc (N)));
+ end if;
+ end;
end if;
-- Update type of function call node, which should be the same as
@@ -5062,12 +5179,13 @@ package body Exp_Util is
function Duplicate_Subexpr
(Exp : Node_Id;
- Name_Req : Boolean := False;
- Renaming_Req : Boolean := False) return Node_Id
+ New_Scope : Entity_Id := Empty;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id
is
begin
Remove_Side_Effects (Exp, Name_Req, Renaming_Req);
- return New_Copy_Tree (Exp);
+ return New_Copy_Tree (Exp, New_Scope => New_Scope);
end Duplicate_Subexpr;
---------------------------------
@@ -5076,8 +5194,9 @@ package body Exp_Util is
function Duplicate_Subexpr_No_Checks
(Exp : Node_Id;
- Name_Req : Boolean := False;
- Renaming_Req : Boolean := False) return Node_Id
+ New_Scope : Entity_Id := Empty;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id
is
New_Exp : Node_Id;
@@ -5087,7 +5206,7 @@ package body Exp_Util is
Name_Req => Name_Req,
Renaming_Req => Renaming_Req);
- New_Exp := New_Copy_Tree (Exp);
+ New_Exp := New_Copy_Tree (Exp, New_Scope => New_Scope);
Remove_Checks (New_Exp);
return New_Exp;
end Duplicate_Subexpr_No_Checks;
@@ -5098,14 +5217,15 @@ package body Exp_Util is
function Duplicate_Subexpr_Move_Checks
(Exp : Node_Id;
- Name_Req : Boolean := False;
- Renaming_Req : Boolean := False) return Node_Id
+ New_Scope : Entity_Id := Empty;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id
is
New_Exp : Node_Id;
begin
Remove_Side_Effects (Exp, Name_Req, Renaming_Req);
- New_Exp := New_Copy_Tree (Exp);
+ New_Exp := New_Copy_Tree (Exp, New_Scope => New_Scope);
Remove_Checks (Exp);
return New_Exp;
end Duplicate_Subexpr_Move_Checks;
@@ -8103,19 +8223,31 @@ package body Exp_Util is
return;
end if;
- -- the expansion of Task and protected type declarations can
+ -- The expansion of task and protected type declarations can
-- create declarations for temporaries which, like other actions
- -- are inserted and analyzed before the current declaraation.
- -- However, the current scope is the synchronized type, and
- -- for unnesting it is critical that the proper scope for these
- -- generated entities be the enclosing one.
+ -- are inserted and analyzed before the current declaration.
+ -- However, in some cases, the current scope is the synchronized
+ -- type, and for unnesting it is critical that the proper scope
+ -- for these generated entities be the enclosing one.
when N_Task_Type_Declaration
| N_Protected_Type_Declaration =>
- Push_Scope (Scope (Current_Scope));
- Insert_List_Before_And_Analyze (P, Ins_Actions);
- Pop_Scope;
+ declare
+ Skip_Scope : constant Boolean :=
+ Ekind (Current_Scope) in Concurrent_Kind;
+ begin
+ if Skip_Scope then
+ Push_Scope (Scope (Current_Scope));
+ end if;
+
+ Insert_List_Before_And_Analyze (P, Ins_Actions);
+
+ if Skip_Scope then
+ Pop_Scope;
+ end if;
+ end;
+
return;
-- A special case, N_Raise_xxx_Error can act either as a statement
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 6178767..1306f5e 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -479,8 +479,9 @@ package Exp_Util is
function Duplicate_Subexpr
(Exp : Node_Id;
- Name_Req : Boolean := False;
- Renaming_Req : Boolean := False) return Node_Id;
+ New_Scope : Entity_Id := Empty;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id;
-- Given the node for a subexpression, this function makes a logical copy
-- of the subexpression, and returns it. This is intended for use when the
-- expansion of an expression needs to repeat part of it. For example,
@@ -494,6 +495,9 @@ package Exp_Util is
-- the caller is responsible for analyzing the returned copy after it is
-- attached to the tree.
--
+ -- The New_Scope entity may be used to specify a new scope for all copied
+ -- entities and itypes.
+ --
-- The Name_Req flag is set to ensure that the result is suitable for use
-- in a context requiring a name (for example, the prefix of an attribute
-- reference).
@@ -509,8 +513,9 @@ package Exp_Util is
function Duplicate_Subexpr_No_Checks
(Exp : Node_Id;
- Name_Req : Boolean := False;
- Renaming_Req : Boolean := False) return Node_Id;
+ New_Scope : Entity_Id := Empty;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id;
-- Identical in effect to Duplicate_Subexpr, except that Remove_Checks is
-- called on the result, so that the duplicated expression does not include
-- checks. This is appropriate for use when Exp, the original expression is
@@ -519,8 +524,9 @@ package Exp_Util is
function Duplicate_Subexpr_Move_Checks
(Exp : Node_Id;
- Name_Req : Boolean := False;
- Renaming_Req : Boolean := False) return Node_Id;
+ New_Scope : Entity_Id := Empty;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id;
-- Identical in effect to Duplicate_Subexpr, except that Remove_Checks is
-- called on Exp after the duplication is complete, so that the original
-- expression does not include checks. In this case the result returned
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 54b6202..eb751e1 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -6869,9 +6869,10 @@ package body Freeze is
end if;
end if;
- -- Static objects require special handling
+ -- Statically allocated objects require special handling
if (Ekind (E) = E_Constant or else Ekind (E) = E_Variable)
+ and then No (Renamed_Object (E))
and then Is_Statically_Allocated (E)
then
Freeze_Static_Object (E);
@@ -10230,11 +10231,17 @@ package body Freeze is
-- issue an error message saying that this object cannot be imported
-- or exported. If it has an address clause it is an overlay in the
-- current partition and the static requirement is not relevant.
- -- Do not issue any error message when ignoring rep clauses.
+ -- Do not issue any error message when ignoring rep clauses or for
+ -- compiler-generated entities.
if Ignore_Rep_Clauses then
null;
+ elsif not Comes_From_Source (E) then
+ pragma
+ Assert (Nkind (Parent (Declaration_Node (E))) in N_Case_Statement
+ | N_If_Statement);
+
elsif Is_Imported (E) then
if No (Address_Clause (E)) then
Error_Msg_N
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 97469d7..e38e3d6 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -939,10 +939,9 @@ Simpler Accessibility Model
* Subprogram parameters::
* Function results::
-No_Raise aspect
+Generalized Finalization
-* New specification for Ada.Finalization.Controlled: New specification for Ada Finalization Controlled.
-* Finalized tagged types::
+* Finalizable tagged types::
* Composite types::
* Interoperability with controlled types::
@@ -12360,9 +12359,9 @@ which changes element (1,2) to 20 and (3,4) to 30.
@geindex Valid_Value
The @code{'Valid_Value} attribute is defined for enumeration types other than
-those in package Standard. This attribute is a function that takes
-a String, and returns Boolean. @code{T'Valid_Value (S)} returns True
-if and only if @code{T'Value (S)} would not raise Constraint_Error.
+those in package Standard or types derived from those types. This attribute is
+a function that takes a String, and returns Boolean. @code{T'Valid_Value (S)}
+returns True if and only if @code{T'Value (S)} would not raise Constraint_Error.
@node Attribute Valid_Scalars,Attribute VADS_Size,Attribute Valid_Value,Implementation Defined Attributes
@anchor{gnat_rm/implementation_defined_attributes attribute-valid-scalars}@anchor{1c5}
@@ -30867,27 +30866,24 @@ that the record type must be a root type, in other words not a derived type.
The aspect additionally makes it possible to specify relaxed semantics for
the finalization operations by means of the @code{Relaxed_Finalization} setting.
-
-Example:
+Here is the archetypal example:
@example
-type Ctrl is record
- Id : Natural := 0;
+type T is record
+ ...
end record
with Finalizable => (Initialize => Initialize,
Adjust => Adjust,
Finalize => Finalize,
Relaxed_Finalization => True);
-procedure Adjust (Obj : in out Ctrl);
-procedure Finalize (Obj : in out Ctrl);
-procedure Initialize (Obj : in out Ctrl);
+procedure Adjust (Obj : in out T);
+procedure Finalize (Obj : in out T);
+procedure Initialize (Obj : in out T);
@end example
-The three procedures have the same profile, taking a single @code{in out T}
-parameter.
-
-We follow the same dynamic semantics as controlled objects:
+The three procedures have the same profile, with a single @code{in out} parameter,
+and also have the same dynamic semantics as for controlled types:
@quotation
@@ -30896,98 +30892,49 @@ We follow the same dynamic semantics as controlled objects:
@item
@code{Initialize} is called when an object of type @code{T} is declared without
-default expression.
+initialization expression.
@item
@code{Adjust} is called after an object of type @code{T} is assigned a new value.
@item
@code{Finalize} is called when an object of type @code{T} goes out of scope (for
-stack-allocated objects) or is explicitly deallocated (for heap-allocated
-objects). It is also called when on the value being replaced in an
-assignment.
+stack-allocated objects) or is deallocated (for heap-allocated objects).
+It is also called when the value is replaced by an assignment.
@end itemize
@end quotation
-However the following differences are enforced by default when compared to the
-current Ada controlled-objects finalization model:
+However, when @code{Relaxed_Finalization} is either @code{True} or not explicitly
+specified, the following differences are implemented relative to the semantics
+of controlled types:
@itemize *
@item
-No automatic finalization of heap allocated objects: @code{Finalize} is only
-called when an object is implicitly deallocated. As a consequence, no-runtime
-support is needed for the implicit case, and no header will be maintained for
-this in heap-allocated controlled objects.
+The compiler has permission to perform no automatic finalization of
+heap-allocated objects: @code{Finalize} is only called when such an object
+is explicitly deallocated, or when the designated object is assigned a new
+value. As a consequence, no runtime support is needed for performing
+implicit deallocation. In particular, no per-object header data is needed
+for heap-allocated objects.
-Heap-allocated objects allocated through a nested access type definition will
-hence `not' be deallocated either. The result is simply that memory will be
-leaked in those cases.
+Heap-allocated objects allocated through a nested access type will therefore
+`not' be deallocated either. The result is simply that memory will be leaked
+in this case.
@item
-The @code{Finalize} procedure should have have the @ref{462,,No_Raise aspect} specified.
-If that’s not the case, a compilation error will be raised.
+The @code{Adjust} and @code{Finalize} procedures are automatically considered as
+having the @ref{466,,No_Raise aspect} specified for them. In particular, the
+compiler has permission to enforce none of the guarantees specified by the
+RM 7.6.1 (14/1) and subsequent subclauses.
@end itemize
-Additionally, two other configuration aspects are added,
-@code{Legacy_Heap_Finalization} and @code{Exceptions_In_Finalize}:
-
-
-@itemize *
-
-@item
-@code{Legacy_Heap_Finalization}: Uses the legacy automatic finalization of
-heap-allocated objects
-
-@item
-@code{Exceptions_In_Finalize}: Allow users to have a finalizer that raises exceptions
-`NB!' note that using this aspect introduces execution time penalities.
-@end itemize
-
-@node No_Raise aspect,Inference of Dependent Types in Generic Instantiations,Generalized Finalization,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions id3}@anchor{463}@anchor{gnat_rm/gnat_language_extensions no-raise-aspect}@anchor{462}
-@subsection No_Raise aspect
-
-
-The @code{No_Raise} aspect can be applied to a subprogram to declare that this subprogram is not
-expected to raise any exceptions. Should an exception still occur during the execution of
-this subprogram, @code{Program_Error} is raised.
-
-@menu
-* New specification for Ada.Finalization.Controlled: New specification for Ada Finalization Controlled.
-* Finalized tagged types::
-* Composite types::
-* Interoperability with controlled types::
-
-@end menu
-
-@node New specification for Ada Finalization Controlled,Finalized tagged types,,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions new-specification-for-ada-finalization-controlled}@anchor{464}
-@subsubsection New specification for @code{Ada.Finalization.Controlled}
-
-
-@code{Ada.Finalization.Controlled} is now specified as:
-
-@example
-type Controlled is abstract tagged null record
- with Initialize => Initialize,
- Adjust => Adjust,
- Finalize => Finalize,
- Legacy_Heap_Finalization, Exceptions_In_Finalize;
-
- procedure Initialize (Self : in out Controlled) is abstract;
- procedure Adjust (Self : in out Controlled) is abstract;
- procedure Finalize (Self : in out Controlled) is abstract;
-@end example
-
-### Examples
-
-A simple example of a ref-counted type:
+Simple example of ref-counted type:
@example
type T is record
- Value : Integer;
+ Value : Integer;
Ref_Count : Natural := 0;
end record;
@@ -30999,8 +30946,8 @@ type T_Access is access all T;
type T_Ref is record
Value : T_Access;
end record
- with Adjust => Adjust,
- Finalize => Finalize;
+ with Finalizable => (Adjust => Adjust,
+ Finalize => Finalize);
procedure Adjust (Ref : in out T_Ref) is
begin
@@ -31013,7 +30960,7 @@ begin
end Finalize;
@end example
-A simple file handle that ensures resources are properly released:
+Simple file handle that ensures resources are properly released:
@example
package P is
@@ -31022,66 +30969,64 @@ package P is
function Open (Path : String) return File;
procedure Close (F : in out File);
+
private
type File is limited record
Handle : ...;
end record
- with Finalize => Close;
+ with Finalizable (Finalize => Close);
+end P;
@end example
-@node Finalized tagged types,Composite types,New specification for Ada Finalization Controlled,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions finalized-tagged-types}@anchor{465}
-@subsubsection Finalized tagged types
-
+@menu
+* Finalizable tagged types::
+* Composite types::
+* Interoperability with controlled types::
-Aspects are inherited by derived types and optionally overriden by those. The
-compiler-generated calls to the user-defined operations are then
-dispatching whenever it makes sense, i.e. the object in question is of
-class-wide type and the class includes at least one finalized tagged type.
+@end menu
-However note that for simplicity, it is forbidden to change the value of any of
-those new aspects in derived types.
+@node Finalizable tagged types,Composite types,,Generalized Finalization
+@anchor{gnat_rm/gnat_language_extensions finalizable-tagged-types}@anchor{463}
+@subsubsection Finalizable tagged types
-@node Composite types,Interoperability with controlled types,Finalized tagged types,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions composite-types}@anchor{466}
-@subsubsection Composite types
+The aspect is inherited by derived types and the primitives may be overridden
+by the derivation. The compiler-generated calls to these operations are then
+dispatching whenever it makes sense, i.e. when the object in question is of a
+class-wide type and the class includes at least one finalizable tagged type.
-When a finalized type is used as a component of a composite type, the latter
-becomes finalized as well. The three primitives are derived automatically
-in order to call the primitives of their components.
+@node Composite types,Interoperability with controlled types,Finalizable tagged types,Generalized Finalization
+@anchor{gnat_rm/gnat_language_extensions composite-types}@anchor{464}
+@subsubsection Composite types
-If that composite type was already user-finalized, then the compiler
-calls the primitives of the components so as to stay consistent with today’s
-controlled types’s behavior.
-So, @code{Initialize} and @code{Adjust} are called on components before they
-are called on the composite object, but @code{Finalize} is called on the composite
-object first.
+When a finalizable type is used as a component of a composite type, the latter
+becomes finalizable as well. The three primitives are derived automatically
+in order to call the primitives of their components. The dynamic semantics is
+the same as for controlled components of composite types.
-@node Interoperability with controlled types,,Composite types,No_Raise aspect
-@anchor{gnat_rm/gnat_language_extensions interoperability-with-controlled-types}@anchor{467}
+@node Interoperability with controlled types,,Composite types,Generalized Finalization
+@anchor{gnat_rm/gnat_language_extensions interoperability-with-controlled-types}@anchor{465}
@subsubsection Interoperability with controlled types
-As a consequence of the redefinition of the @code{Controlled} type as a base type
-with the new aspects defined, interoperability with controlled type naturally
-follows the definition of the above rules. In particular:
-
+Finalizable types are fully interoperable with controlled types, in particular
+it is possible for a finalizable type to have a controlled component and vice
+versa, but the stricter dynamic semantics, in other words that of controlled
+types, is applied in this case.
-@itemize *
+@node No_Raise aspect,Inference of Dependent Types in Generic Instantiations,Generalized Finalization,Experimental Language Extensions
+@anchor{gnat_rm/gnat_language_extensions no-raise-aspect}@anchor{466}
+@subsection No_Raise aspect
-@item
-It is possible to have a new finalized type have a controlled type
-component
-@item
-It is possible to have a controlled type have a finalized type
-component
-@end itemize
+The @code{No_Raise} aspect can be applied to a subprogram to declare that this
+subprogram is not expected to raise an exception. Should an exception still
+be raised during the execution of the subprogram, it is caught at the end of
+this execution and @code{Program_Error} is propagated to the caller.
@node Inference of Dependent Types in Generic Instantiations,External_Initialization Aspect,No_Raise aspect,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions inference-of-dependent-types-in-generic-instantiations}@anchor{468}
+@anchor{gnat_rm/gnat_language_extensions inference-of-dependent-types-in-generic-instantiations}@anchor{467}
@subsection Inference of Dependent Types in Generic Instantiations
@@ -31158,7 +31103,7 @@ package Int_Array_Operations is new Array_Operations
@end example
@node External_Initialization Aspect,Finally construct,Inference of Dependent Types in Generic Instantiations,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions external-initialization-aspect}@anchor{469}
+@anchor{gnat_rm/gnat_language_extensions external-initialization-aspect}@anchor{468}
@subsection External_Initialization Aspect
@@ -31199,7 +31144,7 @@ The maximum size of loaded files is limited to 2@w{^31} bytes.
@end cartouche
@node Finally construct,,External_Initialization Aspect,Experimental Language Extensions
-@anchor{gnat_rm/gnat_language_extensions finally-construct}@anchor{46a}
+@anchor{gnat_rm/gnat_language_extensions finally-construct}
@subsection Finally construct
@@ -31216,7 +31161,7 @@ This feature is similar to the one with the same name in other languages such as
@end menu
@node Syntax<2>,Legality Rules<2>,,Finally construct
-@anchor{gnat_rm/gnat_language_extensions id4}@anchor{46b}
+@anchor{gnat_rm/gnat_language_extensions id4}@anchor{46a}
@subsubsection Syntax
@@ -31231,7 +31176,7 @@ handled_sequence_of_statements ::=
@end example
@node Legality Rules<2>,Dynamic Semantics<2>,Syntax<2>,Finally construct
-@anchor{gnat_rm/gnat_language_extensions id5}@anchor{46c}
+@anchor{gnat_rm/gnat_language_extensions id5}@anchor{46b}
@subsubsection Legality Rules
@@ -31241,7 +31186,7 @@ to be transferred outside the finally part are forbidden.
Goto & exit where the target is outside of the finally’s @code{sequence_of_statements} are forbidden
@node Dynamic Semantics<2>,,Legality Rules<2>,Finally construct
-@anchor{gnat_rm/gnat_language_extensions id6}@anchor{46d}
+@anchor{gnat_rm/gnat_language_extensions id6}@anchor{46c}
@subsubsection Dynamic Semantics
@@ -31256,7 +31201,7 @@ execution, that is the finally block must be executed in full even if the contai
aborted, or if the control is transferred out of the block.
@node Security Hardening Features,Obsolescent Features,GNAT language extensions,Top
-@anchor{gnat_rm/security_hardening_features doc}@anchor{46e}@anchor{gnat_rm/security_hardening_features id1}@anchor{46f}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15}
+@anchor{gnat_rm/security_hardening_features doc}@anchor{46d}@anchor{gnat_rm/security_hardening_features id1}@anchor{46e}@anchor{gnat_rm/security_hardening_features security-hardening-features}@anchor{15}
@chapter Security Hardening Features
@@ -31278,7 +31223,7 @@ change.
@end menu
@node Register Scrubbing,Stack Scrubbing,,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{470}
+@anchor{gnat_rm/security_hardening_features register-scrubbing}@anchor{469}
@section Register Scrubbing
@@ -31314,7 +31259,7 @@ programming languages, see @cite{Using the GNU Compiler Collection (GCC)}.
@c Stack Scrubbing:
@node Stack Scrubbing,Hardened Conditionals,Register Scrubbing,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{471}
+@anchor{gnat_rm/security_hardening_features stack-scrubbing}@anchor{470}
@section Stack Scrubbing
@@ -31458,7 +31403,7 @@ Bar_Callable_Ptr.
@c Hardened Conditionals:
@node Hardened Conditionals,Hardened Booleans,Stack Scrubbing,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{472}
+@anchor{gnat_rm/security_hardening_features hardened-conditionals}@anchor{471}
@section Hardened Conditionals
@@ -31548,7 +31493,7 @@ be used with other programming languages supported by GCC.
@c Hardened Booleans:
@node Hardened Booleans,Control Flow Redundancy,Hardened Conditionals,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{473}
+@anchor{gnat_rm/security_hardening_features hardened-booleans}@anchor{472}
@section Hardened Booleans
@@ -31609,7 +31554,7 @@ and more details on that attribute, see @cite{Using the GNU Compiler Collection
@c Control Flow Redundancy:
@node Control Flow Redundancy,,Hardened Booleans,Security Hardening Features
-@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{474}
+@anchor{gnat_rm/security_hardening_features control-flow-redundancy}@anchor{473}
@section Control Flow Redundancy
@@ -31777,7 +31722,7 @@ see @cite{Using the GNU Compiler Collection (GCC)}. These options
can be used with other programming languages supported by GCC.
@node Obsolescent Features,Compatibility and Porting Guide,Security Hardening Features,Top
-@anchor{gnat_rm/obsolescent_features doc}@anchor{475}@anchor{gnat_rm/obsolescent_features id1}@anchor{476}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16}
+@anchor{gnat_rm/obsolescent_features doc}@anchor{474}@anchor{gnat_rm/obsolescent_features id1}@anchor{475}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{16}
@chapter Obsolescent Features
@@ -31796,7 +31741,7 @@ compatibility purposes.
@end menu
@node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id2}@anchor{477}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{478}
+@anchor{gnat_rm/obsolescent_features id2}@anchor{476}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{477}
@section pragma No_Run_Time
@@ -31809,7 +31754,7 @@ preferred usage is to use an appropriately configured run-time that
includes just those features that are to be made accessible.
@node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id3}@anchor{479}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{47a}
+@anchor{gnat_rm/obsolescent_features id3}@anchor{478}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{479}
@section pragma Ravenscar
@@ -31818,7 +31763,7 @@ The pragma @code{Ravenscar} has exactly the same effect as pragma
is part of the new Ada 2005 standard.
@node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id4}@anchor{47b}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{47c}
+@anchor{gnat_rm/obsolescent_features id4}@anchor{47a}@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{47b}
@section pragma Restricted_Run_Time
@@ -31828,7 +31773,7 @@ preferred since the Ada 2005 pragma @code{Profile} is intended for
this kind of implementation dependent addition.
@node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id5}@anchor{47d}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{47e}
+@anchor{gnat_rm/obsolescent_features id5}@anchor{47c}@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{47d}
@section pragma Task_Info
@@ -31854,7 +31799,7 @@ in the spec of package System.Task_Info in the runtime
library.
@node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{47f}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{480}
+@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{47e}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{47f}
@section package System.Task_Info (@code{s-tasinf.ads})
@@ -31864,7 +31809,7 @@ to support the @code{Task_Info} pragma. The predefined Ada package
standard replacement for GNAT’s @code{Task_Info} functionality.
@node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
-@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{481}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{482}
+@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{480}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{17}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{481}
@chapter Compatibility and Porting Guide
@@ -31886,7 +31831,7 @@ applications developed in other Ada environments.
@end menu
@node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{483}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{484}
+@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{482}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{483}
@section Writing Portable Fixed-Point Declarations
@@ -32008,7 +31953,7 @@ If you follow this scheme you will be guaranteed that your fixed-point
types will be portable.
@node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{485}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{486}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{484}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{485}
@section Compatibility with Ada 83
@@ -32036,7 +31981,7 @@ following subsections treat the most likely issues to be encountered.
@end menu
@node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{487}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{488}
+@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{486}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{487}
@subsection Legal Ada 83 programs that are illegal in Ada 95
@@ -32136,7 +32081,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration.
@end itemize
@node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{489}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{48a}
+@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{488}@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{489}
@subsection More deterministic semantics
@@ -32164,7 +32109,7 @@ which open select branches are executed.
@end itemize
@node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{48b}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{48c}
+@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{48a}@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{48b}
@subsection Changed semantics
@@ -32239,7 +32184,7 @@ include @code{pragma Interface} and the floating point type attributes
@end itemize
@node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{48f}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{490}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{48f}
@section Compatibility between Ada 95 and Ada 2005
@@ -32311,7 +32256,7 @@ can declare a function returning a value from an anonymous access type.
@end itemize
@node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{491}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{492}
+@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{490}@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{491}
@section Implementation-dependent characteristics
@@ -32334,7 +32279,7 @@ transition from certain Ada 83 compilers.
@end menu
@node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{493}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{494}
+@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{492}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{493}
@subsection Implementation-defined pragmas
@@ -32356,7 +32301,7 @@ avoiding compiler rejection of units that contain such pragmas; they are not
relevant in a GNAT context and hence are not otherwise implemented.
@node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{495}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{496}
+@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{494}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{495}
@subsection Implementation-defined attributes
@@ -32370,7 +32315,7 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
@code{Type_Class}.
@node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{497}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{498}
+@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{496}@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{497}
@subsection Libraries
@@ -32399,7 +32344,7 @@ be preferable to retrofit the application using modular types.
@end itemize
@node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{499}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{49a}
+@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{498}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{499}
@subsection Elaboration order
@@ -32435,7 +32380,7 @@ pragmas either globally (as an effect of the `-gnatE' switch) or locally
@end itemize
@node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{49b}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{49c}
+@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{49a}@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{49b}
@subsection Target-specific aspects
@@ -32448,10 +32393,10 @@ on the robustness of the original design. Moreover, Ada 95 (and thus
Ada 2005 and Ada 2012) are sometimes
incompatible with typical Ada 83 compiler practices regarding implicit
packing, the meaning of the Size attribute, and the size of access values.
-GNAT’s approach to these issues is described in @ref{49d,,Representation Clauses}.
+GNAT’s approach to these issues is described in @ref{49c,,Representation Clauses}.
@node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{49e}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{49f}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{49d}@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{49e}
@section Compatibility with Other Ada Systems
@@ -32494,7 +32439,7 @@ far beyond this minimal set, as described in the next section.
@end itemize
@node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{4a0}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{49d}
+@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{49f}@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{49c}
@section Representation Clauses
@@ -32587,7 +32532,7 @@ with thin pointers.
@end itemize
@node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{4a1}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{4a2}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{4a0}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{4a1}
@section Compatibility with HP Ada 83
@@ -32617,7 +32562,7 @@ extension of package System.
@end itemize
@node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
-@anchor{share/gnu_free_documentation_license doc}@anchor{4a3}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a4}
+@anchor{share/gnu_free_documentation_license doc}@anchor{4a2}@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{4a3}
@chapter GNU Free Documentation License
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 2579b31..114a891 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -10072,7 +10072,7 @@ Library (RTL) ALI files.
@code{n} controls the optimization level:
-@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
+@multitable {xxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
@item
`n'
@@ -10087,7 +10087,7 @@ Effect
@tab
-No optimization, the default setting if no @code{-O} appears
+No optimization, the default setting if no @code{-O} appears.
@item
@@ -10095,9 +10095,8 @@ No optimization, the default setting if no @code{-O} appears
@tab
-Normal optimization, the default if you specify @code{-O} without an
-operand. A good compromise between code quality and compilation
-time.
+Moderate optimization, same as @code{-O} without an operand.
+A good compromise between code quality and compilation time.
@item
@@ -10105,7 +10104,7 @@ time.
@tab
-Extensive optimization, may improve execution time, possibly at
+Extensive optimization, should improve execution time, possibly at
the cost of substantially increased compilation time.
@item
@@ -10114,8 +10113,8 @@ the cost of substantially increased compilation time.
@tab
-Same as @code{-O2}, and also includes inline expansion for small
-subprograms in the same unit.
+Full optimization, may further improve execution time, possibly at
+the cost of substantially larger generated code.
@item
@@ -10123,7 +10122,23 @@ subprograms in the same unit.
@tab
-Optimize space usage
+Optimize for size (code and data) rather than speed.
+
+@item
+
+`z'
+
+@tab
+
+Optimize aggressively for size (code and data) rather than speed.
+
+@item
+
+`g'
+
+@tab
+
+Optimize for debugging experience rather than speed.
@end multitable
@@ -20277,13 +20292,12 @@ Turning on optimization makes the compiler attempt to improve the
performance and/or code size at the expense of compilation time and
possibly the ability to debug the program.
-If you use multiple @code{-O} switches, with or without level
-numbers, the last such switch is the one that’s used.
-
-You can use the
-@code{-O} switch (the permitted forms are @code{-O0}, @code{-O1}
-@code{-O2}, @code{-O3}, and @code{-Os})
-to @code{gcc} to control the optimization level:
+You can pass the @code{-O} switch, with or without an operand
+(the permitted forms with an operand are @code{-O0}, @code{-O1},
+@code{-O2}, @code{-O3}, @code{-Os}, @code{-Oz}, and
+@code{-Og}) to @code{gcc} to control the optimization level. If you
+pass multiple @code{-O} switches, with or without an operand,
+the last such switch is the one that’s used:
@itemize *
@@ -20294,8 +20308,7 @@ to @code{gcc} to control the optimization level:
@item @code{-O0}
-No optimization (the default);
-generates unoptimized code but has
+No optimization (the default); generates unoptimized code but has
the fastest compilation time. Debugging is easiest with this switch.
Note that many other compilers do substantial optimization even if
@@ -20312,10 +20325,11 @@ mind when doing performance comparisons.
@item @code{-O1}
-Moderate optimization; optimizes reasonably well but does not
-degrade compilation time significantly. You may not be able to see
-some variables in the debugger and changing the value of some
-variables in the debugger may not have the effect you desire.
+Moderate optimization (same as @code{-O} without an operand);
+optimizes reasonably well but does not degrade compilation time
+significantly. You may not be able to see some variables in the
+debugger, and changing the value of some variables in the debugger
+may not have the effect you desire.
@end table
@item
@@ -20324,9 +20338,8 @@ variables in the debugger may not have the effect you desire.
@item @code{-O2}
-Full optimization;
-generates highly optimized code and has
-the slowest compilation time. You may see significant impacts on
+Extensive optimization; generates highly optimized code but has
+an increased compilation time. You may see significant impacts on
your ability to display and modify variables in the debugger.
@end table
@@ -20336,9 +20349,9 @@ your ability to display and modify variables in the debugger.
@item @code{-O3}
-Full optimization as in @code{-O2};
-also uses more aggressive automatic inlining of subprograms within a unit
-(@ref{104,,Inlining of Subprograms}) and attempts to vectorize loops.
+Full optimization; attempts more sophisticated transformations, in
+particular on loops, possibly at the cost of larger generated code.
+You may be hardly able to use the debugger at this optimization level.
@end table
@item
@@ -20347,16 +20360,41 @@ also uses more aggressive automatic inlining of subprograms within a unit
@item @code{-Os}
-Optimize space usage (code and data) of resulting program.
+Optimize for size (code and data) of resulting binary rather than
+speed; based on the @code{-O2} optimization level, but disables
+some of its transformations that often increase code size, as well
+as performs further optimizations designed to reduce code size.
+@end table
+
+@item
+
+@table @asis
+
+@item @code{-Oz}
+
+Optimize aggressively for size (code and data) of resulting binary
+rather than speed; may increase the number of instructions executed
+if these instructions require fewer bytes to be encoded.
+@end table
+
+@item
+
+@table @asis
+
+@item @code{-Og}
+
+Optimize for debugging experience rather than speed; based on the
+@code{-O1} optimization level, but attempts to eliminate all the
+negative effects of optimization on debugging.
@end table
@end itemize
Higher optimization levels perform more global transformations on the
program and apply more expensive analysis algorithms in order to generate
faster and more compact code. The price in compilation time, and the
-resulting improvement in execution time,
-both depend on the particular application and the hardware environment.
-You should experiment to find the best level for your application.
+resulting improvement in execution time, both depend on the particular
+application and the hardware environment. You should experiment to find
+the best level for your application.
Since the precise set of optimizations done at each level will vary from
release to release (and sometime from target to target), it is best to think
diff --git a/gcc/ada/libgnarl/s-stusta.adb b/gcc/ada/libgnarl/s-stusta.adb
index 5aca435..c9848a0 100644
--- a/gcc/ada/libgnarl/s-stusta.adb
+++ b/gcc/ada/libgnarl/s-stusta.adb
@@ -32,6 +32,7 @@
-- This is why this package is part of GNARL:
with System.Tasking.Debug;
+with System.Tasking.Stages;
with System.Task_Primitives.Operations;
with System.IO;
@@ -103,7 +104,9 @@ package body System.Stack_Usage.Tasking is
-- Calculate the task usage for a given task
- Report_For_Task (Id);
+ if not System.Tasking.Stages.Terminated (Id) then
+ Report_For_Task (Id);
+ end if;
end loop;
end if;
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index af08fdb..08da29a 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -7511,13 +7511,14 @@ package body Sem_Attr is
Set_Etype (N, Standard_Boolean);
Validate_Non_Static_Attribute_Function_Call;
- if P_Type in Standard_Boolean
+ if Root_Type (P_Type) in Standard_Boolean
| Standard_Character
| Standard_Wide_Character
| Standard_Wide_Wide_Character
then
Error_Attr_P
- ("prefix of % attribute must not be a type in Standard");
+ ("prefix of % attribute must not be a type originating from " &
+ "Standard");
end if;
if Discard_Names (First_Subtype (P_Type)) then
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
index 3399a41..c81b563 100644
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -3684,13 +3684,15 @@ package body Sem_Case is
-- Use of nonstatic predicate is an error
if not Is_Discrete_Type (E)
- or else not Has_Static_Predicate (E)
+ or else (not Has_Static_Predicate (E)
+ and then
+ not Has_Static_Predicate_Aspect (E))
or else Has_Dynamic_Predicate_Aspect (E)
or else Has_Ghost_Predicate_Aspect (E)
then
Bad_Predicated_Subtype_Use
- ("cannot use subtype& with non-static "
- & "predicate as case alternative",
+ ("cannot use subtype& with nonstatic "
+ & "predicate as choice in case alternative",
Choice, E, Suggest_Static => True);
-- Static predicate case. The bounds are those of
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index de5a8c8..e3d9925 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -4932,6 +4932,8 @@ package body Sem_Ch10 is
if Entity (Name (Clause)) = Id
or else
(Nkind (Name (Clause)) = N_Expanded_Name
+ and then
+ Is_Entity_Name (Prefix (Name (Clause)))
and then Entity (Prefix (Name (Clause))) = Id)
then
return True;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 5768e28e..02c7c36 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -9340,9 +9340,6 @@ package body Sem_Ch12 is
and then Nkind (Ancestor_Type (N)) in N_Entity
then
declare
- Root_Typ : constant Entity_Id :=
- Root_Type (Ancestor_Type (N));
-
Typ : Entity_Id := Ancestor_Type (N);
begin
@@ -9351,7 +9348,7 @@ package body Sem_Ch12 is
Switch_View (Typ);
end if;
- exit when Typ = Root_Typ;
+ exit when Etype (Typ) = Typ;
Typ := Etype (Typ);
end loop;
@@ -14132,6 +14129,16 @@ package body Sem_Ch12 is
T2 := Etype (I2);
end if;
+ -- In the case of a fixed-lower-bound subtype, we want to check
+ -- against the index type's range rather than the range of the
+ -- subtype (which will be seen as unconstrained, and whose bounds
+ -- won't generally match those of the formal unconstrained array
+ -- type's corresponding index type).
+
+ if Is_Fixed_Lower_Bound_Index_Subtype (T2) then
+ T2 := Etype (Scalar_Range (T2));
+ end if;
+
if not Subtypes_Match
(Find_Actual_Type (Etype (I1), A_Gen_T), T2)
then
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 74eac9c..e94b043 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -4991,7 +4991,7 @@ package body Sem_Ch3 is
if Is_Array_Type (T)
and then No_Initialization (N)
- and then Nkind (Original_Node (E)) = N_Aggregate
+ and then Nkind (Unqualify (Original_Node (E))) = N_Aggregate
then
Act_T := Etype (E);
@@ -5137,10 +5137,7 @@ package body Sem_Ch3 is
elsif Is_Array_Type (T)
and then No_Initialization (N)
- and then (Nkind (Original_Node (E)) = N_Aggregate
- or else (Nkind (Original_Node (E)) = N_Qualified_Expression
- and then Nkind (Original_Node (Expression
- (Original_Node (E)))) = N_Aggregate))
+ and then Nkind (Unqualify (Original_Node (E))) = N_Aggregate
then
if not Is_Entity_Name (Object_Definition (N)) then
Act_T := Etype (E);
@@ -6633,8 +6630,6 @@ package body Sem_Ch3 is
end;
end if;
- -- Constrained array case
-
if No (T) then
-- We might be creating more than one itype with the same Related_Id,
-- e.g. for an array object definition and its initial value. Give
@@ -6644,6 +6639,8 @@ package body Sem_Ch3 is
T := Create_Itype (E_Void, P, Related_Id, 'T', Suffix_Index => -1);
end if;
+ -- Constrained array case
+
if Nkind (Def) = N_Constrained_Array_Definition then
Index := First (Discrete_Subtype_Definitions (Def));
@@ -8491,11 +8488,19 @@ package body Sem_Ch3 is
Analyze (Decl);
- pragma Assert (Has_Discriminants (Full_Der)
- and then not Has_Unknown_Discriminants (Full_Der));
+ pragma
+ Assert
+ ((Has_Discriminants (Full_Der)
+ and then not Has_Unknown_Discriminants (Full_Der))
+ or else Serious_Errors_Detected > 0);
Uninstall_Declarations (Par_Scope);
+ if Etype (Full_Der) = Any_Type then
+ pragma Assert (Serious_Errors_Detected > 0);
+ return;
+ end if;
+
-- Freeze the underlying record view, to prevent generation of
-- useless dispatching information, which is simply shared with
-- the real derived type.
@@ -9460,8 +9465,8 @@ package body Sem_Ch3 is
if Constraint_Present then
if not Has_Discriminants (Parent_Base)
or else
- (Has_Unknown_Discriminants (Parent_Base)
- and then Is_Private_Type (Parent_Base))
+ (Has_Unknown_Discriminants (Parent_Type)
+ and then Is_Private_Type (Parent_Type))
then
Error_Msg_N
("invalid constraint: type has no discriminant",
@@ -15095,7 +15100,8 @@ package body Sem_Ch3 is
-- If this is a range for a fixed-lower-bound subtype, then set the
-- index itype's low bound to the FLB and the index itype's upper bound
-- to the high bound of the parent array type's index subtype. Also,
- -- mark the itype as an FLB index subtype.
+ -- set the Etype of the new scalar range and mark the itype as an FLB
+ -- index subtype.
if Nkind (S) = N_Range and then Is_FLB_Index then
Set_Scalar_Range
@@ -15103,6 +15109,7 @@ package body Sem_Ch3 is
Make_Range (Sloc (S),
Low_Bound => Low_Bound (S),
High_Bound => Type_High_Bound (T)));
+ Set_Etype (Scalar_Range (Def_Id), Etype (Index));
Set_Is_Fixed_Lower_Bound_Index_Subtype (Def_Id);
else
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 4069839..8be9647 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -308,8 +308,12 @@ package body Sem_Ch4 is
(N : Node_Id;
Prefix : Node_Id;
Exprs : List_Id) return Boolean;
- -- AI05-0139: Generalized indexing to support iterators over containers
- -- ??? Need to provide a more detailed spec of what this function does
+ -- AI05-0139: Generalized indexing to support iterators over containers.
+ -- Given the N_Indexed_Component node N, with the given prefix and
+ -- expressions list, check if the generalized indexing is applicable;
+ -- if applicable then build its indexing function, link it to N through
+ -- attribute Generalized_Indexing, and return True; otherwise return
+ -- False.
function Try_Indexed_Call
(N : Node_Id;
@@ -7642,35 +7646,14 @@ package body Sem_Ch4 is
begin
if not Is_Overloaded (R) then
if Is_Numeric_Type (Etype (R)) then
-
- -- In an instance a generic actual may be a numeric type even if
- -- the formal in the generic unit was not. In that case, the
- -- predefined operator was not a possible interpretation in the
- -- generic, and cannot be one in the instance, unless the operator
- -- is an actual of an instance.
-
- if In_Instance
- and then
- not Is_Numeric_Type (Corresponding_Generic_Type (Etype (R)))
- then
- null;
- else
- Add_One_Interp (N, Op_Id, Base_Type (Etype (R)));
- end if;
+ Add_One_Interp (N, Op_Id, Base_Type (Etype (R)));
end if;
else
Get_First_Interp (R, Index, It);
while Present (It.Typ) loop
if Is_Numeric_Type (It.Typ) then
- if In_Instance
- and then
- not Is_Numeric_Type
- (Corresponding_Generic_Type (Etype (It.Typ)))
- then
- null;
-
- elsif Is_Effectively_Visible_Operator (N, Base_Type (It.Typ))
+ if Is_Effectively_Visible_Operator (N, Base_Type (It.Typ))
then
Add_One_Interp (N, Op_Id, Base_Type (It.Typ));
end if;
@@ -8533,21 +8516,29 @@ package body Sem_Ch4 is
Prefix : Node_Id;
Exprs : List_Id) return Boolean
is
- Pref_Typ : Entity_Id := Etype (Prefix);
+ Heuristic : Boolean := False;
+ Pref_Typ : Entity_Id := Etype (Prefix);
function Constant_Indexing_OK return Boolean;
- -- Constant_Indexing is legal if there is no Variable_Indexing defined
- -- for the type, or else node not a target of assignment, or an actual
- -- for an IN OUT or OUT formal (RM 4.1.6 (11)).
-
- function Expr_Matches_In_Formal
- (Subp : Entity_Id;
- Par : Node_Id) return Boolean;
- -- Find formal corresponding to given indexed component that is an
- -- actual in a call. Note that the enclosing subprogram call has not
- -- been analyzed yet, and the parameter list is not normalized, so
- -- that if the argument is a parameter association we must match it
- -- by name and not by position.
+ -- Determines whether the Constant_Indexing aspect has been specified
+ -- for the type of the prefix and can be interpreted as constant
+ -- indexing; that is, there is no Variable_Indexing defined for the
+ -- type, or else the node is not a target of an assignment, or an
+ -- actual for an IN OUT or OUT formal, or the name in an object
+ -- renaming (RM 4.1.6 (12/3..15/3)).
+ --
+ -- Given that prefix notation calls have not yet been resolved, if the
+ -- type of the prefix has both aspects present (Constant_Indexing and
+ -- Variable_Indexing), and context analysis performed by this routine
+ -- identifies a potential prefix notation call (i.e., an N_Selected_
+ -- Component node), this function may rely on heuristics to decide
+ -- between constant or variable indexing. In such cases, if the
+ -- decision is later found to be incorrect, Try_Container_Indexing
+ -- will retry using the alternative indexing aspect.
+
+ -- When heuristics are used to compute the result of this function
+ -- the behavior of Try_Container_Indexing might not be strictly
+ -- following the rules of the RM.
function Indexing_Interpretations
(T : Entity_Id;
@@ -8555,59 +8546,429 @@ package body Sem_Ch4 is
-- Return a set of interpretations reflecting all of the functions
-- associated with an indexing aspect of type T of the given kind.
+ function Try_Indexing_Function
+ (Func_Name : Node_Id;
+ Assoc : List_Id) return Entity_Id;
+ -- Build a call to the given indexing function name with the given
+ -- parameter associations; if there are several indexing functions
+ -- the call is analyzed for each of the interpretation; if there are
+ -- several successfull candidates, resolution is handled by result.
+ -- Return the Etype of the built function call.
+
--------------------------
-- Constant_Indexing_OK --
--------------------------
function Constant_Indexing_OK return Boolean is
- Par : Node_Id;
+
+ function Expr_Matches_In_Formal
+ (Subp : Entity_Id;
+ Subp_Call : Node_Id;
+ Param : Node_Id;
+ Skip_Controlling_Formal : Boolean := False) return Boolean;
+ -- Find formal corresponding to given indexed component that is an
+ -- actual in a call. Note that the enclosing subprogram call has not
+ -- been analyzed yet, and the parameter list is not normalized, so
+ -- that if the argument is a parameter association we must match it
+ -- by name and not by position. In the traversal up the tree done by
+ -- Constant_Indexing_OK, the previous node in the traversal (that is,
+ -- the actual parameter used to ascend to the subprogram call node),
+ -- is passed to this function in formal Param, and it is used to
+ -- determine wether the argument is passed by name or by position.
+ -- Skip_Controlling_Formal is set to True to skip the first formal
+ -- of Subp.
+
+ procedure Handle_Selected_Component
+ (Current_Node : Node_Id;
+ Sel_Comp : Node_Id;
+ Candidate : out Entity_Id;
+ Is_Constant_Idx : out Boolean);
+ -- Current_Node is the current node climbing up the tree. Determine
+ -- if Sel_Comp is a candidate for a prefixed call using constant
+ -- indexing; if no candidate is found Candidate is returned Empty
+ -- and Is_Constant_Idx is returned False.
+
+ function Has_IN_Mode (Formal : Node_Id) return Boolean is
+ (Ekind (Formal) = E_In_Parameter);
+ -- Return True if the given formal has mode IN
+
+ ----------------------------
+ -- Expr_Matches_In_Formal --
+ ----------------------------
+
+ function Expr_Matches_In_Formal
+ (Subp : Entity_Id;
+ Subp_Call : Node_Id;
+ Param : Node_Id;
+ Skip_Controlling_Formal : Boolean := False) return Boolean
+ is
+ pragma Assert (Nkind (Subp_Call) in N_Subprogram_Call);
+
+ Actual : Node_Id := First (Parameter_Associations (Subp_Call));
+ Formal : Node_Id := First_Formal (Subp);
+
+ begin
+ if Skip_Controlling_Formal then
+ Next_Formal (Formal);
+ end if;
+
+ -- Match by position
+
+ if Nkind (Param) /= N_Parameter_Association then
+ while Present (Actual) and then Present (Formal) loop
+ exit when Actual = Param;
+ Next (Actual);
+
+ if Present (Formal) then
+ Next_Formal (Formal);
+
+ -- Otherwise this is a parameter mismatch, the error is
+ -- reported elsewhere, or else variable indexing is implied.
+
+ else
+ return False;
+ end if;
+ end loop;
+
+ -- Match by name
+
+ else
+ while Present (Formal) loop
+ exit when Chars (Formal) = Chars (Selector_Name (Param));
+ Next_Formal (Formal);
+
+ if No (Formal) then
+ return False;
+ end if;
+ end loop;
+ end if;
+
+ return Present (Formal) and then Has_IN_Mode (Formal);
+ end Expr_Matches_In_Formal;
+
+ -------------------------------
+ -- Handle_Selected_Component --
+ -------------------------------
+
+ procedure Handle_Selected_Component
+ (Current_Node : Node_Id;
+ Sel_Comp : Node_Id;
+ Candidate : out Entity_Id;
+ Is_Constant_Idx : out Boolean)
+ is
+ procedure Search_Constant_Interpretation
+ (Call : Node_Id;
+ Target_Name : Node_Id;
+ Candidate : out Entity_Id;
+ Is_Unique : out Boolean;
+ Unique_Mode : out Boolean);
+ -- Given a subprogram call, search in the homonyms chain for
+ -- visible (or potentially visible) dispatching primitives that
+ -- have at least one formal. Candidate is the entity of the first
+ -- found candidate; Is_Unique is returned True when the mode of
+ -- the first formal of all the candidates match. If no candidate
+ -- is found the out parameter Candidate is returned Empty, and
+ -- Is_Unique is returned False.
+
+ procedure Search_Enclosing_Call
+ (Call_Node : out Node_Id;
+ Prev_Node : out Node_Id);
+ -- Climb up to the tree looking for an enclosing subprogram call
+ -- of a prefixed notation call. If found then the Call_Node and
+ -- its Prev_Node in such traversal are returned; otherwise
+ -- Call_Node and Prev_Node are returned Empty.
+
+ ------------------------------------
+ -- Search_Constant_Interpretation --
+ ------------------------------------
+
+ procedure Search_Constant_Interpretation
+ (Call : Node_Id;
+ Target_Name : Node_Id;
+ Candidate : out Entity_Id;
+ Is_Unique : out Boolean;
+ Unique_Mode : out Boolean)
+ is
+ Constant_Idx : Boolean;
+ In_Proc_Call : constant Boolean :=
+ Present (Call)
+ and then
+ Nkind (Call) = N_Procedure_Call_Statement;
+ Kind : constant Entity_Kind :=
+ (if In_Proc_Call then E_Procedure
+ else E_Function);
+ Target_Subp : constant Entity_Id :=
+ Current_Entity (Target_Name);
+ begin
+ Candidate := Empty;
+ Is_Unique := False;
+ Unique_Mode := False;
+
+ if Present (Target_Subp) then
+ declare
+ Hom : Entity_Id := Target_Subp;
+
+ begin
+ while Present (Hom) loop
+ if Is_Overloadable (Hom)
+ and then Is_Dispatching_Operation (Hom)
+ and then
+ (Is_Immediately_Visible (Scope (Hom))
+ or else
+ Is_Potentially_Use_Visible (Scope (Hom)))
+ and then Ekind (Hom) = Kind
+ and then Present (First_Formal (Hom))
+ then
+ if No (Candidate) then
+ Candidate := Hom;
+ Is_Unique := True;
+ Unique_Mode := True;
+ Constant_Idx :=
+ Has_IN_Mode (First_Formal (Candidate));
+
+ else
+ Is_Unique := False;
+
+ if Ekind (First_Formal (Hom))
+ /= Ekind (First_Formal (Candidate))
+ or else Has_IN_Mode (First_Formal (Hom))
+ /= Constant_Idx
+ then
+ Unique_Mode := False;
+ exit;
+ end if;
+ end if;
+ end if;
+
+ Hom := Homonym (Hom);
+ end loop;
+ end;
+ end if;
+ end Search_Constant_Interpretation;
+
+ ---------------------------
+ -- Search_Enclosing_Call --
+ ---------------------------
+
+ procedure Search_Enclosing_Call
+ (Call_Node : out Node_Id;
+ Prev_Node : out Node_Id)
+ is
+ Prev : Node_Id := Current_Node;
+ Par : Node_Id := Parent (N);
+
+ begin
+ while Present (Par)
+ and then Nkind (Par) not in N_Subprogram_Call
+ | N_Handled_Sequence_Of_Statements
+ | N_Assignment_Statement
+ | N_Iterator_Specification
+ | N_Object_Declaration
+ | N_Case_Statement
+ | N_Declaration
+ | N_Elsif_Part
+ | N_If_Statement
+ | N_Simple_Return_Statement
+ loop
+ Prev := Par;
+ Par := Parent (Par);
+ end loop;
+
+ if Present (Par)
+ and then Nkind (Par) in N_Subprogram_Call
+ and then Nkind (Name (Par)) = N_Selected_Component
+ then
+ Call_Node := Par;
+ Prev_Node := Prev;
+ else
+ Call_Node := Empty;
+ Prev_Node := Empty;
+ end if;
+ end Search_Enclosing_Call;
+
+ -- Local variables
+
+ Is_Unique : Boolean;
+ Unique_Mode : Boolean;
+ Call_Node : Node_Id;
+ Prev_Node : Node_Id;
+
+ -- Start of processing for Handle_Selected_Component
+
+ begin
+ pragma Assert (Nkind (Sel_Comp) = N_Selected_Component);
+
+ -- Climb up the tree starting from Current_Node searching for the
+ -- enclosing subprogram call of a prefixed notation call.
+
+ Search_Enclosing_Call (Call_Node, Prev_Node);
+
+ -- Search for a candidate visible (or potentially visible)
+ -- dispatching primitive that has at least one formal, and may
+ -- be called using the prefix notation. This must be done even
+ -- if we did not found an enclosing call since the prefix notation
+ -- call has not been transformed yet into a subprogram call. The
+ -- found Call_Node (if any) is passed now to help identifying if
+ -- the prefix notation call corresponds with a procedure call or
+ -- a function call.
+
+ Search_Constant_Interpretation
+ (Call => Call_Node,
+ Target_Name => Selector_Name (Sel_Comp),
+ Candidate => Candidate,
+ Is_Unique => Is_Unique,
+ Unique_Mode => Unique_Mode);
+
+ -- If there is no candidate to interpret this node as a prefixed
+ -- call to a subprogram we return no candidate, and the caller
+ -- will continue ascending in the tree.
+
+ if No (Candidate) then
+ Is_Constant_Idx := False;
+
+ -- If we found an unique candidate and also found the enclosing
+ -- call node, we differentiate two cases: either we climbed up
+ -- the tree through the first actual parameter of the call (that
+ -- is, the name of the selected component), or we climbed up the
+ -- tree though another actual parameter of the prefixed call and
+ -- we must skip the controlling formal of the call.
+
+ elsif Is_Unique
+ and then Present (Call_Node)
+ then
+ -- First actual parameter
+
+ if Name (Call_Node) = Prev_Node
+ and then Nkind (Prev_Node) = N_Selected_Component
+ and then Nkind (Selector_Name (Prev_Node)) in N_Has_Chars
+ and then Chars (Selector_Name (Prev_Node)) = Chars (Candidate)
+ then
+ Is_Constant_Idx := Has_IN_Mode (First_Formal (Candidate));
+
+ -- Any other actual parameter
+
+ else
+ Is_Constant_Idx :=
+ Expr_Matches_In_Formal (Candidate,
+ Subp_Call => Call_Node,
+ Param => Prev_Node,
+ Skip_Controlling_Formal => True);
+ end if;
+
+ -- The mode of the first formal of all the candidates match but,
+ -- given that we have several candidates, we cannot check if
+ -- indexing is used in the first actual parameter of the call
+ -- or in another actual parameter. Heuristically assume here
+ -- that indexing is used in the prefix of a call.
+
+ elsif Unique_Mode then
+ Heuristic := True;
+ Is_Constant_Idx := Has_IN_Mode (First_Formal (Candidate));
+
+ -- The target candidate subprogram has several possible
+ -- interpretations; we don't know what to do with an
+ -- N_Selected_Component node for a prefixed notation call
+ -- to AA.BB that has several candidate targets and it has
+ -- not yet been resolved. For now we maintain the
+ -- behavior that we have had so far; to be improved???
+
+ else
+ Heuristic := True;
+
+ if Nkind (Call_Node) = N_Procedure_Call_Statement then
+ Is_Constant_Idx := False;
+
+ -- For function calls we rely on the mode of the
+ -- first formal of the first found candidate???
+
+ else
+ Is_Constant_Idx := Has_IN_Mode (First_Formal (Candidate));
+ end if;
+ end if;
+ end Handle_Selected_Component;
+
+ -- Local variables
+
+ Asp_Constant : constant Node_Id :=
+ Find_Value_Of_Aspect (Pref_Typ,
+ Aspect_Constant_Indexing);
+ Asp_Variable : constant Node_Id :=
+ Find_Value_Of_Aspect (Pref_Typ,
+ Aspect_Variable_Indexing);
+ Par : Node_Id;
+
+ -- Start of processing for Constant_Indexing_OK
begin
- if No (Find_Value_Of_Aspect (Pref_Typ, Aspect_Variable_Indexing)) then
+ if No (Asp_Constant) then
+ return False;
+
+ -- It is interpreted as constant indexing when the prefix has the
+ -- Constant_Indexing aspect and the Variable_Indexing aspect is not
+ -- specified for the type of the prefix.
+
+ elsif No (Asp_Variable) then
return True;
+ -- It is interpreted as constant indexing when the prefix denotes
+ -- a constant.
+
elsif not Is_Variable (Prefix) then
return True;
end if;
+ -- Both aspects are present
+
+ pragma Assert (Present (Asp_Constant) and Present (Asp_Variable));
+
+ -- The prefix must be interpreted as a constant indexing when it
+ -- is used within a primary where a name denoting a constant is
+ -- permitted.
+
Par := N;
while Present (Par) loop
- if Nkind (Parent (Par)) = N_Assignment_Statement
- and then Par = Name (Parent (Par))
+
+ -- Avoid climbing more than needed
+
+ exit when Nkind (Parent (Par)) in N_Iterator_Specification
+ | N_Handled_Sequence_Of_Statements;
+
+ if Nkind (Parent (Par)) in N_Case_Statement
+ | N_Declaration
+ | N_Elsif_Part
+ | N_If_Statement
+ | N_Simple_Return_Statement
then
- return False;
+ return True;
+
+ -- It is not interpreted as constant indexing for the variable
+ -- name in the LHS of an assignment.
+
+ elsif Nkind (Parent (Par)) = N_Assignment_Statement then
+ return Par /= Name (Parent (Par));
-- The call may be overloaded, in which case we assume that its
-- resolution does not depend on the type of the parameter that
- -- includes the indexing operation.
+ -- includes the indexing operation because we cannot invoke
+ -- Preanalyze_And_Resolve (since it would cause a never-ending
+ -- loop).
elsif Nkind (Parent (Par)) in N_Subprogram_Call then
- if not Is_Entity_Name (Name (Parent (Par))) then
-
- -- ??? We don't know what to do with an N_Selected_Component
- -- node for a prefixed-notation call to AA.BB where AA's
- -- type is known, but BB has not yet been resolved. In that
- -- case, the preceding Is_Entity_Name call returns False.
- -- Incorrectly returning False here will usually work
- -- better than incorrectly returning True, so that's what
- -- we do for now.
+ -- Regular subprogram call
- return False;
- end if;
-
- declare
- Proc : Entity_Id;
+ -- It is not interpreted as constant indexing for the name
+ -- used for an OUT or IN OUT parameter.
- begin
- -- We should look for an interpretation with the proper
- -- number of formals, and determine whether it is an
- -- In_Parameter, but for now we examine the formal that
- -- corresponds to the indexing, and assume that variable
- -- indexing is required if some interpretation has an
- -- assignable formal at that position. Still does not
- -- cover the most complex cases ???
+ -- We should look for an interpretation with the proper
+ -- number of formals, and determine whether it is an
+ -- In_Parameter, but for now we examine the formal that
+ -- corresponds to the indexing, and assume that variable
+ -- indexing is required if some interpretation has an
+ -- assignable formal at that position. Still does not
+ -- cover the most complex cases ???
+ if Is_Entity_Name (Name (Parent (Par))) then
if Is_Overloaded (Name (Parent (Par))) then
declare
Proc : constant Node_Id := Name (Parent (Par));
@@ -8617,57 +8978,103 @@ package body Sem_Ch4 is
begin
Get_First_Interp (Proc, I, It);
while Present (It.Nam) loop
- if not Expr_Matches_In_Formal (It.Nam, Par) then
+ if not Expr_Matches_In_Formal
+ (Subp => It.Nam,
+ Subp_Call => Parent (Par),
+ Param => Par)
+ then
return False;
end if;
Get_Next_Interp (I, It);
end loop;
- end;
- -- All interpretations have a matching in-mode formal
+ -- All interpretations have a matching in-mode formal
- return True;
+ return True;
+ end;
else
- Proc := Entity (Name (Parent (Par)));
+ declare
+ Proc : Entity_Id := Entity (Name (Parent (Par)));
- -- If this is an indirect call, get formals from
- -- designated type.
+ begin
+ -- If this is an indirect call, get formals from
+ -- designated type.
- if Is_Access_Subprogram_Type (Etype (Proc)) then
- Proc := Designated_Type (Etype (Proc));
- end if;
+ if Is_Access_Subprogram_Type (Etype (Proc)) then
+ Proc := Designated_Type (Etype (Proc));
+ end if;
+
+ return Expr_Matches_In_Formal
+ (Subp => Proc,
+ Subp_Call => Parent (Par),
+ Param => Par);
+ end;
end if;
- return Expr_Matches_In_Formal (Proc, Par);
- end;
+ -- Continue climbing
+
+ elsif Nkind (Name (Parent (Par))) = N_Explicit_Dereference then
+ null;
+
+ -- Not a regular call; we know that we are in a subprogram
+ -- call, we also know that the name of the call may be a
+ -- prefixed call, and we know the name of the target
+ -- subprogram. Search for an unique target candidate in the
+ -- homonym chain.
+
+ elsif Nkind (Name (Parent (Par))) = N_Selected_Component then
+ declare
+ Candidate : Entity_Id;
+ Is_Constant_Idx : Boolean;
+
+ begin
+ Handle_Selected_Component
+ (Current_Node => Par,
+ Sel_Comp => Name (Parent (Par)),
+ Candidate => Candidate,
+ Is_Constant_Idx => Is_Constant_Idx);
+
+ if Present (Candidate) then
+ return Is_Constant_Idx;
+
+ -- Continue climbing
+
+ else
+ null;
+ end if;
+ end;
+ end if;
+
+ -- It is not interpreted as constant indexing for the name in
+ -- an object renaming.
elsif Nkind (Parent (Par)) = N_Object_Renaming_Declaration then
return False;
- -- If the indexed component is a prefix it may be the first actual
- -- of a prefixed call. Retrieve the called entity, if any, and
- -- check its first formal. Determine if the context is a procedure
- -- or function call.
+ -- If the indexed component is a prefix it may be an actual of
+ -- of a prefixed call.
elsif Nkind (Parent (Par)) = N_Selected_Component then
declare
- Sel : constant Node_Id := Selector_Name (Parent (Par));
- Nam : constant Entity_Id := Current_Entity (Sel);
+ Candidate : Entity_Id;
+ Is_Constant_Idx : Boolean;
begin
- if Present (Nam) and then Is_Overloadable (Nam) then
- if Nkind (Parent (Parent (Par))) =
- N_Procedure_Call_Statement
- then
- return False;
+ Handle_Selected_Component
+ (Current_Node => Par,
+ Sel_Comp => Parent (Par),
+ Candidate => Candidate,
+ Is_Constant_Idx => Is_Constant_Idx);
- elsif Ekind (Nam) = E_Function
- and then Present (First_Formal (Nam))
- then
- return Ekind (First_Formal (Nam)) = E_In_Parameter;
- end if;
+ if Present (Candidate) then
+ return Is_Constant_Idx;
+
+ -- Continue climbing
+
+ else
+ null;
end if;
end;
@@ -8678,61 +9085,12 @@ package body Sem_Ch4 is
Par := Parent (Par);
end loop;
- -- In all other cases, constant indexing is legal
+ -- It is not interpreted as constant indexing when both aspects
+ -- are present (RM 4.1.6(13/3)).
- return True;
+ return False;
end Constant_Indexing_OK;
- ----------------------------
- -- Expr_Matches_In_Formal --
- ----------------------------
-
- function Expr_Matches_In_Formal
- (Subp : Entity_Id;
- Par : Node_Id) return Boolean
- is
- Actual : Node_Id;
- Formal : Node_Id;
-
- begin
- Formal := First_Formal (Subp);
- Actual := First (Parameter_Associations ((Parent (Par))));
-
- if Nkind (Par) /= N_Parameter_Association then
-
- -- Match by position
-
- while Present (Actual) and then Present (Formal) loop
- exit when Actual = Par;
- Next (Actual);
-
- if Present (Formal) then
- Next_Formal (Formal);
-
- -- Otherwise this is a parameter mismatch, the error is
- -- reported elsewhere, or else variable indexing is implied.
-
- else
- return False;
- end if;
- end loop;
-
- else
- -- Match by name
-
- while Present (Formal) loop
- exit when Chars (Formal) = Chars (Selector_Name (Par));
- Next_Formal (Formal);
-
- if No (Formal) then
- return False;
- end if;
- end loop;
- end if;
-
- return Present (Formal) and then Ekind (Formal) = E_In_Parameter;
- end Expr_Matches_In_Formal;
-
------------------------------
-- Indexing_Interpretations --
------------------------------
@@ -8782,14 +9140,127 @@ package body Sem_Ch4 is
return Indexing_Func;
end Indexing_Interpretations;
+ ---------------------------
+ -- Try_Indexing_Function --
+ ---------------------------
+
+ function Try_Indexing_Function
+ (Func_Name : Node_Id;
+ Assoc : List_Id) return Entity_Id
+ is
+ Loc : constant Source_Ptr := Sloc (N);
+ Func : Entity_Id;
+ Indexing : Node_Id;
+
+ begin
+ if not Is_Overloaded (Func_Name) then
+ Func := Entity (Func_Name);
+
+ Indexing :=
+ Make_Function_Call (Loc,
+ Name => New_Occurrence_Of (Func, Loc),
+ Parameter_Associations => Assoc);
+
+ Set_Parent (Indexing, Parent (N));
+ Set_Generalized_Indexing (N, Indexing);
+ Analyze (Indexing);
+ Set_Etype (N, Etype (Indexing));
+
+ -- If the return type of the indexing function is a reference
+ -- type, add the dereference as a possible interpretation. Note
+ -- that the indexing aspect may be a function that returns the
+ -- element type with no intervening implicit dereference, and
+ -- that the reference discriminant is not the first discriminant.
+
+ if Has_Discriminants (Etype (Func)) then
+ Check_Implicit_Dereference (N, Etype (Func));
+ end if;
+
+ else
+ -- If there are multiple indexing functions, build a function
+ -- call and analyze it for each of the possible interpretations.
+
+ Indexing :=
+ Make_Function_Call (Loc,
+ Name =>
+ Make_Identifier (Loc, Chars (Func_Name)),
+ Parameter_Associations => Assoc);
+ Set_Parent (Indexing, Parent (N));
+ Set_Generalized_Indexing (N, Indexing);
+ Set_Etype (N, Any_Type);
+ Set_Etype (Name (Indexing), Any_Type);
+
+ declare
+ I : Interp_Index;
+ It : Interp;
+ Success : Boolean;
+
+ begin
+ Get_First_Interp (Func_Name, I, It);
+ Set_Etype (Indexing, Any_Type);
+
+ -- Analyze each candidate function with the given actuals
+
+ while Present (It.Nam) loop
+ Analyze_One_Call (Indexing, It.Nam, False, Success);
+ Get_Next_Interp (I, It);
+ end loop;
+
+ -- If there are several successful candidates, resolution will
+ -- be by result. Mark the interpretations of the function name
+ -- itself.
+
+ if Is_Overloaded (Indexing) then
+ Get_First_Interp (Indexing, I, It);
+
+ while Present (It.Nam) loop
+ Add_One_Interp (Name (Indexing), It.Nam, It.Typ);
+ Get_Next_Interp (I, It);
+ end loop;
+
+ else
+ Set_Etype (Name (Indexing), Etype (Indexing));
+ end if;
+
+ -- Now add the candidate interpretations to the indexing node
+ -- itself, to be replaced later by the function call.
+
+ if Is_Overloaded (Name (Indexing)) then
+ Get_First_Interp (Name (Indexing), I, It);
+
+ while Present (It.Nam) loop
+ Add_One_Interp (N, It.Nam, It.Typ);
+
+ -- Add dereference interpretation if the result type has
+ -- implicit reference discriminants.
+
+ if Has_Discriminants (Etype (It.Nam)) then
+ Check_Implicit_Dereference (N, Etype (It.Nam));
+ end if;
+
+ Get_Next_Interp (I, It);
+ end loop;
+
+ else
+ Set_Etype (N, Etype (Name (Indexing)));
+
+ if Has_Discriminants (Etype (N)) then
+ Check_Implicit_Dereference (N, Etype (N));
+ end if;
+ end if;
+ end;
+ end if;
+
+ return Etype (Indexing);
+ end Try_Indexing_Function;
+
-- Local variables
Loc : constant Source_Ptr := Sloc (N);
Assoc : List_Id;
C_Type : Entity_Id;
- Func : Entity_Id;
Func_Name : Node_Id;
- Indexing : Node_Id;
+ Idx_Type : Entity_Id;
-- Start of processing for Try_Container_Indexing
@@ -8799,6 +9270,13 @@ package body Sem_Ch4 is
if Present (Generalized_Indexing (N)) then
return True;
+
+ -- Old language version or unknown type require no action
+
+ elsif Ada_Version < Ada_2012
+ or else Pref_Typ = Any_Type
+ then
+ return False;
end if;
-- An explicit dereference needs to be created in the case of a prefix
@@ -8833,8 +9311,8 @@ package body Sem_Ch4 is
Func_Name := Empty;
- -- The context is suitable for constant indexing, so obtain the name of
- -- the indexing functions from aspect Constant_Indexing.
+ -- The context is suitable for constant indexing, so obtain the name
+ -- of the indexing functions from aspect Constant_Indexing.
if Constant_Indexing_OK then
Func_Name :=
@@ -8867,6 +9345,11 @@ package body Sem_Ch4 is
else
return False;
end if;
+
+ -- Handle cascaded errors
+
+ elsif No (Entity (Func_Name)) then
+ return False;
end if;
Assoc := New_List (Relocate_Node (Prefix));
@@ -8907,110 +9390,54 @@ package body Sem_Ch4 is
end loop;
end;
- if not Is_Overloaded (Func_Name) then
- Func := Entity (Func_Name);
-
- -- Can happen in case of e.g. cascaded errors
-
- if No (Func) then
- return False;
- end if;
-
- Indexing :=
- Make_Function_Call (Loc,
- Name => New_Occurrence_Of (Func, Loc),
- Parameter_Associations => Assoc);
-
- Set_Parent (Indexing, Parent (N));
- Set_Generalized_Indexing (N, Indexing);
- Analyze (Indexing);
- Set_Etype (N, Etype (Indexing));
-
- -- If the return type of the indexing function is a reference type,
- -- add the dereference as a possible interpretation. Note that the
- -- indexing aspect may be a function that returns the element type
- -- with no intervening implicit dereference, and that the reference
- -- discriminant is not the first discriminant.
-
- if Has_Discriminants (Etype (Func)) then
- Check_Implicit_Dereference (N, Etype (Func));
- end if;
-
- else
- -- If there are multiple indexing functions, build a function call
- -- and analyze it for each of the possible interpretations.
-
- Indexing :=
- Make_Function_Call (Loc,
- Name =>
- Make_Identifier (Loc, Chars (Func_Name)),
- Parameter_Associations => Assoc);
- Set_Parent (Indexing, Parent (N));
- Set_Generalized_Indexing (N, Indexing);
- Set_Etype (N, Any_Type);
- Set_Etype (Name (Indexing), Any_Type);
-
+ Idx_Type := Try_Indexing_Function (Func_Name, Assoc);
+
+ -- Last chance handling for heuristics: Given that prefix notation
+ -- calls have not yet been resolved, when the type of the prefix has
+ -- both operational aspects present (Constant_Indexing and Variable_
+ -- Indexing), and the analysis of the context identified a potential
+ -- prefix notation call (i.e. an N_Selected_Component node), the
+ -- evaluation of Constant_Indexing_OK is based on heuristics; in such
+ -- case, if the chosen indexing approach is noticed now to be wrong
+ -- we retry with the other alternative before leaving.
+
+ -- Retrying means that the heuristic decision taken when analyzing
+ -- the context failed in this case, and therefore we should adjust
+ -- the code of Handle_Selected_Component to improve identification
+ -- of prefix notation calls. This last chance handling handler is
+ -- left here for the purpose of improving such routine because it
+ -- proved to be usefull for identified such cases when the function
+ -- Handle_Selected_Component was added.
+
+ if Idx_Type = Any_Type and then Heuristic then
declare
- I : Interp_Index;
- It : Interp;
- Success : Boolean;
+ Tried_Func_Name : constant Node_Id := Func_Name;
begin
- Get_First_Interp (Func_Name, I, It);
- Set_Etype (Indexing, Any_Type);
-
- -- Analyze each candidate function with the given actuals
+ Func_Name :=
+ Indexing_Interpretations (C_Type,
+ Aspect_Constant_Indexing);
- while Present (It.Nam) loop
- Analyze_One_Call (Indexing, It.Nam, False, Success);
- Get_Next_Interp (I, It);
- end loop;
-
- -- If there are several successful candidates, resolution will
- -- be by result. Mark the interpretations of the function name
- -- itself.
-
- if Is_Overloaded (Indexing) then
- Get_First_Interp (Indexing, I, It);
-
- while Present (It.Nam) loop
- Add_One_Interp (Name (Indexing), It.Nam, It.Typ);
- Get_Next_Interp (I, It);
- end loop;
+ if Present (Func_Name)
+ and then Func_Name /= Tried_Func_Name
+ then
+ Idx_Type := Try_Indexing_Function (Func_Name, Assoc);
else
- Set_Etype (Name (Indexing), Etype (Indexing));
- end if;
-
- -- Now add the candidate interpretations to the indexing node
- -- itself, to be replaced later by the function call.
-
- if Is_Overloaded (Name (Indexing)) then
- Get_First_Interp (Name (Indexing), I, It);
-
- while Present (It.Nam) loop
- Add_One_Interp (N, It.Nam, It.Typ);
-
- -- Add dereference interpretation if the result type has
- -- implicit reference discriminants.
+ Func_Name :=
+ Indexing_Interpretations (C_Type,
+ Aspect_Variable_Indexing);
- if Has_Discriminants (Etype (It.Nam)) then
- Check_Implicit_Dereference (N, Etype (It.Nam));
- end if;
-
- Get_Next_Interp (I, It);
- end loop;
-
- else
- Set_Etype (N, Etype (Name (Indexing)));
- if Has_Discriminants (Etype (N)) then
- Check_Implicit_Dereference (N, Etype (N));
+ if Present (Func_Name)
+ and then Func_Name /= Tried_Func_Name
+ then
+ Idx_Type := Try_Indexing_Function (Func_Name, Assoc);
end if;
end if;
end;
end if;
- if Etype (Indexing) = Any_Type then
+ if Idx_Type = Any_Type then
Error_Msg_NE
("container cannot be indexed with&", N, Etype (First (Exprs)));
Rewrite (N, New_Occurrence_Of (Any_Id, Loc));
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 621edc7..19e72ab 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -14696,19 +14696,18 @@ package body Sem_Prag is
D := Declaration_Node (E);
- if (Nkind (D) = N_Full_Type_Declaration and then Is_Array_Type (E))
+ if (Nkind (D) in N_Full_Type_Declaration
+ | N_Formal_Type_Declaration
+ and then Is_Array_Type (E))
or else
(Nkind (D) = N_Object_Declaration
and then Ekind (E) in E_Constant | E_Variable
and then Nkind (Object_Definition (D)) =
N_Constrained_Array_Definition)
- or else
- (Ada_Version >= Ada_2022
- and then Nkind (D) = N_Formal_Type_Declaration)
then
-- The flag is set on the base type, or on the object
- if Nkind (D) = N_Full_Type_Declaration then
+ if Is_Array_Type (E) then
E := Base_Type (E);
end if;
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index b73b947..0df6c27 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -6101,6 +6101,8 @@ package body Sem_Res is
elsif Is_Fixed_Point_Type (It.Typ) then
if Analyzed (N) then
Error_Msg_N ("ambiguous operand in fixed operation", N);
+ elsif It.Typ = Any_Fixed then
+ Resolve (N, B_Typ);
else
Resolve (N, It.Typ);
end if;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 0e1505b..7757e04 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -3025,7 +3025,7 @@ package body Sem_Util is
-- For an array aggregate, a discrete_choice_list that has
-- a nonstatic range is considered as two or more separate
- -- occurrences of the expression (RM 6.4.1(20/3)).
+ -- occurrences of the expression (RM 6.4.1(6.20/3)).
elsif Is_Array_Type (Etype (N))
and then Nkind (N) = N_Aggregate
@@ -3110,48 +3110,105 @@ package body Sem_Util is
end loop;
end if;
- -- Handle discrete associations
+ -- Handle named associations
if Present (Component_Associations (N)) then
Assoc := First (Component_Associations (N));
while Present (Assoc) loop
- if not Box_Present (Assoc) then
- Choice := First (Choices (Assoc));
- while Present (Choice) loop
+ Handle_Association : declare
- -- For now we skip discriminants since it requires
- -- performing the analysis in two phases: first one
- -- analyzing discriminants and second one analyzing
- -- the rest of components since discriminants are
- -- evaluated prior to components: too much extra
- -- work to detect a corner case???
+ procedure Collect_Expression_Ids (Expr : Node_Id);
+ -- Collect identifiers in association expression Expr
- if Nkind (Choice) in N_Has_Entity
- and then Present (Entity (Choice))
- and then Ekind (Entity (Choice)) = E_Discriminant
- then
- null;
+ procedure Handle_Association_Choices
+ (Choices : List_Id; Expr : Node_Id);
+ -- Collect identifiers in an association expression
+ -- Expr for each choice in Choices.
- elsif Box_Present (Assoc) then
- null;
+ ----------------------------
+ -- Collect_Expression_Ids --
+ ----------------------------
+ procedure Collect_Expression_Ids (Expr : Node_Id) is
+ Comp_Expr : Node_Id;
+
+ begin
+ if not Analyzed (Expr) then
+ Comp_Expr := New_Copy_Tree (Expr);
+ Set_Parent (Comp_Expr, Parent (N));
+ Preanalyze_Without_Errors (Comp_Expr);
else
- if not Analyzed (Expression (Assoc)) then
- Comp_Expr :=
- New_Copy_Tree (Expression (Assoc));
- Set_Parent (Comp_Expr, Parent (N));
- Preanalyze_Without_Errors (Comp_Expr);
+ Comp_Expr := Expr;
+ end if;
+
+ Collect_Identifiers (Comp_Expr);
+ end Collect_Expression_Ids;
+
+ --------------------------------
+ -- Handle_Association_Choices --
+ --------------------------------
+
+ procedure Handle_Association_Choices
+ (Choices : List_Id; Expr : Node_Id)
+ is
+ Choice : Node_Id := First (Choices);
+
+ begin
+ while Present (Choice) loop
+
+ -- For now skip discriminants since it requires
+ -- performing analysis in two phases: first one
+ -- analyzing discriminants and second analyzing
+ -- the rest of components since discriminants
+ -- are evaluated prior to components: too much
+ -- extra work to detect a corner case???
+
+ if Nkind (Choice) in N_Has_Entity
+ and then Present (Entity (Choice))
+ and then
+ Ekind (Entity (Choice)) = E_Discriminant
+ then
+ null;
+
else
- Comp_Expr := Expression (Assoc);
+ Collect_Expression_Ids (Expr);
end if;
- Collect_Identifiers (Comp_Expr);
- end if;
+ Next (Choice);
+ end loop;
+ end Handle_Association_Choices;
- Next (Choice);
- end loop;
- end if;
+ begin
+ if not Box_Present (Assoc) then
+ if Nkind (Assoc) = N_Component_Association then
+ Handle_Association_Choices
+ (Choices (Assoc), Expression (Assoc));
+
+ elsif
+ Nkind (Assoc) = N_Iterated_Component_Association
+ and then Present (Defining_Identifier (Assoc))
+ then
+ Handle_Association_Choices
+ (Discrete_Choices (Assoc), Expression (Assoc));
+
+ -- Nkind (Assoc) = N_Iterated_Component_Association
+ -- with iterator_specification, or
+ -- Nkind (Assoc) = N_Iterated_Element_Association
+ -- with loop_parameter_specification
+ -- or iterator_specification
+ --
+ -- It seems that we might also need to deal with
+ -- iterable/iterator_names and iterator_filters
+ -- within iterator_specifications, and range bounds
+ -- within loop_parameter_specifications, but the
+ -- utility of doing that seems very low. ???
+
+ else
+ Collect_Expression_Ids (Expression (Assoc));
+ end if;
+ end if;
+ end Handle_Association;
Next (Assoc);
end loop;
@@ -8063,12 +8120,20 @@ package body Sem_Util is
loop
Ren := Renamed_Object (Id);
+ -- The reference renames a function result. Check the original
+ -- node in case expansion relocates the function call.
+
+ -- Ren : ... renames Func_Call;
+
+ if Nkind (Original_Node (Ren)) = N_Function_Call then
+ exit;
+
-- The reference renames an abstract state or a whole object
-- Obj : ...;
-- Ren : ... renames Obj;
- if Is_Entity_Name (Ren) then
+ elsif Is_Entity_Name (Ren) then
-- Do not follow a renaming that goes through a generic formal,
-- because these entities are hidden and must not be referenced
@@ -8081,14 +8146,6 @@ package body Sem_Util is
Id := Entity (Ren);
end if;
- -- The reference renames a function result. Check the original
- -- node in case expansion relocates the function call.
-
- -- Ren : ... renames Func_Call;
-
- elsif Nkind (Original_Node (Ren)) = N_Function_Call then
- exit;
-
-- Otherwise the reference renames something which does not yield
-- an abstract state or a whole object. Treat the reference as not
-- having a proper entity for SPARK legality purposes.
@@ -12368,9 +12425,14 @@ package body Sem_Util is
while Present (Node) loop
case Nkind (Node) is
- when N_Null_Statement | N_Call_Marker | N_Raise_xxx_Error =>
+ when N_Null_Statement | N_Call_Marker =>
null;
+ when N_Raise_xxx_Error =>
+ if Comes_From_Source (Node) then
+ return False;
+ end if;
+
when N_Object_Declaration =>
if Present (Expression (Node))
and then not Side_Effect_Free (Expression (Node))
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index efa38b5..3f6cd69 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -92,17 +92,17 @@ begin
-- Common switches available everywhere
- Write_Switch_Char ("g ", "");
+ Write_Switch_Char ("g ", "");
Write_Line ("Generate debugging information");
- Write_Switch_Char ("Idir ", "");
+ Write_Switch_Char ("Idir ", "");
Write_Line ("Specify source files search path");
- Write_Switch_Char ("I- ", "");
+ Write_Switch_Char ("I- ", "");
Write_Line ("Do not look for sources in current directory");
- Write_Switch_Char ("O[0123] ", "");
- Write_Line ("Control the optimization level");
+ Write_Switch_Char ("O[?] ", "");
+ Write_Line ("Control the optimization level (?=0/1/2/3/s/z/g)");
Write_Eol;
diff --git a/gcc/builtins.def b/gcc/builtins.def
index ff47005..6794109 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -217,6 +217,8 @@ along with GCC; see the file COPYING3. If not see
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
false, true, true, ATTRS, false, \
flag_openacc)
+/* Set NONANSI_P = false to enable the builtins also with -fno-nonansi-builtins,
+ esp. as -std=c++../c.. imply that flag and -fopenacc should be othogonal. */
#undef DEF_GOACC_BUILTIN_COMPILER
#define DEF_GOACC_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
@@ -232,10 +234,12 @@ along with GCC; see the file COPYING3. If not see
(flag_openacc \
|| flag_openmp \
|| flag_tree_parallelize_loops > 1))
+/* Set NONANSI_P = false to enable the builtins also with -fno-nonansi-builtins,
+ esp. as -std=c++../c.. imply that flag and -fopenmp should be othogonal. */
#undef DEF_GOMP_BUILTIN_COMPILER
#define DEF_GOMP_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- flag_openmp, true, true, ATTRS, false, flag_openmp)
+ flag_openmp, true, false, ATTRS, false, flag_openmp)
/* Builtin used by the implementation of GNU TM. These
functions are mapped to the actual implementation of the STM library. */
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index d842028..061f1c6 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,29 @@
+2025-05-30 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-05-29 Sandra Loosemore <sloosemore@baylibre.com>
+
+ * c-parser.cc (c_parser_skip_to_closing_brace): New, copied from
+ the equivalent function in the C++ front end.
+ (c_parser_skip_to_end_of_block_or_statement): Pass false to
+ the error flag.
+ (c_parser_omp_context_selector): Immediately return error_mark_node
+ after giving an error that the integer trait property is invalid,
+ similarly to C++ front end.
+ (c_parser_omp_context_selector_specification): Likewise handle
+ error return from c_parser_omp_context_selector similarly to C++.
+ (c_parser_omp_metadirective): Do not call
+ c_parser_skip_to_end_of_block_or_statement after an error.
+
+2025-05-30 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-05-29 Sandra Loosemore <sloosemore@baylibre.com>
+
+ PR c/120180
+ * c-parser.cc (c_parser_omp_metadirective): Only consume the
+ token if it is the expected close paren.
+
2025-05-02 Jakub Jelinek <jakub@redhat.com>
Backported from master:
diff --git a/gcc/c/ChangeLog.omp b/gcc/c/ChangeLog.omp
index ff881b5..d3e1d0e 100644
--- a/gcc/c/ChangeLog.omp
+++ b/gcc/c/ChangeLog.omp
@@ -1,3 +1,12 @@
+2025-06-05 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-06-02 Sandra Loosemore <sloosemore@baylibre.com>
+
+ * c-parser.cc (c_parser_omp_context_selector): Call
+ convert_lvalue_to_rvalue and c_objc_common_truthvalue_conversion
+ on the expression for OMP_TRAIT_PROPERTY_BOOL_EXPR.
+
2025-05-15 waffl3x <waffl3x@baylibre.com>
PR c++/119659
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 9af7440..368caf8 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -1418,6 +1418,51 @@ c_parser_skip_to_end_of_parameter (c_parser *parser)
parser->error = false;
}
+/* Skip tokens until a non-nested closing curly brace is the next
+ token, or there are no more tokens. Return true in the first case,
+ false otherwise. */
+
+static bool
+c_parser_skip_to_closing_brace (c_parser *parser)
+{
+ unsigned nesting_depth = 0;
+
+ while (true)
+ {
+ c_token *token = c_parser_peek_token (parser);
+
+ switch (token->type)
+ {
+ case CPP_PRAGMA_EOL:
+ if (!parser->in_pragma)
+ break;
+ /* FALLTHRU */
+ case CPP_EOF:
+ /* If we've run out of tokens, stop. */
+ return false;
+
+ case CPP_CLOSE_BRACE:
+ /* If the next token is a non-nested `}', then we have reached
+ the end of the current block. */
+ if (nesting_depth-- == 0)
+ return true;
+ break;
+
+ case CPP_OPEN_BRACE:
+ /* If it the next token is a `{', then we are entering a new
+ block. Consume the entire block. */
+ ++nesting_depth;
+ break;
+
+ default:
+ break;
+ }
+
+ /* Consume the token. */
+ c_parser_consume_token (parser);
+ }
+}
+
/* Expect to be at the end of the pragma directive and consume an
end of line marker. */
@@ -1582,7 +1627,7 @@ c_parser_skip_to_end_of_block_or_statement (c_parser *parser,
here for secondary error recovery, after parser->error has
been cleared. */
c_parser_consume_pragma (parser);
- c_parser_skip_to_pragma_eol (parser);
+ c_parser_skip_to_pragma_eol (parser, false);
parser->error = save_error;
continue;
@@ -28380,20 +28425,31 @@ c_parser_omp_context_selector (c_parser *parser, enum omp_tss_code set,
break;
case OMP_TRAIT_PROPERTY_DEV_NUM_EXPR:
case OMP_TRAIT_PROPERTY_BOOL_EXPR:
- t = c_parser_expr_no_commas (parser, NULL).value;
- if (t != error_mark_node)
+ {
+ c_expr texpr = c_parser_expr_no_commas (parser, NULL);
+ texpr = convert_lvalue_to_rvalue (token->location, texpr,
+ true, true);
+ t = texpr.value;
+ }
+ if (t == error_mark_node)
+ return error_mark_node;
+ mark_exp_read (t);
+ if (property_kind == OMP_TRAIT_PROPERTY_BOOL_EXPR)
{
- mark_exp_read (t);
- t = c_fully_fold (t, false, NULL);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
- error_at (token->location,
- "property must be integer expression");
- else
- properties = make_trait_property (NULL_TREE, t,
- properties);
+ t = c_objc_common_truthvalue_conversion (token->location,
+ t,
+ boolean_type_node);
+ if (t == error_mark_node)
+ return error_mark_node;
}
- else
- return error_mark_node;
+ else if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
+ {
+ error_at (token->location,
+ "property must be integer expression");
+ return error_mark_node;
+ }
+ t = c_fully_fold (t, false, NULL);
+ properties = make_trait_property (NULL_TREE, t, properties);
break;
case OMP_TRAIT_PROPERTY_CLAUSE_LIST:
if (sel == OMP_TRAIT_CONSTRUCT_SIMD)
@@ -28495,11 +28551,14 @@ c_parser_omp_context_selector_specification (c_parser *parser, tree parms)
tree selectors = c_parser_omp_context_selector (parser, set, parms);
if (selectors == error_mark_node)
- ret = error_mark_node;
+ {
+ c_parser_skip_to_closing_brace (parser);
+ ret = error_mark_node;
+ }
else if (ret != error_mark_node)
ret = make_trait_set_selector (set, selectors, ret);
- braces.skip_until_found_close (parser);
+ braces.require_close (parser);
if (c_parser_next_token_is (parser, CPP_COMMA))
c_parser_consume_token (parser);
@@ -31148,7 +31207,6 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p)
{
error_at (match_loc, "too many %<otherwise%> or %<default%> "
"clauses in %<metadirective%>");
- c_parser_skip_to_end_of_block_or_statement (parser, true);
goto error;
}
default_seen = true;
@@ -31157,14 +31215,12 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p)
{
error_at (match_loc, "%<otherwise%> or %<default%> clause "
"must appear last in %<metadirective%>");
- c_parser_skip_to_end_of_block_or_statement (parser, true);
goto error;
}
if (!default_p && strcmp (p, "when") != 0)
{
error_at (match_loc, "%qs is not valid for %qs",
p, "metadirective");
- c_parser_skip_to_end_of_block_or_statement (parser, true);
goto error;
}
@@ -31232,7 +31288,6 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p)
if (i == 0)
{
error_at (loc, "expected directive name");
- c_parser_skip_to_end_of_block_or_statement (parser, true);
goto error;
}
@@ -31300,7 +31355,10 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p)
goto add;
case CPP_CLOSE_PAREN:
if (nesting_depth-- == 0)
- break;
+ {
+ c_parser_consume_token (parser);
+ break;
+ }
goto add;
default:
add:
@@ -31312,8 +31370,6 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p)
break;
}
- c_parser_consume_token (parser);
-
if (!skip)
{
c_token eol_token;
@@ -31440,9 +31496,9 @@ c_parser_omp_metadirective (c_parser *parser, bool *if_p)
return;
error:
+ /* Skip the metadirective pragma. Do not skip the metadirective body. */
if (parser->in_pragma)
- c_parser_skip_to_pragma_eol (parser);
- c_parser_skip_to_end_of_block_or_statement (parser, true);
+ c_parser_skip_to_pragma_eol (parser, false);
}
/* Main entry point to parsing most OpenMP pragmas. */
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 6ae6a97..48646de 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1879,7 +1879,7 @@ cgraph_node::remove (void)
clone_info *info, saved_info;
if (symtab->ipa_clones_dump_file && symtab->cloned_nodes.contains (this))
fprintf (symtab->ipa_clones_dump_file,
- "Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), order,
+ "Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), get_uid (),
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
DECL_SOURCE_COLUMN (decl));
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index abde770..45119e3 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -493,7 +493,7 @@ public:
static inline void checking_verify_symtab_nodes (void);
/* Get unique identifier of the node. */
- inline int get_uid ()
+ inline int get_uid () const
{
return m_uid;
}
diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc
index bf5bc41..3c9c642 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -324,11 +324,11 @@ dump_callgraph_transformation (const cgraph_node *original,
{
fprintf (symtab->ipa_clones_dump_file,
"Callgraph clone;%s;%d;%s;%d;%d;%s;%d;%s;%d;%d;%s\n",
- original->asm_name (), original->order,
+ original->asm_name (), original->get_uid (),
DECL_SOURCE_FILE (original->decl),
DECL_SOURCE_LINE (original->decl),
DECL_SOURCE_COLUMN (original->decl), clone->asm_name (),
- clone->order, DECL_SOURCE_FILE (clone->decl),
+ clone->get_uid (), DECL_SOURCE_FILE (clone->decl),
DECL_SOURCE_LINE (clone->decl), DECL_SOURCE_COLUMN (clone->decl),
suffix);
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 40b50dc..5725704 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4598,15 +4598,13 @@ case "${target}" in
for which in arch tune; do
eval "val=\$with_$which"
- case ${val} in
- "" | gfx900 | gfx906 | gfx908 | gfx90a | gfx90c | gfx1030 | gfx1036 | gfx1100 | gfx1103)
- # OK
- ;;
- *)
+ if test x"$val" != x \
+ && ! grep -q "GCN_DEVICE($val," \
+ "${srcdir}/config/gcn/gcn-devices.def";
+ then
echo "Unknown cpu used in --with-$which=$val." 1>&2
exit 1
- ;;
- esac
+ fi
done
[ "x$with_arch" = x ] && with_arch=gfx900
diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def
index 1209630..24b7cd3 100644
--- a/gcc/config/aarch64/aarch64-cores.def
+++ b/gcc/config/aarch64/aarch64-cores.def
@@ -132,7 +132,7 @@ AARCH64_CORE("octeontx2f95mm", octeontx2f95mm, cortexa57, V8_2A, (CRYPTO, PROFI
/* Fujitsu ('F') cores. */
AARCH64_CORE("a64fx", a64fx, a64fx, V8_2A, (F16, SVE), a64fx, 0x46, 0x001, -1)
-AARCH64_CORE("fujitsu-monaka", fujitsu_monaka, cortexa57, V9_3A, (F16, FP8, LS64, RNG, CRYPTO, SVE2_AES, SVE2_BITPERM, SVE2_SHA3, SVE2_SM4), fujitsu_monaka, 0x46, 0x003, -1)
+AARCH64_CORE("fujitsu-monaka", fujitsu_monaka, cortexa57, V9_3A, (F16, FAMINMAX, FP8FMA, FP8DOT2, FP8DOT4, LS64, LUT, RNG, CRYPTO, SVE2_AES, SVE2_BITPERM, SVE2_SHA3, SVE2_SM4), fujitsu_monaka, 0x46, 0x003, -1)
/* HiSilicon ('H') cores. */
AARCH64_CORE("tsv110", tsv110, tsv110, V8_2A, (CRYPTO, F16), tsv110, 0x48, 0xd01, -1)
diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc
index ba470d9..14e7da5 100644
--- a/gcc/config/alpha/alpha.cc
+++ b/gcc/config/alpha/alpha.cc
@@ -4291,14 +4291,10 @@ alpha_get_mem_rtx_alignment_and_offset (rtx expr, int &a, HOST_WIDE_INT &o)
tree mem = MEM_EXPR (expr);
if (mem != NULL_TREE)
- switch (TREE_CODE (mem))
- {
- case MEM_REF:
- tree_offset = mem_ref_offset (mem).force_shwi ();
- tree_align = get_object_alignment (get_base_address (mem));
- break;
+ {
+ HOST_WIDE_INT comp_offset = 0;
- case COMPONENT_REF:
+ for (; TREE_CODE (mem) == COMPONENT_REF; mem = TREE_OPERAND (mem, 0))
{
tree byte_offset = component_ref_field_offset (mem);
tree bit_offset = DECL_FIELD_BIT_OFFSET (TREE_OPERAND (mem, 1));
@@ -4307,14 +4303,15 @@ alpha_get_mem_rtx_alignment_and_offset (rtx expr, int &a, HOST_WIDE_INT &o)
|| !poly_int_tree_p (byte_offset, &offset)
|| !tree_fits_shwi_p (bit_offset))
break;
- tree_offset = offset + tree_to_shwi (bit_offset) / BITS_PER_UNIT;
+ comp_offset += offset + tree_to_shwi (bit_offset) / BITS_PER_UNIT;
}
- tree_align = get_object_alignment (get_base_address (mem));
- break;
- default:
- break;
- }
+ if (TREE_CODE (mem) == MEM_REF)
+ {
+ tree_offset = comp_offset + mem_ref_offset (mem).force_shwi ();
+ tree_align = get_object_alignment (get_base_address (mem));
+ }
+ }
if (reg_align > mem_align)
{
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 01b8e4b..f8bbdc7 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -5273,6 +5273,41 @@
;;<< << << << << << << << << << << << << << << << << << << << << << << << << <<
;; arithmetic shift left
+;; Work around PR120423: Transform left shift of a paradoxical subreg
+;; into left shift of the zero-extended entity.
+(define_split ; PR120423
+ [(set (match_operand:HISI 0 "register_operand")
+ (ashift:HISI (subreg:HISI (match_operand:QIPSI 1 "nonimmediate_operand")
+ 0)
+ (match_operand:QI 2 "const_int_operand")))]
+ "!reload_completed
+ && !avropt_lra_p
+ && <HISI:SIZE> > <QIPSI:SIZE>"
+ [(set (match_dup 4)
+ (zero_extend:HISI (match_dup 5)))
+ (set (match_dup 0)
+ (ashift:HISI (match_dup 4)
+ (match_dup 2)))]
+ {
+ operands[4] = gen_reg_rtx (<HISI:MODE>mode);
+ operands[5] = force_reg (<QIPSI:MODE>mode, operands[1]);
+ })
+
+;; Similar happens for PR116389.
+(define_split ; PR116389
+ [(set (match_operand:HISI 0 "register_operand")
+ (subreg:HISI (match_operand:QIPSI 1 "nonimmediate_operand")
+ 0))]
+ "!reload_completed
+ && !avropt_lra_p
+ && <HISI:SIZE> > <QIPSI:SIZE>"
+ [(set (match_dup 0)
+ (zero_extend:HISI (match_dup 2)))]
+ {
+ operands[2] = force_reg (<QIPSI:MODE>mode, operands[1]);
+ })
+
+
;; "ashlqi3"
;; "ashlqq3" "ashluqq3"
(define_expand "ashl<mode>3"
diff --git a/gcc/config/gcn/gcn-devices.def b/gcc/config/gcn/gcn-devices.def
index af14203..426acf0 100644
--- a/gcc/config/gcn/gcn-devices.def
+++ b/gcc/config/gcn/gcn-devices.def
@@ -171,6 +171,28 @@ GCN_DEVICE(gfx90c, GFX90C, 0x32, ISA_GCN5,
/* Generic Name */ GFX9_GENERIC
)
+GCN_DEVICE(gfx942, GFX942, 0x4c, ISA_CDNA3,
+ /* XNACK default */ HSACO_ATTR_ANY,
+ /* SRAM_ECC default */ HSACO_ATTR_ANY,
+ /* WAVE64 mode */ HSACO_ATTR_UNSUPPORTED,
+ /* CU mode */ HSACO_ATTR_UNSUPPORTED,
+ /* Max ISA VGPRs */ 512,
+ /* Generic code obj version */ 0, /* non-generic */
+ /* Architecture Family */ GFX9,
+ /* Generic Name */ NONE
+ )
+
+GCN_DEVICE(gfx950, GFX950, 0x4f, ISA_CDNA3,
+ /* XNACK default */ HSACO_ATTR_ANY,
+ /* SRAM_ECC default */ HSACO_ATTR_ANY,
+ /* WAVE64 mode */ HSACO_ATTR_UNSUPPORTED,
+ /* CU mode */ HSACO_ATTR_UNSUPPORTED,
+ /* Max ISA VGPRs */ 512,
+ /* Generic code obj version */ 0, /* non-generic */
+ /* Architecture Family */ GFX9,
+ /* Generic Name */ NONE
+ )
+
GCN_DEVICE(gfx9-generic, GFX9_GENERIC, 0x051, ISA_GCN5,
/* XNACK default */ HSACO_ATTR_ANY,
/* SRAM_ECC default */ HSACO_ATTR_UNSUPPORTED,
@@ -182,6 +204,17 @@ GCN_DEVICE(gfx9-generic, GFX9_GENERIC, 0x051, ISA_GCN5,
/* Generic Name */ NONE
)
+GCN_DEVICE(gfx9-4-generic, GFX9_4_GENERIC, 0x05f, ISA_CDNA3,
+ /* XNACK default */ HSACO_ATTR_ANY,
+ /* SRAM_ECC default */ HSACO_ATTR_UNSUPPORTED,
+ /* WAVE64 mode */ HSACO_ATTR_UNSUPPORTED,
+ /* CU mode */ HSACO_ATTR_UNSUPPORTED,
+ /* Max ISA VGPRs */ 256,
+ /* Generic code obj version */ 1,
+ /* Architecture Family */ GFX9,
+ /* Generic Name */ NONE
+ )
+
/* GCN GFX10.3 (RDNA 2) */
GCN_DEVICE(gfx1030, GFX1030, 0x36, ISA_RDNA2,
diff --git a/gcc/config/gcn/gcn-opts.h b/gcc/config/gcn/gcn-opts.h
index 88f562d..bcea14f 100644
--- a/gcc/config/gcn/gcn-opts.h
+++ b/gcc/config/gcn/gcn-opts.h
@@ -33,7 +33,8 @@ extern enum gcn_isa {
ISA_RDNA2,
ISA_RDNA3,
ISA_CDNA1,
- ISA_CDNA2
+ ISA_CDNA2,
+ ISA_CDNA3
} gcn_isa;
#define TARGET_GCN5 (gcn_isa == ISA_GCN5)
@@ -41,6 +42,8 @@ extern enum gcn_isa {
#define TARGET_CDNA1_PLUS (gcn_isa >= ISA_CDNA1)
#define TARGET_CDNA2 (gcn_isa == ISA_CDNA2)
#define TARGET_CDNA2_PLUS (gcn_isa >= ISA_CDNA2)
+#define TARGET_CDNA3 (gcn_isa == ISA_CDNA3)
+#define TARGET_CDNA3_PLUS (gcn_isa >= ISA_CDNA3)
#define TARGET_RDNA2 (gcn_isa == ISA_RDNA2)
#define TARGET_RDNA2_PLUS (gcn_isa >= ISA_RDNA2 && gcn_isa < ISA_CDNA1)
#define TARGET_RDNA3 (gcn_isa == ISA_RDNA3)
@@ -81,18 +84,22 @@ enum hsaco_attr_type
#define TARGET_DPP8 TARGET_RDNA2_PLUS
/* Device requires CDNA1-style manually inserted wait states for AVGPRs. */
#define TARGET_AVGPR_CDNA1_NOPS TARGET_CDNA1
+/* Whether to use the 'globally coherent' (glc) or the 'scope' (sc0, sc1) flag
+ for scalar memory operations. The string starts on purpose with a space. */
+#define TARGET_GLC_NAME (TARGET_CDNA3 ? " sc0" : " glc")
/* The metadata on different devices need different granularity. */
#define TARGET_VGPR_GRANULARITY \
(TARGET_RDNA3 ? 12 \
: TARGET_RDNA2_PLUS || TARGET_CDNA2_PLUS ? 8 \
: 4)
/* This mostly affects the metadata. */
-#define TARGET_ARCHITECTED_FLAT_SCRATCH TARGET_RDNA3
+#define TARGET_ARCHITECTED_FLAT_SCRATCH (TARGET_RDNA3 || TARGET_CDNA3)
/* Device has Sub-DWord Addressing instrucions. */
#define TARGET_SDWA (!TARGET_RDNA3)
/* Different devices uses different cache control instructions. */
-#define TARGET_WBINVL1_CACHE (!TARGET_RDNA2_PLUS)
+#define TARGET_WBINVL1_CACHE (!TARGET_RDNA2_PLUS && !TARGET_CDNA3)
#define TARGET_GLn_CACHE TARGET_RDNA2_PLUS
+#define TARGET_TARGET_SC_CACHE TARGET_CDNA3
/* Some devices have TGSPLIT, which needs at least metadata. */
#define TARGET_TGSPLIT TARGET_CDNA2_PLUS
diff --git a/gcc/config/gcn/gcn-tables.opt b/gcc/config/gcn/gcn-tables.opt
index 96ce9bd..4a381b3 100644
--- a/gcc/config/gcn/gcn-tables.opt
+++ b/gcc/config/gcn/gcn-tables.opt
@@ -49,9 +49,18 @@ EnumValue
Enum(gpu_type) String(gfx90c) Value(PROCESSOR_GFX90C)
EnumValue
+Enum(gpu_type) String(gfx942) Value(PROCESSOR_GFX942)
+
+EnumValue
+Enum(gpu_type) String(gfx950) Value(PROCESSOR_GFX950)
+
+EnumValue
Enum(gpu_type) String(gfx9-generic) Value(PROCESSOR_GFX9_GENERIC)
EnumValue
+Enum(gpu_type) String(gfx9-4-generic) Value(PROCESSOR_GFX9_4_GENERIC)
+
+EnumValue
Enum(gpu_type) String(gfx1030) Value(PROCESSOR_GFX1030)
EnumValue
diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md
index 977ad88..4b21302 100644
--- a/gcc/config/gcn/gcn-valu.md
+++ b/gcc/config/gcn/gcn-valu.md
@@ -1161,7 +1161,7 @@
&& (((unsigned HOST_WIDE_INT)INTVAL(operands[2]) + 0x1000) < 0x2000))"
{
addr_space_t as = INTVAL (operands[3]);
- const char *glc = INTVAL (operands[4]) ? " glc" : "";
+ const char *glc = INTVAL (operands[4]) ? TARGET_GLC_NAME : "";
static char buf[200];
if (AS_FLAT_P (as))
@@ -1221,7 +1221,7 @@
&& (((unsigned HOST_WIDE_INT)INTVAL(operands[3]) + 0x1000) < 0x2000))"
{
addr_space_t as = INTVAL (operands[4]);
- const char *glc = INTVAL (operands[5]) ? " glc" : "";
+ const char *glc = INTVAL (operands[5]) ? TARGET_GLC_NAME : "";
static char buf[200];
if (AS_GLOBAL_P (as))
@@ -1288,7 +1288,7 @@
&& (((unsigned HOST_WIDE_INT)INTVAL(operands[1]) + 0x1000) < 0x2000))"
{
addr_space_t as = INTVAL (operands[3]);
- const char *glc = INTVAL (operands[4]) ? " glc" : "";
+ const char *glc = INTVAL (operands[4]) ? TARGET_GLC_NAME : "";
static char buf[200];
if (AS_FLAT_P (as))
@@ -1345,7 +1345,7 @@
&& (((unsigned HOST_WIDE_INT)INTVAL(operands[2]) + 0x1000) < 0x2000))"
{
addr_space_t as = INTVAL (operands[4]);
- const char *glc = INTVAL (operands[5]) ? " glc" : "";
+ const char *glc = INTVAL (operands[5]) ? TARGET_GLC_NAME : "";
static char buf[200];
if (AS_GLOBAL_P (as))
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 91ce801..9b882d9 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -7108,7 +7108,8 @@ print_operand_address (FILE *file, rtx mem)
E - print conditional code for v_cmp (eq_u64/ne_u64...)
A - print address in formatting suitable for given address space.
O - print offset:n for data share operations.
- g - print "glc", if appropriate for given MEM
+ G - print "glc" (or for gfx94x: sc0) unconditionally [+ indep. of regnum]
+ g - print "glc" (or for gfx94x: sc0), if appropriate for given MEM
L - print low-part of a multi-reg value
H - print second part of a multi-reg value (high-part of 2-reg value)
J - print third part of a multi-reg value
@@ -7724,10 +7725,13 @@ print_operand (FILE *file, rtx x, int code)
else
output_addr_const (file, x);
return;
+ case 'G':
+ fputs (TARGET_GLC_NAME, file);
+ return;
case 'g':
gcc_assert (xcode == MEM);
if (MEM_VOLATILE_P (x))
- fputs (" glc", file);
+ fputs (TARGET_GLC_NAME, file);
return;
default:
output_operand_lossage ("invalid %%xn code");
diff --git a/gcc/config/gcn/gcn.h b/gcc/config/gcn/gcn.h
index 5198fbc..3d42de3 100644
--- a/gcc/config/gcn/gcn.h
+++ b/gcc/config/gcn/gcn.h
@@ -43,6 +43,8 @@ extern const struct gcn_device_def {
builtin_define ("__CDNA1__"); \
else if (TARGET_CDNA2) \
builtin_define ("__CDNA2__"); \
+ else if (TARGET_CDNA3) \
+ builtin_define ("__CDNA3__"); \
else if (TARGET_RDNA2) \
builtin_define ("__RDNA2__"); \
else if (TARGET_RDNA3) \
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index e0fb735..1998931 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -206,7 +206,7 @@
; vdata: vgpr0-255
; srsrc: sgpr0-102
; soffset: sgpr0-102
-; flags: offen, idxen, glc, lds, slc, tfe
+; flags: offen, idxen, %G, lds, slc, tfe
;
; mtbuf - Typed memory buffer operation. Two words
; offset: 12-bit constant
@@ -216,10 +216,10 @@
; vdata: vgpr0-255
; srsrc: sgpr0-102
; soffset: sgpr0-102
-; flags: offen, idxen, glc, lds, slc, tfe
+; flags: offen, idxen, %G, lds, slc, tfe
;
; flat - flat or global memory operations
-; flags: glc, slc
+; flags: %G, slc
; addr: vgpr0-255
; data: vgpr0-255
; vdst: vgpr0-255
@@ -1964,6 +1964,14 @@
[(set_attr "type" "mult")
(set_attr "length" "8")])
+(define_insn "*memory_barrier"
+ [(set (match_operand:BLK 0)
+ (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))]
+ "TARGET_TARGET_SC_CACHE"
+ "buffer_inv sc1"
+ [(set_attr "type" "mubuf")
+ (set_attr "length" "4")])
+
; FIXME: These patterns have been disabled as they do not seem to work
; reliably - they can cause hangs or incorrect results.
; TODO: flush caches according to memory model
@@ -1979,9 +1987,9 @@
(use (match_operand 3 "const_int_operand"))]
"0 /* Disabled. */"
"@
- s_atomic_<bare_mnemonic><X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0)
- flat_atomic_<bare_mnemonic><X>\t%0, %1, %2 glc\;s_waitcnt\t0
- global_atomic_<bare_mnemonic><X>\t%0, %A1, %2%O1 glc\;s_waitcnt\tvmcnt(0)"
+ s_atomic_<bare_mnemonic><X>\t%0, %1, %2 %G2\;s_waitcnt\tlgkmcnt(0)
+ flat_atomic_<bare_mnemonic><X>\t%0, %1, %2 %G2\;s_waitcnt\t0
+ global_atomic_<bare_mnemonic><X>\t%0, %A1, %2%O1 %G2\;s_waitcnt\tvmcnt(0)"
[(set_attr "type" "smem,flat,flat")
(set_attr "length" "12")])
@@ -2046,9 +2054,9 @@
UNSPECV_ATOMIC))]
""
"@
- s_atomic_cmpswap<X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0)
- flat_atomic_cmpswap<X>\t%0, %1, %2 glc\;s_waitcnt\t0
- global_atomic_cmpswap<X>\t%0, %A1, %2%O1 glc\;s_waitcnt\tvmcnt(0)"
+ s_atomic_cmpswap<X>\t%0, %1, %2 %G2\;s_waitcnt\tlgkmcnt(0)
+ flat_atomic_cmpswap<X>\t%0, %1, %2 %G2\;s_waitcnt\t0
+ global_atomic_cmpswap<X>\t%0, %A1, %2%O1 %G2\;s_waitcnt\tvmcnt(0)"
[(set_attr "type" "smem,flat,flat")
(set_attr "length" "12")
(set_attr "delayeduse" "*,yes,yes")])
@@ -2088,15 +2096,15 @@
switch (which_alternative)
{
case 0:
- return "s_load%o0\t%0, %A1 glc\;s_waitcnt\tlgkmcnt(0)";
+ return "s_load%o0\t%0, %A1 %G1\;s_waitcnt\tlgkmcnt(0)";
case 1:
return (TARGET_RDNA2 /* Not GFX11. */
- ? "flat_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\t0"
- : "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0");
+ ? "flat_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\t0"
+ : "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0");
case 2:
return (TARGET_RDNA2 /* Not GFX11. */
- ? "global_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\tvmcnt(0)"
- : "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)");
+ ? "global_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\tvmcnt(0)"
+ : "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)");
}
break;
case MEMMODEL_CONSUME:
@@ -2105,25 +2113,31 @@
switch (which_alternative)
{
case 0:
- return "s_load%o0\t%0, %A1 glc\;s_waitcnt\tlgkmcnt(0)\;"
+ return "s_load%o0\t%0, %A1 %G1\;s_waitcnt\tlgkmcnt(0)\;"
"s_dcache_wb_vol";
case 1:
return (TARGET_RDNA2
- ? "flat_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\t0\;"
+ ? "flat_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\t0\;"
"buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_RDNA3
- ? "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0\;"
+ ? "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0\;"
"buffer_gl1_inv\;buffer_gl0_inv"
- : "flat_load%o0\t%0, %A1%O1 glc\;s_waitcnt\t0\;"
+ : TARGET_TARGET_SC_CACHE
+ ? "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0\;"
+ "buffer_inv sc1"
+ : "flat_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\t0\;"
"buffer_wbinvl1_vol");
case 2:
return (TARGET_RDNA2
- ? "global_load%o0\t%0, %A1%O1 glc dlc\;s_waitcnt\tvmcnt(0)\;"
+ ? "global_load%o0\t%0, %A1%O1 %G1 dlc\;s_waitcnt\tvmcnt(0)\;"
"buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_RDNA3
- ? "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)\;"
+ ? "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)\;"
"buffer_gl1_inv\;buffer_gl0_inv"
- : "global_load%o0\t%0, %A1%O1 glc\;s_waitcnt\tvmcnt(0)\;"
+ : TARGET_TARGET_SC_CACHE
+ ? "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)\;"
+ "buffer_inv sc1"
+ : "global_load%o0\t%0, %A1%O1 %G1\;s_waitcnt\tvmcnt(0)\;"
"buffer_wbinvl1_vol");
}
break;
@@ -2133,25 +2147,31 @@
switch (which_alternative)
{
case 0:
- return "s_dcache_wb_vol\;s_load%o0\t%0, %A1 glc\;"
+ return "s_dcache_wb_vol\;s_load%o0\t%0, %A1 %G1\;"
"s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol";
case 1:
return (TARGET_RDNA2
- ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 glc dlc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 %G1 dlc\;"
"s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_RDNA3
- ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 glc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_load%o0\t%0, %A1%O1 %G1\;"
"s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv"
- : "buffer_wbinvl1_vol\;flat_load%o0\t%0, %A1%O1 glc\;"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;flat_load%o0\t%0, %A1%O1 %G1\;"
+ "s_waitcnt\t0\;buffer_inv sc1"
+ : "buffer_wbinvl1_vol\;flat_load%o0\t%0, %A1%O1 %G1\;"
"s_waitcnt\t0\;buffer_wbinvl1_vol");
case 2:
return (TARGET_RDNA2
- ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 glc dlc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 %G1 dlc\;"
"s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_RDNA3
- ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 glc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;global_load%o0\t%0, %A1%O1 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv"
- : "buffer_wbinvl1_vol\;global_load%o0\t%0, %A1%O1 glc\;"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;global_load%o0\t%0, %A1%O1 %G1\;"
+ "s_waitcnt\tvmcnt(0)\;buffer_inv sc1"
+ : "buffer_wbinvl1_vol\;global_load%o0\t%0, %A1%O1 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol");
}
break;
@@ -2176,11 +2196,11 @@
switch (which_alternative)
{
case 0:
- return "s_store%o1\t%1, %A0 glc\;s_waitcnt\tlgkmcnt(0)";
+ return "s_store%o1\t%1, %A0 %G1\;s_waitcnt\tlgkmcnt(0)";
case 1:
- return "flat_store%o1\t%A0, %1%O0 glc\;s_waitcnt\t0";
+ return "flat_store%o1\t%A0, %1%O0 %G1\;s_waitcnt\t0";
case 2:
- return "global_store%o1\t%A0, %1%O0 glc\;s_waitcnt\tvmcnt(0)";
+ return "global_store%o1\t%A0, %1%O0 %G1\;s_waitcnt\tvmcnt(0)";
}
break;
case MEMMODEL_RELEASE:
@@ -2188,18 +2208,22 @@
switch (which_alternative)
{
case 0:
- return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 glc";
+ return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 %G1";
case 1:
return (TARGET_GLn_CACHE
- ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 glc"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 %G1"
: TARGET_WBINVL1_CACHE
- ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc"
+ ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 %G1"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;flat_store%o1\t%A0, %1%O0 %G1"
: "error: cache architectire unspecified");
case 2:
return (TARGET_GLn_CACHE
- ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 glc"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 %G1"
: TARGET_WBINVL1_CACHE
- ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc"
+ ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 %G1"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;global_store%o1\t%A0, %1%O0 %G1"
: "error: cache architecture unspecified");
}
break;
@@ -2209,23 +2233,29 @@
switch (which_alternative)
{
case 0:
- return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 glc\;"
+ return "s_dcache_wb_vol\;s_store%o1\t%1, %A0 %G1\;"
"s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol";
case 1:
return (TARGET_GLn_CACHE
- ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 glc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_store%o1\t%A0, %1%O0 %G1\;"
"s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_WBINVL1_CACHE
- ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 glc\;"
+ ? "buffer_wbinvl1_vol\;flat_store%o1\t%A0, %1%O0 %G1\;"
"s_waitcnt\t0\;buffer_wbinvl1_vol"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;flat_store%o1\t%A0, %1%O0 %G1\;"
+ "s_waitcnt\t0\;buffer_inv sc1"
: "error: cache architecture unspecified");
case 2:
return (TARGET_GLn_CACHE
- ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 glc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;global_store%o1\t%A0, %1%O0 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_WBINVL1_CACHE
- ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 glc\;"
+ ? "buffer_wbinvl1_vol\;global_store%o1\t%A0, %1%O0 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;global_store%o1\t%A0, %1%O0 %G1\;"
+ "s_waitcnt\tvmcnt(0)\;buffer_inv sc1"
: "error: cache architecture unspecified");
}
break;
@@ -2252,11 +2282,11 @@
switch (which_alternative)
{
case 0:
- return "s_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0)";
+ return "s_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\tlgkmcnt(0)";
case 1:
- return "flat_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\t0";
+ return "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0";
case 2:
- return "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;"
+ return "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
"s_waitcnt\tvmcnt(0)";
}
break;
@@ -2266,23 +2296,29 @@
switch (which_alternative)
{
case 0:
- return "s_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\tlgkmcnt(0)\;"
+ return "s_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\tlgkmcnt(0)\;"
"s_dcache_wb_vol\;s_dcache_inv_vol";
case 1:
return (TARGET_GLn_CACHE
- ? "flat_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\t0\;"
+ ? "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0\;"
"buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_WBINVL1_CACHE
- ? "flat_atomic_swap<X>\t%0, %1, %2 glc\;s_waitcnt\t0\;"
+ ? "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0\;"
"buffer_wbinvl1_vol"
+ : TARGET_TARGET_SC_CACHE
+ ? "flat_atomic_swap<X>\t%0, %1, %2 %G1\;s_waitcnt\t0\;"
+ "buffer_inv sc1"
: "error: cache architecture unspecified");
case 2:
return (TARGET_GLn_CACHE
- ? "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;"
+ ? "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_WBINVL1_CACHE
- ? "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;"
+ ? "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"
+ : TARGET_TARGET_SC_CACHE
+ ? "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
+ "s_waitcnt\tvmcnt(0)\;buffer_inv sc1"
: "error: cache architecture unspecified");
}
break;
@@ -2291,24 +2327,31 @@
switch (which_alternative)
{
case 0:
- return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 glc\;"
+ return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 %G1\;"
"s_waitcnt\tlgkmcnt(0)";
case 1:
return (TARGET_GLn_CACHE
- ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 glc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;"
"s_waitcnt\t0"
: TARGET_WBINVL1_CACHE
- ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 glc\;"
+ ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;"
+ "s_waitcnt\t0"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;"
"s_waitcnt\t0"
: "error: cache architecture unspecified");
case 2:
return (TARGET_GLn_CACHE
? "buffer_gl1_inv\;buffer_gl0_inv\;"
- "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;"
+ "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
"s_waitcnt\tvmcnt(0)"
: TARGET_WBINVL1_CACHE
? "buffer_wbinvl1_vol\;"
- "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;"
+ "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
+ "s_waitcnt\tvmcnt(0)"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;"
+ "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
"s_waitcnt\tvmcnt(0)"
: "error: cache architecture unspecified");
}
@@ -2319,25 +2362,32 @@
switch (which_alternative)
{
case 0:
- return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 glc\;"
+ return "s_dcache_wb_vol\;s_atomic_swap<X>\t%0, %1, %2 %G1\;"
"s_waitcnt\tlgkmcnt(0)\;s_dcache_inv_vol";
case 1:
return (TARGET_GLn_CACHE
- ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 glc\;"
+ ? "buffer_gl1_inv\;buffer_gl0_inv\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;"
"s_waitcnt\t0\;buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_WBINVL1_CACHE
- ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 glc\;"
+ ? "buffer_wbinvl1_vol\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;"
"s_waitcnt\t0\;buffer_wbinvl1_vol"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;flat_atomic_swap<X>\t%0, %1, %2 %G1\;"
+ "s_waitcnt\t0\;buffer_inv sc1"
: "error: cache architecture unspecified");
case 2:
return (TARGET_GLn_CACHE
? "buffer_gl1_inv\;buffer_gl0_inv\;"
- "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;"
+ "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_gl1_inv\;buffer_gl0_inv"
: TARGET_WBINVL1_CACHE
? "buffer_wbinvl1_vol\;"
- "global_atomic_swap<X>\t%0, %A1, %2%O1 glc\;"
+ "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
"s_waitcnt\tvmcnt(0)\;buffer_wbinvl1_vol"
+ : TARGET_TARGET_SC_CACHE
+ ? "buffer_inv sc1\;"
+ "global_atomic_swap<X>\t%0, %A1, %2%O1 %G1\;"
+ "s_waitcnt\tvmcnt(0)\;buffer_inv sc1"
: "error: cache architecture unspecified");
}
break;
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 38df84f..a6f0a58 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -25545,14 +25545,10 @@ ix86_vector_costs::finish_cost (const vector_costs *scalar_costs)
/* When X86_TUNE_AVX512_TWO_EPILOGUES is enabled arrange for both
a AVX2 and a SSE epilogue for AVX512 vectorized loops. */
if (loop_vinfo
+ && LOOP_VINFO_EPILOGUE_P (loop_vinfo)
+ && GET_MODE_SIZE (loop_vinfo->vector_mode) == 32
&& ix86_tune_features[X86_TUNE_AVX512_TWO_EPILOGUES])
- {
- if (GET_MODE_SIZE (loop_vinfo->vector_mode) == 64)
- m_suggested_epilogue_mode = V32QImode;
- else if (LOOP_VINFO_EPILOGUE_P (loop_vinfo)
- && GET_MODE_SIZE (loop_vinfo->vector_mode) == 32)
- m_suggested_epilogue_mode = V16QImode;
- }
+ m_suggested_epilogue_mode = V16QImode;
/* When a 128bit SSE vectorized epilogue still has a VF of 16 or larger
enable a 64bit SSE epilogue. */
if (loop_vinfo
diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
index fc223fb..4b7f0a1 100644
--- a/gcc/config/microblaze/microblaze.cc
+++ b/gcc/config/microblaze/microblaze.cc
@@ -239,6 +239,10 @@ section *sdata2_section;
#define TARGET_HAVE_TLS true
#endif
+/* MicroBlaze does not do speculative execution. */
+#undef TARGET_HAVE_SPECULATION_SAFE_VALUE
+#define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
+
/* Return truth value if a CONST_DOUBLE is ok to be a legitimate constant. */
static bool
microblaze_const_double_ok (rtx op, machine_mode mode)
diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc
index 205bc2d..bee18e7 100644
--- a/gcc/config/nvptx/mkoffload.cc
+++ b/gcc/config/nvptx/mkoffload.cc
@@ -260,8 +260,10 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
unsigned ix;
const char *sm_ver = NULL, *version = NULL;
const char *sm_ver2 = NULL, *version2 = NULL;
- size_t file_cnt = 0;
- size_t *file_idx = XALLOCAVEC (size_t, len);
+ /* To reduce the number of reallocations for 'file_idx', guess 'file_cnt'
+ (very roughly...), based on 'len'. */
+ const size_t file_cnt_guessed = 13 + len / 27720;
+ auto_vec<size_t> file_idx (file_cnt_guessed);
fprintf (out, "#include <stdint.h>\n\n");
@@ -269,9 +271,10 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
terminated by a NUL. */
for (size_t i = 0; i != len;)
{
+ file_idx.safe_push (i);
+
char c;
bool output_fn_ptr = false;
- file_idx[file_cnt++] = i;
fprintf (out, "static const char ptx_code_%u[] =\n\t\"", obj_count++);
while ((c = input[i++]))
@@ -349,6 +352,9 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
}
}
+ const size_t file_cnt = file_idx.length ();
+ gcc_checking_assert (file_cnt == obj_count);
+
/* Create function-pointer array, required for reverse
offload function-pointer lookup. */
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f950c61..db696c1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,125 @@
+2025-06-09 Jason Merrill <jason@redhat.com>
+
+ Backported from master:
+ 2025-06-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/120555
+ * decl2.cc (fn_being_defined, fn_template_being_defined): New.
+ (mark_used): Check fn_template_being_defined.
+
+2025-06-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/120502
+ * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: Do constexpr evaluation
+ before genericize.
+ * constexpr.cc (cxx_eval_store_expression): Add comment.
+
+2025-06-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/120123
+ * lambda.cc (nonlambda_method_basetype): Look through lambdas
+ even when current_class_ref is null.
+
+2025-05-30 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-05-29 Sandra Loosemore <sloosemore@baylibre.com>
+
+ * parser.cc (cp_parser_omp_metadirective): Do not call
+ cp_parser_skip_to_end_of_block_or_statement after an error.
+
+2025-05-30 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-05-29 Sandra Loosemore <sloosemore@baylibre.com>
+
+ PR c/120180
+ * parser.cc (cp_parser_omp_metadirective): Only consume the
+ token if it is the expected close paren.
+
+2025-05-26 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-26 Tobias Burnus <tburnus@baylibre.com>
+
+ PR c++/120413
+ * semantics.cc (finish_omp_target_clauses_r): Handle
+ BIND_EXPR with empty BIND_EXPR_BLOCK.
+
+2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120363
+ * decl2.cc (get_tls_init_fn): Set context as global_namespace.
+ (get_tls_wrapper_fn): Likewise.
+
+2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120414
+ * module.cc (trees_in::tree_node): Allow reading a USING_DECL
+ when streaming tt_data_member.
+
+2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120013
+ * module.cc (trees_in::install_entity): Handle re-registering
+ the inner TYPE_DECL of a partial specialisation.
+
+2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120350
+ * rtti.cc (get_tinfo_decl_direct): Mark TREE_ADDRESSABLE.
+
+2025-05-15 Patrick Palka <ppalka@redhat.com>
+
+ Backported from master:
+ 2025-05-15 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/120161
+ * pt.cc (unify) <case RECORD_TYPE>: When comparing specializations
+ of a non-primary template, still perform a type comparison.
+
+2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120125
+ * module.cc (trees_out::write_function_def): Only set
+ DECL_NOT_REALLY_EXTERN if the importer might need to emit it.
+ * optimize.cc (maybe_thunk_body): Don't assume 'fn' has a cgraph
+ node created.
+
+2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/119864
+ * decl2.cc (start_objects): Only use module initialized for
+ host.
+ (c_parse_final_cleanups): Don't always create an OMP offload
+ init function in modules.
+
+2025-05-12 Jason Merrill <jason@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/120012
+ * class.cc (check_non_pod_aggregate): Check is_empty_class.
+
2025-05-07 Jason Merrill <jason@redhat.com>
Backported from master:
diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index 3f2574a..c9026b4 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,15 @@
+2025-06-05 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-06-02 Sandra Loosemore <sloosemore@baylibre.com>
+
+ * cp-tree.h (maybe_convert_cond): Declare.
+ * parser.cc (cp_parser_omp_context_selector): Call
+ maybe_convert_cond and fold_build_cleanup_point_expr on the
+ expression for OMP_TRAIT_PROPERTY_BOOL_EXPR.
+ * pt.cc (tsubst_omp_context_selector): Likewise.
+ * semantics.cc (maybe_convert_cond): Remove static declaration.
+
2025-05-15 Sandra Loosemore <sloosemore@baylibre.com>
Tobias Burnus <tburnus@baylibre.com>
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index 6767ac1..93ad9d6 100644
--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
@@ -6835,8 +6835,10 @@ check_non_pod_aggregate (tree field)
tree type = TREE_TYPE (field);
if (TYPE_IDENTIFIER (type) == as_base_identifier)
type = TYPE_CONTEXT (type);
- if (!CLASS_TYPE_P (type) || (!CLASSTYPE_NON_POD_AGGREGATE (type)
- && !CLASSTYPE_NON_AGGREGATE_POD (type)))
+ if (!CLASS_TYPE_P (type)
+ || is_empty_class (type)
+ || (!CLASSTYPE_NON_POD_AGGREGATE (type)
+ && !CLASSTYPE_NON_AGGREGATE_POD (type)))
return;
tree size = end_of_class (type, (DECL_FIELD_IS_BASE (field)
? eoc_nvsize : eoc_nv_or_dsize));
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 48327fb..5c98208 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -6424,7 +6424,8 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
if (TREE_CLOBBER_P (init)
&& CLOBBER_KIND (init) < CLOBBER_OBJECT_END)
- /* Only handle clobbers ending the lifetime of objects. */
+ /* Only handle clobbers ending the lifetime of objects.
+ ??? We should probably set CONSTRUCTOR_NO_CLEARING. */
return void_node;
/* First we figure out where we're storing to. */
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index a4f3eaa..9144239 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -1473,6 +1473,19 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
break;
case TARGET_EXPR:
+ if (!flag_no_inline)
+ if (tree &init = TARGET_EXPR_INITIAL (stmt))
+ {
+ tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt),
+ (data->flags & ff_mce_false
+ ? mce_false : mce_unknown));
+ if (folded != init && TREE_CONSTANT (folded))
+ init = folded;
+ }
+
+ /* This needs to happen between the constexpr evaluation (which wants
+ pre-generic trees) and fold (which wants the cp_genericize_init
+ transformations). */
if (data->flags & ff_genericize)
cp_genericize_target_expr (stmt_p);
@@ -1481,14 +1494,6 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
cp_walk_tree (&init, cp_fold_r, data, NULL);
cp_walk_tree (&TARGET_EXPR_CLEANUP (stmt), cp_fold_r, data, NULL);
*walk_subtrees = 0;
- if (!flag_no_inline)
- {
- tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt),
- (data->flags & ff_mce_false
- ? mce_false : mce_unknown));
- if (folded != init && TREE_CONSTANT (folded))
- init = folded;
- }
/* Folding might replace e.g. a COND_EXPR with a TARGET_EXPR; in
that case, strip it in favor of this one. */
if (TREE_CODE (init) == TARGET_EXPR)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index f984940..e512c72 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -7951,6 +7951,7 @@ extern bool perform_deferred_access_checks (tsubst_flags_t);
extern bool perform_or_defer_access_check (tree, tree, tree,
tsubst_flags_t,
access_failure_info *afi = NULL);
+extern tree maybe_convert_cond (tree);
/* RAII sentinel to ensures that deferred access checks are popped before
a function returns. */
diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index 23b4bfe..fb2801c 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -4031,6 +4031,7 @@ get_tls_init_fn (tree var)
SET_DECL_LANGUAGE (fn, lang_c);
TREE_PUBLIC (fn) = TREE_PUBLIC (var);
DECL_ARTIFICIAL (fn) = true;
+ DECL_CONTEXT (fn) = FROB_CONTEXT (global_namespace);
DECL_COMDAT (fn) = DECL_COMDAT (var);
DECL_EXTERNAL (fn) = DECL_EXTERNAL (var);
if (DECL_ONE_ONLY (var))
@@ -4090,7 +4091,7 @@ get_tls_wrapper_fn (tree var)
TREE_PUBLIC (fn) = TREE_PUBLIC (var);
DECL_ARTIFICIAL (fn) = true;
DECL_IGNORED_P (fn) = 1;
- DECL_CONTEXT (fn) = DECL_CONTEXT (var);
+ DECL_CONTEXT (fn) = FROB_CONTEXT (global_namespace);
/* The wrapper is inline and emitted everywhere var is used. */
DECL_DECLARED_INLINE_P (fn) = true;
if (TREE_PUBLIC (var))
@@ -4189,7 +4190,11 @@ start_objects (bool initp, unsigned priority, bool has_body,
bool omp_target = false)
{
bool default_init = initp && priority == DEFAULT_INIT_PRIORITY;
- bool is_module_init = default_init && module_global_init_needed ();
+ /* FIXME: We may eventually want to treat OpenMP offload initializers
+ in modules specially as well. */
+ bool is_module_init = (default_init
+ && !omp_target
+ && module_global_init_needed ());
tree name = NULL_TREE;
if (is_module_init)
@@ -5881,12 +5886,8 @@ c_parse_final_cleanups (void)
if (static_init_fini_fns[true]->get_or_insert (DEFAULT_INIT_PRIORITY))
has_module_inits = true;
- if (flag_openmp)
- {
- if (!static_init_fini_fns[2 + true])
- static_init_fini_fns[2 + true] = priority_map_t::create_ggc ();
- static_init_fini_fns[2 + true]->get_or_insert (DEFAULT_INIT_PRIORITY);
- }
+ /* FIXME: We need to work out what static constructors on OpenMP offload
+ target in modules will look like. */
}
/* Generate initialization and destruction functions for all
@@ -6271,6 +6272,33 @@ mark_single_function (tree expr, tsubst_flags_t complain)
return true;
}
+/* True iff we have started, but not finished, defining FUNCTION_DECL DECL. */
+
+bool
+fn_being_defined (tree decl)
+{
+ /* DECL_INITIAL is set to error_mark_node in grokfndecl for a definition, and
+ changed to BLOCK by poplevel at the end of the function. */
+ return (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_INITIAL (decl) == error_mark_node);
+}
+
+/* True if DECL is an instantiation of a function template currently being
+ defined. */
+
+bool
+fn_template_being_defined (tree decl)
+{
+ if (TREE_CODE (decl) != FUNCTION_DECL
+ || !DECL_LANG_SPECIFIC (decl)
+ || !DECL_TEMPLOID_INSTANTIATION (decl)
+ || DECL_TEMPLATE_INSTANTIATED (decl))
+ return false;
+ tree tinfo = DECL_TEMPLATE_INFO (decl);
+ tree pattern = DECL_TEMPLATE_RESULT (TI_TEMPLATE (tinfo));
+ return fn_being_defined (pattern);
+}
+
/* Mark DECL (either a _DECL or a BASELINK) as "used" in the program.
If DECL is a specialization or implicitly declared class member,
generate the actual definition. Return false if something goes
@@ -6424,6 +6452,9 @@ mark_used (tree decl, tsubst_flags_t complain /* = tf_warning_or_error */)
maybe_instantiate_decl (decl);
if (!decl_dependent_p (decl)
+ /* Don't require this yet for an instantiation of a function template
+ we're currently defining (c++/120555). */
+ && !fn_template_being_defined (decl)
&& !require_deduced_type (decl, complain))
return false;
@@ -6438,9 +6469,6 @@ mark_used (tree decl, tsubst_flags_t complain /* = tf_warning_or_error */)
&& uses_template_parms (DECL_TI_ARGS (decl)))
return true;
- if (!require_deduced_type (decl, complain))
- return false;
-
if (builtin_pack_fn_p (decl))
{
error ("use of built-in parameter pack %qD outside of a template",
diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc
index b2e0ecd..352e1b9 100644
--- a/gcc/cp/lambda.cc
+++ b/gcc/cp/lambda.cc
@@ -1033,12 +1033,9 @@ current_nonlambda_function (void)
tree
nonlambda_method_basetype (void)
{
- if (!current_class_ref)
- return NULL_TREE;
-
tree type = current_class_type;
if (!type || !LAMBDA_TYPE_P (type))
- return type;
+ return current_class_ref ? type : NULL_TREE;
while (true)
{
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index f562bf8..e66f725 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -8097,18 +8097,37 @@ trees_in::install_entity (tree decl)
gcc_checking_assert (!existed);
slot = ident;
}
- else if (state->is_partition ())
- {
- /* The decl is already in the entity map, but we see it again now from a
- partition: we want to overwrite if the original decl wasn't also from
- a (possibly different) partition. Otherwise, for things like template
- instantiations, make_dependency might not realise that this is also
- provided from a partition and should be considered part of this module
- (and thus always emitted into the primary interface's CMI). */
+ else
+ {
unsigned *slot = entity_map->get (DECL_UID (decl));
- module_state *imp = import_entity_module (*slot);
- if (!imp->is_partition ())
- *slot = ident;
+
+ /* The entity must be in the entity map already. However, DECL may
+ be the DECL_TEMPLATE_RESULT of an existing partial specialisation
+ if we matched it while streaming another instantiation; in this
+ case we already registered that TEMPLATE_DECL. */
+ if (!slot)
+ {
+ tree type = TREE_TYPE (decl);
+ gcc_checking_assert (TREE_CODE (decl) == TYPE_DECL
+ && CLASS_TYPE_P (type)
+ && CLASSTYPE_TEMPLATE_SPECIALIZATION (type));
+ slot = entity_map->get (DECL_UID (CLASSTYPE_TI_TEMPLATE (type)));
+ }
+ gcc_checking_assert (slot);
+
+ if (state->is_partition ())
+ {
+ /* The decl is already in the entity map, but we see it again now
+ from a partition: we want to overwrite if the original decl
+ wasn't also from a (possibly different) partition. Otherwise,
+ for things like template instantiations, make_dependency might
+ not realise that this is also provided from a partition and
+ should be considered part of this module (and thus always
+ emitted into the primary interface's CMI). */
+ module_state *imp = import_entity_module (*slot);
+ if (!imp->is_partition ())
+ *slot = ident;
+ }
}
return true;
@@ -10503,7 +10522,8 @@ trees_in::tree_node (bool is_use)
res = lookup_field_ident (ctx, u ());
if (!res
- || TREE_CODE (res) != FIELD_DECL
+ || (TREE_CODE (res) != FIELD_DECL
+ && TREE_CODE (res) != USING_DECL)
|| DECL_CONTEXT (res) != ctx)
res = NULL_TREE;
}
@@ -12638,7 +12658,11 @@ trees_out::write_function_def (tree decl)
{
unsigned flags = 0;
- flags |= 1 * DECL_NOT_REALLY_EXTERN (decl);
+ /* Whether the importer should emit this definition, if used. */
+ flags |= 1 * (DECL_NOT_REALLY_EXTERN (decl)
+ && (get_importer_interface (decl)
+ != importer_interface::always_import));
+
if (f)
{
flags |= 2;
diff --git a/gcc/cp/optimize.cc b/gcc/cp/optimize.cc
index 6f9a77f..fc4d6c2 100644
--- a/gcc/cp/optimize.cc
+++ b/gcc/cp/optimize.cc
@@ -309,8 +309,8 @@ maybe_thunk_body (tree fn, bool force)
defer_mangling_aliases = save_defer_mangling_aliases;
cgraph_node::get_create (fns[0])->set_comdat_group (comdat_group);
cgraph_node::get_create (fns[1])->add_to_same_comdat_group
- (cgraph_node::get_create (fns[0]));
- symtab_node::get (fn)->add_to_same_comdat_group
+ (cgraph_node::get (fns[0]));
+ symtab_node::get_create (fn)->add_to_same_comdat_group
(symtab_node::get (fns[0]));
if (fns[2])
/* If *[CD][12]* dtors go into the *[CD]5* comdat group and dtor is
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index be86252..4e1a491 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -51717,12 +51717,25 @@ cp_parser_omp_context_selector (cp_parser *parser, enum omp_tss_code set,
&& !value_dependent_expression_p (t))
{
t = fold_non_dependent_expr (t);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
+ if (property_kind == OMP_TRAIT_PROPERTY_BOOL_EXPR)
{
- error_at (token->location,
- "property must be integer expression");
- return error_mark_node;
+ t = maybe_convert_cond (t);
+ if (t == error_mark_node)
+ return error_mark_node;
+ }
+ else
+ {
+ t = convert_from_reference (t);
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
+ {
+ error_at (token->location,
+ "property must be integer expression");
+ return error_mark_node;
+ }
}
+ if (!processing_template_decl
+ && TREE_CODE (t) != CLEANUP_POINT_EXPR)
+ t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
properties = make_trait_property (NULL_TREE, t, properties);
break;
@@ -53390,7 +53403,6 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok,
{
error_at (match_loc, "too many %<otherwise%> or %<default%> "
"clauses in %<metadirective%>");
- cp_parser_skip_to_end_of_block_or_statement (parser, true);
goto fail;
}
else
@@ -53400,14 +53412,12 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok,
{
error_at (match_loc, "%<otherwise%> or %<default%> clause "
"must appear last in %<metadirective%>");
- cp_parser_skip_to_end_of_block_or_statement (parser, true);
goto fail;
}
if (!default_p && strcmp (p, "when") != 0)
{
error_at (match_loc, "%qs is not valid for %qs",
p, "metadirective");
- cp_parser_skip_to_end_of_block_or_statement (parser, true);
goto fail;
}
@@ -53476,7 +53486,6 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok,
if (i == 0)
{
error_at (loc, "expected directive name");
- cp_parser_skip_to_end_of_block_or_statement (parser, true);
goto fail;
}
@@ -53549,7 +53558,10 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok,
goto add;
case CPP_CLOSE_PAREN:
if (nesting_depth-- == 0)
- break;
+ {
+ cp_lexer_consume_token (parser->lexer);
+ break;
+ }
goto add;
default:
add:
@@ -53561,8 +53573,6 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok,
break;
}
- cp_lexer_consume_token (parser->lexer);
-
if (!skip)
{
cp_token eol_token = {};
@@ -53694,11 +53704,8 @@ cp_parser_omp_metadirective (cp_parser *parser, cp_token *pragma_tok,
return;
fail:
- /* Skip the metadirective pragma. */
+ /* Skip the metadirective pragma. Do not skip the metadirective body. */
cp_parser_skip_to_pragma_eol (parser, pragma_tok);
-
- /* Skip the metadirective body. */
- cp_parser_skip_to_end_of_block_or_statement (parser, true);
}
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index d794083..2747126 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -18415,7 +18415,9 @@ tsubst_omp_context_selector (tree ctx, tree args, tsubst_flags_t complain,
}
}
- switch (omp_ts_map[OMP_TS_CODE (sel)].tp_type)
+ enum omp_tp_type property_kind
+ = omp_ts_map[OMP_TS_CODE (sel)].tp_type;
+ switch (property_kind)
{
case OMP_TRAIT_PROPERTY_DEV_NUM_EXPR:
case OMP_TRAIT_PROPERTY_BOOL_EXPR:
@@ -18423,12 +18425,26 @@ tsubst_omp_context_selector (tree ctx, tree args, tsubst_flags_t complain,
args, complain, in_decl);
t = fold_non_dependent_expr (t);
if (!value_dependent_expression_p (t)
- && !type_dependent_expression_p (t)
- && !INTEGRAL_TYPE_P (TREE_TYPE (t)))
- error_at (cp_expr_loc_or_input_loc (t),
- "property must be integer expression");
- else
- properties = make_trait_property (NULL_TREE, t, NULL_TREE);
+ && !type_dependent_expression_p (t))
+ {
+ if (property_kind == OMP_TRAIT_PROPERTY_BOOL_EXPR)
+ t = maybe_convert_cond (t);
+ else
+ {
+ t = convert_from_reference (t);
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
+ {
+ error_at (cp_expr_loc_or_input_loc (t),
+ "property must be integer expression");
+ t = error_mark_node;
+ }
+ }
+ }
+ if (t != error_mark_node
+ && !processing_template_decl
+ && TREE_CODE (t) != CLEANUP_POINT_EXPR)
+ t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
+ properties = make_trait_property (NULL_TREE, t, NULL_TREE);
break;
case OMP_TRAIT_PROPERTY_CLAUSE_LIST:
if (OMP_TS_CODE (sel) == OMP_TRAIT_CONSTRUCT_SIMD)
@@ -26012,10 +26028,10 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (parm)),
INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (t)),
UNIFY_ALLOW_NONE, explain_p);
- else
- return unify_success (explain_p);
+ gcc_checking_assert (t == arg);
}
- else if (!same_type_ignoring_top_level_qualifiers_p (parm, arg))
+
+ if (!same_type_ignoring_top_level_qualifiers_p (parm, arg))
return unify_type_mismatch (explain_p, parm, arg);
return unify_success (explain_p);
diff --git a/gcc/cp/rtti.cc b/gcc/cp/rtti.cc
index 3539962..8393301 100644
--- a/gcc/cp/rtti.cc
+++ b/gcc/cp/rtti.cc
@@ -468,6 +468,7 @@ get_tinfo_decl_direct (tree type, tree name, int pseudo_ix)
DECL_IGNORED_P (d) = 1;
TREE_READONLY (d) = 1;
TREE_STATIC (d) = 1;
+ TREE_ADDRESSABLE (d) = 1;
/* Tell equal_address_to that different tinfo decls never
overlap. */
if (vec_safe_is_empty (unemitted_tinfo_decls))
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 32d4511..0029080 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -52,7 +52,6 @@ along with GCC; see the file COPYING3. If not see
during template instantiation, which may be regarded as a
degenerate form of parsing. */
-static tree maybe_convert_cond (tree);
static tree finalize_nrv_r (tree *, int *, void *);
/* Used for OpenMP non-static data member privatization. */
@@ -1117,7 +1116,7 @@ annotate_saver::restore (tree new_inner)
statement. Convert it to a boolean value, if appropriate.
In addition, verify sequence points if -Wsequence-point is enabled. */
-static tree
+tree
maybe_convert_cond (tree cond)
{
/* Empty conditions remain empty. */
@@ -11819,10 +11818,10 @@ finish_omp_target_clauses_r (tree *tp, int *walk_subtrees, void *ptr)
if (TREE_CODE (t) == BIND_EXPR)
{
- tree block = BIND_EXPR_BLOCK (t);
- for (tree var = BLOCK_VARS (block); var; var = DECL_CHAIN (var))
- if (!data->local_decls.contains (var))
- data->local_decls.add (var);
+ if (tree block = BIND_EXPR_BLOCK (t))
+ for (tree var = BLOCK_VARS (block); var; var = DECL_CHAIN (var))
+ if (!data->local_decls.contains (var))
+ data->local_decls.add (var);
return NULL_TREE;
}
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index ec68c85..bad3408 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7336,7 +7336,7 @@ truncate the copy without appending the terminating @code{NUL} character.
Using the attribute makes it possible to suppress the warning. However,
when the array is declared with the attribute the call to @code{strlen} is
diagnosed because when the array doesn't contain a @code{NUL}-terminated
-string the call is undefined. To copy, compare, of search non-string
+string the call is undefined. To copy, compare, or search non-string
character arrays use the @code{memcpy}, @code{memcmp}, @code{memchr},
and other functions that operate on arrays of bytes. In addition,
calling @code{strnlen} and @code{strndup} with such arrays is safe
diff --git a/gcc/doc/gm2.texi b/gcc/doc/gm2.texi
index cb52e8c..8293da4 100644
--- a/gcc/doc/gm2.texi
+++ b/gcc/doc/gm2.texi
@@ -1495,7 +1495,7 @@ from @samp{bad} will cause an overflow to @samp{foo}. If we compile
the code with the following options:
@example
-$ gm2 -g -fsoft-check-all -O2 -c assignvalue.mod
+$ gm2 -g -fsoft-check-all -O2 -fm2-plugin -c assignvalue.mod
assignvalue.mod:16:0:inevitable that this error will occur at run time,
assignment will result in an overflow
@end example
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 1af0082..9d72f79 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1342,9 +1342,13 @@ default set of libraries is selected based on the value of
@item amdgcn*-*-*
@var{list} is a comma separated list of ISA names (allowed values:
-@code{gfx900}, @code{gfx906}, @code{gfx908}, @code{gfx90a}, @code{gfx90c},
-@code{gfx1030}, @code{gfx1036}, @code{gfx1100}, @code{gfx1103}).
-It ought not include the name of the default
+@code{gfx900}, @code{gfx902}, @code{gfx904}, @code{gfx906}, @code{gfx908},
+@code{gfx909}, @code{gfx90a}, @code{gfx90c}, @code{gfx942}, @code{gfx950},
+@code{gfx9-generic}, @code{gfx9-4-generic}, @code{gfx1030}, @code{gfx1031},
+@code{gfx1032}, @code{gfx1033}, @code{gfx1034}, @code{gfx1035}, @code{gfx1036},
+@code{gfx10-3-generic}, @code{gfx1100}, @code{gfx1101}, @code{gfx1102},
+@code{gfx1103}, @code{gfx1150}, @code{gfx1151}, @code{gfx1152}, @code{gfx1153},
+@code{gfx11-generic}). It ought not include the name of the default
ISA, specified via @option{--with-arch}. If @var{list} is empty, then there
will be no multilibs and only the default run-time library will be built. If
@var{list} is @code{default} or @option{--with-multilib-list=} is not
@@ -4053,9 +4057,10 @@ By default, multilib support is built for @code{gfx900}, @code{gfx906},
requires LLVM 15 or newer. LLVM 13.0.1 or LLVM 14 can be used by specifying
a @code{--with-multilib-list=} that does not list any GFX 11 device nor
@code{gfx1036}. At least LLVM 16 is required for @code{gfx1150} and
-@code{gfx1151}, LLVM 19 for the generic @code{gfx9-generic},
-@code{gfx10-3-generic}, and @code{gfx11-generic} targets and for
-@code{gfx1152}, while LLVM 20 is required for @code{gfx1153}.
+@code{gfx1151}, LLVM 18 for @code{gfx942}, LLVM 19 for the generic
+@code{gfx9-generic}, @code{gfx9-4-generic}, @code{gfx10-3-generic}, and
+@code{gfx11-generic} targets and for @code{gfx1152}, while LLVM 20 is required
+for @code{gfx950} and @code{gfx1153}.
The supported ISA architectures are listed in the GCC manual. The generic
ISA targets @code{gfx9-generic}, @code{gfx10-3-generic}, and
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 3135821..c122724 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -22614,10 +22614,20 @@ Compile for CDNA2 Instinct MI200 series devices (gfx90a).
@item gfx90c
Compile for GCN5 Vega 7 devices (gfx90c).
+@item gfx942
+Compile for CDNA3 Instinct MI300 series devices (gfx942). (Experimental)
+
+@item gfx950
+Compile for the CDNA3 gfx950 devices. (Experimental)
+
@item gfx9-generic
Compile generic code for Vega devices, executable on the following subset of
GFX9 devices: gfx900, gfx902, gfx904, gfx906, gfx909 and gfx90c. (Experimental)
+@item gfx9-4-generic
+Compile generic code for CDNA3 devices, executable on the following subset of
+GFX9 devices: gfx942 and gfx950. (Experimental)
+
@item gfx1030
Compile for RDNA2 gfx1030 devices (GFX10 series).
diff --git a/gcc/dse.cc b/gcc/dse.cc
index ffc86ff..14f82c3 100644
--- a/gcc/dse.cc
+++ b/gcc/dse.cc
@@ -1190,7 +1190,10 @@ canon_address (rtx mem,
address = strip_offset_and_add (address, offset);
if (ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (mem))
- && const_or_frame_p (address))
+ && const_or_frame_p (address)
+ /* Literal addresses can alias any base, avoid creating a
+ group for them. */
+ && ! CONST_SCALAR_INT_P (address))
{
group_info *group = get_group_info (address);
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 8c711e4..b5a7886 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -31099,7 +31099,8 @@ resolve_addr_in_expr (dw_attr_node *a, dw_loc_descr_ref loc)
return false;
remove_addr_table_entry (loc->dw_loc_oprnd1.val_entry);
loc->dw_loc_oprnd1.val_entry
- = add_addr_table_entry (rtl, ate_kind_rtx);
+ = add_addr_table_entry (rtl, loc->dtprel
+ ? ate_kind_rtx_dtprel : ate_kind_rtx);
}
break;
case DW_OP_const4u:
diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc
index a034395..aa80c04 100644
--- a/gcc/ext-dce.cc
+++ b/gcc/ext-dce.cc
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "print-rtl.h"
#include "dbgcnt.h"
#include "diagnostic-core.h"
+#include "target.h"
/* These should probably move into a C++ class. */
static vec<bitmap_head> livein;
@@ -764,13 +765,25 @@ ext_dce_process_uses (rtx_insn *insn, rtx obj,
We don't want to mark those bits live unnecessarily
as that inhibits extension elimination in important
cases such as those in Coremark. So we need that
- outer code. */
+ outer code.
+
+ But if !TRULY_NOOP_TRUNCATION_MODES_P, the mode
+ change performed by Y would normally need to be a
+ TRUNCATE rather than a SUBREG. It is probably the
+ guarantee provided by SUBREG_PROMOTED_VAR_P that
+ allows the SUBREG in Y as an exception. We must
+ therefore preserve that guarantee and treat the
+ upper bits of the inner register as live
+ regardless of the outer code. See PR 120050. */
if (!REG_P (SUBREG_REG (y))
|| (SUBREG_PROMOTED_VAR_P (y)
&& ((GET_CODE (SET_SRC (x)) == SIGN_EXTEND
&& SUBREG_PROMOTED_SIGNED_P (y))
|| (GET_CODE (SET_SRC (x)) == ZERO_EXTEND
- && SUBREG_PROMOTED_UNSIGNED_P (y)))))
+ && SUBREG_PROMOTED_UNSIGNED_P (y))
+ || !TRULY_NOOP_TRUNCATION_MODES_P (
+ GET_MODE (y),
+ GET_MODE (SUBREG_REG (y))))))
break;
bit = subreg_lsb (y).to_constant ();
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2697deb..9ee7251 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,187 @@
+2025-06-13 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backported from master:
+ 2025-06-13 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/120483
+ * trans-expr.cc (gfc_conv_substring): Use pointer arithmetic on
+ static allocatable char arrays.
+
+2025-06-04 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-06-03 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/99838
+ * data.cc (gfc_assign_data_value): For a new initializer use the
+ location from the constructor as fallback.
+
+2025-06-03 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-30 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/102599
+ PR fortran/114022
+ * expr.cc (simplify_complex_array_inquiry_ref): Helper function for
+ simplification of inquiry references (%re/%im) of constant complex
+ arrays.
+ (find_inquiry_ref): Use it for handling %re/%im inquiry references
+ of complex arrays.
+ (scalarize_intrinsic_call): Fix frontend memleak.
+ * primary.cc (gfc_match_varspec): When the reference is NULL, the
+ previous simplification has succeeded in evaluating inquiry
+ references also of arrays.
+
+2025-06-03 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-27 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101735
+ * primary.cc (gfc_match_varspec): Correct order of logic.
+
+2025-06-03 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-27 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101735
+ * expr.cc (find_inquiry_ref): If an inquiry reference applies to
+ a substring, use that, and calculate substring length if needed.
+ * primary.cc (extend_ref): Also handle attaching to end of
+ reference chain for appending.
+ (gfc_match_varspec): Discrimate between arrays of character and
+ substrings of them. If a substring is taken from a character
+ component of a derived type, get the proper typespec so that
+ inquiry references work correctly.
+ (gfc_match_rvalue): Handle corner case where we hit a seemingly
+ dangling '%' and missed an inquiry reference. Try another match.
+
+2025-06-02 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/120193
+ * trans-types.cc (gfc_init_types): For flag_unsigned use
+ build_distinct_type_copy or build_variant_type_copy from
+ gfc_character_types[index_char] if index_char > -1 instead of
+ gfc_character_types[index_char] or
+ gfc_build_unsigned_type (&gfc_unsigned_kinds[index]).
+
+2025-06-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/119856
+ * io.cc: Set missing comma error checks to STD_STD_LEGACY.
+
+2025-05-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/120049
+ * check.cc (gfc_check_c_associated): Use new helper functions.
+ Only call check_c_ptr_1 if optional c_ptr_2 tests succeed.
+ (check_c_ptr_1): Handle only c_ptr_1 checks.
+ (check_c_ptr_2): Expand checks for c_ptr_2 and handle cases
+ where there is no derived pointer in the gfc_expr and check
+ the inmod_sym_id only if it exists. Rephrase error message.
+ * misc.cc (gfc_typename): Handle the case for BT_VOID rather
+ than throw an internal error.
+
+2025-05-31 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-30 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/120355
+ * interface.cc (compare_parameter): If the global function has a
+ result clause, take typespec from there for the comparison against
+ the dummy argument.
+
+2025-05-22 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-15 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/85750
+ * resolve.cc (resolve_symbol): Reorder conditions when to apply
+ default-initializers.
+
+2025-05-20 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-10 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/102891
+ * dependency.cc (gfc_ref_needs_temporary_p): Within an array
+ reference, inquiry references of complex variables generally
+ need a temporary.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-15 Tobias Burnus <tburnus@baylibre.com>
+
+ * trans-openmp.cc (gfc_omp_deep_mapping_do): Handle SSA_NAME if
+ a def_stmt is available.
+
+2025-05-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/120049
+ * check.cc (gfc_check_c_associated): Modify checks to avoid
+ ICE and allow use, intrinsic :: iso_c_binding from a separate
+ module file.
+
+2025-05-15 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-14 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/120139
+ * dump-parse-tree.cc (get_c_type_name): If no constant
+ size of an array exists, output an asterisk.
+
+2025-05-15 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-14 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/120107
+ * dump-parse-tree.cc (write_type): Do not dump non-interoperable
+ types.
+
+2025-05-13 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/120163
+ * gfortran.h: Add formal_resolved to gfc_symbol.
+ * resolve.cc (gfc_resolve_formal_arglist): Set it.
+ (resolve_function): Do not call gfc_get_formal_from_actual_arglist
+ if we already resolved a formal arglist.
+ (resolve_call): Likewise.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+ Daniil Kochergin <daniil2472s@gmail.com>
+ Tobias Burnus <tburnus@baylibre.com>
+
+ PR fortran/120191
+ * trans-intrinsic.cc (strip_kind_from_actual): Remove.
+ (gfc_conv_intrinsic_minmaxloc): Don't call strip_kind_from_actual.
+ Free and clear kind_arg->expr if non-NULL. Set back_arg->name to
+ "%VAL" instead of a loop looking for last argument. Remove actual
+ variable, use array_arg instead. Free and clear dim_arg->expr if
+ non-NULL for BT_CHARACTER cases instead of using a loop.
+
2025-05-11 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/119928
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index 05c8e3f..7c5eee2 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,16 @@
+2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+ Sandra Loosemore <sloosemore@baylibre.com>
+
+ * f95-lang.cc (ATTR_PURE_NOTHROW_LIST): Define.
+ * trans-expr.cc (get_builtin_fn): Handle omp_get_num_devices
+ and omp_get_intrinsic_device.
+ * gfortran.h (gfc_option_t): Add disable_omp_... for them.
+ * options.cc (gfc_handle_option): Handle them with
+ -fno-builtin-.
+
2025-05-15 Sandra Loosemore <sloosemore@baylibre.com>
Tobias Burnus <tburnus@baylibre.com>
diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index 9c66c25..ce9da31 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -5916,39 +5916,110 @@ gfc_check_c_sizeof (gfc_expr *arg)
}
-bool
-gfc_check_c_associated (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2)
+/* Helper functions check_c_ptr_1 and check_c_ptr_2
+ used in gfc_check_c_associated. */
+
+static inline
+bool check_c_ptr_1 (gfc_expr *c_ptr_1)
{
+ if ((c_ptr_1->ts.type == BT_VOID)
+ && (c_ptr_1->expr_type == EXPR_FUNCTION))
+ return true;
+
if (c_ptr_1->ts.type != BT_DERIVED
|| c_ptr_1->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING
|| (c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_PTR
&& c_ptr_1->ts.u.derived->intmod_sym_id != ISOCBINDING_FUNPTR))
- {
- gfc_error ("Argument C_PTR_1 at %L to C_ASSOCIATED shall have the "
- "type TYPE(C_PTR) or TYPE(C_FUNPTR)", &c_ptr_1->where);
- return false;
- }
+ goto check_1_error;
+
+ if ((c_ptr_1->ts.type == BT_DERIVED)
+ && (c_ptr_1->expr_type == EXPR_STRUCTURE)
+ && (c_ptr_1->ts.u.derived->intmod_sym_id
+ == ISOCBINDING_NULL_FUNPTR))
+ goto check_1_error;
- if (!scalar_check (c_ptr_1, 0))
+ if (scalar_check (c_ptr_1, 0))
+ return true;
+ else
+ /* Return since the check_1_error message may not apply here. */
return false;
- if (c_ptr_2
- && (c_ptr_2->ts.type != BT_DERIVED
- || c_ptr_2->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING
- || (c_ptr_1->ts.u.derived->intmod_sym_id
- != c_ptr_2->ts.u.derived->intmod_sym_id)))
- {
- gfc_error ("Argument C_PTR_2 at %L to C_ASSOCIATED shall have the "
- "same type as C_PTR_1: %s instead of %s", &c_ptr_1->where,
- gfc_typename (&c_ptr_1->ts),
- gfc_typename (&c_ptr_2->ts));
- return false;
- }
+check_1_error:
+
+ gfc_error ("Argument C_PTR_1 at %L to C_ASSOCIATED shall have the "
+ "type TYPE(C_PTR) or TYPE(C_FUNPTR)", &c_ptr_1->where);
+ return false;
+}
+
+static inline
+bool check_c_ptr_2 (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2)
+{
+ switch (c_ptr_2->ts.type)
+ {
+ case BT_VOID:
+ if (c_ptr_2->expr_type == EXPR_FUNCTION)
+ {
+ if ((c_ptr_1->ts.type == BT_DERIVED)
+ && c_ptr_1->expr_type == EXPR_STRUCTURE
+ && (c_ptr_1->ts.u.derived->intmod_sym_id
+ == ISOCBINDING_FUNPTR))
+ goto check_2_error;
+ }
+ break;
+
+ case BT_DERIVED:
+ if ((c_ptr_2->expr_type == EXPR_STRUCTURE)
+ && (c_ptr_2->ts.u.derived->intmod_sym_id == ISOCBINDING_PTR)
+ && (c_ptr_1->ts.type == BT_VOID)
+ && (c_ptr_1->expr_type == EXPR_FUNCTION))
+ return scalar_check (c_ptr_2, 1);
+
+ if ((c_ptr_2->expr_type == EXPR_STRUCTURE)
+ && (c_ptr_1->ts.type == BT_VOID)
+ && (c_ptr_1->expr_type == EXPR_FUNCTION))
+ goto check_2_error;
+
+ if (c_ptr_2->ts.u.derived->from_intmod != INTMOD_ISO_C_BINDING)
+ goto check_2_error;
+
+ if (c_ptr_1->ts.type == BT_DERIVED
+ && (c_ptr_1->ts.u.derived->intmod_sym_id
+ != c_ptr_2->ts.u.derived->intmod_sym_id))
+ goto check_2_error;
+ break;
- if (c_ptr_2 && !scalar_check (c_ptr_2, 1))
+ default:
+ goto check_2_error;
+ }
+
+ if (scalar_check (c_ptr_2, 1))
+ return true;
+ else
+ /* Return since the check_2_error message may not apply here. */
return false;
- return true;
+check_2_error:
+
+ gfc_error ("Argument C_PTR_2 at %L to C_ASSOCIATED shall have the "
+ "same type as C_PTR_1, found %s instead of %s", &c_ptr_2->where,
+ gfc_typename (&c_ptr_2->ts), gfc_typename (&c_ptr_1->ts));
+
+ return false;
+ }
+
+
+bool
+gfc_check_c_associated (gfc_expr *c_ptr_1, gfc_expr *c_ptr_2)
+{
+ if (c_ptr_2)
+ {
+ if (check_c_ptr_2 (c_ptr_1, c_ptr_2))
+ return check_c_ptr_1 (c_ptr_1);
+ else
+ return false;
+ }
+ else
+ return check_c_ptr_1 (c_ptr_1);
}
diff --git a/gcc/fortran/data.cc b/gcc/fortran/data.cc
index 5c83f69..a438c26 100644
--- a/gcc/fortran/data.cc
+++ b/gcc/fortran/data.cc
@@ -593,7 +593,13 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index,
{
/* Point the container at the new expression. */
if (last_con == NULL)
- symbol->value = expr;
+ {
+ symbol->value = expr;
+ /* For a new initializer use the location from the
+ constructor as fallback. */
+ if (!GFC_LOCUS_IS_SET(expr->where) && con != NULL)
+ symbol->value->where = con->where;
+ }
else
last_con->expr = expr;
}
diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc
index 57c0c49..aa8a57a 100644
--- a/gcc/fortran/dependency.cc
+++ b/gcc/fortran/dependency.cc
@@ -944,8 +944,12 @@ gfc_ref_needs_temporary_p (gfc_ref *ref)
types), not in characters. */
return subarray_p;
- case REF_COMPONENT:
case REF_INQUIRY:
+ /* Within an array reference, inquiry references of complex
+ variables generally need a temporary. */
+ return subarray_p;
+
+ case REF_COMPONENT:
break;
}
diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 9708964..648109b 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -4350,6 +4350,8 @@ get_c_type_name (gfc_typespec *ts, gfc_array_spec *as, const char **pre,
mpz_clear (sz);
*asterisk = false;
}
+ else
+ *asterisk = true;
}
return ret;
}
@@ -4394,10 +4396,11 @@ write_type (gfc_symbol *sym)
{
gfc_component *c;
- /* Don't dump our iso c module, nor vtypes. */
+ /* Don't dump types that are not interoperable, our very own ISO C Binding
+ module, or vtypes. */
if (sym->from_intmod == INTMOD_ISO_C_BINDING || sym->attr.flavor != FL_DERIVED
- || sym->attr.vtype)
+ || sym->attr.vtype || !sym->attr.is_bind_c)
return;
fprintf (dumpfile, "typedef struct %s {\n", sym->name);
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 827e199..95ea055 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -1838,6 +1838,55 @@ find_substring_ref (gfc_expr *p, gfc_expr **newp)
}
+/* Simplify inquiry references (%re/%im) of constant complex arrays.
+ Used by find_inquiry_ref. */
+
+static gfc_expr *
+simplify_complex_array_inquiry_ref (gfc_expr *p, inquiry_type inquiry)
+{
+ gfc_expr *e, *r, *result;
+ gfc_constructor_base base;
+ gfc_constructor *c;
+
+ if ((inquiry != INQUIRY_RE && inquiry != INQUIRY_IM)
+ || p->expr_type != EXPR_ARRAY
+ || p->ts.type != BT_COMPLEX
+ || p->rank <= 0
+ || p->value.constructor == NULL
+ || !gfc_is_constant_array_expr (p))
+ return NULL;
+
+ /* Simplify array sections. */
+ gfc_simplify_expr (p, 0);
+
+ result = gfc_get_array_expr (BT_REAL, p->ts.kind, &p->where);
+ result->rank = p->rank;
+ result->shape = gfc_copy_shape (p->shape, p->rank);
+
+ base = p->value.constructor;
+ for (c = gfc_constructor_first (base); c; c = gfc_constructor_next (c))
+ {
+ e = c->expr;
+ if (e->expr_type != EXPR_CONSTANT)
+ goto fail;
+
+ r = gfc_get_constant_expr (BT_REAL, e->ts.kind, &e->where);
+ if (inquiry == INQUIRY_RE)
+ mpfr_set (r->value.real, mpc_realref (e->value.complex), GFC_RND_MODE);
+ else
+ mpfr_set (r->value.real, mpc_imagref (e->value.complex), GFC_RND_MODE);
+
+ gfc_constructor_append_expr (&result->value.constructor, r, &e->where);
+ }
+
+ return result;
+
+fail:
+ gfc_free_expr (result);
+ return NULL;
+}
+
+
/* Pull an inquiry result out of an expression. */
static bool
@@ -1846,7 +1895,9 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp)
gfc_ref *ref;
gfc_ref *inquiry = NULL;
gfc_ref *inquiry_head;
+ gfc_ref *ref_ss = NULL;
gfc_expr *tmp;
+ bool nofail = false;
tmp = gfc_copy_expr (p);
@@ -1862,6 +1913,9 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp)
{
inquiry = ref->next;
ref->next = NULL;
+ if (ref->type == REF_SUBSTRING)
+ ref_ss = ref;
+ break;
}
}
@@ -1891,6 +1945,28 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp)
if (!gfc_notify_std (GFC_STD_F2003, "LEN part_ref at %C"))
goto cleanup;
+ /* Inquire length of substring? */
+ if (ref_ss)
+ {
+ if (ref_ss->u.ss.start->expr_type == EXPR_CONSTANT
+ && ref_ss->u.ss.end->expr_type == EXPR_CONSTANT)
+ {
+ HOST_WIDE_INT istart, iend, length;
+ istart = gfc_mpz_get_hwi (ref_ss->u.ss.start->value.integer);
+ iend = gfc_mpz_get_hwi (ref_ss->u.ss.end->value.integer);
+
+ if (istart <= iend)
+ length = iend - istart + 1;
+ else
+ length = 0;
+ *newp = gfc_get_int_expr (gfc_default_integer_kind,
+ NULL, length);
+ break;
+ }
+ else
+ goto cleanup;
+ }
+
if (tmp->ts.u.cl->length
&& tmp->ts.u.cl->length->expr_type == EXPR_CONSTANT)
*newp = gfc_copy_expr (tmp->ts.u.cl->length);
@@ -1921,24 +1997,50 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp)
break;
case INQUIRY_RE:
- if (tmp->ts.type != BT_COMPLEX || tmp->expr_type != EXPR_CONSTANT)
+ if (tmp->ts.type != BT_COMPLEX)
goto cleanup;
if (!gfc_notify_std (GFC_STD_F2008, "RE part_ref at %C"))
goto cleanup;
+ if (tmp->expr_type == EXPR_ARRAY)
+ {
+ *newp = simplify_complex_array_inquiry_ref (tmp, INQUIRY_RE);
+ if (*newp != NULL)
+ {
+ nofail = true;
+ break;
+ }
+ }
+
+ if (tmp->expr_type != EXPR_CONSTANT)
+ goto cleanup;
+
*newp = gfc_get_constant_expr (BT_REAL, tmp->ts.kind, &tmp->where);
mpfr_set ((*newp)->value.real,
mpc_realref (tmp->value.complex), GFC_RND_MODE);
break;
case INQUIRY_IM:
- if (tmp->ts.type != BT_COMPLEX || tmp->expr_type != EXPR_CONSTANT)
+ if (tmp->ts.type != BT_COMPLEX)
goto cleanup;
if (!gfc_notify_std (GFC_STD_F2008, "IM part_ref at %C"))
goto cleanup;
+ if (tmp->expr_type == EXPR_ARRAY)
+ {
+ *newp = simplify_complex_array_inquiry_ref (tmp, INQUIRY_IM);
+ if (*newp != NULL)
+ {
+ nofail = true;
+ break;
+ }
+ }
+
+ if (tmp->expr_type != EXPR_CONSTANT)
+ goto cleanup;
+
*newp = gfc_get_constant_expr (BT_REAL, tmp->ts.kind, &tmp->where);
mpfr_set ((*newp)->value.real,
mpc_imagref (tmp->value.complex), GFC_RND_MODE);
@@ -1951,7 +2053,7 @@ find_inquiry_ref (gfc_expr *p, gfc_expr **newp)
if (!(*newp))
goto cleanup;
- else if ((*newp)->expr_type != EXPR_CONSTANT)
+ else if ((*newp)->expr_type != EXPR_CONSTANT && !nofail)
{
gfc_free_expr (*newp);
goto cleanup;
@@ -2523,7 +2625,7 @@ scalarize_intrinsic_call (gfc_expr *e, bool init_flag)
rank[n] = a->expr->rank;
else
rank[n] = 1;
- ctor = gfc_constructor_copy (a->expr->value.constructor);
+ ctor = a->expr->value.constructor;
args[n] = gfc_constructor_first (ctor);
}
else
diff --git a/gcc/fortran/f95-lang.cc b/gcc/fortran/f95-lang.cc
index 3808fed..3b6610e 100644
--- a/gcc/fortran/f95-lang.cc
+++ b/gcc/fortran/f95-lang.cc
@@ -571,7 +571,7 @@ gfc_builtin_function (tree decl)
return decl;
}
-/* So far we need just these 10 attribute types. */
+/* So far we need just these 12 attribute types. */
#define ATTR_NULL 0
#define ATTR_LEAF_LIST (ECF_LEAF)
#define ATTR_NOTHROW_LEAF_LIST (ECF_NOTHROW | ECF_LEAF)
@@ -587,6 +587,7 @@ gfc_builtin_function (tree decl)
#define ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST \
(ECF_COLD | ECF_NORETURN | \
ECF_NOTHROW | ECF_LEAF)
+#define ATTR_PURE_NOTHROW_LIST (ECF_PURE | ECF_NOTHROW)
static void
gfc_define_builtin (const char *name, tree type, enum built_in_function code,
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index c9cf072..aa44571 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2074,6 +2074,9 @@ typedef struct gfc_symbol
This is legal in Fortran, but can cause problems with autogenerated
C prototypes for C23. */
unsigned ext_dummy_arglist_mismatch:1;
+ /* Set if the formal arglist has already been resolved, to avoid
+ trying to generate it again from actual arguments. */
+ unsigned formal_resolved:1;
/* Reference counter, used for memory management.
@@ -3335,8 +3338,10 @@ typedef struct
int flag_init_logical;
int flag_init_character;
char flag_init_character_value;
- bool disable_omp_is_initial_device;
- bool disable_acc_on_device;
+ bool disable_omp_is_initial_device:1;
+ bool disable_omp_get_initial_device:1;
+ bool disable_omp_get_num_devices:1;
+ bool disable_acc_on_device:1;
int fpe;
int fpe_summary;
diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index 753f589..b854292 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -2547,7 +2547,14 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
}
else if (formal->attr.function)
{
- if (!gfc_compare_types (&global_asym->ts,
+ gfc_typespec ts;
+
+ if (global_asym->result)
+ ts = global_asym->result->ts;
+ else
+ ts = global_asym->ts;
+
+ if (!gfc_compare_types (&ts,
&formal->ts))
{
gfc_error ("Type mismatch at %L passing global "
diff --git a/gcc/fortran/io.cc b/gcc/fortran/io.cc
index b5c9d33..7466d8f 100644
--- a/gcc/fortran/io.cc
+++ b/gcc/fortran/io.cc
@@ -1228,7 +1228,8 @@ between_desc:
default:
if (mode != MODE_FORMAT)
format_locus.nextc += format_string_pos - 1;
- if (!gfc_notify_std (GFC_STD_GNU, "Missing comma at %L", &format_locus))
+ if (!gfc_notify_std (GFC_STD_LEGACY,
+ "Missing comma in FORMAT string at %L", &format_locus))
return false;
/* If we do not actually return a failure, we need to unwind this
before the next round. */
@@ -1290,7 +1291,8 @@ extension_optional_comma:
default:
if (mode != MODE_FORMAT)
format_locus.nextc += format_string_pos;
- if (!gfc_notify_std (GFC_STD_GNU, "Missing comma at %L", &format_locus))
+ if (!gfc_notify_std (GFC_STD_LEGACY,
+ "Missing comma in FORMAT string at %L", &format_locus))
return false;
/* If we do not actually return a failure, we need to unwind this
before the next round. */
diff --git a/gcc/fortran/misc.cc b/gcc/fortran/misc.cc
index 893c40f..b8bdf75 100644
--- a/gcc/fortran/misc.cc
+++ b/gcc/fortran/misc.cc
@@ -214,6 +214,9 @@ gfc_typename (gfc_typespec *ts, bool for_hash)
case BT_UNKNOWN:
strcpy (buffer, "UNKNOWN");
break;
+ case BT_VOID:
+ strcpy (buffer, "VOID");
+ break;
default:
gfc_internal_error ("gfc_typename(): Undefined type");
}
diff --git a/gcc/fortran/options.cc b/gcc/fortran/options.cc
index ddddc1c..d3c9066 100644
--- a/gcc/fortran/options.cc
+++ b/gcc/fortran/options.cc
@@ -883,6 +883,10 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
return false; /* Not supported. */
if (!strcmp ("omp_is_initial_device", arg))
gfc_option.disable_omp_is_initial_device = true;
+ else if (!strcmp ("omp_get_initial_device", arg))
+ gfc_option.disable_omp_get_initial_device = true;
+ else if (!strcmp ("omp_get_num_devices", arg))
+ gfc_option.disable_omp_get_num_devices = true;
else if (!strcmp ("acc_on_device", arg))
gfc_option.disable_acc_on_device = true;
else
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 72ecc7c..b5dddde 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -2102,10 +2102,18 @@ extend_ref (gfc_expr *primary, gfc_ref *tail)
{
if (primary->ref == NULL)
primary->ref = tail = gfc_get_ref ();
+ else if (tail == NULL)
+ {
+ /* Set tail to end of reference chain. */
+ for (gfc_ref *ref = primary->ref; ref; ref = ref->next)
+ if (ref->next == NULL)
+ {
+ tail = ref;
+ break;
+ }
+ }
else
{
- if (tail == NULL)
- gfc_internal_error ("extend_ref(): Bad tail");
tail->next = gfc_get_ref ();
tail = tail->next;
}
@@ -2302,9 +2310,22 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
gfc_array_spec *as;
bool coarray_only = sym->attr.codimension && !sym->attr.dimension
&& sym->ts.type == BT_CHARACTER;
+ gfc_ref *ref, *strarr = NULL;
tail = extend_ref (primary, tail);
- tail->type = REF_ARRAY;
+ if (sym->ts.type == BT_CHARACTER && tail->type == REF_SUBSTRING)
+ {
+ gcc_assert (sym->attr.dimension);
+ /* Find array reference for substrings of character arrays. */
+ for (ref = primary->ref; ref && ref->next; ref = ref->next)
+ if (ref->type == REF_ARRAY && ref->next->type == REF_SUBSTRING)
+ {
+ strarr = ref;
+ break;
+ }
+ }
+ else
+ tail->type = REF_ARRAY;
/* In EQUIVALENCE, we don't know yet whether we are seeing
an array, character variable or array of character
@@ -2317,7 +2338,8 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
else
as = sym->as;
- m = gfc_match_array_ref (&tail->u.ar, as, equiv_flag, as ? as->corank : 0,
+ ref = strarr ? strarr : tail;
+ m = gfc_match_array_ref (&ref->u.ar, as, equiv_flag, as ? as->corank : 0,
coarray_only);
if (m != MATCH_YES)
return m;
@@ -2483,6 +2505,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
{
bool t;
gfc_symtree *tbp;
+ gfc_typespec *ts = &primary->ts;
m = gfc_match_name (name);
if (m == MATCH_NO)
@@ -2490,8 +2513,18 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
if (m != MATCH_YES)
return MATCH_ERROR;
+ /* For derived type components find typespec of ultimate component. */
+ if (ts->type == BT_DERIVED && primary->ref)
+ {
+ for (gfc_ref *ref = primary->ref; ref; ref = ref->next)
+ {
+ if (ref->type == REF_COMPONENT && ref->u.c.component)
+ ts = &ref->u.c.component->ts;
+ }
+ }
+
intrinsic = false;
- if (primary->ts.type != BT_CLASS && primary->ts.type != BT_DERIVED)
+ if (ts->type != BT_CLASS && ts->type != BT_DERIVED)
{
inquiry = is_inquiry_ref (name, &tmp);
if (inquiry)
@@ -2564,7 +2597,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
return MATCH_ERROR;
}
else if (tmp->u.i == INQUIRY_LEN
- && primary->ts.type != BT_CHARACTER)
+ && ts->type != BT_CHARACTER)
{
gfc_error ("The LEN part_ref at %C must be applied "
"to a CHARACTER expression");
@@ -2659,6 +2692,11 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
primary->ref = tmp;
else
{
+ /* Find end of reference chain if inquiry reference and tail not
+ set. */
+ if (tail == NULL && inquiry && tmp)
+ tail = extend_ref (primary, tail);
+
/* Set by the for loop below for the last component ref. */
gcc_assert (tail != NULL);
tail->next = tmp;
@@ -2678,6 +2716,9 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
if (primary->expr_type == EXPR_CONSTANT)
goto check_done;
+ if (primary->ref == NULL)
+ goto check_done;
+
switch (tmp->u.i)
{
case INQUIRY_RE:
@@ -2828,6 +2869,7 @@ check_substring:
if (substring)
primary->ts.u.cl = NULL;
+ gfc_gobble_whitespace ();
if (gfc_peek_ascii_char () == '(')
{
gfc_error_now ("Unexpected array/substring ref at %C");
@@ -4271,6 +4313,16 @@ gfc_match_rvalue (gfc_expr **result)
return MATCH_ERROR;
}
+ /* Scan for possible inquiry references. */
+ if (m == MATCH_YES
+ && e->expr_type == EXPR_VARIABLE
+ && gfc_peek_ascii_char () == '%')
+ {
+ m = gfc_match_varspec (e, 0, false, false);
+ if (m == MATCH_NO)
+ m = MATCH_YES;
+ }
+
if (m == MATCH_YES)
{
e->where = where;
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 3872b39..5b0fe03 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -533,7 +533,8 @@ gfc_resolve_formal_arglist (gfc_symbol *proc)
}
}
}
-
+ if (sym)
+ sym->formal_resolved = 1;
gfc_current_ns = orig_current_ns;
}
@@ -3472,7 +3473,7 @@ resolve_function (gfc_expr *expr)
&expr->where, &sym->formal_at);
}
}
- else
+ else if (!sym->formal_resolved)
{
gfc_get_formal_from_actual_arglist (sym, expr->value.function.actual);
sym->formal_at = expr->where;
@@ -4033,7 +4034,7 @@ resolve_call (gfc_code *c)
&c->loc, &csym->formal_at);
}
}
- else
+ else if (!csym->formal_resolved)
{
gfc_get_formal_from_actual_arglist (csym, c->ext.actual);
csym->formal_at = c->loc;
@@ -17969,16 +17970,16 @@ skip_interfaces:
|| (a->dummy && !a->pointer && a->intent == INTENT_OUT
&& sym->ns->proc_name->attr.if_source != IFSRC_IFBODY))
apply_default_init (sym);
+ else if (a->function && !a->pointer && !a->allocatable && !a->use_assoc
+ && sym->result)
+ /* Default initialization for function results. */
+ apply_default_init (sym->result);
else if (a->function && sym->result && a->access != ACCESS_PRIVATE
&& (sym->ts.u.derived->attr.alloc_comp
|| sym->ts.u.derived->attr.pointer_comp))
/* Mark the result symbol to be referenced, when it has allocatable
components. */
sym->result->attr.referenced = 1;
- else if (a->function && !a->pointer && !a->allocatable && !a->use_assoc
- && sym->result)
- /* Default initialization for function results. */
- apply_default_init (sym->result);
}
if (sym->ts.type == BT_CLASS && sym->ns == gfc_current_ns
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 7031a829..a3f6de2 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -2784,9 +2784,11 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind,
start.expr = gfc_evaluate_now (start.expr, &se->pre);
/* Change the start of the string. */
- if ((TREE_CODE (TREE_TYPE (se->expr)) == ARRAY_TYPE
- || TREE_CODE (TREE_TYPE (se->expr)) == INTEGER_TYPE)
- && TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
+ if (((TREE_CODE (TREE_TYPE (se->expr)) == ARRAY_TYPE
+ || TREE_CODE (TREE_TYPE (se->expr)) == INTEGER_TYPE)
+ && TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
+ || (POINTER_TYPE_P (TREE_TYPE (se->expr))
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (se->expr))) != ARRAY_TYPE))
tmp = se->expr;
else
tmp = build_fold_indirect_ref_loc (input_location,
@@ -2797,6 +2799,14 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind,
tmp = gfc_build_array_ref (tmp, start.expr, NULL_TREE, true);
se->expr = gfc_build_addr_expr (type, tmp);
}
+ else if (POINTER_TYPE_P (TREE_TYPE (tmp)))
+ {
+ tree diff;
+ diff = fold_build2 (MINUS_EXPR, size_type_node, start.expr,
+ build_one_cst (size_type_node));
+ se->expr
+ = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (tmp), tmp, diff);
+ }
}
/* Length = end + 1 - start. */
@@ -4627,6 +4637,16 @@ get_builtin_fn (gfc_symbol * sym)
&& !strcmp (sym->name, "omp_is_initial_device"))
return builtin_decl_explicit (BUILT_IN_OMP_IS_INITIAL_DEVICE);
+ if (!gfc_option.disable_omp_get_initial_device
+ && flag_openmp && sym->attr.function && sym->ts.type == BT_INTEGER
+ && !strcmp (sym->name, "omp_get_initial_device"))
+ return builtin_decl_explicit (BUILT_IN_OMP_GET_INITIAL_DEVICE);
+
+ if (!gfc_option.disable_omp_get_num_devices
+ && flag_openmp && sym->attr.function && sym->ts.type == BT_INTEGER
+ && !strcmp (sym->name, "omp_get_num_devices"))
+ return builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_DEVICES);
+
if (!gfc_option.disable_acc_on_device
&& flag_openacc && sym->attr.function && sym->ts.type == BT_LOGICAL
&& !strcmp (sym->name, "acc_on_device_h"))
diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc
index 6ffc3e0..974e25f 100644
--- a/gcc/fortran/trans-intrinsic.cc
+++ b/gcc/fortran/trans-intrinsic.cc
@@ -4716,22 +4716,6 @@ maybe_absent_optional_variable (gfc_expr *e)
}
-/* Remove unneeded kind= argument from actual argument list when the
- result conversion is dealt with in a different place. */
-
-static void
-strip_kind_from_actual (gfc_actual_arglist * actual)
-{
- for (gfc_actual_arglist *a = actual; a; a = a->next)
- {
- if (a && a->name && strcmp (a->name, "kind") == 0)
- {
- gfc_free_expr (a->expr);
- a->expr = NULL;
- }
- }
-}
-
/* Emit code for minloc or maxloc intrinsic. There are many different cases
we need to handle. For performance reasons we sometimes create two
loops instead of one, where the second one is much simpler.
@@ -4926,7 +4910,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
tree b_if, b_else;
tree back;
gfc_loopinfo loop, *ploop;
- gfc_actual_arglist *actual, *array_arg, *dim_arg, *mask_arg, *kind_arg;
+ gfc_actual_arglist *array_arg, *dim_arg, *mask_arg, *kind_arg;
gfc_actual_arglist *back_arg;
gfc_ss *arrayss = nullptr;
gfc_ss *maskss = nullptr;
@@ -4945,8 +4929,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
int n;
bool optional_mask;
- actual = expr->value.function.actual;
- array_arg = actual;
+ array_arg = expr->value.function.actual;
dim_arg = array_arg->next;
mask_arg = dim_arg->next;
kind_arg = mask_arg->next;
@@ -4955,14 +4938,16 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
bool dim_present = dim_arg->expr != nullptr;
bool nested_loop = dim_present && expr->rank > 0;
- /* The last argument, BACK, is passed by value. Ensure that
- by setting its name to %VAL. */
- for (gfc_actual_arglist *a = actual; a; a = a->next)
+ /* Remove kind. */
+ if (kind_arg->expr)
{
- if (a->next == NULL)
- a->name = "%VAL";
+ gfc_free_expr (kind_arg->expr);
+ kind_arg->expr = NULL;
}
+ /* Pass BACK argument by value. */
+ back_arg->name = "%VAL";
+
if (se->ss)
{
if (se->ss->info->useflags)
@@ -4984,25 +4969,19 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
}
}
- arrayexpr = actual->expr;
+ arrayexpr = array_arg->expr;
- /* Special case for character maxloc. Remove unneeded actual
- arguments, then call a library function. */
+ /* Special case for character maxloc. Remove unneeded "dim" actual
+ argument, then call a library function. */
if (arrayexpr->ts.type == BT_CHARACTER)
{
gcc_assert (expr->rank == 0);
- gfc_actual_arglist *a = actual;
- strip_kind_from_actual (a);
- while (a)
+ if (dim_arg->expr)
{
- if (a->name && strcmp (a->name, "dim") == 0)
- {
- gfc_free_expr (a->expr);
- a->expr = NULL;
- }
- a = a->next;
+ gfc_free_expr (dim_arg->expr);
+ dim_arg->expr = NULL;
}
gfc_conv_intrinsic_funcall (se, expr);
return;
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 64e5cec..7a63f52 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -2568,6 +2568,26 @@ gfc_omp_deep_mapping_do (bool is_cnt, gimple *ctx, tree clause,
else
while (TREE_CODE (tmp) == COMPONENT_REF || TREE_CODE (tmp) == ARRAY_REF)
tmp = TREE_OPERAND (tmp, TREE_CODE (tmp) == COMPONENT_REF ? 1 : 0);
+ if (TREE_CODE (tmp) == MEM_REF)
+ tmp = TREE_OPERAND (tmp, 0);
+ if (TREE_CODE (tmp) == SSA_NAME)
+ {
+ gimple *def_stmt = SSA_NAME_DEF_STMT (tmp);
+ if (gimple_code (def_stmt) == GIMPLE_ASSIGN)
+ {
+ tmp = gimple_assign_rhs1 (def_stmt);
+ if (poly)
+ {
+ tmp = TYPE_FIELDS (type);
+ type = TREE_TYPE (tmp);
+ }
+ else
+ while (TREE_CODE (tmp) == COMPONENT_REF
+ || TREE_CODE (tmp) == ARRAY_REF)
+ tmp = TREE_OPERAND (tmp,
+ TREE_CODE (tmp) == COMPONENT_REF ? 1 : 0);
+ }
+ }
/* If the clause argument is nonallocatable, skip is-allocate check. */
if (GFC_DECL_GET_SCALAR_ALLOCATABLE (tmp)
|| GFC_DECL_GET_SCALAR_POINTER (tmp)
diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index 3374778..f898075 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -1140,11 +1140,6 @@ gfc_init_types (void)
}
gfc_character1_type_node = gfc_character_types[0];
- /* The middle end only recognizes a single unsigned type. For
- compatibility of existing test cases, let's just use the
- character type. The reader of tree dumps is expected to be able
- to deal with this. */
-
if (flag_unsigned)
{
for (index = 0; gfc_unsigned_kinds[index].kind != 0;++index)
@@ -1159,18 +1154,26 @@ gfc_init_types (void)
break;
}
}
- if (index_char > 0)
+ if (index_char > -1)
{
- gfc_unsigned_types[index] = gfc_character_types[index_char];
+ type = gfc_character_types[index_char];
+ if (TYPE_STRING_FLAG (type))
+ {
+ type = build_distinct_type_copy (type);
+ TYPE_CANONICAL (type)
+ = TYPE_CANONICAL (gfc_character_types[index_char]);
+ }
+ else
+ type = build_variant_type_copy (type);
+ TYPE_NAME (type) = NULL_TREE;
+ TYPE_STRING_FLAG (type) = 0;
}
else
- {
- type = gfc_build_unsigned_type (&gfc_unsigned_kinds[index]);
- gfc_unsigned_types[index] = type;
- snprintf (name_buf, sizeof(name_buf), "unsigned(kind=%d)",
- gfc_integer_kinds[index].kind);
- PUSH_TYPE (name_buf, type);
- }
+ type = gfc_build_unsigned_type (&gfc_unsigned_kinds[index]);
+ gfc_unsigned_types[index] = type;
+ snprintf (name_buf, sizeof(name_buf), "unsigned(kind=%d)",
+ gfc_integer_kinds[index].kind);
+ PUSH_TYPE (name_buf, type);
}
}
diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index a64922a..b867d66 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -4224,6 +4224,40 @@ gimple_fold_builtin_omp_is_initial_device (gimple_stmt_iterator *gsi)
return false;
}
+/* omp_get_initial_device was in OpenMP 5.0/5.1 explicitly and in
+ 5.0 implicitly the same as omp_get_num_devices; since 6.0 it is
+ unspecified whether -1 or omp_get_num_devices() is returned. For
+ better backward compatibility, use omp_get_num_devices() on the
+ host - and -1 on the device (where the result is unspecified). */
+
+static bool
+gimple_fold_builtin_omp_get_initial_device (gimple_stmt_iterator *gsi)
+{
+#if ACCEL_COMPILER
+ replace_call_with_value (gsi, build_int_cst (integer_type_node, -1));
+#else
+ if (!ENABLE_OFFLOADING)
+ replace_call_with_value (gsi, integer_zero_node);
+ else
+ {
+ tree fn = builtin_decl_explicit (BUILT_IN_OMP_GET_NUM_DEVICES);
+ gcall *repl = gimple_build_call (fn, 0);
+ replace_call_with_call_and_fold (gsi, repl);
+ }
+#endif
+ return true;
+}
+
+static bool
+gimple_fold_builtin_omp_get_num_devices (gimple_stmt_iterator *gsi)
+{
+ if (!ENABLE_OFFLOADING)
+ {
+ replace_call_with_value (gsi, integer_zero_node);
+ return true;
+ }
+ return false;
+}
/* Fold a call to __builtin_acc_on_device. */
@@ -5468,6 +5502,12 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi)
case BUILT_IN_OMP_IS_INITIAL_DEVICE:
return gimple_fold_builtin_omp_is_initial_device (gsi);
+ case BUILT_IN_OMP_GET_INITIAL_DEVICE:
+ return gimple_fold_builtin_omp_get_initial_device (gsi);
+
+ case BUILT_IN_OMP_GET_NUM_DEVICES:
+ return gimple_fold_builtin_omp_get_num_devices (gsi);
+
case BUILT_IN_REALLOC:
return gimple_fold_builtin_realloc (gsi);
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index a8ff3c8..7ce9ba7 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -292,7 +292,7 @@ ipcp_lattice<valtype>::print (FILE * f, bool dump_sources, bool dump_benefits)
else
fprintf (f, " [scc: %i, from:", val->scc_no);
for (s = val->sources; s; s = s->next)
- fprintf (f, " %i(%f)", s->cs->caller->order,
+ fprintf (f, " %i(%f)", s->cs->caller->get_uid (),
s->cs->sreal_frequency ().to_double ());
fprintf (f, "]");
}
diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 0398d69..5f6f93c 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -3329,6 +3329,10 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
ipa_edge_args *args = ipa_edge_args_sum->get (e);
if (!args)
return;
+ ipa_node_params *old_inline_root_info = ipa_node_params_sum->get (cs->callee);
+ ipa_node_params *new_inline_root_info
+ = ipa_node_params_sum->get (cs->caller->inlined_to
+ ? cs->caller->inlined_to : cs->caller);
int count = ipa_get_cs_argument_count (args);
int i;
@@ -3540,6 +3544,30 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
enum tree_code operation;
operation = ipa_get_jf_pass_through_operation (src);
+ tree old_ir_ptype = ipa_get_type (old_inline_root_info,
+ dst_fid);
+ tree new_ir_ptype = ipa_get_type (new_inline_root_info,
+ formal_id);
+ if (!useless_type_conversion_p (old_ir_ptype, new_ir_ptype))
+ {
+ /* Jump-function construction now permits type-casts
+ from an integer to another if the latter can hold
+ all values or has at least the same precision.
+ However, as we're combining multiple pass-through
+ functions together, we are losing information about
+ signedness and thus if conversions should sign or
+ zero extend. Therefore we must prevent combining
+ such jump-function if signednesses do not match. */
+ if (!INTEGRAL_TYPE_P (old_ir_ptype)
+ || !INTEGRAL_TYPE_P (new_ir_ptype)
+ || (TYPE_UNSIGNED (new_ir_ptype)
+ != TYPE_UNSIGNED (old_ir_ptype)))
+ {
+ ipa_set_jf_unknown (dst);
+ continue;
+ }
+ }
+
if (operation == NOP_EXPR)
{
bool agg_p;
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 1331ba49..6e6cf89 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -1848,6 +1848,12 @@ scan_expr_access (tree expr, gimple *stmt, isra_scan_context ctx,
if (!desc || !desc->split_candidate)
return;
+ if (storage_order_barrier_p (expr))
+ {
+ disqualify_split_candidate (desc, "Encountered a storage order barrier.");
+ return;
+ }
+
if (!poffset.is_constant (&offset)
|| !psize.is_constant (&size)
|| !pmax_size.is_constant (&max_size))
@@ -4644,7 +4650,7 @@ ipa_sra_summarize_function (cgraph_node *node)
{
if (dump_file)
fprintf (dump_file, "Creating summary for %s/%i:\n", node->name (),
- node->order);
+ node->get_uid ());
gcc_obstack_init (&gensum_obstack);
loaded_decls = new hash_set<tree>;
diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc
index a055d12..8efda29 100644
--- a/gcc/lto-streamer-out.cc
+++ b/gcc/lto-streamer-out.cc
@@ -1376,7 +1376,8 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
hstate.commit_flag ();
hstate.add_int (TYPE_PRECISION_RAW (t));
hstate.add_int (TYPE_ALIGN (t));
- hstate.add_int (TYPE_EMPTY_P (t));
+ if (!lto_stream_offload_p)
+ hstate.add_int (TYPE_EMPTY_P (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog
index f56104b..cb70f1c 100644
--- a/gcc/m2/ChangeLog
+++ b/gcc/m2/ChangeLog
@@ -1,3 +1,60 @@
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-05-05 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/120117
+ * gm2-compiler/M2GenGCC.mod (FoldBecomes): Remove the call to
+ RemoveQuad since this is performed by TypeCheckBecomes.
+ * gm2-compiler/PCSymBuild.mod (buildConstFunction): Rewrite
+ header comment.
+ Check for a set or a type aliased set and appropriately
+ skip type equivalences and obtain the element type.
+ * gm2-compiler/SymbolTable.mod (PutConst): Add call to
+ CheckBreak.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-04-24 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/119915
+ * gm2-libs/FormatStrings.mod (PerformFormatString): Handle
+ the %u and %x format specifiers in a similar way to the %d
+ specifier. Avoid using Slice and use Copy instead.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-04-24 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/119914
+ * gm2-compiler/M2Check.mod (checkConstMeta): Add check for
+ Ztype, Rtype and Ctype and unbounded arrays.
+ (IsZRCType): New procedure function.
+ (isZRC): Add comment.
+ * gm2-compiler/M2Quads.mod:
+ * gm2-compiler/M2Range.mod (gdbinit): New procedure.
+ (BreakWhenRangeCreated): Ditto.
+ (CheckBreak): Ditto.
+ (InitRange): Call CheckBreak.
+ (Init): Add gdbhook and initialize interactive watch point.
+ * gm2-compiler/SymbolTable.def (GetNthParamAnyClosest): New
+ procedure function.
+ * gm2-compiler/SymbolTable.mod (BreakSym): Remove constant.
+ (BreakSym): Add Variable.
+ (stop): Remove.
+ (gdbhook): New procedure.
+ (BreakWhenSymCreated): Ditto.
+ (CheckBreak): Ditto.
+ (NewSym): Call CheckBreak.
+ (Init): Add gdbhook and initialize interactive watch point.
+ (MakeProcedure): Replace guarded call to stop with CheckBreak.
+ (GetNthParamChoice): New procedure function.
+ (GetNthParamOrdered): Ditto.
+ (GetNthParamAnyClosest): Ditto.
+ (GetOuterModuleScope): Ditto.
+
2025-04-25 Release Manager
* GCC 15.1.0 released.
diff --git a/gcc/m2/gm2-compiler/M2Check.mod b/gcc/m2/gm2-compiler/M2Check.mod
index 528c51d..d86ef8e 100644
--- a/gcc/m2/gm2-compiler/M2Check.mod
+++ b/gcc/m2/gm2-compiler/M2Check.mod
@@ -803,7 +803,12 @@ BEGIN
THEN
typeRight := GetDType (right) ;
typeLeft := GetDType (left) ;
- RETURN doCheckPair (result, tinfo, typeLeft, typeRight)
+ IF IsZRCType (typeLeft) AND IsUnbounded (typeRight)
+ THEN
+ RETURN false
+ ELSE
+ RETURN doCheckPair (result, tinfo, typeLeft, typeRight)
+ END
END ;
RETURN result
END checkConstMeta ;
@@ -868,7 +873,19 @@ END checkSubrangeTypeEquivalence ;
(*
- isZRC -
+ IsZRCType - return TRUE if type is a ZType, RType or a CType.
+*)
+
+PROCEDURE IsZRCType (type: CARDINAL) : BOOLEAN ;
+BEGIN
+ RETURN (type = CType) OR (type = ZType) OR (type = RType)
+END IsZRCType ;
+
+
+(*
+ isZRC - return TRUE if zrc is a ZType, RType or a CType
+ and sym is either a complex type when zrc = CType
+ or is not a composite type when zrc is a RType or ZType.
*)
PROCEDURE isZRC (zrc, sym: CARDINAL) : BOOLEAN ;
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index a1e3c07..bc1d588 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -2914,9 +2914,6 @@ BEGIN
IF TypeCheckBecomes (p, quad)
THEN
PerformFoldBecomes (p, quad)
- ELSE
- GetQuad (quad, op, des, op2, expr) ;
- RemoveQuad (p, des, quad)
END
END
END
diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod
index 9bb8c4d..4022657 100644
--- a/gcc/m2/gm2-compiler/M2Quads.mod
+++ b/gcc/m2/gm2-compiler/M2Quads.mod
@@ -69,6 +69,7 @@ FROM SymbolTable IMPORT ModeOfAddr, GetMode, PutMode, GetSymName, IsUnknown,
GetArraySubscript, GetDimension,
GetParam,
GetNth, GetNthParamAny,
+ GetNthParamAnyClosest,
GetFirstUsed, GetDeclaredMod,
GetQuads, GetReadQuads, GetWriteQuads,
GetWriteLimitQuads, GetReadLimitQuads,
@@ -5676,7 +5677,8 @@ BEGIN
WHILE i<=ParamTotal DO
IF i <= NoOfParamAny (Proc)
THEN
- FormalI := GetParam(Proc, i) ;
+ (* FormalI := GetParam(Proc, i) ; *)
+ FormalI := GetNthParamAnyClosest (Proc, i, GetCurrentModule ()) ;
IF CompilerDebugging
THEN
n1 := GetSymName(FormalI) ;
@@ -5801,7 +5803,7 @@ BEGIN
MetaError3 ('parameter {%3n} in {%1dD} causes a mismatch it was declared as a {%2d}', call, GetNth (call, i), i)
END ;
BuildRange (InitTypesParameterCheck (tokno, CheckedProcedure, i,
- GetParam (CheckedProcedure, i),
+ GetNthParamAnyClosest (CheckedProcedure, i, GetCurrentModule ()),
GetParam (ProcType, i), ParamCheckId)) ;
INC(i)
END
@@ -6150,7 +6152,7 @@ BEGIN
MetaErrorStringT2 (tokpos, Msg, ProcedureSym, ParameterNo) ;
IF NoOfParamAny (ProcedureSym) >= ParameterNo
THEN
- FormalParam := GetNthParamAny (ProcedureSym, ParameterNo) ;
+ FormalParam := GetNthParamAnyClosest (ProcedureSym, ParameterNo, GetCurrentModule ()) ;
IF IsUnboundedParamAny (ProcedureSym, ParameterNo)
THEN
MetaErrorT2 (GetVarDeclFullTok (FormalParam), 'formal parameter {%1ad} has an open array type {%2tad}',
@@ -6205,7 +6207,7 @@ BEGIN
MetaErrorStringT2 (tokpos, Msg, ProcedureSym, ParameterNo) ;
IF NoOfParamAny (ProcedureSym) >= ParameterNo
THEN
- FormalParam := GetNthParamAny (ProcedureSym, ParameterNo) ;
+ FormalParam := GetNthParamAnyClosest (ProcedureSym, ParameterNo, GetCurrentModule ()) ;
IF IsUnboundedParamAny (ProcedureSym, ParameterNo)
THEN
MetaErrorT2 (GetVarDeclFullTok (FormalParam), '{%W}formal parameter {%1ad} has an open array type {%2tad}',
diff --git a/gcc/m2/gm2-compiler/M2Range.mod b/gcc/m2/gm2-compiler/M2Range.mod
index 2a5bfab..8e3943a 100644
--- a/gcc/m2/gm2-compiler/M2Range.mod
+++ b/gcc/m2/gm2-compiler/M2Range.mod
@@ -154,6 +154,34 @@ TYPE
VAR
TopOfRange: CARDINAL ;
RangeIndex: Index ;
+ BreakRange: CARDINAL ;
+
+
+PROCEDURE gdbhook ;
+END gdbhook ;
+
+
+(*
+ BreakWhenRangeCreated - to be called interactively by gdb.
+*)
+
+PROCEDURE BreakWhenRangeCreated (r: CARDINAL) ;
+BEGIN
+ BreakRange := r
+END BreakWhenRangeCreated ;
+
+
+(*
+ CheckBreak - if sym = BreakRange then call gdbhook.
+*)
+
+PROCEDURE CheckBreak (r: CARDINAL) ;
+BEGIN
+ IF BreakRange = r
+ THEN
+ gdbhook
+ END
+END CheckBreak ;
(*
@@ -302,6 +330,7 @@ BEGIN
THEN
InternalError ('out of memory error')
ELSE
+ CheckBreak (r) ;
WITH p^ DO
type := none ;
des := NulSym ;
@@ -3746,7 +3775,19 @@ END WriteRangeCheck ;
PROCEDURE Init ;
BEGIN
TopOfRange := 0 ;
- RangeIndex := InitIndex(1)
+ RangeIndex := InitIndex(1) ;
+ BreakWhenRangeCreated (0) ; (* Disable the intereactive range watch. *)
+ (* To examine the range when it is created run cc1gm2 from gdb
+ and set a break point on gdbhook.
+ (gdb) break gdbhook
+ (gdb) run
+ Now below interactively call BreakWhenRangeCreated with the symbol
+ under investigation. *)
+ gdbhook ;
+ (* Now is the time to interactively call gdb, for example:
+ (gdb) print BreakWhenRangeCreated (1234)
+ (gdb) cont
+ and you will arrive at gdbhook when this symbol is created. *)
END Init ;
diff --git a/gcc/m2/gm2-compiler/PCSymBuild.mod b/gcc/m2/gm2-compiler/PCSymBuild.mod
index b124c3e..3bffe86 100644
--- a/gcc/m2/gm2-compiler/PCSymBuild.mod
+++ b/gcc/m2/gm2-compiler/PCSymBuild.mod
@@ -64,7 +64,7 @@ FROM SymbolTable IMPORT NulSym, ModeOfAddr, ProcedureKind,
GetFromOuterModule,
CheckForEnumerationInCurrentModule,
GetMode, PutVariableAtAddress, ModeOfAddr, SkipType,
- IsSet, PutConstSet,
+ IsSet, PutConstSet, IsType,
IsConst, IsConstructor, PutConst, PutConstructor,
PopValue, PushValue,
MakeTemporary, PutVar,
@@ -1408,9 +1408,10 @@ END TypeToMeta ;
(*
- buildConstFunction - we are only concerned about resolving the return type o
+ buildConstFunction - we are only concerned about resolving the return type of
a function, so we can ignore all parameters - except
- the first one in the case of VAL(type, foo).
+ the first one in the case of VAL(type, foo)
+ and the type of bar in MIN (bar) and MAX (bar).
buildConstFunction uses a unary exprNode to represent
a function.
*)
@@ -1866,11 +1867,11 @@ BEGIN
THEN
IF (func=Min) OR (func=Max)
THEN
- IF IsSet (sym)
+ IF IsSet (sym) OR (IsType (sym) AND IsSet (SkipType (sym)))
THEN
- type := SkipType(GetType(sym))
+ type := GetType (SkipType (sym))
ELSE
- (* sym is the type required for MAX, MIN and VAL *)
+ (* sym is the type required for MAX, MIN and VAL. *)
type := sym
END
ELSE
diff --git a/gcc/m2/gm2-compiler/SymbolTable.def b/gcc/m2/gm2-compiler/SymbolTable.def
index 85a3672..2a9865a 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.def
+++ b/gcc/m2/gm2-compiler/SymbolTable.def
@@ -3478,4 +3478,20 @@ PROCEDURE UsesOptArgAny (Sym: CARDINAL) : BOOLEAN ;
PROCEDURE GetProcedureKindDesc (kind: ProcedureKind) : String ;
+(*
+ GetNthParamAnyClosest - returns the nth parameter from the order
+ proper procedure, forward declaration
+ or definition module procedure.
+ It chooses the parameter which is closest
+ in source terms to currentmodule.
+ The same module will return using the order
+ proper procedure, forward procedure, definition module.
+ Whereas an imported procedure will choose from
+ DefProcedure, ProperProcedure, ForwardProcedure.
+*)
+
+PROCEDURE GetNthParamAnyClosest (sym: CARDINAL; ParamNo: CARDINAL;
+ currentmodule: CARDINAL) : CARDINAL ;
+
+
END SymbolTable.
diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod b/gcc/m2/gm2-compiler/SymbolTable.mod
index 826d2d3..ff661dc 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.mod
+++ b/gcc/m2/gm2-compiler/SymbolTable.mod
@@ -122,8 +122,6 @@ CONST
UnboundedAddressName = "_m2_contents" ;
UnboundedHighName = "_m2_high_%d" ;
- BreakSym = 203 ;
-
TYPE
ProcAnyBoolean = PROCEDURE (CARDINAL, ProcedureKind) : BOOLEAN ;
ProcAnyCardinal = PROCEDURE (CARDINAL, ProcedureKind) : CARDINAL ;
@@ -930,6 +928,7 @@ VAR
(* passes and reduce duplicate *)
(* errors. *)
ConstLitArray : Indexing.Index ;
+ BreakSym : CARDINAL ; (* Allows interactive debugging. *)
(*
@@ -1032,11 +1031,34 @@ END FinalSymbol ;
(*
- stop - a debugger convenience hook.
+ gdbhook - a debugger convenience hook.
+*)
+
+PROCEDURE gdbhook ;
+END gdbhook ;
+
+
+(*
+ BreakWhenSymCreated - to be called interactively by gdb.
*)
-PROCEDURE stop ;
-END stop ;
+PROCEDURE BreakWhenSymCreated (sym: CARDINAL) ;
+BEGIN
+ BreakSym := sym
+END BreakWhenSymCreated ;
+
+
+(*
+ CheckBreak - if sym = BreakSym then call gdbhook.
+*)
+
+PROCEDURE CheckBreak (sym: CARDINAL) ;
+BEGIN
+ IF sym = BreakSym
+ THEN
+ gdbhook
+ END
+END CheckBreak ;
(*
@@ -1053,10 +1075,7 @@ BEGIN
SymbolType := DummySym
END ;
PutIndice(Symbols, sym, pSym) ;
- IF sym = BreakSym
- THEN
- stop
- END ;
+ CheckBreak (sym) ;
INC(FreeSymbol)
END NewSym ;
@@ -1660,6 +1679,18 @@ PROCEDURE Init ;
VAR
pCall: PtrToCallFrame ;
BEGIN
+ BreakWhenSymCreated (NulSym) ; (* Disable the intereactive sym watch. *)
+ (* To examine the symbol table when a symbol is created run cc1gm2 from gdb
+ and set a break point on gdbhook.
+ (gdb) break gdbhook
+ (gdb) run
+ Now below interactively call BreakWhenSymCreated with the symbol
+ under investigation. *)
+ gdbhook ;
+ (* Now is the time to interactively call gdb, for example:
+ (gdb) print BreakWhenSymCreated (1234)
+ (gdb) cont
+ and you will arrive at gdbhook when this symbol is created. *)
AnonymousName := 0 ;
CurrentError := NIL ;
InitTree (ConstLitPoolTree) ;
@@ -3959,10 +3990,7 @@ VAR
BEGIN
tok := CheckTok (tok, 'procedure') ;
Sym := DeclareSym(tok, ProcedureName) ;
- IF Sym = BreakSym
- THEN
- stop
- END ;
+ CheckBreak (Sym) ;
IF NOT IsError(Sym)
THEN
pSym := GetPsym(Sym) ;
@@ -6926,6 +6954,89 @@ END GetNthParamAny ;
(*
+ GetNthParamChoice - returns the parameter definition from
+ sym:ParamNo:kind or NulSym.
+*)
+
+PROCEDURE GetNthParamChoice (sym: CARDINAL; ParamNo: CARDINAL;
+ kind: ProcedureKind) : CARDINAL ;
+BEGIN
+ IF GetProcedureParametersDefined (sym, kind)
+ THEN
+ RETURN GetNthParam (sym, kind, ParamNo)
+ ELSE
+ RETURN NulSym
+ END
+END GetNthParamChoice ;
+
+
+(*
+ GetNthParamOrdered - returns the parameter definition from list {a, b, c}
+ in order.
+ sym:ParamNo:{a,b,c} or NulSym.
+*)
+
+PROCEDURE GetNthParamOrdered (sym: CARDINAL; ParamNo: CARDINAL;
+ a, b, c: ProcedureKind) : CARDINAL ;
+VAR
+ param: CARDINAL ;
+BEGIN
+ param := GetNthParamChoice (sym, ParamNo, a) ;
+ IF param = NulSym
+ THEN
+ param := GetNthParamChoice (sym, ParamNo, b) ;
+ IF param = NulSym
+ THEN
+ param := GetNthParamChoice (sym, ParamNo, c)
+ END
+ END ;
+ RETURN param
+END GetNthParamOrdered ;
+
+
+(*
+ GetNthParamAnyClosest - returns the nth parameter from the order
+ proper procedure, forward declaration
+ or definition module procedure.
+ It chooses the parameter which is closest
+ in source terms to currentmodule.
+ The same module will return using the order
+ proper procedure, forward procedure, definition module.
+ Whereas an imported procedure will choose from
+ DefProcedure, ProperProcedure, ForwardProcedure.
+*)
+
+PROCEDURE GetNthParamAnyClosest (sym: CARDINAL; ParamNo: CARDINAL;
+ currentmodule: CARDINAL) : CARDINAL ;
+BEGIN
+ IF GetOuterModuleScope (currentmodule) = GetOuterModuleScope (sym)
+ THEN
+ (* Same module. *)
+ RETURN GetNthParamOrdered (sym, ParamNo,
+ ProperProcedure, ForwardProcedure, DefProcedure)
+ ELSE
+ (* Procedure is imported. *)
+ RETURN GetNthParamOrdered (sym, ParamNo,
+ DefProcedure, ProperProcedure, ForwardProcedure)
+ END
+END GetNthParamAnyClosest ;
+
+
+(*
+ GetOuterModuleScope - returns the outer module symbol scope for sym.
+*)
+
+PROCEDURE GetOuterModuleScope (sym: CARDINAL) : CARDINAL ;
+BEGIN
+ WHILE NOT (IsDefImp (sym) OR
+ (IsModule (sym) AND (GetScope (sym) = NulSym))) DO
+ sym := GetScope (sym)
+ END ;
+ RETURN sym
+END GetOuterModuleScope ;
+
+
+(*
The Following procedures fill in the symbol table with the
symbol entities.
*)
@@ -7154,6 +7265,7 @@ VAR
pSym: PtrToSymbol ;
BEGIN
pSym := GetPsym(Sym) ;
+ CheckBreak (Sym) ;
WITH pSym^ DO
CASE SymbolType OF
diff --git a/gcc/m2/gm2-libs/FormatStrings.mod b/gcc/m2/gm2-libs/FormatStrings.mod
index ec2985b..aea8da9 100644
--- a/gcc/m2/gm2-libs/FormatStrings.mod
+++ b/gcc/m2/gm2-libs/FormatStrings.mod
@@ -378,7 +378,7 @@ BEGIN
THEN
INC (afterperc) ;
Cast (u, w) ;
- in := ConCat (in, Slice (fmt, startpos, nextperc)) ;
+ in := Copy (fmt, in, startpos, nextperc) ;
in := ConCat (in, CardinalToString (u, width, leader, 16, TRUE)) ;
startpos := afterperc ;
DSdbExit (NIL) ;
@@ -387,7 +387,7 @@ BEGIN
THEN
INC (afterperc) ;
Cast (u, w) ;
- in := ConCat (in, Slice (fmt, startpos, nextperc)) ;
+ in := Copy (fmt, in, startpos, nextperc) ;
in := ConCat (in, CardinalToString (u, width, leader, 10, FALSE)) ;
startpos := afterperc ;
DSdbExit (NIL) ;
diff --git a/gcc/omp-builtins.def b/gcc/omp-builtins.def
index 97e8b6a..cfc2fd8 100644
--- a/gcc/omp-builtins.def
+++ b/gcc/omp-builtins.def
@@ -71,7 +71,12 @@ DEF_GOACC_BUILTIN_ONLY (BUILT_IN_GOACC_SINGLE_COPY_END, "GOACC_single_copy_end",
DEF_GOMP_BUILTIN_COMPILER (BUILT_IN_OMP_IS_INITIAL_DEVICE,
"omp_is_initial_device", BT_FN_INT,
- ATTR_CONST_NOTHROW_LEAF_LIST)
+ ATTR_CONST_NOTHROW_LIST)
+DEF_GOMP_BUILTIN_COMPILER (BUILT_IN_OMP_GET_INITIAL_DEVICE,
+ "omp_get_initial_device", BT_FN_INT,
+ ATTR_PURE_NOTHROW_LIST)
+DEF_GOMP_BUILTIN_COMPILER (BUILT_IN_OMP_GET_NUM_DEVICES, "omp_get_num_devices",
+ BT_FN_INT, ATTR_PURE_NOTHROW_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_OMP_GET_THREAD_NUM, "omp_get_thread_num",
BT_FN_INT, ATTR_NOTHROW_LEAF_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_OMP_GET_NUM_THREADS, "omp_get_num_threads",
@@ -88,8 +93,6 @@ DEF_GOMP_BUILTIN (BUILT_IN_OMP_SET_DEFAULT_DEVICE, "omp_set_default_device",
BT_FN_INT, ATTR_NOTHROW_LEAF_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_OMP_GET_INTEROP_INT, "omp_get_interop_int",
BT_FN_PTRMODE_PTR_INT_PTR, ATTR_NOTHROW_LEAF_LIST)
-DEF_GOMP_BUILTIN (BUILT_IN_OMP_GET_NUM_DEVICES, "omp_get_num_devices",
- BT_FN_INT, ATTR_NOTHROW_LEAF_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_OMP_INIT_ALLOCATOR, "omp_init_allocator",
BT_FN_PTRMODE_PTRMODE_INT_PTR, ATTR_NOTHROW_LEAF_LIST)
DEF_GOMP_BUILTIN (BUILT_IN_OMP_DESTROY_ALLOCATOR, "omp_destroy_allocator",
diff --git a/gcc/omp-general.cc b/gcc/omp-general.cc
index 0eaa431..6580a5f 100644
--- a/gcc/omp-general.cc
+++ b/gcc/omp-general.cc
@@ -2759,10 +2759,16 @@ omp_selector_is_dynamic (tree ctx)
static tree
omp_device_num_check (tree *device_num, bool *is_host)
{
+ /* C++ may wrap the device_num expr in a CLEANUP_POINT_EXPR; we want
+ to look inside of it for the special cases. */
+ tree t = *device_num;
+ if (TREE_CODE (t) == CLEANUP_POINT_EXPR)
+ t = TREE_OPERAND (t, 0);
+
/* First check for some constant values we can treat specially. */
- if (tree_fits_shwi_p (*device_num))
+ if (tree_fits_shwi_p (t))
{
- HOST_WIDE_INT num = tree_to_shwi (*device_num);
+ HOST_WIDE_INT num = tree_to_shwi (t);
if (num < -1)
return integer_zero_node;
/* Initial device? */
@@ -2781,9 +2787,9 @@ omp_device_num_check (tree *device_num, bool *is_host)
/* Also test for direct calls to OpenMP routines that return valid
device numbers. */
- if (TREE_CODE (*device_num) == CALL_EXPR)
+ if (TREE_CODE (t) == CALL_EXPR)
{
- tree fndecl = get_callee_fndecl (*device_num);
+ tree fndecl = get_callee_fndecl (t);
if (fndecl && omp_runtime_api_call (fndecl))
{
const char *fnname = IDENTIFIER_POINTER (DECL_NAME (fndecl));
diff --git a/gcc/omp-offload.cc b/gcc/omp-offload.cc
index 3218f69..16fa232 100644
--- a/gcc/omp-offload.cc
+++ b/gcc/omp-offload.cc
@@ -262,7 +262,8 @@ omp_discover_declare_target_tgt_fn_r (tree *tp, int *walk_subtrees, void *data)
DECL_ATTRIBUTES (decl)))
return NULL_TREE;
- if (!DECL_EXTERNAL (decl) && DECL_SAVED_TREE (decl))
+ if (DECL_SAVED_TREE (decl)
+ && (!DECL_EXTERNAL (decl) || DECL_DECLARED_INLINE_P (decl)))
((vec<tree> *) data)->safe_push (decl);
DECL_ATTRIBUTES (decl) = tree_cons (id, NULL_TREE,
DECL_ATTRIBUTES (decl));
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index f78bda3..3bfcf33 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,19 @@
+2025-06-12 Joseph Myers <josmyers@redhat.com>
+
+ * es.po: Update.
+
+2025-05-15 Joseph Myers <josmyers@redhat.com>
+
+ * zh_CN.po: Update.
+
+2025-05-14 Joseph Myers <josmyers@redhat.com>
+
+ * sv.po: Update.
+
+2025-05-12 Joseph Myers <josmyers@redhat.com>
+
+ * sv.po: Update.
+
2025-04-30 Joseph Myers <josmyers@redhat.com>
* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
diff --git a/gcc/po/es.po b/gcc/po/es.po
index 6033f331..2959212 100644
--- a/gcc/po/es.po
+++ b/gcc/po/es.po
@@ -2,7 +2,7 @@
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2016, 2017, 2018, 2019, 2020 Free Software Foundation, Inc.
# This file is distributed under the same license as the gcc package.
# Cristian Othón Martínez Vera <cfuga@cfuga.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020
+# Antonio Ceballos Roa <aceballos@gmail.com>, 2016, 2017, 2018, 2019, 2020, 2025
#
# Agradezco a Juan Cuquejo Mira por sus comentarios sobre esta traducción
#
@@ -40,10 +40,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gcc 10.1-b20200209\n"
+"Project-Id-Version: gcc 15.1.0\n"
"Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n"
"POT-Creation-Date: 2025-04-23 19:27+0000\n"
-"PO-Revision-Date: 2020-03-22 16:48+0100\n"
+"PO-Revision-Date: 2025-06-12 23:08+0200\n"
"Last-Translator: Antonio Ceballos Roa <aceballos@gmail.com>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
"Language: es\n"
@@ -15533,12 +15533,12 @@ msgstr "Activa las opciones comunes para generar información de análisis de pe
#: common.opt:2648
#, no-c-format
msgid "Register the profile information in the .gcov_info section instead of using a constructor/destructor."
-msgstr ""
+msgstr "Registra la información de análisis de perfil en la sección .gcov_info en lugar de utilizar un constructor/destructor."
#: common.opt:2652
#, no-c-format
msgid "Register the profile information in the specified section instead of using a constructor/destructor."
-msgstr ""
+msgstr "Registra la información de análisis de perfil en la sección especificada en lugar de utilizar un constructor/destructor."
#: common.opt:2656
#, no-c-format
@@ -18902,7 +18902,7 @@ msgstr ""
#: gcov-tool.cc:157 gcov-tool.cc:300
#, c-format
msgid "no profile files were merged\n"
-msgstr ""
+msgstr "no se han mezclado ficheros de perfil\n"
#: gcov-tool.cc:169
#, c-format
@@ -18925,26 +18925,22 @@ msgid " -w, --weight <w1,w2> Set weights (float point values)\
msgstr " -w, --weight <p1,p2> Establece los pesos (valores de coma flotante)\n"
#: gcov-tool.cc:188
-#, fuzzy, c-format
-#| msgid "Merge subcomand usage:"
+#, c-format
msgid "Merge subcommand usage:"
msgstr "Modo de empleo de la suborden de mezcla:"
#: gcov-tool.cc:240
-#, fuzzy, c-format
-#| msgid ""
-#| " -l, --long-file-names Use long output file names for included\n"
-#| " source files\n"
+#, c-format
msgid ""
" merge-stream [options] [<file>] Merge coverage stream file (or stdin)\n"
" and coverage file contents\n"
msgstr ""
-" -l, --long-file-names Usa nombres largos de ficheros para los\n"
-" ficheros fuentes incluidos\n"
+" merge-stream [options] [<fich>] Mezcla el fichero de flujo de cobertura\n"
+" (o stdin) y el contenido del fichero de\n"
+" cobertura\n"
#: gcov-tool.cc:258
-#, fuzzy, c-format
-#| msgid "Merge subcomand usage:"
+#, c-format
msgid "Merge-stream subcommand usage:"
msgstr "Modo de empleo de la suborden de mezcla:"
@@ -19014,8 +19010,7 @@ msgid " -t <float>, --hot_threshold <float> Set the threshold for hotness\n"
msgstr " -t <float>, --hot_threshold <float> Establece el umbral de calentura\n"
#: gcov-tool.cc:510
-#, fuzzy, c-format
-#| msgid "Overlap subcomand usage:"
+#, c-format
msgid "Overlap subcommand usage:"
msgstr "Modo de empleo de la suborden de solapamiento:"
@@ -19059,10 +19054,9 @@ msgstr ""
"%s.\n"
#: gcov-tool.cc:595
-#, fuzzy, c-format
-#| msgid "Copyright %s 2019 Free Software Foundation, Inc.\n"
+#, c-format
msgid "Copyright %s 2025 Free Software Foundation, Inc.\n"
-msgstr "Copyright %s 2019 Free Software Foundation, Inc.\n"
+msgstr "Copyright %s 2025 Free Software Foundation, Inc.\n"
#: gcov.cc:1096
#, c-format
@@ -19102,22 +19096,21 @@ msgstr ""
" en lugar de los porcentajes\n"
#: gcov.cc:1102
-#, fuzzy, c-format
-#| msgid ""
-#| " -c, --branch-counts Output counts of branches taken\n"
-#| " rather than percentages\n"
+#, c-format
msgid ""
" -g, --conditions Include modified condition/decision\n"
" coverage (masking MC/DC) in output\n"
msgstr ""
-" -c, --branch-counts Se muestra el número de ramificaciones\n"
-" en lugar de los porcentajes\n"
+" -g, --conditions Incluye la cobertura de condición/decisión\n"
+" modificada (enmascarando MC/DC) en la\n"
+" salida\n"
#: gcov.cc:1104
-#, fuzzy, c-format
-#| msgid " -p, --preserve-paths Preserve all pathname components\n"
+#, c-format
msgid " -e, --prime-paths Show prime path coverage summary\n"
-msgstr " -p, --preserve-paths Preserva todos los nombres de ruta de los componentes\n"
+msgstr ""
+" -e, --prime-paths Muestra el resumen de la cobertura de camino\n"
+" primario\n"
#: gcov.cc:1105
#, c-format
@@ -19127,6 +19120,10 @@ msgid ""
" TYPE is 'covered', 'uncovered', or 'both'\n"
" and defaults to 'uncovered'\n"
msgstr ""
+" --prime-paths-lines[=TIPO] Incluye los caminos en la salida\n"
+" modo de traza de línea - no afecta a json\n"
+" TIPO es 'covered', 'uncovered' o 'both'\n"
+" y el predefinido es 'uncovered'\n"
#: gcov.cc:1109
#, c-format
@@ -19136,6 +19133,10 @@ msgid ""
" TYPE is 'covered', 'uncovered', or 'both'\n"
" and defaults to 'uncovered'\n"
msgstr ""
+" --prime-paths-source[=TIPO] Incluye los caminos en la salida\n"
+" modo de traza de fuente - no afecta a json\n"
+" TIPO es 'covered', 'uncovered' o 'both'\n"
+" y el predefinido es 'uncovered'\n"
#: gcov.cc:1113
#, c-format
@@ -19145,7 +19146,7 @@ msgstr " -d, --display-progress Muestra información de progreso\n"
#: gcov.cc:1114
#, c-format
msgid " -D, --debug\t\t\t Display debugging dumps\n"
-msgstr ""
+msgstr " -D, --debug\t\t\t Muestra volcados de depuración\n"
#: gcov.cc:1115
#, c-format
@@ -19153,16 +19154,14 @@ msgid " -f, --function-summaries Output summaries for each function\n"
msgstr " -f, --function-summaries Muestra sumarios para cada función\n"
#: gcov.cc:1116
-#, fuzzy, c-format
-#| msgid " -f, --function Print function level info\n"
+#, c-format
msgid " --include Include functions matching this regex\n"
-msgstr " -f, --function Imprime información sobre el nivel de funciones\n"
+msgstr " --include Incluye funciones coincidentes con esta regex\n"
#: gcov.cc:1117
-#, fuzzy, c-format
-#| msgid " -h, --help Print this help, then exit\n"
+#, c-format
msgid " --exclude Exclude functions matching this regex\n"
-msgstr " -h, --help Muestra esta información, y finaliza\n"
+msgstr " --exclude Excluye funciones coincidentes con esta regex\n"
#: gcov.cc:1118
#, c-format
@@ -19170,18 +19169,18 @@ msgid " -h, --help Print this help, then exit\n"
msgstr " -h, --help Muestra esta información, y finaliza\n"
#: gcov.cc:1119
-#, fuzzy, c-format
-#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n"
+#, c-format
msgid ""
" -j, --json-format Output JSON intermediate format\n"
" into .gcov.json.gz file\n"
-msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n"
+msgstr ""
+" -j, --json-format Envía el formato intermedio JSON\n"
+" al fichero .gcov.json.gz\n"
#: gcov.cc:1121
-#, fuzzy, c-format
-#| msgid " -j, --human-readable Output human readable numbers\n"
+#, c-format
msgid " -H, --human-readable Output human readable numbers\n"
-msgstr " -j, --human-readable Salida con números legibles para humanos\n"
+msgstr " -H, --human-readable Salida con números legibles para humanos\n"
#: gcov.cc:1122
#, c-format
@@ -19200,19 +19199,16 @@ msgstr ""
#: gcov.cc:1125
#, c-format
msgid " -m, --demangled-names Output demangled function names\n"
-msgstr " -m, --demangled-names Nombres de función mutilados de salida\n"
+msgstr " -m, --demangled-names Saca nombres de función desofuscados\n"
#: gcov.cc:1126
-#, fuzzy, c-format
-#| msgid ""
-#| " -l, --long-file-names Use long output file names for included\n"
-#| " source files\n"
+#, c-format
msgid ""
" -M, --filter-on-demangled Make --include/--exclude match on demangled\n"
" names. This does not imply -m\n"
msgstr ""
-" -l, --long-file-names Usa nombres largos de ficheros para los\n"
-" ficheros fuentes incluidos\n"
+" -M, --filter-on-demangled Aplica --include/--exclude a los nombres\n"
+" desofuscados. No implica -m\n"
#: gcov.cc:1128
#, c-format
@@ -19270,24 +19266,23 @@ msgid " -x, --hash-filenames Hash long pathnames\n"
msgstr " -x, --hash-filenames Nombres de ruta largos de Hash\n"
#: gcov.cc:1139
-#, fuzzy, c-format
-#| msgid "Options:\n"
+#, c-format
msgid ""
"\n"
"Obsolete options:\n"
-msgstr "Opciones:\n"
+msgstr ""
+"\n"
+"Opciones obsoletas:\n"
#: gcov.cc:1140
-#, fuzzy, c-format
-#| msgid " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n"
+#, c-format
msgid " -i, --json-format Replaced with -j, --json-format\n"
-msgstr " -i, --json-format Salida con formato JSON intermedia en el fichero .gcov.json.gz\n"
+msgstr " -i, --json-format Reemplazado por -j, --json-format\n"
#: gcov.cc:1141
-#, fuzzy, c-format
-#| msgid " -j, --human-readable Output human readable numbers\n"
+#, c-format
msgid " -j, --human-readable Replaced with -H, --human-readable\n"
-msgstr " -j, --human-readable Salida con números legibles para humanos\n"
+msgstr " -j, --human-readable Reemplazado por -H, --human-readable\n"
#: gcov.cc:1152
#, c-format
@@ -19295,20 +19290,19 @@ msgid "gcov %s%s\n"
msgstr "gcov %s%s\n"
#: gcov.cc:1153
-#, fuzzy, c-format
-#| msgid "collect2 version %s\n"
+#, c-format
msgid "JSON format version: %s\n"
-msgstr "collect2 versión %s\n"
+msgstr "versión del formato JSON: %s\n"
#: gcov.cc:1237
#, c-format
msgid "invalid argument '%s' for '--prime-paths-lines'. Valid arguments are: 'covered', 'uncovered', 'both'\n"
-msgstr ""
+msgstr "argumento no válido '%s' para --prime-paths-lines'. Argumentos válidos: 'covered', 'uncovered', 'both'\n"
#: gcov.cc:1258
#, c-format
msgid "invalid argument '%s' for '--prime-paths-source'. Valid arguments are: 'covered', 'uncovered', 'both'\n"
-msgstr ""
+msgstr "argumento no válido '%s' para --prime-paths-source'. Argumentos válidos: 'covered', 'uncovered', 'both'\n"
#: gcov.cc:1726
#, c-format
@@ -19376,10 +19370,9 @@ msgid "%s:already seen blocks for '%s'\n"
msgstr "%s:ya se vieron bloques para '%s'\n"
#: gcov.cc:2391
-#, fuzzy, c-format
-#| msgid "%s:already seen blocks for '%s'\n"
+#, c-format
msgid "%s:already seen conditions for '%s'\n"
-msgstr "%s:ya se vieron bloques para '%s'\n"
+msgstr "%s:condiciones ya vistas para '%s'\n"
#: gcov.cc:2449 gcov.cc:2589
#, c-format
@@ -19482,28 +19475,24 @@ msgid "No calls\n"
msgstr "No hay llamadas\n"
#: gcov.cc:3090 gcov.cc:3144
-#, fuzzy, c-format
-#| msgid "Lines executed:%s of %d\n"
+#, c-format
msgid "Condition outcomes covered:%s of %d\n"
-msgstr "Líneas ejecutadas:%s de %d\n"
+msgstr "Salidas de condiciones cubiertas:%s de %d\n"
#: gcov.cc:3095 gcov.cc:3149
-#, fuzzy, c-format
-#| msgid "bad condition code"
+#, c-format
msgid "No conditions\n"
-msgstr "código de condición erróneo"
+msgstr "No hay condiciones\n"
#: gcov.cc:3101 gcov.cc:3155
-#, fuzzy, c-format
-#| msgid "Branches executed:%s of %d\n"
+#, c-format
msgid "Prime paths covered:%s of %d\n"
-msgstr "Ramificaciones ejecutadas:%s de %d\n"
+msgstr "Caminos primarios cubiertos:%s de %d\n"
#: gcov.cc:3105 gcov.cc:3159
-#, fuzzy, c-format
-#| msgid "Display this information."
+#, c-format
msgid "No path information\n"
-msgstr "Muestra esta información."
+msgstr "No hay información de caminos\n"
#: gcov.cc:3379
#, c-format
@@ -19513,13 +19502,12 @@ msgstr "%s:no hay líneas para '%s'\n"
#: gcov.cc:3515
#, c-format
msgid "condition outcomes covered %d/%d\n"
-msgstr ""
+msgstr "salidas de condiciones cubiertas %d/%d\n"
#: gcov.cc:3528
-#, fuzzy, c-format
-#| msgid "unconditional %2d taken %s\n"
+#, c-format
msgid "condition %2u not covered (%s%s)\n"
-msgstr "el incondicional %2d tomado %s\n"
+msgstr "condición %2u no cubierta (%s%s)\n"
#: gcov.cc:3542
#, c-format
@@ -19537,10 +19525,9 @@ msgid "branch %2d taken %s%s"
msgstr "ramificación %2d tomada %s%s"
#: gcov.cc:3557
-#, fuzzy, c-format
-#| msgid "branch %2d never executed"
+#, c-format
msgid "branch %2d never executed%s"
-msgstr "la ramificacion %2d nunca se ejecuta"
+msgstr "la ramificacion %2d nunca se ejecuta%s"
#: gcov.cc:3562
#, c-format
@@ -19558,15 +19545,14 @@ msgid "unconditional %2d never executed\n"
msgstr "el incondicional %2d nunca se ejecuta\n"
#: gcov.cc:3729
-#, fuzzy, c-format
-#| msgid "parameter name omitted"
+#, c-format
msgid "path coverage omitted\n"
-msgstr "se omitió el nombre del parámetro"
+msgstr "cobertura de caminos omitida\n"
#: gcov.cc:3731
#, c-format
msgid "paths covered %u of %zu\n"
-msgstr ""
+msgstr "caminos cubiertos %u de %zu\n"
#: gcov.cc:3806
#, c-format
@@ -19612,16 +19598,14 @@ msgid "End of search list.\n"
msgstr "Fin de la lista de búsqueda.\n"
#: incpath.cc:408
-#, fuzzy, c-format
-#| msgid "#include <...> search starts here:\n"
+#, c-format
msgid "#embed <...> search starts here:\n"
-msgstr "la búsqueda de #include <...> inicia aquí:\n"
+msgstr "la búsqueda de #embed <...> comienza aquí:\n"
#: incpath.cc:411
-#, fuzzy, c-format
-#| msgid "End of search list.\n"
+#, c-format
msgid "End of #embed search list.\n"
-msgstr "Fin de la lista de búsqueda.\n"
+msgstr "Fin de la lista de búsqueda de #embed.\n"
#: input.cc:35
msgid "<built-in>"
@@ -27144,10 +27128,9 @@ msgid "wrong number of arguments to %%:dwarf-version-gt"
msgstr "número erróneo de argumentos para %%:debug-level-gt"
#: gcov-tool.cc:75
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "error in removing %s\n"
+#, gcc-internal-format, gfc-internal-format
msgid "error in removing %s"
-msgstr "error al quitar %s\n"
+msgstr "error al quitar %s"
#: gcov-tool.cc:106
#, gcc-internal-format, gfc-internal-format
@@ -27167,19 +27150,17 @@ msgstr "No se puede cambiar al directorio %s"
#: gcov-tool.cc:125
#, gcc-internal-format, gfc-internal-format
msgid "output file %s already exists in folder %s"
-msgstr ""
+msgstr "el fichero de salida %s ya existe en la carpeta %s"
#: gcov-tool.cc:217 gcov-tool.cc:285
-#, fuzzy, gcc-internal-format
-#| msgid "weights need to be non-negative\n"
+#, gcc-internal-format
msgid "weights need to be non-negative"
-msgstr "los pesos tienen que ser no negativos\n"
+msgstr "los pesos han de ser no negativos"
#: gcov-tool.cc:424
-#, fuzzy, gcc-internal-format
-#| msgid "scale needs to be non-negative\n"
+#, gcc-internal-format
msgid "scale needs to be non-negative"
-msgstr "la escala tiene que ser no negativa\n"
+msgstr "la escala ha de ser no negativa"
#: gcse.cc:4194
#, gcc-internal-format, gfc-internal-format
diff --git a/gcc/po/sv.po b/gcc/po/sv.po
index 31e5502..28318cd 100644
--- a/gcc/po/sv.po
+++ b/gcc/po/sv.po
@@ -32,7 +32,7 @@ msgstr ""
"Project-Id-Version: gcc 15.1.0\n"
"Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n"
"POT-Creation-Date: 2025-04-23 19:27+0000\n"
-"PO-Revision-Date: 2025-05-10 14:36+0200\n"
+"PO-Revision-Date: 2025-05-14 22:41+0200\n"
"Last-Translator: Göran Uddeborg <goeran@uddeborg.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"Language: sv\n"
@@ -2732,7 +2732,7 @@ msgstr "Varna för avslutande blanktecken på rader utom i råa stränglitterale
#: c-family/c.opt:1523
#, no-c-format
msgid "Warn about trailing whitespace on lines except when in raw string literals. Equivalent to Wtrailing-whitespace=blanks when enabled or Wtrailing-whitespace=none when disabled."
-msgstr "Varna för avslutande mellanrum på rader utom i råa strängliteraler. Ekvivalent med Wtrailing-whitespace=blanks när det är aktiverat eller Wtrailing-whitespace=none när det är avaktiverat."
+msgstr "Varna för avslutande mellanrum på rader utom i råa stränglitteraler. Ekvivalent med Wtrailing-whitespace=blanks när det är aktiverat eller Wtrailing-whitespace=none när det är avaktiverat."
#: c-family/c.opt:1527
#, no-c-format
@@ -3864,7 +3864,7 @@ msgstr "-finternal-ebcdic\tIntern bearbetning är i EBCDIC kodsida 1140"
#: cobol/lang.opt:94
#, no-c-format
msgid "Enable/disable static linkage for CALL literals"
-msgstr "Aktivera/avaktivera statisk länkning för CALL-literaler"
+msgstr "Aktivera/avaktivera statisk länkning för CALL-litteraler"
#: cobol/lang.opt:98
#, no-c-format
@@ -4719,7 +4719,7 @@ msgstr "Det maximala djupet av exploderade noder som skall förekomma i en dot-d
#: analyzer/analyzer.opt:59
#, no-c-format
msgid "The number of bytes at which to ellipsize string literals in analyzer text art diagrams."
-msgstr "Antalet byte vid vilket strängliteraler i textkonstdiagram från analyseraren skall ha ellips."
+msgstr "Antalet byte vid vilket stränglitteraler i textkonstdiagram från analyseraren skall ha ellips."
#: analyzer/analyzer.opt:63
#, no-c-format
@@ -6677,7 +6677,7 @@ msgstr "Parameter för att styra vilka återskrivningsmöjligheter vi försöker
#: config/aarch64/aarch64.opt:437
#, no-c-format
msgid "Warn about usage of experimental Function Multi Versioning."
-msgstr "Varna för användning av experminetell funktionsmultiversionering."
+msgstr "Varna för användning av experimentell funktionsmultiversionering."
#: config/linux.opt:24
#, no-c-format
@@ -8848,7 +8848,7 @@ msgstr "Gör så att länkarens lättnadsmaskin antar att programräknaren slår
#: config/avr/avr.opt:112
#, no-c-format
msgid "Optimization. Accumulate outgoing function arguments and acquire/release the needed stack space for outgoing function arguments in function prologue/epilogue. Without this option, outgoing arguments are pushed before calling a function and popped afterwards. This option can lead to reduced code size for functions that call many functions that get their arguments on the stack like, for example printf."
-msgstr "Optimering. Samla utgående funktionsargument och ta/släpp det nödvändiga stackutrymmet för utgående funktionsargument i funktionsprologen/-epilogen. Utan denna flagga trycks utgående argument på stacken före anrop av en funktion och plockas efteråt. Denna flagga kan medföra reducerad kodstorlek för funktioner som anropar många funktioner som får sina argument på stacken som, till exempel printf."
+msgstr "Optimering. Samla utgående funktionsargument och ta/släpp det nödvändiga stackutrymmet för utgående funktionsargument i funktionsprologen/-epilogen. Utan denna flagga trycks utgående argument på stacken före anrop av en funktion och plockas efteråt. Denna flagga kan medföra reducerad kodstorlek för funktioner som anropar många funktioner som får sina argument på stacken, som till exempel printf."
#: config/avr/avr.opt:116
#, no-c-format
@@ -8878,7 +8878,7 @@ msgstr "Enheten har sektionen .rodata placerad i RAM-området."
#: config/avr/avr.opt:137
#, no-c-format
msgid "This option is used internally for multilib generation and selection. The device has no SPH special function register."
-msgstr "Denna flagga används internt för multilib-generering och -val. Enheten har inga speiciella SPH-fuktionsregister."
+msgstr "Denna flagga används internt för multilib-generering och -val. Enheten har inga speciella SPH-fuktionsregister."
#: config/avr/avr.opt:141
#, no-c-format
@@ -14856,7 +14856,7 @@ msgstr "Skriv en KÄLLFIL.opt-record.json-fil med detaljer om vilka optimeringar
#: common.opt:2469
#, no-c-format
msgid "Detect loops calculating CRC and replace with faster implementation. If the target supports CRC instruction and the CRC loop uses the same polynomial as the one used in the CRC instruction, directly replace with the corresponding CRC instruction. Otherwise, if the target supports carry-less-multiplication instruction, generate CRC using it. If neither case applies, generate table-based CRC."
-msgstr "Upptäck slingor som beräknar CRC och ersätt dem med en snabbare implementation. Om målet stödjer en CRC-instruktion och CRC-slingan använder samma polynom smo det som används i CRC-instruktionen, ersätt då direkt med motsvarande CRC-instruktion. Annars, om målet stöjder en instruktion för minnesfri multiplikation, generera en CRC som använder det. Om inget av fallen är tillämpligt, generera tabellbaserad CRC."
+msgstr "Upptäck slingor som beräknar CRC och ersätt dem med en snabbare implementation. Om målet stödjer en CRC-instruktion och CRC-slingan använder samma polynom smo det som används i CRC-instruktionen, ersätt då direkt med motsvarande CRC-instruktion. Annars, om målet stödjer en instruktion för minnesfri multiplikation, generera en CRC som använder det. Om inget av fallen är tillämpligt, generera tabellbaserad CRC."
#: common.opt:2483
#, no-c-format
@@ -17528,7 +17528,7 @@ msgstr "Framtvinga användningen av SLP vid vektorisering, misslyckas om det int
#: params.opt:1266
#, no-c-format
msgid "Maximum number of basic blocks before VRP switches to a fast model with less memory requirements."
-msgstr "Maximalt antal grundblock innan VRP byter till en snabb modell med mintre minneskrav."
+msgstr "Maximalt antal grundblock innan VRP byter till en snabb modell med mindre minneskrav."
#: params.opt:1270
#, no-c-format
@@ -17563,7 +17563,7 @@ msgstr "den anropade returnerar en post"
#: calls.cc:2565
msgid "target is not able to optimize the call into a sibling call"
-msgstr "målet kan inte optinera anropet till ett syskonanrop"
+msgstr "målet kan inte optimera anropet till ett syskonanrop"
#: calls.cc:2574
msgid "callee returns twice"
@@ -49107,7 +49107,7 @@ msgstr "%<detach%>-klausulens händelsehandtag har typen %qT istället för %<om
#: cp/parser.cc:42940
#, gcc-internal-format
msgid "string literal must not contain %<\\0%>"
-msgstr "strängliteraler får inte innehålla %<\\0%>"
+msgstr "stränglitteraler får inte innehålla %<\\0%>"
#: c/c-parser.cc:20581 c/c-parser.cc:20702 cp/parser.cc:42835
#: cp/parser.cc:42975
@@ -52621,7 +52621,6 @@ msgstr "%s: regcomp: %s"
msgid "logic error: missing inode for %s"
msgstr "logikfel: saknad inod för %s"
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104709
#: cobol/util.cc:2141
#, gcc-internal-format, gfc-internal-format
msgid "failed compiling %s"
@@ -78141,7 +78140,6 @@ msgstr "HOLDS-uttryck vid %L måste vara ett skalärt logiskt uttryck"
msgid "ORDERED clause parameter is less than COLLAPSE at %L"
msgstr "ORDERED-klausulparameter är mindre än COLLAPSE vid %L"
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107122
#: fortran/openmp.cc:8623
#, gcc-internal-format, gfc-internal-format
msgid "ORDER clause must not be used together with ORDERED at %L"
diff --git a/gcc/po/zh_CN.po b/gcc/po/zh_CN.po
index a5073c1..3f9023f 100644
--- a/gcc/po/zh_CN.po
+++ b/gcc/po/zh_CN.po
@@ -4,7 +4,7 @@
# Meng Jie <zuxy.meng@gmail.com>, 2005-2014.
# Jeff Bai <jeffbai@aosc.xyz>, 2015.
# Mingye Wang (Arthur2e5) <arthur200126@gmail.com>, 2015, 2016.
-# Boyuan Yang <073plan@gmail.com>, 2019, 2023, 2024.
+# Boyuan Yang <073plan@gmail.com>, 2019, 2023-2025.
# Zixing Zhou <zixingzhou@foxmail.com>, 2023.
# Zhanhaoxiang Zhang <zzhx2006@outlook.com>, 2024.
#
@@ -33,11 +33,11 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gcc 14.2.0\n"
+"Project-Id-Version: gcc 15.1.0\n"
"Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n"
"POT-Creation-Date: 2025-04-23 19:27+0000\n"
-"PO-Revision-Date: 2025-01-09 15:04+0800\n"
-"Last-Translator: Zhanhaoxiang Zhang <zzhx2006@outlook.com>\n"
+"PO-Revision-Date: 2025-05-15 13:53-0400\n"
+"Last-Translator: Boyuan Yang <073plan@gmail.com>\n"
"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
@@ -45,7 +45,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
-"X-Generator: Poedit 3.5\n"
+"X-Generator: Poedit 3.6\n"
#: cif-code.def:39
msgid "function not considered for inlining"
@@ -317,10 +317,8 @@ msgid "-E or -x required when input is from standard input"
msgstr "当输入来自标准输入设备时,需要 -E 或 -x"
#: config/darwin.h:153
-#, fuzzy
-#| msgid " conflicting code gen style switches are used"
msgid "conflicting code generation switches"
-msgstr "使用了相互冲突的代码生成风格"
+msgstr "使用了相互冲突的代码生成开关"
#: config/darwin.h:158
msgid "-bundle_loader not allowed with -dynamiclib"
@@ -831,10 +829,9 @@ msgid "Issue debug information for compiler-generated auxiliary variables."
msgstr ""
#: fortran/lang.opt:486
-#, fuzzy, no-c-format
-#| msgid "Enable Plan 9 language extensions"
+#, no-c-format
msgid "Enable all DEC language extensions."
-msgstr "启用九号计划语言扩展"
+msgstr "启用所有 DEC 语言扩展。"
#: fortran/lang.opt:490
#, fuzzy, no-c-format
@@ -868,9 +865,9 @@ msgid "Enable legacy math intrinsics for compatibility."
msgstr ""
#: fortran/lang.opt:515
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Enable support for DEC STRUCTURE/RECORD."
-msgstr "启用对巨型对象的支持"
+msgstr "启用对 DEC STRUCTURE/RECORD 的支持。"
#: fortran/lang.opt:519
#, no-c-format
@@ -1257,10 +1254,9 @@ msgid "Does nothing. Preserved for backward compatibility."
msgstr "不起作用。为向前兼容保留的选项。"
#: fortran/lang.opt:911
-#, fuzzy, no-c-format
-#| msgid "Statically link the GNU Fortran helper library (libgfortran)"
+#, no-c-format
msgid "Statically link the GNU Fortran helper library (libgfortran)."
-msgstr "静态链接 GNU Fortran 助手库(libgfortran)"
+msgstr "静态链接 GNU Fortran 助手库(libgfortran)。"
#: fortran/lang.opt:915
#, fuzzy, no-c-format
@@ -1296,7 +1292,7 @@ msgstr "遵循 ISO Fortran 2023 标准。"
#: fortran/lang.opt:939
#, no-c-format
msgid "Enable experimental Fortran 202y features."
-msgstr ""
+msgstr "启用实验性的 Fortuan 202y 特性。"
#: fortran/lang.opt:943
#, no-c-format
@@ -1670,7 +1666,7 @@ msgstr "当把函数转换为不兼容类型时给出警告"
#: c-family/c.opt:410
#, no-c-format
msgid "-Wbidi-chars=[none|unpaired|any|ucn] Warn about UTF-8 bidirectional control characters."
-msgstr ""
+msgstr "-Wbidi-chars=[none|unpaired|any|ucn] 对 UTF-8 双向控制字符给出警告。"
#: c-family/c.opt:433
#, no-c-format
@@ -1703,10 +1699,9 @@ msgid "Deprecated in favor of -Wc11-c23-compat."
msgstr "已弃用,请改用 -Wc11-c23-compat。"
#: c-family/c.opt:457
-#, fuzzy, no-c-format
-#| msgid "Warn about features not present in ISO C11, but present in ISO C23."
+#, no-c-format
msgid "Warn about features not present in ISO C23, but present in ISO C2Y."
-msgstr "对 ISO C11 中不存在但 ISO C23 中存在的特性给出警告。"
+msgstr "对 ISO C23 中不存在但 ISO C2Y 中存在的特性给出警告。"
#: c-family/c.opt:461
#, no-c-format
@@ -1869,10 +1864,9 @@ msgid "Warn for implicit type conversions that may change a value."
msgstr "当隐式类型转换可能改变值时给出警告"
#: c-family/c.opt:590
-#, fuzzy, no-c-format
-#| msgid "Warn for converting NULL from/to a non-pointer type"
+#, no-c-format
msgid "Warn for converting NULL from/to a non-pointer type."
-msgstr "将 NULL 转换为非指针类型时给出警告"
+msgstr "对 NULL 和非指针类型之间的转换给出警告。"
#: c-family/c.opt:598
#, fuzzy, no-c-format
@@ -1880,10 +1874,9 @@ msgid "Warn when performing class template argument deduction on a type with no
msgstr "%qE不是类型%qT的有效模板实参,因为对象%qD没有外部链接"
#: c-family/c.opt:603
-#, fuzzy, no-c-format
-#| msgid "Warn when all constructors and destructors are private"
+#, no-c-format
msgid "Warn when all constructors and destructors are private."
-msgstr "当所有构造函数和析构函数都是私有时给出警告"
+msgstr "当所有构造函数和析构函数都是私有时给出警告。"
#: c-family/c.opt:607
#, no-c-format
@@ -1893,7 +1886,7 @@ msgstr "对悬空的 else 给出警告。"
#: c-family/c.opt:611 c-family/c.opt:615
#, no-c-format
msgid "Warn for uses of pointers to auto variables whose lifetime has ended."
-msgstr ""
+msgstr "对使用了指向生命周期已结束的 auto 变量的指针给出警告。"
#: c-family/c.opt:619
#, no-c-format
@@ -1993,16 +1986,14 @@ msgid "Warn about implicit conversions from \"float\" to \"double\"."
msgstr "对从“float”到“double”的隐式转换给出警告。"
#: c-family/c.opt:702
-#, fuzzy, no-c-format
-#| msgid "Warn when a declaration does not specify a type"
+#, no-c-format
msgid "Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier."
-msgstr "当声明未指定类型时给出警告"
+msgstr "当声明中含有重复的 const, volatile, restrict 或 _Atomic 说明符时给出警告。"
#: c-family/c.opt:706
-#, fuzzy, no-c-format
-#| msgid "Warn about an empty body in an if or else statement"
+#, no-c-format
msgid "Warn about duplicated branches in if-else statements."
-msgstr "当 if 或 else 语句体为空时给出警告"
+msgstr "对 if-else 语句中重复的分支给出警告。"
#: c-family/c.opt:710
#, no-c-format
@@ -2263,10 +2254,9 @@ msgid "Warn when a function never produces a constant expression."
msgstr "数字常量表达式下溢时警告"
#: c-family/c.opt:930
-#, fuzzy, no-c-format
-#| msgid "Warn about invalid uses of the \"offsetof\" macro"
+#, no-c-format
msgid "Warn about invalid uses of the \"offsetof\" macro."
-msgstr "对“offsetof”宏无效的使用给出警告"
+msgstr "对“offsetof”宏无效的使用给出警告。"
#: c-family/c.opt:934
#, fuzzy, no-c-format
@@ -2432,7 +2422,7 @@ msgstr ""
#: c-family/c.opt:1083
#, no-c-format
msgid "Warn on namespace definition."
-msgstr ""
+msgstr "对命名空间的定义给出警告。"
#: c-family/c.opt:1087
#, fuzzy, no-c-format
@@ -2556,10 +2546,9 @@ msgid "Warn when fields in a struct with the packed attribute are misaligned."
msgstr ""
#: c-family/c.opt:1211
-#, fuzzy, no-c-format
-#| msgid "Warn about possibly missing parentheses"
+#, no-c-format
msgid "Warn about possibly missing parentheses."
-msgstr "可能缺少括号的情况下给出警告"
+msgstr "在可能缺少括号的情况下给出警告。"
#: c-family/c.opt:1219
#, no-c-format
@@ -2978,9 +2967,9 @@ msgid "Warn about useless casts."
msgstr "对无用的类型转换给出警告。"
#: c-family/c.opt:1599
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Warn about using variadic macros."
-msgstr "当定义在主文件中的宏未被使用时给出警告"
+msgstr "在使用了变长参数宏时给出警告。"
#: c-family/c.opt:1603
#, no-c-format
@@ -3131,10 +3120,9 @@ msgid "Enable support for C++ concepts."
msgstr "启用对 C++ concepts 的支持。"
#: c-family/c.opt:1819
-#, fuzzy, no-c-format
-#| msgid "Removed in GCC 10. This switch has no effect."
+#, no-c-format
msgid "Removed in GCC 15. This switch has no effect."
-msgstr "已在 GCC 10 中移除。此开关不起作用。"
+msgstr "已在 GCC 15 中移除。此开关不起作用。"
#: c-family/c.opt:1823
#, no-c-format
@@ -3383,10 +3371,9 @@ msgid "Allow implicit conversions between vectors with differing numbers of subp
msgstr "允许具有不同元素数量和/或元素类型的向量间的转换。"
#: c-family/c.opt:2059
-#, fuzzy, no-c-format
-#| msgid "Enable C++ modules-ts (experimental)."
+#, no-c-format
msgid "Enable C++20 Modules (experimental)."
-msgstr "启用 C++ modules-ts(实验性)。"
+msgstr "启用 C++20 模块 实验性)。"
#: c-family/c.opt:2067
#, no-c-format
@@ -3900,10 +3887,9 @@ msgid "Conform to the ISO 2020 C++ standard (experimental and incomplete support
msgstr "遵循 ISO 2020 C++ 标准(试验性质的不完全支持)。"
#: c-family/c.opt:2589 c-family/c.opt:2593
-#, fuzzy, no-c-format
-#| msgid "Conform to the ISO 2020 C++ standard (experimental and incomplete support)."
+#, no-c-format
msgid "Conform to the ISO 2023 C++ standard (published in 2024; experimental and incomplete support)."
-msgstr "遵循 ISO 2020 C++ 标准(试验性质的不完全支持)。"
+msgstr "遵循 ISO 2023 C++ 标准(于2024年发布;试验性质的不完全支持)。"
#: c-family/c.opt:2597 c-family/c.opt:2601
#, no-c-format
@@ -3927,10 +3913,9 @@ msgid "Conform to the ISO 2017 C standard (published in 2018)."
msgstr "遵循 ISO 2017 C 标准(于2018年发布)。"
#: c-family/c.opt:2621 c-family/c.opt:2779
-#, fuzzy, no-c-format
-#| msgid "Conform to the ISO 2017 C standard (published in 2018)."
+#, no-c-format
msgid "Conform to the ISO 2023 C standard (published in 2024)."
-msgstr "遵循 ISO 2017 C 标准(于2018年发布)。"
+msgstr "遵循 ISO 2023 C 标准(于2014年发布)。"
#: c-family/c.opt:2625
#, no-c-format
@@ -3938,10 +3923,9 @@ msgid "Deprecated in favor of -std=c23."
msgstr "已弃用,请改用 -std=c23。"
#: c-family/c.opt:2629
-#, fuzzy, no-c-format
-#| msgid "Conform to the ISO 2020 C++ standard (experimental and incomplete support)."
+#, no-c-format
msgid "Conform to the ISO 202Y C standard draft (experimental and incomplete support)."
-msgstr "遵循 ISO 2020 C++ 标准(试验性质的不完全支持)。"
+msgstr "遵循 ISO 202Y C 标准草案(试验性质的不完全支持)。"
#: c-family/c.opt:2633 c-family/c.opt:2637 c-family/c.opt:2751
#, no-c-format
@@ -4136,10 +4120,9 @@ msgid "Enable Cobol parser debugging"
msgstr "启用后端调试."
#: cobol/lang.opt:102
-#, fuzzy, no-c-format
-#| msgid "Enable backend debugging."
+#, no-c-format
msgid "Enable Cobol yacc debugging"
-msgstr "启用后端调试."
+msgstr "启用 Cobol yacc 调试"
#: cobol/lang.opt:106
#, no-c-format
@@ -4182,9 +4165,9 @@ msgid "Select the runtime."
msgstr "选择运行时。"
#: ada/gcc-interface/lang.opt:93
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Catch typos."
-msgstr "进入了 catch 块"
+msgstr "捕获打字错误。"
#: ada/gcc-interface/lang.opt:97
#, fuzzy, no-c-format
@@ -4236,10 +4219,9 @@ msgid "Generate JSON file."
msgstr "生成 JSON 文件。"
#: d/lang.opt:167
-#, fuzzy, no-c-format
-#| msgid "-MF <file>\tWrite dependency output to the given file"
+#, no-c-format
msgid "-Xf <file>\tWrite JSON output to the given <file>."
-msgstr "-MF <文件>\t将依赖项输出到给定文件"
+msgstr "-Xf <文件>\t将 JSON 输出到给定<文件>。"
#: d/lang.opt:171
#, no-c-format
@@ -4440,10 +4422,9 @@ msgid "Implement 'in' contracts of overridden methods to be a superset of parent
msgstr ""
#: d/lang.opt:408
-#, fuzzy, no-c-format
-#| msgid "Consider access to byte sized memory slow."
+#, no-c-format
msgid "Disable access to shared memory objects."
-msgstr "认为按字节访问内存速度较慢。"
+msgstr "禁用对共享内存对象的访问。"
#: d/lang.opt:412
#, no-c-format
@@ -9265,7 +9246,7 @@ msgstr "指定目标架构的名称"
#: config/nvptx/nvptx.opt:64
#, no-c-format
msgid "Alias:"
-msgstr ""
+msgstr "别名:"
#: config/nvptx/nvptx.opt:125
#, fuzzy, no-c-format
@@ -9274,9 +9255,9 @@ msgid "Known PTX ISA versions (for use with the -mptx= option):"
msgstr "已知 MIPS ISA 等级 (用于 -mips 选项):"
#: config/nvptx/nvptx.opt:156
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Specify the PTX ISA version to use."
-msgstr "ELF 文件 ABI 版本无效"
+msgstr "指定要使用的 PTX ISA 版本。"
#: config/nvptx/nvptx.opt:160
#, no-c-format
@@ -12154,10 +12135,9 @@ msgid "Always align function entry, jump target and return address."
msgstr ""
#: config/nds32/nds32.opt:85
-#, fuzzy, no-c-format
-#| msgid "Align code and data to 32 bits"
+#, no-c-format
msgid "Align function entry to 4 byte."
-msgstr "将代码和数据对齐到 32 位边界上"
+msgstr "将函数入口对齐到 4 字节。"
#: config/nds32/nds32.opt:97
#, no-c-format
@@ -12206,9 +12186,9 @@ msgid "Generate string extension instructions."
msgstr "生成加载/存储乘法指令"
#: config/nds32/nds32.opt:139
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Generate DSP extension instructions."
-msgstr "生成加载/存储乘法指令"
+msgstr "生成 DSP 扩展指令。"
#: config/nds32/nds32.opt:143
#, fuzzy, no-c-format
@@ -12355,10 +12335,9 @@ msgid "Known IQ2000 CPUs (for use with the -mcpu= option):"
msgstr "已知 IQ2000 处理器 (用于 -mcpu= 选项):"
#: config/iq2000/iq2000.opt:61 config/mips/mips.opt:142
-#, fuzzy, no-c-format
-#| msgid "Use ROM instead of RAM"
+#, no-c-format
msgid "Use ROM instead of RAM."
-msgstr "使用 ROM 而不是 RAM"
+msgstr "使用 ROM 而不是 RAM。"
#: config/iq2000/iq2000.opt:70
#, fuzzy, no-c-format
@@ -12373,15 +12352,14 @@ msgid "Put uninitialized constants in ROM (needs -membedded-data)."
msgstr "将未初始化的常量放在 ROM 中(需要 -membedded-data)"
#: config/csky/csky.opt:34
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Specify the target architecture."
-msgstr "指定目标架构的名称"
+msgstr "指定目标架构的名称。"
#: config/csky/csky.opt:38
-#, fuzzy, no-c-format
-#| msgid "Specify the target CPU"
+#, no-c-format
msgid "Specify the target processor."
-msgstr "选择目标 CPU"
+msgstr "指定目标处理器。"
#: config/csky/csky.opt:90
#, fuzzy, no-c-format
@@ -12426,10 +12404,9 @@ msgid "Enable coprocessor instructions."
msgstr "启用 clip 指令"
#: config/csky/csky.opt:122
-#, fuzzy, no-c-format
-#| msgid "Enable average instructions"
+#, no-c-format
msgid "Enable cache prefetch instructions."
-msgstr "启用均值指令"
+msgstr "启用缓存预取指令。"
#: config/csky/csky.opt:126
#, fuzzy, no-c-format
@@ -12546,12 +12523,12 @@ msgstr "已知 C6X ISA (用于 -march= 选项):"
#: config/c6x/c6x.opt:30 config/mips/mips.opt:134
#, no-c-format
msgid "Use big-endian byte order."
-msgstr "令大端在前。"
+msgstr "使用大端字节序。"
#: config/c6x/c6x.opt:34 config/mips/mips.opt:138
#, no-c-format
msgid "Use little-endian byte order."
-msgstr "令小端在前。"
+msgstr "使用小端字节序。"
#: config/c6x/c6x.opt:42
#, fuzzy, no-c-format
@@ -12958,10 +12935,9 @@ msgid "Annotate assembler instructions with estimated addresses."
msgstr "使用估算的地址评注汇编指令"
#: config/sh/sh.opt:247
-#, fuzzy, no-c-format
-#| msgid "Generate code in little endian mode"
+#, no-c-format
msgid "Generate code in little endian mode."
-msgstr "生成小端在前的代码"
+msgstr "在小端序模式下生成代码。"
#: config/sh/sh.opt:251
#, fuzzy, no-c-format
@@ -13014,27 +12990,24 @@ msgid "Pretend a branch-around-a-move is a conditional move."
msgstr "将数据传输周围的跳转认为是条件转移。"
#: config/sh/sh.opt:295
-#, fuzzy, no-c-format
-#| msgid "Enable the use of the fsca instruction"
+#, no-c-format
msgid "Enable the use of the fsca instruction."
-msgstr "启用对 fsca 指令的使用"
+msgstr "启用对 fsca 指令的使用。"
#: config/sh/sh.opt:299
-#, fuzzy, no-c-format
-#| msgid "Enable the use of the fsrra instruction"
+#, no-c-format
msgid "Enable the use of the fsrra instruction."
-msgstr "启用 fsrra 指令的使用"
+msgstr "启用 fsrra 指令的使用。"
#: config/gcn/gcn-tables.opt:25
#, no-c-format
msgid "GCN GPU type to use:"
-msgstr ""
+msgstr "要使用的 GCN GPU 类型:"
#: config/gcn/gcn.opt:26 config/gcn/gcn.opt:30
-#, fuzzy, no-c-format
-#| msgid "Specify the name of the target CPU"
+#, no-c-format
msgid "Specify the name of the target GPU."
-msgstr "指定目标 CPU 的名称"
+msgstr "指定目标 CPU 的名称。"
#: config/gcn/gcn.opt:34
#, no-c-format
@@ -13093,10 +13066,9 @@ msgid "Assume small address space."
msgstr "假定小地址空间"
#: config/bpf/bpf.opt:28
-#, fuzzy, no-c-format
-#| msgid "Generate LP64 code"
+#, no-c-format
msgid "Generate xBPF."
-msgstr "生成 LP64 代码"
+msgstr "生成 xBPF。"
#: config/bpf/bpf.opt:34
#, fuzzy, no-c-format
@@ -13127,10 +13099,9 @@ msgid "Enable extra conditional-branch instructions j(s)lt and j(s)le."
msgstr "启用条件移动指令。"
#: config/bpf/bpf.opt:56
-#, fuzzy, no-c-format
-#| msgid "Enable 32-bit divide instructions"
+#, no-c-format
msgid "Enable 32-bit ALU instructions."
-msgstr "启用 32 位除法指令"
+msgstr "启用 32 位 ALU 指令。"
#: config/bpf/bpf.opt:60
#, fuzzy, no-c-format
@@ -13351,10 +13322,9 @@ msgid "FP exceptions are enabled."
msgstr "FP 异常已启用"
#: config/mips/mips.opt:223
-#, fuzzy, no-c-format
-#| msgid "Use 32-bit floating-point registers"
+#, no-c-format
msgid "Use 32-bit floating-point registers."
-msgstr "使用 32 位浮点寄存器"
+msgstr "使用 32 位浮点寄存器。"
#: config/mips/mips.opt:227
#, no-c-format
@@ -13456,22 +13426,19 @@ msgid "Use -G for object-local data."
msgstr "为对象局部数据使用 -G"
#: config/mips/mips.opt:305
-#, fuzzy, no-c-format
-#| msgid "Use indirect calls"
+#, no-c-format
msgid "Use indirect calls."
-msgstr "使用间接调用"
+msgstr "使用间接调用。"
#: config/mips/mips.opt:309
-#, fuzzy, no-c-format
-#| msgid "Use a 32-bit long type"
+#, no-c-format
msgid "Use a 32-bit long type."
-msgstr "使用 32 位 long 类型"
+msgstr "使用 32 位 long 类型。"
#: config/mips/mips.opt:313
-#, fuzzy, no-c-format
-#| msgid "Use a 64-bit long type"
+#, no-c-format
msgid "Use a 64-bit long type."
-msgstr "使用 64 位 long 类型"
+msgstr "使用 64 位 long 类型。"
#: config/mips/mips.opt:317
#, fuzzy, no-c-format
@@ -13486,9 +13453,9 @@ msgid "Don't optimize block moves."
msgstr "不优化块移动"
#: config/mips/mips.opt:325
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Use microMIPS instructions."
-msgstr "使用浮点双精度指令"
+msgstr "使用 microMIPS 指令。"
#: config/mips/mips.opt:329
#, fuzzy, no-c-format
@@ -13497,10 +13464,9 @@ msgid "Use MIPS MSA Extension instructions."
msgstr "使用 MIPS-DSP 指令"
#: config/mips/mips.opt:333
-#, fuzzy, no-c-format
-#| msgid "Allow the use of MT instructions"
+#, no-c-format
msgid "Allow the use of MT instructions."
-msgstr "允许使用 MT 指令"
+msgstr "允许使用 MT 指令。"
#: config/mips/mips.opt:337
#, fuzzy, no-c-format
@@ -13509,10 +13475,9 @@ msgid "Prevent the use of all floating-point operations."
msgstr "不允许使用任何浮点操作"
#: config/mips/mips.opt:341
-#, fuzzy, no-c-format
-#| msgid "Use MCU instructions"
+#, no-c-format
msgid "Use MCU instructions."
-msgstr "使用 MCU 指令"
+msgstr "使用 MCU 指令。"
#: config/mips/mips.opt:345
#, fuzzy, no-c-format
@@ -30236,14 +30201,14 @@ msgid "if this code is reached, the program will abort"
msgstr "如果执行到这段代码,程序将中止"
#: godump.cc:1434
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "could not close Go dump file: %m"
-msgstr "无法打开用零填充的指令转储文件%qs:%s"
+msgstr "无法关闭 Go 转储文件:%m"
#: godump.cc:1446
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "could not open Go dump file %qs: %m"
-msgstr "无法打开最终指令转储文件%qs:%s"
+msgstr "无法打开 Go 转储文件 %qs:%m"
#: graphite.cc:529
#, fuzzy, gcc-internal-format
@@ -30399,9 +30364,9 @@ msgid "array types have different bounds"
msgstr "?: 的操作数类型不一致,分别为%qT和%qT"
#: ipa-devirt.cc:1139
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "return value type mismatch"
-msgstr "<返回值>"
+msgstr "返回值类型不匹配"
#: ipa-devirt.cc:1154
#, gcc-internal-format
@@ -30610,10 +30575,9 @@ msgid "name %qs is defined to different value in another translation unit"
msgstr "%qE未声明(不在函数内)"
#: ipa-devirt.cc:4325
-#, fuzzy, gcc-internal-format
-#| msgid "missing definition"
+#, gcc-internal-format
msgid "mismatching definition"
-msgstr "定义缺失"
+msgstr "不匹配的定义"
#: ipa-fnsummary.cc:4845
#, fuzzy, gcc-internal-format
@@ -30867,13 +30831,12 @@ msgstr "需要 %<,%> 或 %<)%>"
#: lazy-diagnostic-path.cc:179
#, gcc-internal-format
msgid "this warning should be skipped"
-msgstr ""
+msgstr "该警告信息应当被跳过"
#: lazy-diagnostic-path.cc:194
-#, fuzzy, gcc-internal-format
-#| msgid "this is the insn:"
+#, gcc-internal-format
msgid "this is a test"
-msgstr "这是指令:"
+msgstr "这是一个测试"
#: lra-assigns.cc:1694
#, fuzzy, gcc-internal-format, gfc-internal-format
@@ -31002,7 +30965,7 @@ msgstr ""
#: lto-compress.cc:165
#, gcc-internal-format
msgid "original size unknown"
-msgstr ""
+msgstr "原始大小未知"
#: lto-compress.cc:171
#, fuzzy, gcc-internal-format, gfc-internal-format
@@ -31145,19 +31108,19 @@ msgid "problem with building target image for %s"
msgstr "组建目标平台:%s\n"
#: lto-wrapper.cc:1083
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "reading input file"
-msgstr "读取输入历史文件…\n"
+msgstr "正在读取输入文件"
#: lto-wrapper.cc:1088
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "writing output file"
-msgstr "写入到输出文件 '%s' 时出错\n"
+msgstr "正在写入输出文件"
#: lto-wrapper.cc:1127
#, gcc-internal-format
msgid "installation error, cannot find %<crtoffloadtable%s.o%>"
-msgstr ""
+msgstr "安装错误,无法找到 %<crtoffloadtable%s.o%>"
#: lto-wrapper.cc:1380
#, fuzzy
@@ -31178,10 +31141,9 @@ msgid "environment variable %<COLLECT_GCC_OPTIONS%> must be set"
msgstr "环境变量 COLLECT_GCC_OPTIONS 必须被设置"
#: lto-wrapper.cc:1575
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "missing argument to %qs"
+#, gcc-internal-format, gfc-internal-format
msgid "missing directory: %s"
-msgstr "%qs缺少参数"
+msgstr "缺失目录:%s"
#: lto-wrapper.cc:1768 lto-wrapper.cc:1828 c-family/c-pch.cc:215
#: c-family/c-pch.cc:250 c-family/c-pch.cc:288 c-family/c-pch.cc:366
@@ -31217,10 +31179,9 @@ msgid "using ltrans cache without file locking support, do not use in parallel"
msgstr ""
#: lto-wrapper.cc:2315 config/gcn/mkoffload.cc:954
-#, fuzzy, gcc-internal-format
-#| msgid "atexit failed"
+#, gcc-internal-format
msgid "%<atexit%> failed"
-msgstr "atexit 失败"
+msgstr "%<atexit%> 失败"
#: multiple_target.cc:72
#, fuzzy, gcc-internal-format
@@ -31744,9 +31705,9 @@ msgid "location of OpenACC %<kernels%>"
msgstr ""
#: omp-oacc-kernels-decompose.cc:1295
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%qs not yet supported"
-msgstr "%P%F:不支持 -shared\n"
+msgstr "%qs 尚未被支持"
#: omp-oacc-neuter-broadcast.cc:1764
#, gcc-internal-format
@@ -32525,14 +32486,9 @@ msgid "fail to initialize plugin %s"
msgstr "无法初始化插件 %s"
#: plugin.cc:708
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid ""
-#| "cannot load plugin %s\n"
-#| "%s"
+#, gcc-internal-format, gfc-internal-format
msgid "cannot load plugin %s: %s"
-msgstr ""
-"无法加载插件 %s\n"
-"%s"
+msgstr "无法加载插件 %s:%s"
#: plugin.cc:718
#, fuzzy, gcc-internal-format, gfc-internal-format
@@ -32555,10 +32511,9 @@ msgstr ""
"%3$s"
#: plugin.cc:737
-#, fuzzy, gcc-internal-format, gfc-internal-format
-#| msgid "fail to initialize plugin %s"
+#, gcc-internal-format, gfc-internal-format
msgid "failed to initialize plugin %s"
-msgstr "无法初始化插件 %s"
+msgstr "初始化插件 %s 失败"
#: plugin.cc:1049
#, fuzzy, gcc-internal-format
@@ -32831,9 +32786,9 @@ msgid "register of %qD used for multiple global register variables"
msgstr "嵌套函数中使用了全局寄存器变量%qD"
#: reginfo.cc:760 config/rs6000/rs6000-logue.cc:5577
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "conflicts with %qD"
-msgstr "%qD与已用的函数冲突"
+msgstr "与 %qD 冲突"
#: reginfo.cc:765
#, gcc-internal-format
@@ -33125,9 +33080,9 @@ msgid "variable symbol is not variable"
msgstr "%L处的符号不是一个 DUMMY 变量"
#: symtab.cc:1130
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "node has unknown type"
-msgstr "未知类型的输入行"
+msgstr "节点类型未知"
#: symtab.cc:1135
#, fuzzy, gcc-internal-format, gfc-internal-format
@@ -45675,10 +45630,9 @@ msgid "mips16 function profiling"
msgstr "mips16 函数取样"
#: config/mmix/mmix.cc:318
-#, fuzzy, gcc-internal-format
-#| msgid "-f%s not supported: ignored"
+#, gcc-internal-format
msgid "%<-f%s%> not supported: ignored"
-msgstr "-f%s 不受支持:已忽略"
+msgstr "%<-f%s%> 不受支持:已忽略"
#: config/mmix/mmix.cc:783
#, gcc-internal-format
@@ -45818,7 +45772,7 @@ msgstr ""
#: config/msp430/msp430-devices.cc:488
#, gcc-internal-format
msgid "could not locate MCU data file %<devices.csv%>"
-msgstr ""
+msgstr "无法定位 MCU 数据文件 %<devices.csv%>"
#: config/msp430/msp430.cc:181
#, gcc-internal-format
@@ -45861,10 +45815,9 @@ msgid "unrecognized MCU name %qs, assuming that it just supports the MSP430X ISA
msgstr ""
#: config/msp430/msp430.cc:250
-#, fuzzy, gcc-internal-format
-#| msgid "unrecognized register name %qs"
+#, gcc-internal-format
msgid "Unrecognized MCU name %qs."
-msgstr "不可识别的寄存名%qs"
+msgstr "无法识别的 MCU 名称 %qs。"
#: config/msp430/msp430.cc:255
#, fuzzy, gcc-internal-format
@@ -46152,9 +46105,9 @@ msgid "%<-mabi=2fp+%> option only support when FPU available, must be enable %<-
msgstr ""
#: config/nvptx/mkoffload.cc:94
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "deleting file %s: %m"
-msgstr "删除临时 exp 文件 %s"
+msgstr "正在删除文件 %s: %m"
#: config/nvptx/mkoffload.cc:119
#, gcc-internal-format
@@ -46203,9 +46156,9 @@ msgid "cannot open '%s'"
msgstr "无法打开“%s”"
#: config/nvptx/mkoffload.cc:860
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "cannot open intermediate ptx file"
-msgstr "无法打开输入文件“%s”"
+msgstr "无法打开中间的 ptx 文件"
#: config/nvptx/nvptx.cc:206
#, fuzzy, gcc-internal-format
@@ -46355,15 +46308,14 @@ msgid "%<CTABLE_ENTRY%> index %wd is not valid"
msgstr ""
#: config/pru/pru-pragma.cc:63
-#, fuzzy, gcc-internal-format
-#| msgid "redefinition of %q#T"
+#, gcc-internal-format
msgid "redefinition of %<CTABLE_ENTRY %wd%>"
-msgstr "%q#T重定义"
+msgstr "%<CTABLE_ENTRY %wd%> 的重定义"
#: config/pru/pru-pragma.cc:67
#, gcc-internal-format
msgid "%<CTABLE_ENTRY%> base address is not a multiple of 256"
-msgstr ""
+msgstr "%<CTABLE_ENTRY%> 基地址不是 256 的倍数"
#: config/pru/pru-pragma.cc:75
#, fuzzy, gcc-internal-format
@@ -46754,10 +46706,9 @@ msgid "rv32e requires ilp32e ABI"
msgstr "rv32e 需要 ilp32e ABI"
#: config/riscv/riscv.cc:10723
-#, fuzzy, gcc-internal-format
-#| msgid "rv32e requires ilp32e ABI"
+#, gcc-internal-format
msgid "rv64e requires lp64e ABI"
-msgstr "rv32e 需要 ilp32e ABI"
+msgstr "rv64e 需要 lp64e ABI"
#: config/riscv/riscv.cc:10728
#, fuzzy, gcc-internal-format
@@ -47252,10 +47203,9 @@ msgstr "%qs必须与%qs一起使用"
#: config/rs6000/rs6000.cc:4222 config/rs6000/rs6000.cc:4231
#: config/rs6000/rs6000.cc:4369 config/rs6000/rs6000.cc:4382
#: config/rs6000/rs6000.cc:4404
-#, fuzzy, gcc-internal-format
-#| msgid "%qT referred to as %qs"
+#, gcc-internal-format
msgid "%qs requires %qs"
-msgstr "%qT作为%qs被引用"
+msgstr "%qs 需要 %qs"
#: config/rs6000/rs6000.cc:4118
#, fuzzy, gcc-internal-format
@@ -47517,10 +47467,9 @@ msgid "%qF requires z15 or higher"
msgstr "%qF 需要 z15 或更高"
#: config/s390/s390-c.cc:965
-#, fuzzy, gcc-internal-format
-#| msgid "%qF requires z14 or higher"
+#, gcc-internal-format
msgid "%qF requires z17 or higher"
-msgstr "%qF 需要 z14 或更高"
+msgstr "%qF 需要 z17 或更高"
#: config/s390/s390-c.cc:979
#, gcc-internal-format
@@ -80823,9 +80772,9 @@ msgid "Extension: Unary operator following arithmetic operator (use parentheses)
msgstr "扩展:%C处单目运算符出现在算术运算符之后"
#: fortran/matchexp.cc:666
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "match_level_4(): Bad operator"
-msgstr "错误的运算符"
+msgstr "match_level_4():错误的运算符"
#: fortran/misc.cc:116
#, gcc-internal-format
diff --git a/gcc/real.cc b/gcc/real.cc
index b64bad0..95a9332 100644
--- a/gcc/real.cc
+++ b/gcc/real.cc
@@ -2230,7 +2230,6 @@ real_from_integer (REAL_VALUE_TYPE *r, format_helper fmt,
{
unsigned int len = val_in.get_precision ();
int i, j, e = 0;
- int maxbitlen = MAX_BITSIZE_MODE_ANY_INT + HOST_BITS_PER_WIDE_INT;
const unsigned int realmax = (SIGNIFICAND_BITS / HOST_BITS_PER_WIDE_INT
* HOST_BITS_PER_WIDE_INT);
@@ -2238,12 +2237,6 @@ real_from_integer (REAL_VALUE_TYPE *r, format_helper fmt,
r->cl = rvc_normal;
r->sign = wi::neg_p (val_in, sgn);
- /* We have to ensure we can negate the largest negative number. */
- wide_int val = wide_int::from (val_in, maxbitlen, sgn);
-
- if (r->sign)
- val = -val;
-
/* Ensure a multiple of HOST_BITS_PER_WIDE_INT, ceiling, as elt
won't work with precisions that are not a multiple of
HOST_BITS_PER_WIDE_INT. */
@@ -2252,7 +2245,13 @@ real_from_integer (REAL_VALUE_TYPE *r, format_helper fmt,
/* Ensure we can represent the largest negative number. */
len += 1;
- len = len/HOST_BITS_PER_WIDE_INT * HOST_BITS_PER_WIDE_INT;
+ len = len / HOST_BITS_PER_WIDE_INT * HOST_BITS_PER_WIDE_INT;
+
+ /* We have to ensure we can negate the largest negative number. */
+ wide_int val = wide_int::from (val_in, len, sgn);
+
+ if (r->sign)
+ val = -val;
/* Cap the size to the size allowed by real.h. */
if (len > realmax)
@@ -2260,14 +2259,18 @@ real_from_integer (REAL_VALUE_TYPE *r, format_helper fmt,
HOST_WIDE_INT cnt_l_z;
cnt_l_z = wi::clz (val);
- if (maxbitlen - cnt_l_z > realmax)
+ if (len - cnt_l_z > realmax)
{
- e = maxbitlen - cnt_l_z - realmax;
+ e = len - cnt_l_z - realmax;
/* This value is too large, we must shift it right to
preserve all the bits we can, and then bump the
- exponent up by that amount. */
- val = wi::lrshift (val, e);
+ exponent up by that amount, but or in 1 if any of
+ the shifted out bits are non-zero. */
+ if (wide_int::from (val, e, UNSIGNED) != 0)
+ val = wi::set_bit (wi::lrshift (val, e), 0);
+ else
+ val = wi::lrshift (val, e);
}
len = realmax;
}
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index fe9c031..fc1155f 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -989,10 +989,10 @@ symtab_node::dump_base (FILE *f)
same_comdat_group->dump_asm_name ());
if (next_sharing_asm_name)
fprintf (f, " next sharing asm name: %i\n",
- next_sharing_asm_name->order);
+ next_sharing_asm_name->get_uid ());
if (previous_sharing_asm_name)
fprintf (f, " previous sharing asm name: %i\n",
- previous_sharing_asm_name->order);
+ previous_sharing_asm_name->get_uid ());
if (address_taken)
fprintf (f, " Address is taken.\n");
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index da60a95..d25e135 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,476 @@
+2025-06-14 Georg-Johann Lay <avr@gjlay.de>
+
+ PR rtl-optimization/120423
+ PR rtl-optimization/116389
+ * gcc.target/avr/torture/pr120423-1.c: New test.
+ * gcc.target/avr/torture/pr120423-2.c: New test.
+ * gcc.target/avr/torture/pr120423-116389.c: New test.
+
+2025-06-13 Georg-Johann Lay <avr@gjlay.de>
+
+ Backported from master:
+ 2025-06-12 Georg-Johann Lay <avr@gjlay.de>
+
+ PR middle-end/117811
+ PR testsuite/52641
+ * gcc.dg/torture/pr117811.c: Fix for int < 32 bit.
+
+2025-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/120638
+ * gcc.dg/pr120638.c: New test.
+
+2025-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-06-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/120547
+ * gcc.dg/bitint-123.c: New test.
+
+2025-06-13 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backported from master:
+ 2025-06-13 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/120483
+ * gfortran.dg/save_8.f90: New test.
+
+2025-06-12 Martin Jambor <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-29 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/120295
+ * gcc.dg/ipa/pr120295.c: New test.
+
+2025-06-09 Jason Merrill <jason@redhat.com>
+
+ Backported from master:
+ 2025-06-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/120555
+ * g++.dg/cpp1z/constexpr-if39.C: New test.
+
+2025-06-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/120502
+ * g++.dg/cpp2a/constexpr-prvalue2.C: New test.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120357
+ * gcc.dg/vect/vect-early-break_136-pr120357.c: New testcase.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120341
+ * gcc.dg/torture/pr120341-1.c: New testcase.
+ * gcc.dg/torture/pr120341-2.c: Likewise.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-09 Richard Biener <rguenther@suse.de>
+
+ PR rtl-optimization/120182
+ * gcc.dg/torture/pr120182.c: New testcase.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120003
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust aarch64 expected
+ thread2 number of threads.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-04-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/120003
+ * gcc.dg/tree-ssa/ssa-thread-23.c: New testcase.
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/119960
+ * gcc.dg/vect/bb-slp-pr119960-1.c: New testcase.
+
+2025-06-06 Richard Biener <rguenther@suse.de>
+
+ Backported from master:
+ 2025-05-15 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/vect-epilogues-1.c: New testcase.
+ * gcc.target/i386/vect-epilogues-2.c: Likewise.
+ * gcc.target/i386/vect-epilogues-3.c: Likewise.
+ * gcc.target/i386/vect-epilogues-4.c: Likewise.
+ * gcc.target/i386/vect-epilogues-5.c: Likewise.
+
+2025-06-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/opt7.ads: New test.
+ * gnat.dg/specs/opt7_pkg.ads: New helper.
+ * gnat.dg/specs/opt7_pkg.adb: Likewise.
+
+2025-06-04 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-06-03 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/99838
+ * gfortran.dg/coarray_data_2.f90: New test.
+
+2025-06-03 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-30 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/102599
+ PR fortran/114022
+ * gfortran.dg/inquiry_type_ref_8.f90: New test.
+
+2025-06-03 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-27 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/101735
+ * gfortran.dg/inquiry_type_ref_7.f90: New test.
+
+2025-06-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/120123
+ * g++.dg/cpp2a/concepts-lambda24.C: New test.
+
+2025-06-02 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/120193
+ * gfortran.dg/guality/pr120193.f90: New test.
+
+2025-06-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-06-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/119856
+ * gfortran.dg/pr119856.f90: New test.
+
+2025-06-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/119856
+ * gfortran.dg/comma_format_extension_1.f: Update dg-options to
+ "-std=legacy".
+ * gfortran.dg/comma_format_extension_3.f: Likewise.
+ * gfortran.dg/continuation_13.f90: Likewise.
+
+2025-05-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/120049
+ * gfortran.dg/pr120049_a.f90: Update test directives.
+ * gfortran.dg/pr120049_b.f90: Update test directives
+ * gfortran.dg/pr120049_2.f90: New test.
+ * gfortran.dg/c_f_pointer_tests_6.f90: Adjust dg-error
+ directive.
+ Co-Authored-By: Steve Kargl <kargl@gcc.gnu.org>
+
+2025-05-31 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-30 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/120355
+ * gfortran.dg/interface_62.f90: New test.
+
+2025-05-30 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-05-29 Sandra Loosemore <sloosemore@baylibre.com>
+
+ * c-c++-common/gomp/declare-variant-2.c: Adjust patterns now that
+ C and C++ now behave similarly.
+ * c-c++-common/gomp/metadirective-error-recovery.c: New.
+
+2025-05-30 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-05-29 Sandra Loosemore <sloosemore@baylibre.com>
+
+ PR c/120180
+ * c-c++-common/gomp/pr120180.c: New.
+
+2025-05-30 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/120480
+ * gcc.dg/pr120480.c: New test.
+
+2025-05-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/sso19.adb: New test.
+ * gnat.dg/sso19_pkg.ads, gnat.dg/sso19_pkg.adb: New helper.
+
+2025-05-26 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-26 Tobias Burnus <tburnus@baylibre.com>
+
+ PR middle-end/118694
+ * c-c++-common/gomp/attrs-metadirective-3.c: Change to never
+ expect 'omp metadirective' in the dump. If !offload_nvptx, check
+ that no 'teams' shows up in the dump; for offload_nvptx, expect
+ OMP_NEXT_VARIANT and an error about directive between 'target'
+ and 'teams'.
+ * c-c++-common/gomp/metadirective-3.c: Likewise.
+
+2025-05-26 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-26 Tobias Burnus <tburnus@baylibre.com>
+
+ PR c++/120413
+ * g++.dg/gomp/target-4.C: New test.
+
+2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120363
+ * g++.dg/modules/pr113292_a.H: Move to...
+ * g++.dg/modules/tls-1_a.H: ...here.
+ * g++.dg/modules/pr113292_b.C: Move to...
+ * g++.dg/modules/tls-1_b.C: ...here.
+ * g++.dg/modules/pr113292_c.C: Move to...
+ * g++.dg/modules/tls-1_c.C: ...here.
+ * g++.dg/modules/tls-2_a.C: New test.
+ * g++.dg/modules/tls-2_b.C: New test.
+ * g++.dg/modules/tls-2_c.C: New test.
+ * g++.dg/modules/tls-3.h: New test.
+ * g++.dg/modules/tls-3_a.H: New test.
+ * g++.dg/modules/tls-3_b.C: New test.
+
+2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-23 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120414
+ * g++.dg/modules/using-31_a.C: New test.
+ * g++.dg/modules/using-31_b.C: New test.
+
+2025-05-22 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-15 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/85750
+ * gfortran.dg/alloc_comp_auto_array_3.f90: Adjust scan counts.
+ * gfortran.dg/alloc_comp_class_3.f03: Remove bogus warnings.
+ * gfortran.dg/alloc_comp_class_4.f03: Likewise.
+ * gfortran.dg/allocate_with_source_14.f03: Adjust scan count.
+ * gfortran.dg/derived_constructor_comps_6.f90: Likewise.
+ * gfortran.dg/derived_result_5.f90: New test.
+
+2025-05-20 Harald Anlauf <anlauf@gmx.de>
+
+ Backported from master:
+ 2025-05-10 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/102891
+ * gfortran.dg/transfer_array_subref.f90: New test.
+
+2025-05-20 Martin Jambor <mjambor@suse.cz>
+
+ Backported from master:
+ 2025-05-14 Martin Jambor <mjambor@suse.cz>
+
+ * gcc.dg/ipa/pr120044-1.c: New test.
+ * gcc.dg/ipa/pr120044-2.c: Likewise.
+ * gcc.dg/tree-ssa/pr114864.c: Likewise.
+
+2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120013
+ * g++.dg/modules/partial-8.h: New test.
+ * g++.dg/modules/partial-8_a.C: New test.
+ * g++.dg/modules/partial-8_b.C: New test.
+ * g++.dg/modules/partial-8_c.C: New test.
+ * g++.dg/modules/partial-8_d.C: New test.
+
+2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-20 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120350
+ * g++.dg/modules/tinfo-3_a.H: New test.
+ * g++.dg/modules/tinfo-3_b.C: New test.
+
+2025-05-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-05-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/120049
+ * gfortran.dg/pr120049_a.f90: New test.
+ * gfortran.dg/pr120049_b.f90: New test.
+
+2025-05-16 Maciej W. Rozycki <macro@orcam.me.uk>
+
+ Backported from master:
+ 2025-04-19 Maciej W. Rozycki <macro@orcam.me.uk>
+
+ * gcc.target/alpha/memcpy-nested-offset-long.c: New file.
+ * gcc.target/alpha/memcpy-nested-offset-quad.c: New file.
+
+2025-05-15 Patrick Palka <ppalka@redhat.com>
+
+ Backported from master:
+ 2025-05-15 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/120161
+ * g++.dg/template/unify13.C: New test.
+
+2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/120125
+ * g++.dg/modules/clone-4_a.C: New test.
+ * g++.dg/modules/clone-4_b.C: New test.
+
+2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ Backported from master:
+ 2025-05-14 Nathaniel Shead <nathanieloshead@gmail.com>
+
+ PR c++/119864
+ * g++.dg/modules/openmp-1.C: New test.
+
+2025-05-13 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/120163
+ * gfortran.dg/interface_61.f90: New test.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-05-05 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/120117
+ * gm2/pim/pass/highbit.mod: New test.
+ * gm2/pim/pass/highbit2.mod: New test.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-04-24 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/119915
+ * gm2/pimlib/run/pass/format2.mod: New test.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-04-24 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/119914
+ * gm2/pim/fail/constintarraybyte.mod: New test.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/120188
+ * gm2.dg/doc/examples/plugin/fail/doc-examples-plugin-fail.exp:
+ Remove call to gm2-dg-frontend-configure-check and replace with
+ tests for whether plugin variables exist.
+
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-05-12 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/120188
+ * lib/gm2-dg.exp (gm2-dg-frontend-configure-check): New function.
+ (gm2-dg-runtest): Add -O2 to the option_list.
+ * gm2.dg/doc/examples/plugin/fail/assignvalue.mod: New test.
+ * gm2.dg/doc/examples/plugin/fail/doc-examples-plugin-fail.exp: New test.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR libfortran/120196
+ * gfortran.dg/pr120196.f90: New test.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/120191
+ * gfortran.dg/pr120191_3.f90: New test.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/120191
+ * gfortran.dg/pr120191_2.f90: New test.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+ Daniil Kochergin <daniil2472s@gmail.com>
+ Tobias Burnus <tburnus@baylibre.com>
+
+ PR fortran/120191
+ * gfortran.dg/pr120191_1.f90: New test.
+
+2025-05-12 Jason Merrill <jason@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Jason Merrill <jason@redhat.com>
+
+ PR c++/120012
+ * g++.dg/abi/base-defaulted2.C: New test.
+
2025-05-11 Richard Biener <rguenther@suse.de>
PR tree-optimization/120211
diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index a2bb7f0..a7ea0db 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,44 @@
+2025-07-03 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-07-03 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * c-c++-common/gomp/omp_get_num_devices_initial_device.c: Fix.
+ * gfortran.dg/gomp/omp_get_num_devices_initial_device.f90: Likewise.
+
+2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+ Sandra Loosemore <sloosemore@baylibre.com>
+
+ * c-c++-common/gomp/omp_get_num_devices_initial_device-2.c: New test.
+ * c-c++-common/gomp/omp_get_num_devices_initial_device.c: New test.
+ * gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90: New test.
+ * gfortran.dg/gomp/omp_get_num_devices_initial_device.f90: New test.
+
+2025-06-05 Sandra Loosemore <sloosemore@baylibre.com>
+
+ Backported from master:
+ 2025-06-02 Sandra Loosemore <sloosemore@baylibre.com>
+
+ * c-c++-common/gomp/declare-variant-2.c: Update expected output.
+ * c-c++-common/gomp/metadirective-condition-constexpr.c: New.
+ * c-c++-common/gomp/metadirective-condition.c: New.
+ * c-c++-common/gomp/metadirective-error-recovery.c: Update expected
+ output.
+ * g++.dg/gomp/metadirective-condition-class.C: New.
+ * g++.dg/gomp/metadirective-condition-template.C: New.
+
+2025-05-22 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-19 Thomas Schwinge <tschwinge@baylibre.com>
+
+ PR lto/120308
+ * gcc.target/nvptx/abi-struct-arg.c: Add empty structure testing.
+ * gcc.target/nvptx/abi-struct-ret.c: Likewise.
+
2025-05-15 Sandra Loosemore <sloosemore@baylibre.com>
Tobias Burnus <tburnus@baylibre.com>
diff --git a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c
index 31dd054..803bf0a 100644
--- a/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/attrs-metadirective-3.c
@@ -9,7 +9,7 @@ f (int x[], int y[], int z[])
{
int i;
- [[omp::sequence (directive (target map(to: x, y) map(from: z)),
+ [[omp::sequence (directive (target map(to: x, y) map(from: z)), /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */
directive (metadirective
when (device={arch("nvptx")}: teams loop)
default (parallel loop)))]]
@@ -20,5 +20,6 @@ f (int x[], int y[], int z[])
/* If offload device "nvptx" isn't supported, the front end can eliminate
that alternative and not produce a metadirective at all. Otherwise this
won't be resolved until late. */
-/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */
-/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */
+/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
index 7711dbc..83e1bb1 100644
--- a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
@@ -38,7 +38,7 @@ void f18 (void);
void f19 (void);
#pragma omp declare variant (f1) match(user={condition()}) /* { dg-error "expected \[^\n\r]*expression before '\\)' token" } */
void f20 (void);
-#pragma omp declare variant (f1) match(user={condition(f1)}) /* { dg-error "property must be integer expression" } */
+#pragma omp declare variant (f1) match(user={condition(f1)})
void f21 (void);
#pragma omp declare variant (f1) match(user={condition(1, 2, 3)}) /* { dg-error "expected '\\)' before ',' token" } */
void f22 (void);
@@ -47,10 +47,9 @@ void f23 (void);
#pragma omp declare variant (f1) match(construct={teams,parallel,master,for}) /* { dg-warning "unknown selector 'master' for context selector set 'construct'" } */
void f24 (void);
#pragma omp declare variant (f1) match(construct={parallel(1 /* { dg-error "selector 'parallel' does not accept any properties" } */
-void f25 (void); /* { dg-error "expected '\\\}' before end of line" "" { target c++ } .-1 } */
- /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-2 } */
+void f25 (void); /* { dg-error "expected '\\\}' before end of line" "" { target *-*-* } .-1 } */
#pragma omp declare variant (f1) match(construct={parallel(1)}) /* { dg-error "selector 'parallel' does not accept any properties" } */
-void f26 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f26 (void);
#pragma omp declare variant (f0) match(construct={simd(12)}) /* { dg-error "expected \[^\n\r]* clause before" } */
void f27 (void); /* { dg-error "'\\)' before numeric constant" "" { target c++ } .-1 } */
#pragma omp declare variant (f1) match(construct={parallel},construct={for}) /* { dg-error "selector set 'construct' specified more than once" } */
@@ -96,13 +95,13 @@ void f46 (void);
#pragma omp declare variant (f1) match(implementation={vendor("foobar")}) /* { dg-warning "unknown property '.foobar.' of 'vendor' selector" } */
void f47 (void);
#pragma omp declare variant (f1) match(implementation={unified_address(yes)}) /* { dg-error "selector 'unified_address' does not accept any properties" } */
-void f48 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f48 (void);
#pragma omp declare variant (f1) match(implementation={unified_shared_memory(no)}) /* { dg-error "selector 'unified_shared_memory' does not accept any properties" } */
-void f49 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f49 (void);
#pragma omp declare variant (f1) match(implementation={dynamic_allocators(42)}) /* { dg-error "selector 'dynamic_allocators' does not accept any properties" } */
-void f50 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f50 (void);
#pragma omp declare variant (f1) match(implementation={reverse_offload()}) /* { dg-error "selector 'reverse_offload' does not accept any properties" } */
-void f51 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
+void f51 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order}) /* { dg-error "expected '\\(' before '\\\}' token" } */
void f52 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(acquire)})
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-3.c b/gcc/testsuite/c-c++-common/gomp/metadirective-3.c
index 0ac0d1d..b6c1601 100644
--- a/gcc/testsuite/c-c++-common/gomp/metadirective-3.c
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-3.c
@@ -8,7 +8,7 @@ f (int x[], int y[], int z[])
{
int i;
- #pragma omp target map(to: x, y) map(from: z)
+ #pragma omp target map(to: x, y) map(from: z) /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_nvptx } } */
#pragma omp metadirective \
when (device={arch("nvptx")}: teams loop) \
default (parallel loop)
@@ -19,5 +19,6 @@ f (int x[], int y[], int z[])
/* If offload device "nvptx" isn't supported, the front end can eliminate
that alternative and not produce a metadirective at all. Otherwise this
won't be resolved until late. */
-/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" { target { ! offload_nvptx } } } } */
-/* { dg-final { scan-tree-dump "#pragma omp metadirective" "gimple" { target { offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump-not "#pragma omp metadirective" "gimple" } } */
+/* { dg-final { scan-tree-dump-not " teams" "gimple" { target { ! offload_nvptx } } } } */
+/* { dg-final { scan-tree-dump "variant.\[0-9\]+ = \\\[omp_next_variant\\\] OMP_NEXT_VARIANT <0,\[\r\n \]+construct context = 14\[\r\n \]+1: device = \\{arch \\(.nvptx.\\)\\}\[\r\n \]+2: >;" "gimple" { target { offload_nvptx } } } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c b/gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c
new file mode 100644
index 0000000..3484478
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-condition-constexpr.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { c || c++11 } } } */
+/* { dg-additional-options "-std=c23" { target c } } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+constexpr int flag = 1;
+
+void f() {
+#pragma omp metadirective when(user={condition(flag)} : nothing) \
+ otherwise(error at(execution))
+}
+
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_error" "original" } } */
+
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-condition.c b/gcc/testsuite/c-c++-common/gomp/metadirective-condition.c
new file mode 100644
index 0000000..099ad9d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-condition.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+static int arr[10];
+static int g (int a) { return -a; }
+
+void f (int *ptr, float x) {
+
+ /* Implicit conversion float -> bool */
+ #pragma omp metadirective when(user={condition(x)} : nothing) otherwise(nothing)
+
+ /* Implicit conversion pointer -> bool */
+ #pragma omp metadirective when(user={condition(ptr)} : nothing) otherwise(nothing)
+
+ /* Array expression undergoes array->pointer conversion, OK but test is
+ always optimized away. */
+ #pragma omp metadirective when(user={condition(arr)} : nothing) otherwise(nothing)
+
+ /* Function reference has pointer-to-function type, OK but test is
+ always optimized away. */
+ #pragma omp metadirective when(user={condition(g)} : nothing) otherwise(nothing)
+}
+
+/* { dg-final { scan-tree-dump "x != 0.0" "original" } } */
+/* { dg-final { scan-tree-dump "ptr != 0B" "original" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c b/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c
new file mode 100644
index 0000000..92995a2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/metadirective-error-recovery.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+/* This test used to ICE in C and only diagnose the first error in C++. */
+
+struct s {
+ int a, b;
+};
+
+void f (int aa, int bb)
+{
+ struct s s1, s2;
+ s1.a = aa;
+ s1.b = bb;
+ s2.a = aa + 1;
+ s2.b = bb + 1;
+
+ /* A struct is not a valid argument for the condition selector. */
+ #pragma omp metadirective when(user={condition(s1)} : nothing) otherwise(nothing)
+ /* { dg-error "used struct type value where scalar is required" "" { target c } .-1 } */
+ /* { dg-error "could not convert .s1. from .s. to .bool." "" { target c++ } .-2 } */
+ #pragma omp metadirective when(user={condition(s2)} : nothing) otherwise(nothing)
+ /* { dg-error "used struct type value where scalar is required" "" { target c } .-1 } */
+ /* { dg-error "could not convert .s2. from .s. to .bool." "" { target c++ } .-2 } */
+
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c
new file mode 100644
index 0000000..891f5cf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device-2.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O1 -fdump-tree-optimized -fno-builtin-omp_get_num_devices -fno-builtin-omp_get_initial_device" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int omp_get_initial_device ();
+extern int omp_get_num_devices ();
+#ifdef __cplusplus
+}
+#endif
+
+int f()
+{
+/* The following assumes that omp_get_initial_device () will not return
+ omp_initial_device (== -1), which is also permitted since OpenMP 6.0. */
+ if (omp_get_initial_device () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_num_devices () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_initial_device () != omp_get_initial_device ()) __builtin_abort ();
+
+ return omp_get_num_devices ();
+}
+
+/* { dg-final { scan-tree-dump-times "abort" 3 "optimized" } } */
+
+/* { dg-final { scan-tree-dump-times "omp_get_num_devices" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "omp_get_initial_device" 3 "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c
new file mode 100644
index 0000000..6e2c1a8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/omp_get_num_devices_initial_device.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O1 -fdump-tree-optimized" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int omp_get_initial_device ();
+extern int omp_get_num_devices ();
+#ifdef __cplusplus
+}
+#endif
+
+int f()
+{
+/* The following assumes that omp_get_initial_device () will not return
+ omp_initial_device (== -1), which is also permitted since OpenMP 6.0. */
+ if (omp_get_initial_device () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_num_devices () != omp_get_num_devices ()) __builtin_abort ();
+
+ if (omp_get_initial_device () != omp_get_initial_device ()) __builtin_abort ();
+
+ return omp_get_num_devices ();
+}
+
+/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */
+
+/* { dg-final { scan-tree-dump-not "omp_get_num_devices" "optimized" { target { ! offloading_enabled } } } } */
+/* { dg-final { scan-tree-dump "return 0;" "optimized" { target { ! offloading_enabled } } } } */
+
+/* { dg-final { scan-tree-dump-times "omp_get_num_devices" 1 "optimized" { target offloading_enabled } } } */
+/* { dg-final { scan-tree-dump "_1 = __builtin_omp_get_num_devices \\(\\);\[\\r\\n\]+\[ \]+return _1;" "optimized" { target offloading_enabled } } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/pr120180.c b/gcc/testsuite/c-c++-common/gomp/pr120180.c
new file mode 100644
index 0000000..cb5a0d5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr120180.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+/* This test used to ICE after erroring on the metadirective in the
+ loop nest. */
+
+int main()
+{
+ int blksize = 15000;
+ double *qq;
+ int i, k, nq;
+
+ #pragma omp metadirective when(user={condition(0)}: target teams distribute parallel for collapse(2) map(qq[:0]) private(i)) \
+ when(user={condition(0)}: target teams distribute parallel for map(qq[:0]) private(i)) \
+ when(user={condition(1)}: target teams loop collapse(2) map(qq[:0]) private(i))
+ for(k=0; k<blksize; k++)
+ {
+#pragma omp metadirective when(user={condition(0)}: simd) default() // { dg-error "intervening code must not contain OpenMP directives" }
+ for (i=0; i<nq; i++)
+ qq[k*nq + i] = 0.0;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/abi/base-defaulted2.C b/gcc/testsuite/g++.dg/abi/base-defaulted2.C
new file mode 100644
index 0000000..9652ae6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/base-defaulted2.C
@@ -0,0 +1,12 @@
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-fabi-version=20 -Wabi" }
+
+struct Base {
+protected:
+ Base() = default;
+ ~Base() = default;
+};
+
+struct Derived : Base {
+ void* ptr; // { dg-bogus "offset" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-if39.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-if39.C
new file mode 100644
index 0000000..38ae7a0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-if39.C
@@ -0,0 +1,30 @@
+// PR c++/120555
+// { dg-do compile { target c++17 } }
+
+struct A { int m; };
+
+template<class T>
+constexpr auto f() {
+ if constexpr (sizeof(T) == sizeof(int))
+ return 1;
+ else
+ return A{f<int>()};
+}
+
+static_assert(f<bool>().m == 1);
+static_assert(f<int>() == 1);
+
+template <class T> constexpr auto g();
+
+template<class T>
+constexpr auto f2() {
+ if constexpr (sizeof(T) == sizeof(int))
+ return 1;
+ else
+ return A{g<int>()}; // { dg-error "auto" }
+}
+
+template <class T> constexpr auto g() { return A{1}; }
+
+static_assert(f2<bool>().m == 1);
+static_assert(f2<int>() == 1);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-lambda24.C b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda24.C
new file mode 100644
index 0000000..28f56ca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-lambda24.C
@@ -0,0 +1,13 @@
+// PR c++/120123
+// { dg-do compile { target c++20 } }
+
+struct H {
+ void member(int) {}
+ void call() {
+ [this]() {
+ [this](const auto& v)
+ requires requires { /*this->*/member(v); }
+ { return member(v); }(0);
+ };
+ }
+};
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-prvalue2.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-prvalue2.C
new file mode 100644
index 0000000..c2dc7cd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-prvalue2.C
@@ -0,0 +1,26 @@
+// PR c++/120502
+// { dg-do compile { target c++20 } }
+// { dg-additional-options -O }
+
+struct non_trivial_if {
+ constexpr non_trivial_if() {}
+};
+struct allocator : non_trivial_if {};
+struct padding {};
+struct __short {
+ [[no_unique_address]] padding p;
+};
+struct basic_string {
+ union {
+ __short s;
+ int l;
+ };
+ [[no_unique_address]] allocator a;
+ constexpr basic_string() {}
+ ~basic_string() {}
+};
+struct time_zone {
+ basic_string __abbrev;
+ long __offset;
+};
+time_zone convert_to_time_zone() { return {}; }
diff --git a/gcc/testsuite/g++.dg/gomp/metadirective-condition-class.C b/gcc/testsuite/g++.dg/gomp/metadirective-condition-class.C
new file mode 100644
index 0000000..6403611
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/metadirective-condition-class.C
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+class c
+{
+ public:
+ int x;
+ c (int xx) { x = xx; }
+ operator bool() { return x != 0; }
+};
+
+void f (c &objref)
+{
+ #pragma omp metadirective when(user={condition(objref)} : nothing) otherwise(nothing)
+}
+
+
+template <typename T> class d
+{
+ public:
+ T x;
+ d (T xx) { x = xx; }
+ operator bool() { return x != 0; }
+};
+
+template <typename T>
+void g (d<T> &objref)
+{
+ #pragma omp metadirective when(user={condition(objref)} : nothing) otherwise(nothing)
+}
+
+int main (void)
+{
+ c obj1 (42);
+ d<int> obj2 (69);
+
+ f (obj1);
+ g (obj2);
+}
+
+/* { dg-final { scan-tree-dump "c::operator bool \\(\\(struct c .\\) objref\\)" "original" } } */
+
+/* { dg-final { scan-tree-dump "d<int>::operator bool \\(\\(struct d .\\) objref\\)" "original" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/metadirective-condition-template.C b/gcc/testsuite/g++.dg/gomp/metadirective-condition-template.C
new file mode 100644
index 0000000..30783d9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/metadirective-condition-template.C
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+template<typename T, typename T2>
+void f (T x, T2 y)
+{
+ #pragma omp metadirective when(user={condition(x)}, \
+ target_device={device_num(y)} : flush)
+}
+
+class c
+{
+ public:
+ int x;
+ c (int xx) { x = xx; }
+ operator bool() { return x != 0; }
+};
+
+template <typename T> class d
+{
+ public:
+ T x;
+ d (T xx) { x = xx; }
+ operator bool() { return x != 0; }
+};
+
+int main (void)
+{
+ c obj1 (42);
+ d<int> obj2 (69);
+
+ f (42, 0);
+ f (&obj1, 0);
+ f (obj1, 0);
+ f (obj2, 0);
+}
+
+/* { dg-final { scan-tree-dump-times "if \\(x != 0 &&" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "if \\(x != 0B &&" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "if \\(<<cleanup_point c::operator bool \\(&x\\)>> &&" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "if \\(<<cleanup_point d<int>::operator bool \\(&x\\)>> &&" 1 "original" } } */
diff --git a/gcc/testsuite/g++.dg/gomp/target-4.C b/gcc/testsuite/g++.dg/gomp/target-4.C
new file mode 100644
index 0000000..80fc9df
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/target-4.C
@@ -0,0 +1,22 @@
+// { dg-do compile { target c++11 } }
+// PR c++/120413
+
+struct S
+{
+ S() {}
+ ~S() {}
+};
+
+struct array
+{
+ S _arr[1];
+};
+
+int main()
+{
+#pragma omp target
+ {
+ array arr{};
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/modules/clone-4_a.C b/gcc/testsuite/g++.dg/modules/clone-4_a.C
new file mode 100644
index 0000000..3ee6109
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/clone-4_a.C
@@ -0,0 +1,12 @@
+// PR c++/120125
+// { dg-additional-options "-fmodules -fdeclone-ctor-dtor" }
+// { dg-module-cmi M }
+
+export module M;
+
+void foo();
+export template <typename _Tp> struct __shared_ptr {
+ inline __shared_ptr() { foo(); }
+};
+
+template class __shared_ptr<int>;
diff --git a/gcc/testsuite/g++.dg/modules/clone-4_b.C b/gcc/testsuite/g++.dg/modules/clone-4_b.C
new file mode 100644
index 0000000..1b36cb4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/clone-4_b.C
@@ -0,0 +1,12 @@
+// PR c++/120125
+// { dg-additional-options "-fmodules -fdeclone-ctor-dtor" }
+
+import M;
+
+int main() {
+ __shared_ptr<int> s1;
+ __shared_ptr<double> s2;
+}
+
+// { dg-final { scan-assembler-not {_ZNW1M12__shared_ptrIiEC[1-4]Ev:} } }
+// { dg-final { scan-assembler {_ZNW1M12__shared_ptrIdEC2Ev:} } }
diff --git a/gcc/testsuite/g++.dg/modules/openmp-1.C b/gcc/testsuite/g++.dg/modules/openmp-1.C
new file mode 100644
index 0000000..b5a30ad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/openmp-1.C
@@ -0,0 +1,9 @@
+// PR c++/119864
+// { dg-do assemble }
+// { dg-additional-options "-fmodules -fopenmp" }
+// { dg-require-effective-target "fopenmp" }
+
+export module M;
+
+int foo();
+int x = foo();
diff --git a/gcc/testsuite/g++.dg/modules/partial-8.h b/gcc/testsuite/g++.dg/modules/partial-8.h
new file mode 100644
index 0000000..d9a83a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/partial-8.h
@@ -0,0 +1,8 @@
+// PR c++/120013
+
+template <typename> struct tuple_element;
+template <typename T> tuple_element<T*> get(T);
+
+// This case wasn't an issue for the PR, but worth double-checking
+template <typename> constexpr int var = 123;
+template <typename T> void foo(T, int = var<T*>);
diff --git a/gcc/testsuite/g++.dg/modules/partial-8_a.C b/gcc/testsuite/g++.dg/modules/partial-8_a.C
new file mode 100644
index 0000000..d6848c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/partial-8_a.C
@@ -0,0 +1,10 @@
+// PR c++/120013
+// { dg-additional-options "-fmodules -Wno-global-module" }
+// { dg-module-cmi m:a }
+
+module;
+#include "partial-8.h"
+template <typename T> struct tuple_element<T*>;
+template <typename T> constexpr int var<T*> = 456;
+module m:a;
+template <typename T> void a(T t) { ::get(t); foo(t); }
diff --git a/gcc/testsuite/g++.dg/modules/partial-8_b.C b/gcc/testsuite/g++.dg/modules/partial-8_b.C
new file mode 100644
index 0000000..ce5cd09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/partial-8_b.C
@@ -0,0 +1,8 @@
+// PR c++/120013
+// { dg-additional-options "-fmodules -Wno-global-module" }
+// { dg-module-cmi m:b }
+
+module;
+#include "partial-8.h"
+module m:b;
+template <typename T> void b(T t) { ::get(t); foo(t); }
diff --git a/gcc/testsuite/g++.dg/modules/partial-8_c.C b/gcc/testsuite/g++.dg/modules/partial-8_c.C
new file mode 100644
index 0000000..eadd282
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/partial-8_c.C
@@ -0,0 +1,7 @@
+// PR c++/120013
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi m }
+
+export module m;
+import :a;
+import :b;
diff --git a/gcc/testsuite/g++.dg/modules/partial-8_d.C b/gcc/testsuite/g++.dg/modules/partial-8_d.C
new file mode 100644
index 0000000..2aedb39
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/partial-8_d.C
@@ -0,0 +1,9 @@
+// PR c++/120013
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi m }
+// Same as partial-8_c.C but in the other order, to ensure
+// that loading a partial spec over an instantiation works
+
+export module m;
+import :b;
+import :a;
diff --git a/gcc/testsuite/g++.dg/modules/tinfo-3_a.H b/gcc/testsuite/g++.dg/modules/tinfo-3_a.H
new file mode 100644
index 0000000..8b53e98
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tinfo-3_a.H
@@ -0,0 +1,7 @@
+// PR c++/120350
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#include <typeinfo>
+struct S {};
+inline const std::type_info& tinfo = typeid(S);
diff --git a/gcc/testsuite/g++.dg/modules/tinfo-3_b.C b/gcc/testsuite/g++.dg/modules/tinfo-3_b.C
new file mode 100644
index 0000000..95e02ab
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tinfo-3_b.C
@@ -0,0 +1,8 @@
+// PR c++/120350
+// { dg-additional-options "-fmodules" }
+
+import "tinfo-3_a.H";
+
+int main() {
+ return tinfo == typeid(int);
+}
diff --git a/gcc/testsuite/g++.dg/modules/pr113292_a.H b/gcc/testsuite/g++.dg/modules/tls-1_a.H
index 90ece2e..90ece2e 100644
--- a/gcc/testsuite/g++.dg/modules/pr113292_a.H
+++ b/gcc/testsuite/g++.dg/modules/tls-1_a.H
diff --git a/gcc/testsuite/g++.dg/modules/pr113292_b.C b/gcc/testsuite/g++.dg/modules/tls-1_b.C
index fc582a5..941bff2 100644
--- a/gcc/testsuite/g++.dg/modules/pr113292_b.C
+++ b/gcc/testsuite/g++.dg/modules/tls-1_b.C
@@ -1,7 +1,7 @@
// PR c++/113292
// { dg-additional-options "-fmodules-ts" }
-import "pr113292_a.H";
+import "tls-1_a.H";
// provide a definition of 'instance' so things link
thread_local test test::instance;
diff --git a/gcc/testsuite/g++.dg/modules/pr113292_c.C b/gcc/testsuite/g++.dg/modules/tls-1_c.C
index b5acf79..4568413 100644
--- a/gcc/testsuite/g++.dg/modules/pr113292_c.C
+++ b/gcc/testsuite/g++.dg/modules/tls-1_c.C
@@ -4,7 +4,7 @@
// { dg-add-options tls }
// { dg-additional-options "-fmodules-ts" }
-import "pr113292_a.H";
+import "tls-1_a.H";
int main() {
auto& instance = test::get_instance();
diff --git a/gcc/testsuite/g++.dg/modules/tls-2_a.C b/gcc/testsuite/g++.dg/modules/tls-2_a.C
new file mode 100644
index 0000000..2efae6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tls-2_a.C
@@ -0,0 +1,12 @@
+// PR c++/120363
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi M }
+
+export module M;
+
+export struct test {
+ static inline const int& get_instance() {
+ return instance;
+ }
+ static thread_local int instance;
+};
diff --git a/gcc/testsuite/g++.dg/modules/tls-2_b.C b/gcc/testsuite/g++.dg/modules/tls-2_b.C
new file mode 100644
index 0000000..af3e709
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tls-2_b.C
@@ -0,0 +1,5 @@
+// PR c++/120363
+// { dg-additional-options "-fmodules" }
+
+module M;
+thread_local int test::instance;
diff --git a/gcc/testsuite/g++.dg/modules/tls-2_c.C b/gcc/testsuite/g++.dg/modules/tls-2_c.C
new file mode 100644
index 0000000..4489516
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tls-2_c.C
@@ -0,0 +1,11 @@
+// PR c++/120363
+// { dg-module-do link }
+// { dg-require-effective-target tls_runtime }
+// { dg-add-options tls }
+// { dg-additional-options "-fmodules" }
+
+import M;
+
+int main() {
+ auto& instance = test::get_instance();
+}
diff --git a/gcc/testsuite/g++.dg/modules/tls-3.h b/gcc/testsuite/g++.dg/modules/tls-3.h
new file mode 100644
index 0000000..6f4a236
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tls-3.h
@@ -0,0 +1,42 @@
+inline thread_local int tla;
+inline int& get_tla() {
+ return tla;
+}
+
+static thread_local int tlb;
+static int& get_tlb() {
+ return tlb;
+}
+
+struct test {
+ static const test& get_instance() {
+ return instance;
+ }
+ static thread_local test instance;
+};
+
+template <typename T>
+struct test_template {
+ static const test_template& get_instance() {
+ return instance;
+ }
+ static thread_local test_template instance;
+
+ template <typename U>
+ static const test_template& get_template_instance() {
+ return template_instance<U>;
+ }
+
+ template <typename U>
+ static thread_local test_template template_instance;
+};
+
+template <typename T>
+thread_local test_template<T> test_template<T>::instance;
+
+template <typename T>
+template <typename U>
+thread_local test_template<T> test_template<T>::template_instance;
+
+template struct test_template<int>;
+template const test_template<int>& test_template<int>::get_template_instance<int>();
diff --git a/gcc/testsuite/g++.dg/modules/tls-3_a.H b/gcc/testsuite/g++.dg/modules/tls-3_a.H
new file mode 100644
index 0000000..beef907
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tls-3_a.H
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+#include "tls-3.h"
diff --git a/gcc/testsuite/g++.dg/modules/tls-3_b.C b/gcc/testsuite/g++.dg/modules/tls-3_b.C
new file mode 100644
index 0000000..ab77b1e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/tls-3_b.C
@@ -0,0 +1,4 @@
+// { dg-additional-options "-fmodules -fno-module-lazy" }
+
+#include "tls-3.h"
+import "tls-3_a.H";
diff --git a/gcc/testsuite/g++.dg/modules/using-31_a.C b/gcc/testsuite/g++.dg/modules/using-31_a.C
new file mode 100644
index 0000000..75bd872
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/using-31_a.C
@@ -0,0 +1,18 @@
+// PR c++/120414
+// { dg-additional-options "-fmodules" }
+// { dg-module-cmi m }
+
+export module m;
+
+template <int n>
+struct Base {
+ static constexpr int base_static_mbr_n = n;
+};
+
+template <int n>
+struct Derived : Base<n> {
+ using Base<n>::base_static_mbr_n;
+ static constexpr int go(int x = base_static_mbr_n) { return x; }
+};
+
+template struct Derived<1>;
diff --git a/gcc/testsuite/g++.dg/modules/using-31_b.C b/gcc/testsuite/g++.dg/modules/using-31_b.C
new file mode 100644
index 0000000..e913a77
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/using-31_b.C
@@ -0,0 +1,5 @@
+// PR c++/120414
+// { dg-additional-options "-fmodules" }
+
+module m;
+static_assert(Derived<1>::go() == 1);
diff --git a/gcc/testsuite/g++.dg/template/unify13.C b/gcc/testsuite/g++.dg/template/unify13.C
new file mode 100644
index 0000000..ec7ca9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/unify13.C
@@ -0,0 +1,18 @@
+// PR c++/120161
+
+template<class T, class U>
+struct mp_list { };
+
+template<class T>
+struct Wrap { struct type { }; };
+
+struct A : mp_list<Wrap<int>::type, void>
+ , mp_list<Wrap<long>::type, void> { };
+
+template<class U>
+void f(mp_list<Wrap<int>::type, U>*);
+
+int main() {
+ A a;
+ f(&a);
+}
diff --git a/gcc/testsuite/gcc.dg/bitint-123.c b/gcc/testsuite/gcc.dg/bitint-123.c
new file mode 100644
index 0000000..4d019a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-123.c
@@ -0,0 +1,26 @@
+/* PR middle-end/120547 */
+/* { dg-do run { target bitint } } */
+/* { dg-options "-O2" } */
+/* { dg-add-options float64 } */
+/* { dg-require-effective-target float64 } */
+
+#define CHECK(x, y) \
+ if ((_Float64) x != (_Float64) y \
+ || (_Float64) (x + 1) != (_Float64) (y + 1)) \
+ __builtin_abort ()
+
+int
+main ()
+{
+ unsigned long long a = 0x20000000000001ULL << 7;
+ volatile unsigned long long b = a;
+ CHECK (a, b);
+#if __BITINT_MAXWIDTH__ >= 4096
+ unsigned _BitInt(4096) c = ((unsigned _BitInt(4096)) 0x20000000000001ULL) << 253;
+ volatile unsigned _BitInt(4096) d = c;
+ CHECK (c, d);
+ unsigned _BitInt(4096) e = ((unsigned _BitInt(4096)) 0x20000000000001ULL) << 931;
+ volatile unsigned _BitInt(4096) f = e;
+ CHECK (e, f);
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-1.c b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c
new file mode 100644
index 0000000..f9fee3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120044-1.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting -fno-inline" } */
+
+struct a {
+ int b;
+} const c;
+void d(char p, struct a e) {
+ while (e.b)
+ ;
+}
+static unsigned short f(const struct a g) {
+ d(g.b, g);
+ return g.b;
+}
+int main() {
+ return f(c);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr120044-2.c b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c
new file mode 100644
index 0000000..5130791
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120044-2.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-early-inlining -fno-tree-fre -fno-tree-pre -fno-code-hoisting -fno-ipa-cp" } */
+
+struct a {
+ int b;
+} const c;
+void d(char p, struct a e) {
+ while (e.b)
+ ;
+}
+static unsigned short f(const struct a g) {
+ d(g.b, g);
+ return g.b;
+}
+int main() {
+ return f(c);
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr120295.c b/gcc/testsuite/gcc.dg/ipa/pr120295.c
new file mode 100644
index 0000000..2033ee9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr120295.c
@@ -0,0 +1,66 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+struct {
+ signed a;
+} b;
+int a, f, j, l;
+char c, k, g, e;
+short d[2] = {0};
+int *i = &j;
+
+volatile int glob;
+void __attribute__((noipa)) sth (const char *, int a)
+{
+ glob = a;
+ return;
+}
+
+void marker_37() {
+ a++;
+ sth ("%d\n", a);
+}
+unsigned long long m(unsigned, char, unsigned, short);
+int n(int, unsigned char, long long);
+int o(long long, unsigned, unsigned);
+unsigned short p(void) {
+ int *r = &l;
+ *r |= ({
+ long long y = (m(c, c, 0, c), b.a);
+ y;
+ });
+ return 0;
+}
+unsigned long long m(unsigned q, char v, unsigned s, short u) {
+ unsigned short ab = 5;
+ if (n(q, ab, d[1]))
+ for (; g; g++)
+ ;
+ return c;
+}
+int n(int af, unsigned char e, long long ae) {
+ unsigned ag = 4;
+ int *ah = &f;
+ *ah = ({ short ad = o(af, f, ag); ad<0 || ad> e; });
+ return *i;
+}
+int o(long long aj, unsigned ai, unsigned ak) {
+ for (; e; e--) {
+ int *al = &f;
+ for (; k; k++)
+ *al = 0;
+ }
+ if (18446744073709551606UL != (unsigned long long) aj)
+ ;
+ else
+ marker_37();
+ return ak;
+}
+int f123() {
+ c = 0xf6;
+ p();
+ return 0;
+}
+int main() {
+ return f123();
+}
diff --git a/gcc/testsuite/gcc.dg/pr120480.c b/gcc/testsuite/gcc.dg/pr120480.c
new file mode 100644
index 0000000..cf7b47a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120480.c
@@ -0,0 +1,11 @@
+/* PR target/120480 */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+struct S { int a, b, c; } s;
+
+void
+foo (void)
+{
+ struct S t = s;
+}
diff --git a/gcc/testsuite/gcc.dg/pr120638.c b/gcc/testsuite/gcc.dg/pr120638.c
new file mode 100644
index 0000000..4a057a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120638.c
@@ -0,0 +1,31 @@
+/* PR tree-optimization/120638 */
+/* { dg-do run } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern float sqrtf (float x);
+
+__attribute__((noipa)) float
+foo (unsigned int s)
+{
+ return 0.5f / sqrtf (1.f + s);
+}
+
+__attribute__((noipa)) float
+bar (float s)
+{
+ if (s < 0.0 || s > 65535.0f)
+ __builtin_unreachable ();
+ return 0.5f / sqrtf (1.f + s);
+}
+
+int
+main ()
+{
+ if (__builtin_fabsf (foo (3) - 0.25f) > 0.00390625f
+ || __builtin_fabsf (foo (15) - 0.125f) > 0.00390625f
+ || __builtin_fabsf (foo (63) - 0.0625f) > 0.00390625f
+ || __builtin_fabsf (bar (3.0f) - 0.25f) > 0.00390625f
+ || __builtin_fabsf (bar (15.0f) - 0.125f) > 0.00390625f
+ || __builtin_fabsf (bar (63.0f) - 0.0625f) > 0.00390625f)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr117811.c b/gcc/testsuite/gcc.dg/torture/pr117811.c
index 13d7e13..05e8622 100644
--- a/gcc/testsuite/gcc.dg/torture/pr117811.c
+++ b/gcc/testsuite/gcc.dg/torture/pr117811.c
@@ -18,8 +18,13 @@ void __attribute__((noclone,noinline)) do_shift (v4 *vec, int shift)
int main ()
{
+#if __SIZEOF_INT__ >= 4
v4 vec = {0x1000000, 0x2000, 0x300, 0x40};
v4 vec2 = {0x100000, 0x200, 0x30, 0x4};
+#else
+ v4 vec = {0x4000, 0x2000, 0x300, 0x40};
+ v4 vec2 = {0x400, 0x200, 0x30, 0x4};
+#endif
do_shift (&vec, 4);
if (memcmp (&vec, &vec2, sizeof (v4)) != 0)
__builtin_abort ();
diff --git a/gcc/testsuite/gcc.dg/torture/pr120182.c b/gcc/testsuite/gcc.dg/torture/pr120182.c
new file mode 100644
index 0000000..5e2d171
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120182.c
@@ -0,0 +1,42 @@
+/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && mmap } } } */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+struct S
+{
+ struct S *next;
+};
+
+static void __attribute__((noipa))
+allocate(void *addr, unsigned long long size)
+{
+ void *ptr = mmap((void *)addr, size,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE,
+ -1, 0);
+ if(ptr != addr)
+ exit(0);
+}
+
+int main (void)
+{
+ int size = 0x8000;
+ char *ptr = (char *)0x288000ull;
+ allocate((void *)ptr, size);
+
+ struct S *s1 = (struct S *)ptr;
+ struct S *s2 = (struct S *)256;
+ for (int i = 0; i < 3; i++)
+ {
+ for(char *addr = (char *)s1; addr < (char *)s1 + sizeof(*s1); ++addr)
+ *addr = 0;
+
+ if(s1->next)
+ s1->next = s1->next->next = s2;
+ else
+ s1->next = s2;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120341-1.c b/gcc/testsuite/gcc.dg/torture/pr120341-1.c
new file mode 100644
index 0000000..e23185b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120341-1.c
@@ -0,0 +1,11 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fallow-store-data-races" } */
+
+char a, *b;
+int main()
+{
+ b = "0";
+ if (a)
+ b[0]++;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr120341-2.c b/gcc/testsuite/gcc.dg/torture/pr120341-2.c
new file mode 100644
index 0000000..7bcc96f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr120341-2.c
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fallow-store-data-races" } */
+
+char a, *b;
+int main()
+{
+ while (a)
+ {
+ b = "0";
+ b[0]++;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
new file mode 100644
index 0000000..cd9b94c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr114864.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-tree-dce -fno-tree-fre" } */
+
+struct a {
+ int b;
+} const c;
+void d(const struct a f) {}
+void e(const struct a f) {
+ f.b == 0 ? 1 : f.b;
+ d(f);
+}
+int main() {
+ e(c);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index d84acee..59891f2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -11,7 +11,7 @@
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" { target { ! aarch64*-*-* } } } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 10" "thread2" { target { ! aarch64*-*-* } } } } */
/* { dg-final { scan-tree-dump "Jumps threaded: 17" "thread2" { target { aarch64*-*-* } } } } */
enum STATE {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c
new file mode 100644
index 0000000..930360a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-23.c
@@ -0,0 +1,19 @@
+/* PR120003 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-cddce3-details" } */
+
+extern _Bool g(int);
+
+_Bool f()
+{
+ _Bool retval = 0;
+ for(int i=0; i<1000000; ++i)
+ retval = retval || g(i);
+ return retval;
+}
+
+/* Jump threading after loop optimization should get the counting loop
+ separated from the loop until retval is true and CD-DCE elide it.
+ It's difficult to check for the fact that a true retval terminates
+ the loop so check CD-DCE eliminates one loop instead. */
+/* { dg-final { scan-tree-dump "fix_loop_structure: removing loop" "cddce3" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c
new file mode 100644
index 0000000..955fc7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double foo (double *dst, double *src, int b)
+{
+ double y = src[1];
+ if (b)
+ {
+ dst[0] = src[0];
+ dst[1] = y;
+ }
+ return y;
+}
+
+/* { dg-final { scan-tree-dump "optimized: basic block part vectorized" "slp2" { target vect_double } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c
new file mode 100644
index 0000000..8a51cfc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_136-pr120357.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-add-options vect_early_break } */
+/* { dg-additional-options "-O3" } */
+
+char a;
+unsigned long long t[2][22];
+int u[22];
+void f(void)
+{
+ for (int v = 0; v < 22; v++)
+ for (_Bool w = 0; w < (u[v] < 0) + 1; w = 1)
+ a *= 0 != t[w][v];
+}
diff --git a/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c
new file mode 100644
index 0000000..631d14f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } } */
+
+typedef unsigned int __attribute__ ((mode (DI))) int64_t;
+typedef unsigned int __attribute__ ((mode (SI))) int32_t;
+
+typedef union
+ {
+ int32_t l[8];
+ }
+val;
+
+typedef struct
+ {
+ int32_t l[2];
+ val v;
+ }
+tre;
+
+typedef struct
+ {
+ int32_t l[3];
+ tre t;
+ }
+due;
+
+typedef struct
+ {
+ val v;
+ int64_t q;
+ int32_t l[2];
+ due d;
+ }
+uno;
+
+void
+memcpy_nested_offset_long (uno *u)
+{
+ u->d.t.v = u->v;
+}
+
+/* Expect assembly such as:
+
+ ldq $4,0($16)
+ ldq $3,8($16)
+ ldq $2,16($16)
+ srl $4,32,$7
+ ldq $1,24($16)
+ srl $3,32,$6
+ stl $4,68($16)
+ srl $2,32,$5
+ stl $7,72($16)
+ srl $1,32,$4
+ stl $3,76($16)
+ stl $6,80($16)
+ stl $2,84($16)
+ stl $5,88($16)
+ stl $1,92($16)
+ stl $4,96($16)
+
+ that is with four quadword loads at offsets 0, 8, 16, 24 each and
+ eight longword stores at offsets 68, 72, 76, 80, 84, 88, 92, 96 each. */
+
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,0\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,8\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,16\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,24\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,68\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,72\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,76\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,80\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,84\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,88\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,92\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstl\\s\\\$\[0-9\]+,96\\\(\\\$16\\\)\\s" 1 } } */
diff --git a/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c
new file mode 100644
index 0000000..1d2227e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c
@@ -0,0 +1,64 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } } */
+
+typedef unsigned int __attribute__ ((mode (DI))) int64_t;
+typedef unsigned int __attribute__ ((mode (SI))) int32_t;
+
+typedef union
+ {
+ int32_t l[8];
+ }
+val;
+
+typedef struct
+ {
+ int32_t l[2];
+ val v;
+ }
+tre;
+
+typedef struct
+ {
+ int32_t l[3];
+ tre t;
+ }
+due;
+
+typedef struct
+ {
+ val v;
+ int64_t q;
+ int32_t l[3];
+ due d;
+ }
+uno;
+
+void
+memcpy_nested_offset_quad (uno *u)
+{
+ u->d.t.v = u->v;
+}
+
+/* Expect assembly such as:
+
+ ldq $4,0($16)
+ ldq $3,8($16)
+ ldq $2,16($16)
+ ldq $1,24($16)
+ stq $4,72($16)
+ stq $3,80($16)
+ stq $2,88($16)
+ stq $1,96($16)
+
+ that is with four quadword loads at offsets 0, 8, 16, 24 each
+ and four quadword stores at offsets 72, 80, 88, 96 each. */
+
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,0\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,8\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,16\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sldq\\s\\\$\[0-9\]+,24\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,72\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,80\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,88\\\(\\\$16\\\)\\s" 1 } } */
+/* { dg-final { scan-assembler-times "\\sstq\\s\\\$\[0-9\]+,96\\\(\\\$16\\\)\\s" 1 } } */
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr120423-1.c b/gcc/testsuite/gcc.target/avr/torture/pr120423-1.c
new file mode 100644
index 0000000..91b4bbc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr120423-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+
+struct data
+{
+ int a;
+ int b;
+ long c;
+};
+
+unsigned char val;
+unsigned val2;
+
+void func1 (struct data *d)
+{
+ d->a = 0;
+ d->b = 0x100 * val - 1;
+}
+
+void func2 (struct data *d)
+{
+ d->a = 0;
+ d->c = 0x10000 * val2 - 1;
+}
+
+void func3 (struct data *d)
+{
+ d->a = 0;
+ d->c = 0x1000000 * val - 1;
+}
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr120423-116389.c b/gcc/testsuite/gcc.target/avr/torture/pr120423-116389.c
new file mode 100644
index 0000000..928c135
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr120423-116389.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+struct T { int val; };
+
+void f_int (int);
+char* get_pos (void);
+struct T* get_pT (void);
+
+void func (char i)
+{
+ struct T t = * get_pT ();
+ unsigned diff = get_pos () - &i;
+
+ if (diff)
+ {
+ long val32 = t.val;
+ if (get_pos ())
+ val32 = diff;
+ if (get_pos ())
+ f_int (2 * val32);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/avr/torture/pr120423-2.c b/gcc/testsuite/gcc.target/avr/torture/pr120423-2.c
new file mode 100644
index 0000000..56e6141
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/torture/pr120423-2.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffixed-18 -ffixed-20 -ffixed-22" } */
+
+struct data
+{
+ int a;
+ int b;
+ long c;
+};
+
+unsigned char val;
+unsigned val2;
+
+void func1 (struct data *d)
+{
+ d->a = 0;
+ d->b = 0x100 * val - 1;
+}
+
+void func2 (struct data *d)
+{
+ d->a = 0;
+ d->c = 0x10000 * val2 - 1;
+}
+
+void func3 (struct data *d)
+{
+ d->a = 0;
+ d->c = 0x1000000 * val - 1;
+}
diff --git a/gcc/testsuite/gcc.target/i386/vect-epilogues-1.c b/gcc/testsuite/gcc.target/i386/vect-epilogues-1.c
new file mode 100644
index 0000000..a7f5f12
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-epilogues-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2 -mno-avx512f -mtune=generic -fdump-tree-vect-optimized" } */
+
+int test (signed char *data, int n)
+{
+ int sum = 0;
+ for (int i = 0; i < n; ++i)
+ sum += data[i];
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump "loop vectorized using 32 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 8 byte vectors" "vect" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-epilogues-2.c b/gcc/testsuite/gcc.target/i386/vect-epilogues-2.c
new file mode 100644
index 0000000..d6c06ed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-epilogues-2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512bw -mtune=generic -fdump-tree-vect-optimized" } */
+
+int test (signed char *data, int n)
+{
+ int sum = 0;
+ for (int i = 0; i < n; ++i)
+ sum += data[i];
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump "loop vectorized using 64 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 32 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump-not "loop vectorized using 16 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump-not "loop vectorized using 8 byte vectors" "vect" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-epilogues-3.c b/gcc/testsuite/gcc.target/i386/vect-epilogues-3.c
new file mode 100644
index 0000000..0ee610f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-epilogues-3.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512bw -mtune=znver4 -fdump-tree-vect-optimized" } */
+
+int test (signed char *data, int n)
+{
+ int sum = 0;
+ for (int i = 0; i < n; ++i)
+ sum += data[i];
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump "loop vectorized using 64 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 32 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors" "vect" } } */
+/* { dg-final { scan-tree-dump "loop vectorized using 8 byte vectors" "vect" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-epilogues-4.c b/gcc/testsuite/gcc.target/i386/vect-epilogues-4.c
new file mode 100644
index 0000000..498db6b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-epilogues-4.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512bw -mtune=generic --param vect-partial-vector-usage=1 -fdump-tree-vect-optimized" } */
+
+int test (signed char *data, int n)
+{
+ int sum = 0;
+ for (int i = 0; i < n; ++i)
+ sum += data[i];
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump-times "loop vectorized using 64 byte vectors" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-not "loop vectorized using 32 byte vectors" "vect" } } */
diff --git a/gcc/testsuite/gcc.target/i386/vect-epilogues-5.c b/gcc/testsuite/gcc.target/i386/vect-epilogues-5.c
new file mode 100644
index 0000000..6772cab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vect-epilogues-5.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx512bw -mtune=znver4 --param vect-partial-vector-usage=1 -fdump-tree-vect-optimized" } */
+
+int test (signed char *data, int n)
+{
+ int sum = 0;
+ for (int i = 0; i < n; ++i)
+ sum += data[i];
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump-times "loop vectorized using 64 byte vectors" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-not "loop vectorized using 32 byte vectors" "vect" } } */
diff --git a/gcc/testsuite/gcc.target/nvptx/abi-struct-arg.c b/gcc/testsuite/gcc.target/nvptx/abi-struct-arg.c
index 54ae651..c2cc4de 100644
--- a/gcc/testsuite/gcc.target/nvptx/abi-struct-arg.c
+++ b/gcc/testsuite/gcc.target/nvptx/abi-struct-arg.c
@@ -3,12 +3,16 @@
/* Struct arg. Passed via pointer. */
+typedef struct {} empty; /* See 'gcc/doc/extend.texi', "Empty Structures". */
typedef struct {char a;} one;
typedef struct {short a;} two;
typedef struct {int a;} four;
typedef struct {long long a;} eight;
typedef struct {int a, b[12];} big;
+/* { dg-final { scan-assembler-times ".extern .func dcl_aempty \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
+void dcl_aempty (empty);
+
/* { dg-final { scan-assembler-times ".extern .func dcl_aone \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
void dcl_aone (one);
@@ -28,6 +32,7 @@ void dcl_abig (big);
void test_1 (void)
{
+ dcl_aempty (({empty t; t;}));
dcl_aone (M (one, 1));
dcl_atwo (M (two, 2));
dcl_afour (M (four, 3));
@@ -35,6 +40,11 @@ void test_1 (void)
dcl_abig (M (big, 5));
}
+/* { dg-final { scan-assembler-times ".visible .func dfn_aempty \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
+void dfn_aempty (empty empty)
+{
+}
+
/* { dg-final { scan-assembler-times ".visible .func dfn_aone \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
void dfn_aone (one one)
{
diff --git a/gcc/testsuite/gcc.target/nvptx/abi-struct-ret.c b/gcc/testsuite/gcc.target/nvptx/abi-struct-ret.c
index d48a82d..13e5021 100644
--- a/gcc/testsuite/gcc.target/nvptx/abi-struct-ret.c
+++ b/gcc/testsuite/gcc.target/nvptx/abi-struct-ret.c
@@ -3,12 +3,16 @@
/* Struct return. Returned via pointer. */
+typedef struct {} empty; /* See 'gcc/doc/extend.texi', "Empty Structures". */
typedef struct {char a;} one;
typedef struct {short a;} two;
typedef struct {int a;} four;
typedef struct {long long a;} eight;
typedef struct {int a, b[12];} big;
+/* { dg-final { scan-assembler-times ".extern .func dcl_rempty \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
+empty dcl_rempty (void);
+
/* { dg-final { scan-assembler-times ".extern .func dcl_rone \\(.param.u64 %\[_a-z0-9\]*\\);" 1 } } */
one dcl_rone (void);
@@ -26,6 +30,7 @@ big dcl_rbig (void);
void test_1 (void)
{
+ dcl_rempty ();
dcl_rone ();
dcl_rtwo ();
dcl_rfour ();
@@ -35,6 +40,12 @@ void test_1 (void)
#define M(T, v) ({T t; t.a = v; t;})
+/* { dg-final { scan-assembler-times ".visible .func dfn_rempty \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
+empty dfn_rempty (void)
+{
+ return ({empty t; t;});
+}
+
/* { dg-final { scan-assembler-times ".visible .func dfn_rone \\(.param.u64 %\[_a-z0-9\]*\\)(?:;|\[\r\n\]+\{)" 2 } } */
one dfn_rone (void)
{
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90
index 2af089e..d0751f3 100644
--- a/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_auto_array_3.f90
@@ -25,6 +25,6 @@ contains
allocate (array(1)%bigarr)
end function
end
-! { dg-final { scan-tree-dump-times "builtin_malloc" 3 "original" } }
+! { dg-final { scan-tree-dump-times "builtin_malloc" 4 "original" } }
! { dg-final { scan-tree-dump-times "builtin_free" 3 "original" } }
-! { dg-final { scan-tree-dump-times "while \\(1\\)" 4 "original" } }
+! { dg-final { scan-tree-dump-times "while \\(1\\)" 5 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03
index 0753e33..8202d78 100644
--- a/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_class_3.f03
@@ -45,11 +45,10 @@ contains
type(c), value :: d
end subroutine
- type(c) function c_init() ! { dg-warning "not set" }
+ type(c) function c_init()
end function
subroutine sub(d)
type(u), value :: d
end subroutine
end program test_pr58586
-
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03 b/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03
index 4a55d73..9ff38e3 100644
--- a/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_class_4.f03
@@ -51,14 +51,14 @@ contains
type(t), value :: d
end subroutine
- type(c) function c_init() ! { dg-warning "not set" }
+ type(c) function c_init()
end function
class(c) function c_init2() ! { dg-warning "not set" }
allocatable :: c_init2
end function
- type(c) function d_init(this) ! { dg-warning "not set" }
+ type(c) function d_init(this)
class(d) :: this
end function
@@ -102,4 +102,3 @@ program test_pr58586
call add_c(oe%init())
deallocate(oe)
end program
-
diff --git a/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03 b/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03
index fd2db74..36c1245 100644
--- a/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03
+++ b/gcc/testsuite/gfortran.dg/allocate_with_source_14.f03
@@ -210,5 +210,5 @@ program main
call v%free()
deallocate(av)
end program
-! { dg-final { scan-tree-dump-times "__builtin_malloc" 22 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_malloc" 23 "original" } }
! { dg-final { scan-tree-dump-times "__builtin_free" 29 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90 b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
index 23ca88b..bc2206d 100644
--- a/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
+++ b/gcc/testsuite/gfortran.dg/c_f_pointer_tests_6.f90
@@ -38,6 +38,6 @@ contains
type(my_c_ptr_0) :: my_ptr2
type(c_funptr) :: myfun
print *,c_associated(my_ptr,my_ptr2)
- print *,c_associated(my_ptr,myfun) ! { dg-error "Argument C_PTR_2 at .1. to C_ASSOCIATED shall have the same type as C_PTR_1: TYPE.c_ptr. instead of TYPE.c_funptr." }
+ print *,c_associated(my_ptr,myfun) ! { dg-error "Argument C_PTR_2 at .1. to C_ASSOCIATED shall have the same type as C_PTR_1, found TYPE.c_funptr. instead of TYPE.c_ptr." }
end subroutine
end
diff --git a/gcc/testsuite/gfortran.dg/coarray_data_2.f90 b/gcc/testsuite/gfortran.dg/coarray_data_2.f90
new file mode 100644
index 0000000..bda57f3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_data_2.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! { dg-additional-options "-fcoarray=lib -Warray-temporaries" }
+!
+! PR fortran/99838 - ICE due to missing locus with data statement for coarray
+!
+! Contributed by Gerhard Steinmetz
+
+program p
+ type t
+ integer :: a
+ end type
+ type(t) :: x(3)[*]
+ data x%a /1, 2, 3/ ! { dg-warning "Creating array temporary" }
+end
diff --git a/gcc/testsuite/gfortran.dg/comma_format_extension_1.f b/gcc/testsuite/gfortran.dg/comma_format_extension_1.f
index a3a5a98..c4b43f0 100644
--- a/gcc/testsuite/gfortran.dg/comma_format_extension_1.f
+++ b/gcc/testsuite/gfortran.dg/comma_format_extension_1.f
@@ -1,5 +1,5 @@
! { dg-do compile }
-! { dg-options "" }
+! { dg-options "-std=legacy" }
! test that the extension for a missing comma is accepted
subroutine mysub
diff --git a/gcc/testsuite/gfortran.dg/comma_format_extension_3.f b/gcc/testsuite/gfortran.dg/comma_format_extension_3.f
index 0b00224..9d974d6 100644
--- a/gcc/testsuite/gfortran.dg/comma_format_extension_3.f
+++ b/gcc/testsuite/gfortran.dg/comma_format_extension_3.f
@@ -3,7 +3,7 @@
! did do the correct thing at runtime.
! Note the missing , before i1 in the format.
! { dg-do run }
-! { dg-options "" }
+! { dg-options "-std=legacy" }
character*12 c
write (c,100) 0, 1
diff --git a/gcc/testsuite/gfortran.dg/continuation_13.f90 b/gcc/testsuite/gfortran.dg/continuation_13.f90
index 9799b59e..475c896 100644
--- a/gcc/testsuite/gfortran.dg/continuation_13.f90
+++ b/gcc/testsuite/gfortran.dg/continuation_13.f90
@@ -1,5 +1,5 @@
! { dg-do run }
-! { dg-options "-std=gnu" }
+! { dg-options "-std=legacy" }
! PR64506
character(25) :: astring
diff --git a/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90 b/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90
index bdfa47b..406e031 100644
--- a/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90
+++ b/gcc/testsuite/gfortran.dg/derived_constructor_comps_6.f90
@@ -129,5 +129,5 @@ contains
prt_spec = name
end function new_prt_spec3
end program main
-! { dg-final { scan-tree-dump-times "__builtin_malloc" 15 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_malloc" 16 "original" } }
! { dg-final { scan-tree-dump-times "__builtin_free" 33 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/derived_result_5.f90 b/gcc/testsuite/gfortran.dg/derived_result_5.f90
new file mode 100644
index 0000000..1ba4d19
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/derived_result_5.f90
@@ -0,0 +1,123 @@
+! { dg-do run }
+! { dg-additional-options "-O2 -Wreturn-type" }
+!
+! PR fortran/85750 - default-initialization and functions returning derived type
+
+module bar
+ implicit none
+ type ilist
+ integer :: count = 42
+ integer, pointer :: ptr(:) => null()
+ end type ilist
+
+ type jlist
+ real, allocatable :: a(:)
+ integer :: count = 23
+ end type jlist
+
+contains
+
+ function make_list(i)
+ integer, intent(in) :: i
+ type(ilist), dimension(2) :: make_list
+ make_list(i)%count = i
+ end function make_list
+
+ function make_list_res(i) result(list)
+ integer, intent(in) :: i
+ type(ilist), dimension(2) :: list
+ list(i)%count = i
+ end function make_list_res
+
+ function make_jlist(i)
+ integer, intent(in) :: i
+ type(jlist), dimension(2) :: make_jlist
+ make_jlist(i)%count = i
+ end function make_jlist
+
+ function make_jlist_res(i) result(list)
+ integer, intent(in) :: i
+ type(jlist), dimension(2) :: list
+ list(i)%count = i
+ end function make_jlist_res
+
+ function empty_ilist()
+ type(ilist), dimension(2) :: empty_ilist
+ end function
+
+ function empty_jlist()
+ type(jlist), dimension(2) :: empty_jlist
+ end function
+
+ function empty_ilist_res() result (res)
+ type(ilist), dimension(2) :: res
+ end function
+
+ function empty_jlist_res() result (res)
+ type(jlist), dimension(2) :: res
+ end function
+
+end module bar
+
+program foo
+ use bar
+ implicit none
+ type(ilist) :: mylist(2) = ilist(count=-2)
+ type(jlist), allocatable :: yourlist(:)
+
+ mylist = ilist(count=-1)
+ if (any (mylist%count /= [-1,-1])) stop 1
+ mylist = empty_ilist()
+ if (any (mylist%count /= [42,42])) stop 2
+ mylist = ilist(count=-1)
+ mylist = empty_ilist_res()
+ if (any (mylist%count /= [42,42])) stop 3
+
+ allocate(yourlist(1:2))
+ if (any (yourlist%count /= [23,23])) stop 4
+ yourlist = jlist(count=-1)
+ if (any (yourlist%count /= [-1,-1])) stop 5
+ yourlist = empty_jlist()
+ if (any (yourlist%count /= [23,23])) stop 6
+ yourlist = jlist(count=-1)
+ yourlist = empty_jlist_res()
+ if (any (yourlist%count /= [23,23])) stop 7
+
+ mylist = make_list(1)
+ if (any (mylist%count /= [1,42])) stop 11
+ mylist = make_list(2)
+ if (any (mylist%count /= [42,2])) stop 12
+ mylist = (make_list(1))
+ if (any (mylist%count /= [1,42])) stop 13
+ mylist = [make_list(2)]
+ if (any (mylist%count /= [42,2])) stop 14
+
+ mylist = make_list_res(1)
+ if (any (mylist%count /= [1,42])) stop 21
+ mylist = make_list_res(2)
+ if (any (mylist%count /= [42,2])) stop 22
+ mylist = (make_list_res(1))
+ if (any (mylist%count /= [1,42])) stop 23
+ mylist = [make_list_res(2)]
+ if (any (mylist%count /= [42,2])) stop 24
+
+ yourlist = make_jlist(1)
+ if (any (yourlist%count /= [1,23])) stop 31
+ yourlist = make_jlist(2)
+ if (any (yourlist%count /= [23,2])) stop 32
+ yourlist = (make_jlist(1))
+ if (any (yourlist%count /= [1,23])) stop 33
+ yourlist = [make_jlist(2)]
+ if (any (yourlist%count /= [23,2])) stop 34
+
+ yourlist = make_jlist_res(1)
+ if (any (yourlist%count /= [1,23])) stop 41
+ yourlist = make_jlist_res(2)
+ if (any (yourlist%count /= [23,2])) stop 42
+ yourlist = (make_jlist_res(1))
+ if (any (yourlist%count /= [1,23])) stop 43
+ yourlist = [make_jlist_res(2)]
+ if (any (yourlist%count /= [23,2])) stop 44
+
+ deallocate (yourlist)
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90 b/gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90
new file mode 100644
index 0000000..18613d4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device-2.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! { dg-additional-options "-O1 -fdump-tree-optimized -fno-builtin-omp_get_num_devices -fno-builtin-omp_get_initial_device" }
+integer function f() result(ret)
+ interface
+ integer function omp_get_initial_device (); end
+ integer function omp_get_num_devices (); end
+ end interface
+
+ if (omp_get_initial_device () /= omp_get_num_devices ()) error stop
+
+ if (omp_get_num_devices () /= omp_get_num_devices ()) error stop
+
+ if (omp_get_initial_device () /= omp_get_initial_device ()) error stop
+
+ ret = omp_get_num_devices ()
+end
+
+! { dg-final { scan-tree-dump-times "error_stop" 3 "optimized" } }
+
+! { dg-final { scan-tree-dump-times "omp_get_num_devices" 4 "optimized" } }
+! { dg-final { scan-tree-dump-times "omp_get_initial_device" 3 "optimized" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device.f90 b/gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device.f90
new file mode 100644
index 0000000..279656b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/omp_get_num_devices_initial_device.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-additional-options "-O1 -fdump-tree-optimized" }
+integer function f() result(ret)
+ interface
+ integer function omp_get_initial_device (); end
+ integer function omp_get_num_devices (); end
+ end interface
+
+ if (omp_get_initial_device () /= omp_get_num_devices ()) error stop
+
+ if (omp_get_num_devices () /= omp_get_num_devices ()) error stop
+
+ if (omp_get_initial_device () /= omp_get_initial_device ()) error stop
+
+ ret = omp_get_num_devices ()
+end
+
+! { dg-final { scan-tree-dump-not "error_stop" "optimized" } }
+
+! { dg-final { scan-tree-dump-not "omp_get_num_devices" "optimized" { target { ! offloading_enabled } } } }
+! { dg-final { scan-tree-dump "return 0;" "optimized" { target { ! offloading_enabled } } } }
+
+! { dg-final { scan-tree-dump-times "omp_get_num_devices" 1 "optimized" { target offloading_enabled } } }
+! { dg-final { scan-tree-dump "_1 = __builtin_omp_get_num_devices \\(\\);\[\\r\\n\]+\[ \]+return _1;" "optimized" { target offloading_enabled } } }
diff --git a/gcc/testsuite/gfortran.dg/guality/pr120193.f90 b/gcc/testsuite/gfortran.dg/guality/pr120193.f90
new file mode 100644
index 0000000..e65febf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/guality/pr120193.f90
@@ -0,0 +1,26 @@
+! PR fortran/120193
+! { dg-do run }
+! { dg-options "-g -funsigned" }
+! { dg-skip-if "" { *-*-* } { "*" } { "-O0" } }
+
+program foo
+ unsigned(kind=1) :: a(2), e
+ unsigned(kind=2) :: b(2), f
+ unsigned(kind=4) :: c(2), g
+ unsigned(kind=8) :: d(2), h
+ character(kind=1, len=1) :: i(2), j
+ character(kind=4, len=1) :: k(2), l
+ a = 97u_1 ! { dg-final { gdb-test 24 "a" "d" } }
+ b = 97u_2 ! { dg-final { gdb-test 24 "b" "c" } }
+ c = 97u_4 ! { dg-final { gdb-test 24 "c" "b" } }
+ d = 97u_8 ! { dg-final { gdb-test 24 "d" "a" } }
+ e = 97u_1 ! { dg-final { gdb-test 24 "e" "97" } }
+ f = 97u_2 ! { dg-final { gdb-test 24 "f" "97" } }
+ g = 97u_4 ! { dg-final { gdb-test 24 "g" "97" } }
+ h = 97u_8 ! { dg-final { gdb-test 24 "h" "97" } }
+ i = 'a' ! { dg-final { gdb-test 24 "i" "('a', 'a')" } }
+ j = 'b' ! { dg-final { gdb-test 24 "j" "'b'" } }
+ k = 'c'
+ l = 'd'
+ print *, a
+end program
diff --git a/gcc/testsuite/gfortran.dg/inquiry_type_ref_7.f90 b/gcc/testsuite/gfortran.dg/inquiry_type_ref_7.f90
new file mode 100644
index 0000000..534225a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inquiry_type_ref_7.f90
@@ -0,0 +1,62 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+!
+! PR fortran/101735 - substrings and parsing of type parameter inquiries
+
+program p
+ implicit none
+ integer, parameter :: ck = 4
+ character(len=5) :: str = ""
+ character(len=5) :: str2(4)
+ character(len=5,kind=ck) :: str4 = ck_""
+ type t
+ character(len=5) :: str(4)
+ end type t
+ type(t) :: var
+ integer :: x, y
+
+ integer, parameter :: i1 = kind (str(1:3))
+ integer, parameter :: j1 = str (1:3) % kind
+ integer, parameter :: k1 = (str(1:3) % kind)
+ integer, parameter :: kk = str (1:3) % kind % kind
+
+ integer, parameter :: i4 = kind (str4(1:3))
+ integer, parameter :: j4 = str4 (1:3) % kind
+ integer, parameter :: ll = str4 (1:3) % len
+
+ integer, parameter :: i2 = len (str(1:3))
+ integer, parameter :: j2 = str (1:3) % len
+ integer, parameter :: k2 = (str(1:3) % len)
+ integer, parameter :: lk = str (1:3) % len % kind
+
+ integer, parameter :: l4 = str2 (:) (2:3) % len
+ integer, parameter :: l5 = var % str (:) (2:4) % len
+ integer, parameter :: k4 = str2 (:) (2:3) % kind
+ integer, parameter :: k5 = var % str (:) (2:4) % kind
+ integer, parameter :: k6 = str2 (:) (2:3) % len % kind
+ integer, parameter :: k7 = var % str (:) (2:4) % len % kind
+
+ if (i1 /= 1) stop 1
+ if (j1 /= 1) stop 2
+ if (k1 /= 1) stop 3
+
+ if (i4 /= ck) stop 4
+ if (j4 /= ck) stop 5
+ if (ll /= 3) stop 6
+
+ if (kk /= 4) stop 7
+ if (lk /= 4) stop 8
+
+ if (i2 /= 3) stop 9
+ if (j2 /= 3) stop 10
+ if (k2 /= 3) stop 11
+
+ if (l4 /= 2) stop 12
+ if (l5 /= 3) stop 13
+ if (k4 /= 1) stop 14
+ if (k5 /= 1) stop 15
+ if (k6 /= 4) stop 16
+ if (k7 /= 4) stop 17
+end
+
+! { dg-final { scan-tree-dump-not "_gfortran_stop_numeric" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/inquiry_type_ref_8.f90 b/gcc/testsuite/gfortran.dg/inquiry_type_ref_8.f90
new file mode 100644
index 0000000..70ef621
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/inquiry_type_ref_8.f90
@@ -0,0 +1,214 @@
+! { dg-do compile }
+! { dg-additional-options "-O0 -fdump-tree-original -std=f2018" }
+!
+! PR fortran/102599 - type parameter inquiries and constant complex arrays
+! PR fortran/114022 - likewise
+!
+! Everything below shall be simplified at compile time.
+
+module mod
+ implicit none
+ public :: wp, c0, z0, y, test1
+ private
+
+ integer :: j
+ integer, parameter :: n = 5
+ integer, parameter :: wp = 8
+ type :: cx
+ real(wp) :: re
+ real(wp) :: im
+ end type cx
+ type(cx), parameter :: c0(*) = [(cx (j,-j), j=1,n)]
+ complex(wp), parameter :: z0(*) = [(cmplx(j,-j,wp),j=1,n)]
+
+ type :: my_type
+ complex(wp) :: z(n) = z0
+ type(cx) :: c(n) = c0
+ end type my_type
+ type(my_type), parameter :: y = my_type()
+
+contains
+
+ ! Check simplification for inquiries of host-associated variables
+ subroutine test1 ()
+ ! Inquiries and full arrays
+ real(wp), parameter :: r0(*) = real (z0)
+ real(wp), parameter :: i0(*) = aimag (z0)
+ real(wp), parameter :: r1(*) = c0 % re
+ real(wp), parameter :: i1(*) = c0 % im
+ real(wp), parameter :: r2(*) = z0 % re
+ real(wp), parameter :: i2(*) = z0 % im
+ real(wp), parameter :: r3(*) = y % c % re
+ real(wp), parameter :: i3(*) = y % c % im
+ real(wp), parameter :: r4(*) = y % z % re
+ real(wp), parameter :: i4(*) = y % z % im
+
+ logical, parameter :: l1 = all (r1 == r0)
+ logical, parameter :: l2 = all (i1 == i0)
+ logical, parameter :: l3 = all (r1 == r2)
+ logical, parameter :: l4 = all (i1 == i2)
+ logical, parameter :: l5 = all (r3 == r4)
+ logical, parameter :: l6 = all (i3 == i4)
+ logical, parameter :: l7 = all (r1 == r3)
+ logical, parameter :: l8 = all (i1 == i3)
+
+ ! Inquiries and array sections
+ real(wp), parameter :: p0(*) = real (z0(::2))
+ real(wp), parameter :: q0(*) = aimag (z0(::2))
+ real(wp), parameter :: p1(*) = c0(::2) % re
+ real(wp), parameter :: q1(*) = c0(::2) % im
+ real(wp), parameter :: p2(*) = z0(::2) % re
+ real(wp), parameter :: q2(*) = z0(::2) % im
+ real(wp), parameter :: p3(*) = y % c(::2) % re
+ real(wp), parameter :: q3(*) = y % c(::2) % im
+ real(wp), parameter :: p4(*) = y % z(::2) % re
+ real(wp), parameter :: q4(*) = y % z(::2) % im
+
+ logical, parameter :: m1 = all (p1 == p0)
+ logical, parameter :: m2 = all (q1 == q0)
+ logical, parameter :: m3 = all (p1 == p2)
+ logical, parameter :: m4 = all (q1 == q2)
+ logical, parameter :: m5 = all (p3 == p4)
+ logical, parameter :: m6 = all (q3 == q4)
+ logical, parameter :: m7 = all (p1 == p3)
+ logical, parameter :: m8 = all (q1 == q3)
+
+ ! Inquiries and vector subscripts
+ real(wp), parameter :: v0(*) = real (z0([3,2]))
+ real(wp), parameter :: w0(*) = aimag (z0([3,2]))
+ real(wp), parameter :: v1(*) = c0([3,2]) % re
+ real(wp), parameter :: w1(*) = c0([3,2]) % im
+ real(wp), parameter :: v2(*) = z0([3,2]) % re
+ real(wp), parameter :: w2(*) = z0([3,2]) % im
+ real(wp), parameter :: v3(*) = y % c([3,2]) % re
+ real(wp), parameter :: w3(*) = y % c([3,2]) % im
+ real(wp), parameter :: v4(*) = y % z([3,2]) % re
+ real(wp), parameter :: w4(*) = y % z([3,2]) % im
+
+ logical, parameter :: o1 = all (v1 == v0)
+ logical, parameter :: o2 = all (w1 == w0)
+ logical, parameter :: o3 = all (v1 == v2)
+ logical, parameter :: o4 = all (w1 == w2)
+ logical, parameter :: o5 = all (v3 == v4)
+ logical, parameter :: o6 = all (w3 == w4)
+ logical, parameter :: o7 = all (v1 == v3)
+ logical, parameter :: o8 = all (w1 == w3)
+
+ ! Miscellaneous
+ complex(wp), parameter :: x(-1:*) = cmplx (r1,i1,kind=wp)
+ real(x%re%kind), parameter :: r(*) = x % re
+ real(x%im%kind), parameter :: i(*) = x % im
+ real(x%re%kind), parameter :: s(*) = [ x(:) % re ]
+ real(x%im%kind), parameter :: t(*) = [ x(:) % im ]
+
+ integer, parameter :: kr = x % re % kind
+ integer, parameter :: ki = x % im % kind
+ integer, parameter :: kx = x % kind
+
+ if (kr /= wp .or. ki /= wp .or. kx /= wp) stop 1
+ if (any (r /= r1)) stop 2
+ if (any (i /= i1)) stop 3
+ if (any (s /= r1)) stop 4
+ if (any (t /= i1)) stop 5
+
+ if (.not. all ([l1,l2,l3,l4,l5,l6,l7,l8])) stop 6
+ if (.not. all ([m1,m2,m3,m4,m5,m6,m7,m8])) stop 7
+ if (.not. all ([o1,o2,o3,o4,o5,o6,o7,o8])) stop 8
+ end subroutine test1
+end
+
+program p
+ use mod, only: wp, c0, z0, y, test1
+ implicit none
+ call test1 ()
+ call test2 ()
+contains
+ ! Check simplification for inquiries of use-associated variables
+ subroutine test2 ()
+ ! Inquiries and full arrays
+ real(wp), parameter :: r0(*) = real (z0)
+ real(wp), parameter :: i0(*) = aimag (z0)
+ real(wp), parameter :: r1(*) = c0 % re
+ real(wp), parameter :: i1(*) = c0 % im
+ real(wp), parameter :: r2(*) = z0 % re
+ real(wp), parameter :: i2(*) = z0 % im
+ real(wp), parameter :: r3(*) = y % c % re
+ real(wp), parameter :: i3(*) = y % c % im
+ real(wp), parameter :: r4(*) = y % z % re
+ real(wp), parameter :: i4(*) = y % z % im
+
+ logical, parameter :: l1 = all (r1 == r0)
+ logical, parameter :: l2 = all (i1 == i0)
+ logical, parameter :: l3 = all (r1 == r2)
+ logical, parameter :: l4 = all (i1 == i2)
+ logical, parameter :: l5 = all (r3 == r4)
+ logical, parameter :: l6 = all (i3 == i4)
+ logical, parameter :: l7 = all (r1 == r3)
+ logical, parameter :: l8 = all (i1 == i3)
+
+ ! Inquiries and array sections
+ real(wp), parameter :: p0(*) = real (z0(::2))
+ real(wp), parameter :: q0(*) = aimag (z0(::2))
+ real(wp), parameter :: p1(*) = c0(::2) % re
+ real(wp), parameter :: q1(*) = c0(::2) % im
+ real(wp), parameter :: p2(*) = z0(::2) % re
+ real(wp), parameter :: q2(*) = z0(::2) % im
+ real(wp), parameter :: p3(*) = y % c(::2) % re
+ real(wp), parameter :: q3(*) = y % c(::2) % im
+ real(wp), parameter :: p4(*) = y % z(::2) % re
+ real(wp), parameter :: q4(*) = y % z(::2) % im
+
+ logical, parameter :: m1 = all (p1 == p0)
+ logical, parameter :: m2 = all (q1 == q0)
+ logical, parameter :: m3 = all (p1 == p2)
+ logical, parameter :: m4 = all (q1 == q2)
+ logical, parameter :: m5 = all (p3 == p4)
+ logical, parameter :: m6 = all (q3 == q4)
+ logical, parameter :: m7 = all (p1 == p3)
+ logical, parameter :: m8 = all (q1 == q3)
+
+ ! Inquiries and vector subscripts
+ real(wp), parameter :: v0(*) = real (z0([3,2]))
+ real(wp), parameter :: w0(*) = aimag (z0([3,2]))
+ real(wp), parameter :: v1(*) = c0([3,2]) % re
+ real(wp), parameter :: w1(*) = c0([3,2]) % im
+ real(wp), parameter :: v2(*) = z0([3,2]) % re
+ real(wp), parameter :: w2(*) = z0([3,2]) % im
+ real(wp), parameter :: v3(*) = y % c([3,2]) % re
+ real(wp), parameter :: w3(*) = y % c([3,2]) % im
+ real(wp), parameter :: v4(*) = y % z([3,2]) % re
+ real(wp), parameter :: w4(*) = y % z([3,2]) % im
+
+ logical, parameter :: o1 = all (v1 == v0)
+ logical, parameter :: o2 = all (w1 == w0)
+ logical, parameter :: o3 = all (v1 == v2)
+ logical, parameter :: o4 = all (w1 == w2)
+ logical, parameter :: o5 = all (v3 == v4)
+ logical, parameter :: o6 = all (w3 == w4)
+ logical, parameter :: o7 = all (v1 == v3)
+ logical, parameter :: o8 = all (w1 == w3)
+
+ ! Miscellaneous
+ complex(wp), parameter :: x(-1:*) = cmplx (r1,i1,kind=wp)
+ real(x%re%kind), parameter :: r(*) = x % re
+ real(x%im%kind), parameter :: i(*) = x % im
+ real(x%re%kind), parameter :: s(*) = [ x(:) % re ]
+ real(x%im%kind), parameter :: t(*) = [ x(:) % im ]
+
+ integer, parameter :: kr = x % re % kind
+ integer, parameter :: ki = x % im % kind
+ integer, parameter :: kx = x % kind
+
+ if (kr /= wp .or. ki /= wp .or. kx /= wp) stop 11
+ if (any (r /= r1)) stop 12
+ if (any (i /= i1)) stop 13
+ if (any (s /= r1)) stop 14
+ if (any (t /= i1)) stop 15
+
+ if (.not. all ([l1,l2,l3,l4,l5,l6,l7,l8])) stop 16
+ if (.not. all ([m1,m2,m3,m4,m5,m6,m7,m8])) stop 17
+ if (.not. all ([o1,o2,o3,o4,o5,o6,o7,o8])) stop 18
+ end subroutine test2
+end
+
+! { dg-final { scan-tree-dump-not "_gfortran_stop_numeric" "original" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_61.f90 b/gcc/testsuite/gfortran.dg/interface_61.f90
new file mode 100644
index 0000000..15db3b8a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_61.f90
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! { dg-options -Wexternal-argument-mismatch }
+! PR fortran/120163 - this used to cause an error.
+! Original test case by Bálint Aradi
+module mod1
+ implicit none
+
+ abstract interface
+ pure subroutine callback_interface(a)
+ real, intent(in) :: a
+ end subroutine callback_interface
+ end interface
+
+contains
+
+ subroutine caller(callback)
+ procedure(callback_interface) :: callback
+ real :: a
+ call callback(a)
+ end subroutine caller
+
+end module mod1
+
+
+module mod2
+ use mod1
+end module mod2
diff --git a/gcc/testsuite/gfortran.dg/interface_62.f90 b/gcc/testsuite/gfortran.dg/interface_62.f90
new file mode 100644
index 0000000..19d4325
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_62.f90
@@ -0,0 +1,39 @@
+! { dg-do compile }
+! PR fortran/120355 - this was rejected because the typespec from
+! the RESULT clause was not picked up.
+! Test case jsberg@bnl.gov.
+
+program p
+ implicit none
+ integer :: i,j
+ interface
+ function s(x) result(y)
+ implicit none
+ integer, intent(in) :: x
+ integer :: y
+ end function s
+ end interface
+ i = 0
+ call t(s,i,j)
+contains
+ subroutine t(f,x,y)
+ implicit none
+ integer, intent(in) :: x
+ integer, intent(out) :: y
+ interface
+ function f(x) result(y)
+ implicit none
+ integer, intent(in) :: x
+ integer :: y
+ end function f
+ end interface
+ y = f(x)
+ end subroutine t
+end program p
+
+function s(x) result(y)
+ implicit none
+ integer, intent(in) :: x
+ integer :: y
+ y = 1 - x
+end function s
diff --git a/gcc/testsuite/gfortran.dg/pr119856.f90 b/gcc/testsuite/gfortran.dg/pr119856.f90
new file mode 100644
index 0000000..60ada0a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr119856.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! PR119856, the error should occur in both write statements.
+program badfmt
+ implicit none
+
+ character(10):: fmt = "(AI5)" ! Not a PARAMETER so not examined
+ ! at compile time
+ integer :: ioerr
+ ioerr = 0
+ write (*, fmt, iostat=ioerr) 'value =', 42
+ if (ioerr /= 5006) stop 10
+!
+ write (*, fmt, iostat=ioerr) 'value =', 43
+ if (ioerr /= 5006) stop 13
+end program badfmt
diff --git a/gcc/testsuite/gfortran.dg/pr120049_2.f90 b/gcc/testsuite/gfortran.dg/pr120049_2.f90
new file mode 100644
index 0000000..1f91e06
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120049_2.f90
@@ -0,0 +1,62 @@
+! Compiled with pr120049_b.f90
+! { dg-options -O0 }
+! { dg-do compile }
+! { dg-compile-aux-modules "pr120049_b.f90" }
+!
+! Test the fix for PR120049
+program tests_gtk_sup
+ use gtk_sup
+ implicit none
+
+ type mytype
+ integer :: myint
+ end type mytype
+ type(mytype) :: ijkl = mytype(42)
+ logical :: truth
+ real :: var1
+ type(c_ptr), target :: val
+ type(c_funptr), target :: fptr
+ character(15) :: stringy
+ complex :: certainly
+ truth = .true.
+ var1 = 86.
+ stringy = "what the hay!"
+ certainly = (3.14,-4.13)
+ if (c_associated(val, c_loc(val))) then
+ stop 1
+ endif
+ if (c_associated(c_loc(val), val)) then
+ stop 2
+ endif
+ print *, c_associated(fptr, C_NULL_FUNPTR)
+ print *, c_associated(c_loc(val), C_NULL_PTR)
+ print *, c_associated(C_NULL_PTR, c_loc(val))
+ print *, c_associated(c_loc(val), 42) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(c_loc(val), .42) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(c_loc(val), truth) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(c_loc(val), .false.) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(c_loc(val), var1) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(c_loc(val), stringy) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(c_loc(val), certainly) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(42) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(.42) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(truth) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(.false.) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(var1) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(stringy) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(certainly) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(.42) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(val, testit(val)) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(testit(val), val) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(testit(val)) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(c_loc(val), C_NULL_FUNPTR) ! { dg-error "C_ASSOCIATED shall have the" }
+ print *, c_associated(C_NULL_FUNPTR, c_loc(val)) ! { dg-error "C_ASSOCIATED shall have the" }
+contains
+
+ function testit (avalue) result(res)
+ type(c_ptr) :: avalue
+ type(mytype) :: res
+ res%myint = 42
+ end function
+
+end program tests_gtk_sup
diff --git a/gcc/testsuite/gfortran.dg/pr120049_a.f90 b/gcc/testsuite/gfortran.dg/pr120049_a.f90
new file mode 100644
index 0000000..7095314
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120049_a.f90
@@ -0,0 +1,18 @@
+! Compiled with pr120049_b.f90
+! { dg-options -O0 }
+! { dg-do run }
+! { dg-compile-aux-modules "pr120049_b.f90" }
+! { dg-additional-sources pr120049_b.f90 }
+!
+! Test the fix for PR86248
+program tests_gtk_sup
+ use gtk_sup
+ implicit none
+ type(c_ptr), target :: val
+ if (c_associated(val, c_loc(val))) then
+ stop 1
+ endif
+ if (c_associated(c_loc(val), val)) then
+ stop 2
+ endif
+end program tests_gtk_sup
diff --git a/gcc/testsuite/gfortran.dg/pr120049_b.f90 b/gcc/testsuite/gfortran.dg/pr120049_b.f90
new file mode 100644
index 0000000..28a2783
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120049_b.f90
@@ -0,0 +1,6 @@
+!
+! Module for pr120049.f90
+!
+module gtk_sup
+ use, intrinsic :: iso_c_binding
+end module gtk_sup
diff --git a/gcc/testsuite/gfortran.dg/pr120191_1.f90 b/gcc/testsuite/gfortran.dg/pr120191_1.f90
new file mode 100644
index 0000000..13a787d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120191_1.f90
@@ -0,0 +1,614 @@
+! PR fortran/120191
+! { dg-do run }
+
+ integer(kind=1) :: a1(10, 10, 10), b1(10)
+ integer(kind=2) :: a2(10, 10, 10), b2(10)
+ integer(kind=4) :: a4(10, 10, 10), b4(10)
+ integer(kind=8) :: a8(10, 10, 10), b8(10)
+ real(kind=4) :: r4(10, 10, 10), s4(10)
+ real(kind=8) :: r8(10, 10, 10), s8(10)
+ logical :: l1(10, 10, 10), l2(10), l3
+ l1 = .true.
+ l2 = .true.
+ l3 = .true.
+ a1 = 0
+ if (any (maxloc (a1) .ne. 1)) stop 1
+ if (any (maxloc (a1, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (a1, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (a1, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (a1, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (a1, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (maxloc (a1, 1) .ne. 1)) stop 7
+ if (any (maxloc (a1, 1, back=.false.) .ne. 1)) stop 8
+ if (any (maxloc (a1, 1, back=.true.) .ne. 10)) stop 9
+ if (any (maxloc (a1, 1, kind=1) .ne. 1)) stop 10
+ if (any (maxloc (a1, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (maxloc (a1, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (maxloc (a1, 1, l1) .ne. 1)) stop 13
+ if (any (maxloc (a1, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (maxloc (a1, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (maxloc (a1, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (maxloc (a1, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (maxloc (a1, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (maxloc (a1, 1, l3) .ne. 1)) stop 19
+ if (any (maxloc (a1, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (maxloc (a1, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (maxloc (a1, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (maxloc (a1, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (maxloc (a1, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b1 = 0
+ if (any (maxloc (b1) .ne. 1)) stop 1
+ if (any (maxloc (b1, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (b1, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (b1, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (b1, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (b1, kind=8, back=.true.) .ne. 10)) stop 6
+ if (maxloc (b1, 1) .ne. 1) stop 7
+ if (maxloc (b1, 1, back=.false.) .ne. 1) stop 8
+ if (maxloc (b1, 1, back=.true.) .ne. 10) stop 9
+ if (maxloc (b1, 1, kind=1) .ne. 1) stop 10
+ if (maxloc (b1, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (maxloc (b1, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (maxloc (b1, 1, l2) .ne. 1) stop 13
+ if (maxloc (b1, 1, l2, back=.false.) .ne. 1) stop 14
+ if (maxloc (b1, 1, l2, back=.true.) .ne. 10) stop 15
+ if (maxloc (b1, 1, l2, kind=8) .ne. 1) stop 16
+ if (maxloc (b1, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (maxloc (b1, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (maxloc (b1, 1, l3) .ne. 1) stop 19
+ if (maxloc (b1, 1, l3, back=.false.) .ne. 1) stop 20
+ if (maxloc (b1, 1, l3, back=.true.) .ne. 10) stop 21
+ if (maxloc (b1, 1, l3, kind=8) .ne. 1) stop 22
+ if (maxloc (b1, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (maxloc (b1, 1, l3, 2, .true.) .ne. 10) stop 24
+ a2 = 0
+ if (any (maxloc (a2) .ne. 1)) stop 1
+ if (any (maxloc (a2, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (a2, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (a2, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (a2, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (a2, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (maxloc (a2, 1) .ne. 1)) stop 7
+ if (any (maxloc (a2, 1, back=.false.) .ne. 1)) stop 8
+ if (any (maxloc (a2, 1, back=.true.) .ne. 10)) stop 9
+ if (any (maxloc (a2, 1, kind=1) .ne. 1)) stop 10
+ if (any (maxloc (a2, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (maxloc (a2, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (maxloc (a2, 1, l1) .ne. 1)) stop 13
+ if (any (maxloc (a2, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (maxloc (a2, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (maxloc (a2, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (maxloc (a2, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (maxloc (a2, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (maxloc (a2, 1, l3) .ne. 1)) stop 19
+ if (any (maxloc (a2, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (maxloc (a2, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (maxloc (a2, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (maxloc (a2, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (maxloc (a2, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b2 = 0
+ if (any (maxloc (b2) .ne. 1)) stop 1
+ if (any (maxloc (b2, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (b2, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (b2, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (b2, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (b2, kind=8, back=.true.) .ne. 10)) stop 6
+ if (maxloc (b2, 1) .ne. 1) stop 7
+ if (maxloc (b2, 1, back=.false.) .ne. 1) stop 8
+ if (maxloc (b2, 1, back=.true.) .ne. 10) stop 9
+ if (maxloc (b2, 1, kind=1) .ne. 1) stop 10
+ if (maxloc (b2, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (maxloc (b2, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (maxloc (b2, 1, l2) .ne. 1) stop 13
+ if (maxloc (b2, 1, l2, back=.false.) .ne. 1) stop 14
+ if (maxloc (b2, 1, l2, back=.true.) .ne. 10) stop 15
+ if (maxloc (b2, 1, l2, kind=8) .ne. 1) stop 16
+ if (maxloc (b2, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (maxloc (b2, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (maxloc (b2, 1, l3) .ne. 1) stop 19
+ if (maxloc (b2, 1, l3, back=.false.) .ne. 1) stop 20
+ if (maxloc (b2, 1, l3, back=.true.) .ne. 10) stop 21
+ if (maxloc (b2, 1, l3, kind=8) .ne. 1) stop 22
+ if (maxloc (b2, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (maxloc (b2, 1, l3, 2, .true.) .ne. 10) stop 24
+ a4 = 0
+ if (any (maxloc (a4) .ne. 1)) stop 1
+ if (any (maxloc (a4, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (a4, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (a4, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (a4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (a4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (maxloc (a4, 1) .ne. 1)) stop 7
+ if (any (maxloc (a4, 1, back=.false.) .ne. 1)) stop 8
+ if (any (maxloc (a4, 1, back=.true.) .ne. 10)) stop 9
+ if (any (maxloc (a4, 1, kind=1) .ne. 1)) stop 10
+ if (any (maxloc (a4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (maxloc (a4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (maxloc (a4, 1, l1) .ne. 1)) stop 13
+ if (any (maxloc (a4, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (maxloc (a4, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (maxloc (a4, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (maxloc (a4, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (maxloc (a4, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (maxloc (a4, 1, l3) .ne. 1)) stop 19
+ if (any (maxloc (a4, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (maxloc (a4, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (maxloc (a4, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (maxloc (a4, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (maxloc (a4, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b4 = 0
+ if (any (maxloc (b4) .ne. 1)) stop 1
+ if (any (maxloc (b4, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (b4, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (b4, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (b4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (b4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (maxloc (b4, 1) .ne. 1) stop 7
+ if (maxloc (b4, 1, back=.false.) .ne. 1) stop 8
+ if (maxloc (b4, 1, back=.true.) .ne. 10) stop 9
+ if (maxloc (b4, 1, kind=1) .ne. 1) stop 10
+ if (maxloc (b4, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (maxloc (b4, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (maxloc (b4, 1, l2) .ne. 1) stop 13
+ if (maxloc (b4, 1, l2, back=.false.) .ne. 1) stop 14
+ if (maxloc (b4, 1, l2, back=.true.) .ne. 10) stop 15
+ if (maxloc (b4, 1, l2, kind=8) .ne. 1) stop 16
+ if (maxloc (b4, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (maxloc (b4, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (maxloc (b4, 1, l3) .ne. 1) stop 19
+ if (maxloc (b4, 1, l3, back=.false.) .ne. 1) stop 20
+ if (maxloc (b4, 1, l3, back=.true.) .ne. 10) stop 21
+ if (maxloc (b4, 1, l3, kind=8) .ne. 1) stop 22
+ if (maxloc (b4, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (maxloc (b4, 1, l3, 2, .true.) .ne. 10) stop 24
+ a8 = 0
+ if (any (maxloc (a8) .ne. 1)) stop 1
+ if (any (maxloc (a8, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (a8, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (a8, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (a8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (a8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (maxloc (a8, 1) .ne. 1)) stop 7
+ if (any (maxloc (a8, 1, back=.false.) .ne. 1)) stop 8
+ if (any (maxloc (a8, 1, back=.true.) .ne. 10)) stop 9
+ if (any (maxloc (a8, 1, kind=1) .ne. 1)) stop 10
+ if (any (maxloc (a8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (maxloc (a8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (maxloc (a8, 1, l1) .ne. 1)) stop 13
+ if (any (maxloc (a8, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (maxloc (a8, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (maxloc (a8, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (maxloc (a8, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (maxloc (a8, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (maxloc (a8, 1, l3) .ne. 1)) stop 19
+ if (any (maxloc (a8, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (maxloc (a8, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (maxloc (a8, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (maxloc (a8, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (maxloc (a8, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b8 = 0
+ if (any (maxloc (b8) .ne. 1)) stop 1
+ if (any (maxloc (b8, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (b8, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (b8, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (b8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (b8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (maxloc (b8, 1) .ne. 1) stop 7
+ if (maxloc (b8, 1, back=.false.) .ne. 1) stop 8
+ if (maxloc (b8, 1, back=.true.) .ne. 10) stop 9
+ if (maxloc (b8, 1, kind=1) .ne. 1) stop 10
+ if (maxloc (b8, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (maxloc (b8, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (maxloc (b8, 1, l2) .ne. 1) stop 13
+ if (maxloc (b8, 1, l2, back=.false.) .ne. 1) stop 14
+ if (maxloc (b8, 1, l2, back=.true.) .ne. 10) stop 15
+ if (maxloc (b8, 1, l2, kind=8) .ne. 1) stop 16
+ if (maxloc (b8, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (maxloc (b8, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (maxloc (b8, 1, l3) .ne. 1) stop 19
+ if (maxloc (b8, 1, l3, back=.false.) .ne. 1) stop 20
+ if (maxloc (b8, 1, l3, back=.true.) .ne. 10) stop 21
+ if (maxloc (b8, 1, l3, kind=8) .ne. 1) stop 22
+ if (maxloc (b8, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (maxloc (b8, 1, l3, 2, .true.) .ne. 10) stop 24
+ r4 = 0.0
+ if (any (maxloc (r4) .ne. 1)) stop 1
+ if (any (maxloc (r4, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (r4, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (r4, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (r4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (r4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (maxloc (r4, 1) .ne. 1)) stop 7
+ if (any (maxloc (r4, 1, back=.false.) .ne. 1)) stop 8
+ if (any (maxloc (r4, 1, back=.true.) .ne. 10)) stop 9
+ if (any (maxloc (r4, 1, kind=1) .ne. 1)) stop 10
+ if (any (maxloc (r4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (maxloc (r4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (maxloc (r4, 1, l1) .ne. 1)) stop 13
+ if (any (maxloc (r4, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (maxloc (r4, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (maxloc (r4, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (maxloc (r4, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (maxloc (r4, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (maxloc (r4, 1, l3) .ne. 1)) stop 19
+ if (any (maxloc (r4, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (maxloc (r4, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (maxloc (r4, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (maxloc (r4, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (maxloc (r4, 1, l3, 2, .true.) .ne. 10)) stop 24
+ s4 = 0.0
+ if (any (maxloc (s4) .ne. 1)) stop 1
+ if (any (maxloc (s4, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (s4, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (s4, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (s4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (s4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (maxloc (s4, 1) .ne. 1) stop 7
+ if (maxloc (s4, 1, back=.false.) .ne. 1) stop 8
+ if (maxloc (s4, 1, back=.true.) .ne. 10) stop 9
+ if (maxloc (s4, 1, kind=1) .ne. 1) stop 10
+ if (maxloc (s4, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (maxloc (s4, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (maxloc (s4, 1, l2) .ne. 1) stop 13
+ if (maxloc (s4, 1, l2, back=.false.) .ne. 1) stop 14
+ if (maxloc (s4, 1, l2, back=.true.) .ne. 10) stop 15
+ if (maxloc (s4, 1, l2, kind=8) .ne. 1) stop 16
+ if (maxloc (s4, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (maxloc (s4, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (maxloc (s4, 1, l3) .ne. 1) stop 19
+ if (maxloc (s4, 1, l3, back=.false.) .ne. 1) stop 20
+ if (maxloc (s4, 1, l3, back=.true.) .ne. 10) stop 21
+ if (maxloc (s4, 1, l3, kind=8) .ne. 1) stop 22
+ if (maxloc (s4, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (maxloc (s4, 1, l3, 2, .true.) .ne. 10) stop 24
+ r8 = 0.0
+ if (any (maxloc (r8) .ne. 1)) stop 1
+ if (any (maxloc (r8, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (r8, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (r8, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (r8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (r8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (maxloc (r8, 1) .ne. 1)) stop 7
+ if (any (maxloc (r8, 1, back=.false.) .ne. 1)) stop 8
+ if (any (maxloc (r8, 1, back=.true.) .ne. 10)) stop 9
+ if (any (maxloc (r8, 1, kind=1) .ne. 1)) stop 10
+ if (any (maxloc (r8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (maxloc (r8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (maxloc (r8, 1, l1) .ne. 1)) stop 13
+ if (any (maxloc (r8, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (maxloc (r8, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (maxloc (r8, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (maxloc (r8, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (maxloc (r8, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (maxloc (r8, 1, l3) .ne. 1)) stop 19
+ if (any (maxloc (r8, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (maxloc (r8, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (maxloc (r8, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (maxloc (r8, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (maxloc (r8, 1, l3, 2, .true.) .ne. 10)) stop 24
+ s8 = 0.0
+ if (any (maxloc (s8) .ne. 1)) stop 1
+ if (any (maxloc (s8, back=.false.) .ne. 1)) stop 2
+ if (any (maxloc (s8, back=.true.) .ne. 10)) stop 3
+ if (any (maxloc (s8, kind=2) .ne. 1)) stop 4
+ if (any (maxloc (s8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (maxloc (s8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (maxloc (s8, 1) .ne. 1) stop 7
+ if (maxloc (s8, 1, back=.false.) .ne. 1) stop 8
+ if (maxloc (s8, 1, back=.true.) .ne. 10) stop 9
+ if (maxloc (s8, 1, kind=1) .ne. 1) stop 10
+ if (maxloc (s8, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (maxloc (s8, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (maxloc (s8, 1, l2) .ne. 1) stop 13
+ if (maxloc (s8, 1, l2, back=.false.) .ne. 1) stop 14
+ if (maxloc (s8, 1, l2, back=.true.) .ne. 10) stop 15
+ if (maxloc (s8, 1, l2, kind=8) .ne. 1) stop 16
+ if (maxloc (s8, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (maxloc (s8, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (maxloc (s8, 1, l3) .ne. 1) stop 19
+ if (maxloc (s8, 1, l3, back=.false.) .ne. 1) stop 20
+ if (maxloc (s8, 1, l3, back=.true.) .ne. 10) stop 21
+ if (maxloc (s8, 1, l3, kind=8) .ne. 1) stop 22
+ if (maxloc (s8, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (maxloc (s8, 1, l3, 2, .true.) .ne. 10) stop 24
+ a1 = 0
+ if (any (minloc (a1) .ne. 1)) stop 1
+ if (any (minloc (a1, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (a1, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (a1, kind=2) .ne. 1)) stop 4
+ if (any (minloc (a1, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (a1, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (minloc (a1, 1) .ne. 1)) stop 7
+ if (any (minloc (a1, 1, back=.false.) .ne. 1)) stop 8
+ if (any (minloc (a1, 1, back=.true.) .ne. 10)) stop 9
+ if (any (minloc (a1, 1, kind=1) .ne. 1)) stop 10
+ if (any (minloc (a1, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (minloc (a1, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (minloc (a1, 1, l1) .ne. 1)) stop 13
+ if (any (minloc (a1, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (minloc (a1, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (minloc (a1, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (minloc (a1, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (minloc (a1, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (minloc (a1, 1, l3) .ne. 1)) stop 19
+ if (any (minloc (a1, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (minloc (a1, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (minloc (a1, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (minloc (a1, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (minloc (a1, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b1 = 0
+ if (any (minloc (b1) .ne. 1)) stop 1
+ if (any (minloc (b1, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (b1, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (b1, kind=2) .ne. 1)) stop 4
+ if (any (minloc (b1, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (b1, kind=8, back=.true.) .ne. 10)) stop 6
+ if (minloc (b1, 1) .ne. 1) stop 7
+ if (minloc (b1, 1, back=.false.) .ne. 1) stop 8
+ if (minloc (b1, 1, back=.true.) .ne. 10) stop 9
+ if (minloc (b1, 1, kind=1) .ne. 1) stop 10
+ if (minloc (b1, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (minloc (b1, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (minloc (b1, 1, l2) .ne. 1) stop 13
+ if (minloc (b1, 1, l2, back=.false.) .ne. 1) stop 14
+ if (minloc (b1, 1, l2, back=.true.) .ne. 10) stop 15
+ if (minloc (b1, 1, l2, kind=8) .ne. 1) stop 16
+ if (minloc (b1, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (minloc (b1, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (minloc (b1, 1, l3) .ne. 1) stop 19
+ if (minloc (b1, 1, l3, back=.false.) .ne. 1) stop 20
+ if (minloc (b1, 1, l3, back=.true.) .ne. 10) stop 21
+ if (minloc (b1, 1, l3, kind=8) .ne. 1) stop 22
+ if (minloc (b1, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (minloc (b1, 1, l3, 2, .true.) .ne. 10) stop 24
+ a2 = 0
+ if (any (minloc (a2) .ne. 1)) stop 1
+ if (any (minloc (a2, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (a2, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (a2, kind=2) .ne. 1)) stop 4
+ if (any (minloc (a2, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (a2, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (minloc (a2, 1) .ne. 1)) stop 7
+ if (any (minloc (a2, 1, back=.false.) .ne. 1)) stop 8
+ if (any (minloc (a2, 1, back=.true.) .ne. 10)) stop 9
+ if (any (minloc (a2, 1, kind=1) .ne. 1)) stop 10
+ if (any (minloc (a2, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (minloc (a2, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (minloc (a2, 1, l1) .ne. 1)) stop 13
+ if (any (minloc (a2, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (minloc (a2, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (minloc (a2, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (minloc (a2, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (minloc (a2, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (minloc (a2, 1, l3) .ne. 1)) stop 19
+ if (any (minloc (a2, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (minloc (a2, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (minloc (a2, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (minloc (a2, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (minloc (a2, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b2 = 0
+ if (any (minloc (b2) .ne. 1)) stop 1
+ if (any (minloc (b2, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (b2, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (b2, kind=2) .ne. 1)) stop 4
+ if (any (minloc (b2, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (b2, kind=8, back=.true.) .ne. 10)) stop 6
+ if (minloc (b2, 1) .ne. 1) stop 7
+ if (minloc (b2, 1, back=.false.) .ne. 1) stop 8
+ if (minloc (b2, 1, back=.true.) .ne. 10) stop 9
+ if (minloc (b2, 1, kind=1) .ne. 1) stop 10
+ if (minloc (b2, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (minloc (b2, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (minloc (b2, 1, l2) .ne. 1) stop 13
+ if (minloc (b2, 1, l2, back=.false.) .ne. 1) stop 14
+ if (minloc (b2, 1, l2, back=.true.) .ne. 10) stop 15
+ if (minloc (b2, 1, l2, kind=8) .ne. 1) stop 16
+ if (minloc (b2, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (minloc (b2, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (minloc (b2, 1, l3) .ne. 1) stop 19
+ if (minloc (b2, 1, l3, back=.false.) .ne. 1) stop 20
+ if (minloc (b2, 1, l3, back=.true.) .ne. 10) stop 21
+ if (minloc (b2, 1, l3, kind=8) .ne. 1) stop 22
+ if (minloc (b2, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (minloc (b2, 1, l3, 2, .true.) .ne. 10) stop 24
+ a4 = 0
+ if (any (minloc (a4) .ne. 1)) stop 1
+ if (any (minloc (a4, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (a4, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (a4, kind=2) .ne. 1)) stop 4
+ if (any (minloc (a4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (a4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (minloc (a4, 1) .ne. 1)) stop 7
+ if (any (minloc (a4, 1, back=.false.) .ne. 1)) stop 8
+ if (any (minloc (a4, 1, back=.true.) .ne. 10)) stop 9
+ if (any (minloc (a4, 1, kind=1) .ne. 1)) stop 10
+ if (any (minloc (a4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (minloc (a4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (minloc (a4, 1, l1) .ne. 1)) stop 13
+ if (any (minloc (a4, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (minloc (a4, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (minloc (a4, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (minloc (a4, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (minloc (a4, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (minloc (a4, 1, l3) .ne. 1)) stop 19
+ if (any (minloc (a4, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (minloc (a4, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (minloc (a4, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (minloc (a4, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (minloc (a4, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b4 = 0
+ if (any (minloc (b4) .ne. 1)) stop 1
+ if (any (minloc (b4, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (b4, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (b4, kind=2) .ne. 1)) stop 4
+ if (any (minloc (b4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (b4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (minloc (b4, 1) .ne. 1) stop 7
+ if (minloc (b4, 1, back=.false.) .ne. 1) stop 8
+ if (minloc (b4, 1, back=.true.) .ne. 10) stop 9
+ if (minloc (b4, 1, kind=1) .ne. 1) stop 10
+ if (minloc (b4, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (minloc (b4, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (minloc (b4, 1, l2) .ne. 1) stop 13
+ if (minloc (b4, 1, l2, back=.false.) .ne. 1) stop 14
+ if (minloc (b4, 1, l2, back=.true.) .ne. 10) stop 15
+ if (minloc (b4, 1, l2, kind=8) .ne. 1) stop 16
+ if (minloc (b4, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (minloc (b4, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (minloc (b4, 1, l3) .ne. 1) stop 19
+ if (minloc (b4, 1, l3, back=.false.) .ne. 1) stop 20
+ if (minloc (b4, 1, l3, back=.true.) .ne. 10) stop 21
+ if (minloc (b4, 1, l3, kind=8) .ne. 1) stop 22
+ if (minloc (b4, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (minloc (b4, 1, l3, 2, .true.) .ne. 10) stop 24
+ a8 = 0
+ if (any (minloc (a8) .ne. 1)) stop 1
+ if (any (minloc (a8, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (a8, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (a8, kind=2) .ne. 1)) stop 4
+ if (any (minloc (a8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (a8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (minloc (a8, 1) .ne. 1)) stop 7
+ if (any (minloc (a8, 1, back=.false.) .ne. 1)) stop 8
+ if (any (minloc (a8, 1, back=.true.) .ne. 10)) stop 9
+ if (any (minloc (a8, 1, kind=1) .ne. 1)) stop 10
+ if (any (minloc (a8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (minloc (a8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (minloc (a8, 1, l1) .ne. 1)) stop 13
+ if (any (minloc (a8, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (minloc (a8, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (minloc (a8, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (minloc (a8, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (minloc (a8, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (minloc (a8, 1, l3) .ne. 1)) stop 19
+ if (any (minloc (a8, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (minloc (a8, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (minloc (a8, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (minloc (a8, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (minloc (a8, 1, l3, 2, .true.) .ne. 10)) stop 24
+ b8 = 0
+ if (any (minloc (b8) .ne. 1)) stop 1
+ if (any (minloc (b8, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (b8, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (b8, kind=2) .ne. 1)) stop 4
+ if (any (minloc (b8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (b8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (minloc (b8, 1) .ne. 1) stop 7
+ if (minloc (b8, 1, back=.false.) .ne. 1) stop 8
+ if (minloc (b8, 1, back=.true.) .ne. 10) stop 9
+ if (minloc (b8, 1, kind=1) .ne. 1) stop 10
+ if (minloc (b8, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (minloc (b8, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (minloc (b8, 1, l2) .ne. 1) stop 13
+ if (minloc (b8, 1, l2, back=.false.) .ne. 1) stop 14
+ if (minloc (b8, 1, l2, back=.true.) .ne. 10) stop 15
+ if (minloc (b8, 1, l2, kind=8) .ne. 1) stop 16
+ if (minloc (b8, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (minloc (b8, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (minloc (b8, 1, l3) .ne. 1) stop 19
+ if (minloc (b8, 1, l3, back=.false.) .ne. 1) stop 20
+ if (minloc (b8, 1, l3, back=.true.) .ne. 10) stop 21
+ if (minloc (b8, 1, l3, kind=8) .ne. 1) stop 22
+ if (minloc (b8, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (minloc (b8, 1, l3, 2, .true.) .ne. 10) stop 24
+ r4 = 0.0
+ if (any (minloc (r4) .ne. 1)) stop 1
+ if (any (minloc (r4, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (r4, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (r4, kind=2) .ne. 1)) stop 4
+ if (any (minloc (r4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (r4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (minloc (r4, 1) .ne. 1)) stop 7
+ if (any (minloc (r4, 1, back=.false.) .ne. 1)) stop 8
+ if (any (minloc (r4, 1, back=.true.) .ne. 10)) stop 9
+ if (any (minloc (r4, 1, kind=1) .ne. 1)) stop 10
+ if (any (minloc (r4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (minloc (r4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (minloc (r4, 1, l1) .ne. 1)) stop 13
+ if (any (minloc (r4, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (minloc (r4, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (minloc (r4, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (minloc (r4, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (minloc (r4, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (minloc (r4, 1, l3) .ne. 1)) stop 19
+ if (any (minloc (r4, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (minloc (r4, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (minloc (r4, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (minloc (r4, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (minloc (r4, 1, l3, 2, .true.) .ne. 10)) stop 24
+ s4 = 0.0
+ if (any (minloc (s4) .ne. 1)) stop 1
+ if (any (minloc (s4, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (s4, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (s4, kind=2) .ne. 1)) stop 4
+ if (any (minloc (s4, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (s4, kind=8, back=.true.) .ne. 10)) stop 6
+ if (minloc (s4, 1) .ne. 1) stop 7
+ if (minloc (s4, 1, back=.false.) .ne. 1) stop 8
+ if (minloc (s4, 1, back=.true.) .ne. 10) stop 9
+ if (minloc (s4, 1, kind=1) .ne. 1) stop 10
+ if (minloc (s4, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (minloc (s4, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (minloc (s4, 1, l2) .ne. 1) stop 13
+ if (minloc (s4, 1, l2, back=.false.) .ne. 1) stop 14
+ if (minloc (s4, 1, l2, back=.true.) .ne. 10) stop 15
+ if (minloc (s4, 1, l2, kind=8) .ne. 1) stop 16
+ if (minloc (s4, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (minloc (s4, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (minloc (s4, 1, l3) .ne. 1) stop 19
+ if (minloc (s4, 1, l3, back=.false.) .ne. 1) stop 20
+ if (minloc (s4, 1, l3, back=.true.) .ne. 10) stop 21
+ if (minloc (s4, 1, l3, kind=8) .ne. 1) stop 22
+ if (minloc (s4, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (minloc (s4, 1, l3, 2, .true.) .ne. 10) stop 24
+ r8 = 0.0
+ if (any (minloc (r8) .ne. 1)) stop 1
+ if (any (minloc (r8, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (r8, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (r8, kind=2) .ne. 1)) stop 4
+ if (any (minloc (r8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (r8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (any (minloc (r8, 1) .ne. 1)) stop 7
+ if (any (minloc (r8, 1, back=.false.) .ne. 1)) stop 8
+ if (any (minloc (r8, 1, back=.true.) .ne. 10)) stop 9
+ if (any (minloc (r8, 1, kind=1) .ne. 1)) stop 10
+ if (any (minloc (r8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+ if (any (minloc (r8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+ if (any (minloc (r8, 1, l1) .ne. 1)) stop 13
+ if (any (minloc (r8, 1, l1, back=.false.) .ne. 1)) stop 14
+ if (any (minloc (r8, 1, l1, back=.true.) .ne. 10)) stop 15
+ if (any (minloc (r8, 1, l1, kind=8) .ne. 1)) stop 16
+ if (any (minloc (r8, 1, l1, 4, .false.) .ne. 1)) stop 17
+ if (any (minloc (r8, 1, l1, 2, .true.) .ne. 10)) stop 18
+ if (any (minloc (r8, 1, l3) .ne. 1)) stop 19
+ if (any (minloc (r8, 1, l3, back=.false.) .ne. 1)) stop 20
+ if (any (minloc (r8, 1, l3, back=.true.) .ne. 10)) stop 21
+ if (any (minloc (r8, 1, l3, kind=8) .ne. 1)) stop 22
+ if (any (minloc (r8, 1, l3, 4, .false.) .ne. 1)) stop 23
+ if (any (minloc (r8, 1, l3, 2, .true.) .ne. 10)) stop 24
+ s8 = 0.0
+ if (any (minloc (s8) .ne. 1)) stop 1
+ if (any (minloc (s8, back=.false.) .ne. 1)) stop 2
+ if (any (minloc (s8, back=.true.) .ne. 10)) stop 3
+ if (any (minloc (s8, kind=2) .ne. 1)) stop 4
+ if (any (minloc (s8, kind=4, back=.false.) .ne. 1)) stop 5
+ if (any (minloc (s8, kind=8, back=.true.) .ne. 10)) stop 6
+ if (minloc (s8, 1) .ne. 1) stop 7
+ if (minloc (s8, 1, back=.false.) .ne. 1) stop 8
+ if (minloc (s8, 1, back=.true.) .ne. 10) stop 9
+ if (minloc (s8, 1, kind=1) .ne. 1) stop 10
+ if (minloc (s8, 1, kind=2, back=.false.) .ne. 1) stop 11
+ if (minloc (s8, 1, kind=4, back=.true.) .ne. 10) stop 12
+ if (minloc (s8, 1, l2) .ne. 1) stop 13
+ if (minloc (s8, 1, l2, back=.false.) .ne. 1) stop 14
+ if (minloc (s8, 1, l2, back=.true.) .ne. 10) stop 15
+ if (minloc (s8, 1, l2, kind=8) .ne. 1) stop 16
+ if (minloc (s8, 1, l2, 4, .false.) .ne. 1) stop 17
+ if (minloc (s8, 1, l2, 2, .true.) .ne. 10) stop 18
+ if (minloc (s8, 1, l3) .ne. 1) stop 19
+ if (minloc (s8, 1, l3, back=.false.) .ne. 1) stop 20
+ if (minloc (s8, 1, l3, back=.true.) .ne. 10) stop 21
+ if (minloc (s8, 1, l3, kind=8) .ne. 1) stop 22
+ if (minloc (s8, 1, l3, 4, .false.) .ne. 1) stop 23
+ if (minloc (s8, 1, l3, 2, .true.) .ne. 10) stop 24
+end
diff --git a/gcc/testsuite/gfortran.dg/pr120191_2.f90 b/gcc/testsuite/gfortran.dg/pr120191_2.f90
new file mode 100644
index 0000000..6334286
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120191_2.f90
@@ -0,0 +1,84 @@
+! PR fortran/120191
+! { dg-do run }
+
+ character(kind=1, len=2) :: a(4, 4, 4), b(4)
+ logical :: l(4, 4, 4), m, n(4)
+ a = 'aa'
+ b = 'aa'
+ l = .true.
+ m = .true.
+ n = .true.
+ if (any (maxloc (a) .ne. 1)) stop 1
+ if (any (maxloc (a, dim=1) .ne. 1)) stop 2
+ if (any (maxloc (a, 1) .ne. 1)) stop 3
+ if (any (maxloc (a, dim=1, mask=l, kind=4, back=.false.) .ne. 1)) stop 4
+ if (any (maxloc (a, 1, l, 4, .false.) .ne. 1)) stop 5
+ if (any (maxloc (a, dim=1, mask=m, kind=4, back=.false.) .ne. 1)) stop 6
+ if (any (maxloc (a, 1, m, 4, .false.) .ne. 1)) stop 7
+ if (any (maxloc (a, dim=1, mask=l, kind=4, back=.true.) .ne. 4)) stop 8
+ if (any (maxloc (a, 1, l, 4, .true.) .ne. 4)) stop 9
+ if (any (maxloc (a, dim=1, mask=m, kind=4, back=.true.) .ne. 4)) stop 10
+ if (any (maxloc (a, 1, m, 4, .true.) .ne. 4)) stop 11
+ if (any (maxloc (b) .ne. 1)) stop 12
+ if (maxloc (b, dim=1) .ne. 1) stop 13
+ if (maxloc (b, 1) .ne. 1) stop 14
+ if (maxloc (b, dim=1, mask=n, kind=4, back=.false.) .ne. 1) stop 15
+ if (maxloc (b, 1, n, 4, .false.) .ne. 1) stop 16
+ if (maxloc (b, dim=1, mask=m, kind=4, back=.false.) .ne. 1) stop 17
+ if (maxloc (b, 1, m, 4, .false.) .ne. 1) stop 18
+ if (maxloc (b, dim=1, mask=n, kind=4, back=.true.) .ne. 4) stop 19
+ if (maxloc (b, 1, n, 4, .true.) .ne. 4) stop 20
+ if (maxloc (b, dim=1, mask=m, kind=4, back=.true.) .ne. 4) stop 21
+ if (maxloc (b, 1, m, 4, .true.) .ne. 4) stop 22
+ l = .false.
+ m = .false.
+ n = .false.
+ if (any (maxloc (a, dim=1, mask=l, kind=4, back=.false.) .ne. 0)) stop 23
+ if (any (maxloc (a, 1, l, 4, .false.) .ne. 0)) stop 24
+ if (maxloc (b, dim=1, mask=n, kind=4, back=.false.) .ne. 0) stop 25
+ if (maxloc (b, 1, n, 4, .false.) .ne. 0) stop 26
+ if (maxloc (b, dim=1, mask=m, kind=4, back=.false.) .ne. 0) stop 27
+ if (maxloc (b, 1, m, 4, .false.) .ne. 0) stop 28
+ if (maxloc (b, dim=1, mask=n, kind=4, back=.true.) .ne. 0) stop 29
+ if (maxloc (b, 1, n, 4, .true.) .ne. 0) stop 30
+ if (maxloc (b, dim=1, mask=m, kind=4, back=.true.) .ne. 0) stop 31
+ if (maxloc (b, 1, m, 4, .true.) .ne. 0) stop 32
+ l = .true.
+ m = .true.
+ n = .true.
+ if (any (minloc (a) .ne. 1)) stop 1
+ if (any (minloc (a, dim=1) .ne. 1)) stop 2
+ if (any (minloc (a, 1) .ne. 1)) stop 3
+ if (any (minloc (a, dim=1, mask=l, kind=4, back=.false.) .ne. 1)) stop 4
+ if (any (minloc (a, 1, l, 4, .false.) .ne. 1)) stop 5
+ if (any (minloc (a, dim=1, mask=m, kind=4, back=.false.) .ne. 1)) stop 6
+ if (any (minloc (a, 1, m, 4, .false.) .ne. 1)) stop 7
+ if (any (minloc (a, dim=1, mask=l, kind=4, back=.true.) .ne. 4)) stop 8
+ if (any (minloc (a, 1, l, 4, .true.) .ne. 4)) stop 9
+ if (any (minloc (a, dim=1, mask=m, kind=4, back=.true.) .ne. 4)) stop 10
+ if (any (minloc (a, 1, m, 4, .true.) .ne. 4)) stop 11
+ if (any (minloc (b) .ne. 1)) stop 12
+ if (minloc (b, dim=1) .ne. 1) stop 13
+ if (minloc (b, 1) .ne. 1) stop 14
+ if (minloc (b, dim=1, mask=n, kind=4, back=.false.) .ne. 1) stop 15
+ if (minloc (b, 1, n, 4, .false.) .ne. 1) stop 16
+ if (minloc (b, dim=1, mask=m, kind=4, back=.false.) .ne. 1) stop 17
+ if (minloc (b, 1, m, 4, .false.) .ne. 1) stop 18
+ if (minloc (b, dim=1, mask=n, kind=4, back=.true.) .ne. 4) stop 19
+ if (minloc (b, 1, n, 4, .true.) .ne. 4) stop 20
+ if (minloc (b, dim=1, mask=m, kind=4, back=.true.) .ne. 4) stop 21
+ if (minloc (b, 1, m, 4, .true.) .ne. 4) stop 22
+ l = .false.
+ m = .false.
+ n = .false.
+ if (any (minloc (a, dim=1, mask=l, kind=4, back=.false.) .ne. 0)) stop 23
+ if (any (minloc (a, 1, l, 4, .false.) .ne. 0)) stop 24
+ if (minloc (b, dim=1, mask=n, kind=4, back=.false.) .ne. 0) stop 25
+ if (minloc (b, 1, n, 4, .false.) .ne. 0) stop 26
+ if (minloc (b, dim=1, mask=m, kind=4, back=.false.) .ne. 0) stop 27
+ if (minloc (b, 1, m, 4, .false.) .ne. 0) stop 28
+ if (minloc (b, dim=1, mask=n, kind=4, back=.true.) .ne. 0) stop 29
+ if (minloc (b, 1, n, 4, .true.) .ne. 0) stop 30
+ if (minloc (b, dim=1, mask=m, kind=4, back=.true.) .ne. 0) stop 31
+ if (minloc (b, 1, m, 4, .true.) .ne. 0) stop 32
+end
diff --git a/gcc/testsuite/gfortran.dg/pr120191_3.f90 b/gcc/testsuite/gfortran.dg/pr120191_3.f90
new file mode 100644
index 0000000..26e4095
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120191_3.f90
@@ -0,0 +1,23 @@
+! PR fortran/120191
+! { dg-do run }
+
+ character(kind=1, len=2) :: a(4, 4, 4), b(4)
+ logical :: l(4, 4, 4), m, n(4)
+ a = 'aa'
+ b = 'aa'
+ l = .false.
+ m = .false.
+ n = .false.
+ if (any (maxloc (a, dim=1, mask=m, kind=4, back=.false.) .ne. 0)) stop 1
+ if (any (maxloc (a, 1, m, 4, .false.) .ne. 0)) stop 2
+ if (any (maxloc (a, dim=1, mask=l, kind=4, back=.true.) .ne. 0)) stop 3
+ if (any (maxloc (a, 1, l, 4, .true.) .ne. 0)) stop 4
+ if (any (maxloc (a, dim=1, mask=m, kind=4, back=.true.) .ne. 0)) stop 5
+ if (any (maxloc (a, 1, m, 4, .true.) .ne. 0)) stop 6
+ if (any (minloc (a, dim=1, mask=m, kind=4, back=.false.) .ne. 0)) stop 7
+ if (any (minloc (a, 1, m, 4, .false.) .ne. 0)) stop 8
+ if (any (minloc (a, dim=1, mask=l, kind=4, back=.true.) .ne. 0)) stop 9
+ if (any (minloc (a, 1, l, 4, .true.) .ne. 0)) stop 10
+ if (any (minloc (a, dim=1, mask=m, kind=4, back=.true.) .ne. 0)) stop 11
+ if (any (minloc (a, 1, m, 4, .true.) .ne. 0)) stop 12
+end
diff --git a/gcc/testsuite/gfortran.dg/pr120196.f90 b/gcc/testsuite/gfortran.dg/pr120196.f90
new file mode 100644
index 0000000..368c43a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120196.f90
@@ -0,0 +1,26 @@
+! PR libfortran/120196
+! { dg-do run }
+
+program pr120196
+ character(len=:, kind=1), allocatable :: a(:), s
+ character(len=:, kind=4), allocatable :: b(:), t
+ logical, allocatable :: l(:)
+ logical :: m
+ allocate (character(len=16, kind=1) :: a(10), s)
+ allocate (l(10))
+ a(:) = ""
+ s = "*"
+ l = .true.
+ m = .true.
+ if (findloc (a, s, dim=1, back=.true.) .ne. 0) stop 1
+ if (findloc (a, s, mask=l, dim=1, back=.true.) .ne. 0) stop 2
+ if (findloc (a, s, mask=m, dim=1, back=.true.) .ne. 0) stop 3
+ deallocate (a, s)
+ allocate (character(len=16, kind=4) :: b(10), t)
+ b(:) = ""
+ t = "*"
+ if (findloc (b, t, dim=1, back=.true.) .ne. 0) stop 4
+ if (findloc (b, t, mask=l, dim=1, back=.true.) .ne. 0) stop 5
+ if (findloc (b, t, mask=m, dim=1, back=.true.) .ne. 0) stop 6
+ deallocate (b, t, l)
+end program pr120196
diff --git a/gcc/testsuite/gfortran.dg/save_8.f90 b/gcc/testsuite/gfortran.dg/save_8.f90
new file mode 100644
index 0000000..8e9198c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/save_8.f90
@@ -0,0 +1,13 @@
+!{ dg-do run }
+
+! Check PR120483 is fixed.
+! Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
+! and Peter Güntert <peter@guentert.com>
+
+program save_8
+ implicit none
+ character(len=:), allocatable, save :: s1
+ s1 = 'ABC'
+ if (s1(3:3) /= 'C') stop 1
+end program save_8
+
diff --git a/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90
new file mode 100644
index 0000000..b480dff
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90
@@ -0,0 +1,48 @@
+! { dg-do run }
+! { dg-additional-options "-O2 -fdump-tree-optimized" }
+!
+! PR fortran/102891 - passing of inquiry ref of complex array to TRANSFER
+
+program main
+ implicit none
+ integer, parameter :: dp = 8
+
+ type complex_wrap1
+ complex(dp) :: z(2)
+ end type complex_wrap1
+
+ type complex_wrap2
+ complex(dp), dimension(:), allocatable :: z
+ end type complex_wrap2
+
+ type(complex_wrap1) :: x = complex_wrap1([ (1, 2), (3, 4) ])
+ type(complex_wrap2) :: w
+
+ w%z = x%z
+
+ ! The following statements should get optimized away...
+ if (size (transfer ( x%z%re ,[1.0_dp])) /= 2) error stop 1
+ if (size (transfer ((x%z%re),[1.0_dp])) /= 2) error stop 2
+ if (size (transfer ([x%z%re],[1.0_dp])) /= 2) error stop 3
+ if (size (transfer ( x%z%im ,[1.0_dp])) /= 2) error stop 4
+ if (size (transfer ((x%z%im),[1.0_dp])) /= 2) error stop 5
+ if (size (transfer ([x%z%im],[1.0_dp])) /= 2) error stop 6
+
+ ! ... while the following may not:
+ if (any (transfer ( x%z%re ,[1.0_dp]) /= x%z%re)) stop 7
+ if (any (transfer ( x%z%im ,[1.0_dp]) /= x%z%im)) stop 8
+
+ if (size (transfer ( w%z%re ,[1.0_dp])) /= 2) stop 11
+ if (size (transfer ((w%z%re),[1.0_dp])) /= 2) stop 12
+ if (size (transfer ([w%z%re],[1.0_dp])) /= 2) stop 13
+ if (size (transfer ( w%z%im ,[1.0_dp])) /= 2) stop 14
+ if (size (transfer ((w%z%im),[1.0_dp])) /= 2) stop 15
+ if (size (transfer ([w%z%im],[1.0_dp])) /= 2) stop 16
+
+ if (any (transfer ( w%z%re ,[1.0_dp]) /= x%z%re)) stop 17
+ if (any (transfer ( w%z%im ,[1.0_dp]) /= x%z%im)) stop 18
+
+ deallocate (w%z)
+end program main
+
+! { dg-final { scan-tree-dump-not "_gfortran_error_stop_numeric" "optimized" } }
diff --git a/gcc/testsuite/gm2.dg/doc/examples/plugin/fail/assignvalue.mod b/gcc/testsuite/gm2.dg/doc/examples/plugin/fail/assignvalue.mod
new file mode 100644
index 0000000..56eb0bb
--- /dev/null
+++ b/gcc/testsuite/gm2.dg/doc/examples/plugin/fail/assignvalue.mod
@@ -0,0 +1,25 @@
+(* { dg-do compile } *)
+(* { dg-options "-fsoft-check-all -fm2-plugin" } *)
+(* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } *)
+
+MODULE assignvalue ; (*!m2iso+gm2*)
+
+PROCEDURE bad () : INTEGER ;
+VAR
+ i: INTEGER ;
+BEGIN
+ i := -1 ;
+ RETURN i
+END bad ;
+
+VAR
+ foo: CARDINAL ;
+BEGIN
+ (* The m2rte plugin will detect this as an error, post
+ optimization. *)
+ foo := bad () (* { dg-error "error: In program module assignvalue" } *)
+ (* { dg-begin-multiline-output "" }
+runtime error will occur, assignment will cause a range error, as the runtime instance value of 'CARDINAL' does not overlap with the type 'INTEGER'
+ { dg-end-multiline-output "" } *)
+
+END assignvalue.
diff --git a/gcc/testsuite/gm2.dg/doc/examples/plugin/fail/doc-examples-plugin-fail.exp b/gcc/testsuite/gm2.dg/doc/examples/plugin/fail/doc-examples-plugin-fail.exp
new file mode 100644
index 0000000..6ddf2d5
--- /dev/null
+++ b/gcc/testsuite/gm2.dg/doc/examples/plugin/fail/doc-examples-plugin-fail.exp
@@ -0,0 +1,25 @@
+# Compile tests, no torture testing.
+#
+# These tests should all generate errors if the plugin is available.
+
+# Load support procs.
+load_lib gm2-dg.exp
+
+gm2_init_pim4 $srcdir/$subdir
+
+# Initialize `dg'.
+dg-init
+
+# If the --enable-plugin has not been enabled during configure, bail.
+if { ![info exists TESTING_IN_BUILD_TREE] || ![info exists ENABLE_PLUGIN] } {
+ return
+}
+
+# Main loop.
+
+set tests [lsort [glob -nocomplain $srcdir/$subdir/*.mod]]
+
+gm2-dg-runtest $tests "" ""
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod b/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod
new file mode 100644
index 0000000..cbcc804
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod
@@ -0,0 +1,10 @@
+MODULE constintarraybyte ;
+
+FROM FormatStrings IMPORT Sprintf1 ;
+FROM DynamicStrings IMPORT String, InitString ;
+
+VAR
+ s: String ;
+BEGIN
+ s := Sprintf1 (InitString("abc%x\n"), 42)
+END constintarraybyte.
diff --git a/gcc/testsuite/gm2/pim/pass/highbit.mod b/gcc/testsuite/gm2/pim/pass/highbit.mod
new file mode 100644
index 0000000..c9c872a
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/pass/highbit.mod
@@ -0,0 +1,13 @@
+MODULE highbit ;
+
+FROM libc IMPORT printf ;
+
+TYPE
+ set = BITSET ;
+
+CONST
+ HighBit = MAX (set) ;
+
+BEGIN
+ printf ("the MAX (set) = %d\n", HighBit)
+END highbit.
diff --git a/gcc/testsuite/gm2/pim/pass/highbit2.mod b/gcc/testsuite/gm2/pim/pass/highbit2.mod
new file mode 100644
index 0000000..940556d
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/pass/highbit2.mod
@@ -0,0 +1,13 @@
+MODULE highbit2 ;
+
+FROM libc IMPORT printf ;
+
+TYPE
+ set = BITSET ;
+
+CONST
+ HighBit = MAX (BITSET) ;
+
+BEGIN
+ printf ("the MAX (BITSET) = %d\n", HighBit)
+END highbit2.
diff --git a/gcc/testsuite/gm2/pimlib/run/pass/format2.mod b/gcc/testsuite/gm2/pimlib/run/pass/format2.mod
new file mode 100644
index 0000000..2ad6a8c
--- /dev/null
+++ b/gcc/testsuite/gm2/pimlib/run/pass/format2.mod
@@ -0,0 +1,63 @@
+MODULE format2;
+
+FROM libc IMPORT exit, printf ;
+FROM Terminal IMPORT Write, WriteLn;
+FROM NumberIO IMPORT WriteCard;
+FROM DynamicStrings IMPORT String, Length, char, InitString;
+FROM FormatStrings IMPORT Sprintf1;
+
+PROCEDURE WriteString (s: String);
+VAR
+ l, i: CARDINAL;
+BEGIN
+ l := Length (s) ;
+ i := 0 ;
+ WHILE i < l DO
+ Write (char (s, i)) ;
+ INC (i)
+ END
+END WriteString;
+
+
+(*
+ assert -
+*)
+
+PROCEDURE assert (cond: BOOLEAN; line: CARDINAL; file: ARRAY OF CHAR) ;
+BEGIN
+ IF NOT cond
+ THEN
+ printf ("%s:%d assertion failed\n", file, line);
+ exit (1)
+ END
+END assert ;
+
+
+VAR
+ n: CARDINAL;
+ r, s: String;
+BEGIN
+ n := 2;
+ r := InitString("%u pieces of cake") ;
+ WriteString (r) ; WriteLn ;
+ assert (Length (r) = 17, __LINE__, __FILE__) ;
+ s := Sprintf1 (r, n) ;
+ WriteCard (Length (s), 4) ; WriteLn ;
+ assert (Length (s) = 16, __LINE__, __FILE__) ;
+
+ r := InitString("%d pieces of cake") ;
+ WriteString (r) ; WriteLn ;
+ assert (Length (r) = 17, __LINE__, __FILE__) ;
+ s := Sprintf1 (r, n) ;
+ WriteCard (Length (s), 4) ; WriteLn ;
+ assert (Length (s) = 16, __LINE__, __FILE__) ;
+
+ r := InitString("%x pieces of cake") ;
+ WriteString (r) ; WriteLn ;
+ assert (Length (r) = 17, __LINE__, __FILE__) ;
+ s := Sprintf1 (r, n) ;
+ WriteCard (Length (s), 4) ; WriteLn ;
+ assert (Length (s) = 16, __LINE__, __FILE__) ;
+
+ WriteString (InitString ('all tests pass')) ; WriteLn ;
+END format2.
diff --git a/gcc/testsuite/gnat.dg/specs/opt7.ads b/gcc/testsuite/gnat.dg/specs/opt7.ads
new file mode 100644
index 0000000..ee151f0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt7.ads
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+-- { dg-options "-O2 -gnatn" }
+
+with Opt7_Pkg; use Opt7_Pkg;
+
+package Opt7 is
+
+ type Rec is record
+ E : Enum;
+ end record;
+
+ function Image (R : Rec) return String is
+ (if R.E = A then Image (R.E) else "");
+
+end Opt7;
diff --git a/gcc/testsuite/gnat.dg/specs/opt7_pkg.adb b/gcc/testsuite/gnat.dg/specs/opt7_pkg.adb
new file mode 100644
index 0000000..1c9d79b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt7_pkg.adb
@@ -0,0 +1,15 @@
+package body Opt7_Pkg is
+
+ type Constant_String_Access is access constant String;
+
+ type Enum_Name is array (Enum) of Constant_String_Access;
+
+ Enum_Name_Table : constant Enum_Name :=
+ (A => new String'("A"), B => new String'("B"));
+
+ function Image (E : Enum) return String is
+ begin
+ return Enum_Name_Table (E).all;
+ end Image;
+
+end Opt7_Pkg;
diff --git a/gcc/testsuite/gnat.dg/specs/opt7_pkg.ads b/gcc/testsuite/gnat.dg/specs/opt7_pkg.ads
new file mode 100644
index 0000000..2dd271b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/opt7_pkg.ads
@@ -0,0 +1,9 @@
+-- { dg-excess-errors "no code generated" }
+
+package Opt7_Pkg is
+
+ type Enum is (A, B);
+
+ function Image (E : Enum) return String with Inline;
+
+end Opt7_Pkg;
diff --git a/gcc/testsuite/gnat.dg/sso19.adb b/gcc/testsuite/gnat.dg/sso19.adb
new file mode 100644
index 0000000..497d9874
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sso19.adb
@@ -0,0 +1,13 @@
+-- { dg-do run }
+-- { dg-options "-O2" }
+
+with SSO19_Pkg; use SSO19_Pkg;
+
+procedure SSO19 is
+ R : constant Rec := (D => (I => 8, F => 4.6095713E-41));
+
+begin
+ if not Is_Valid (R) then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/sso19_pkg.adb b/gcc/testsuite/gnat.dg/sso19_pkg.adb
new file mode 100644
index 0000000..cbcb2f9
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sso19_pkg.adb
@@ -0,0 +1,13 @@
+package body SSO19_Pkg is
+
+ function Is_Valid_Private (Item : Data) return Boolean is
+ begin
+ return Item.I'Valid and Item.F'Valid;
+ end Is_Valid_Private;
+
+ function Is_Valid (Item : Rec) return Boolean is
+ begin
+ return Is_Valid_Private (Item.D);
+ end Is_Valid;
+
+end SSO19_Pkg;
diff --git a/gcc/testsuite/gnat.dg/sso19_pkg.ads b/gcc/testsuite/gnat.dg/sso19_pkg.ads
new file mode 100644
index 0000000..cad5368
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sso19_pkg.ads
@@ -0,0 +1,24 @@
+with System;
+
+package SSO19_Pkg is
+
+ subtype Small_Int is Short_Integer range -1000 .. 1000;
+
+ type Data is record
+ I : Small_Int;
+ F : Float;
+ end record;
+ for Data use record
+ I at 0 range 0 .. 15;
+ F at 4 range 0 .. 31;
+ end record;
+ for Data'Bit_Order use System.High_Order_First;
+ for Data'Scalar_Storage_Order use System.High_Order_First;
+
+ type Rec is record
+ D : Data;
+ end record;
+
+ function Is_Valid (Item : Rec) return Boolean;
+
+end SSO19_Pkg;
diff --git a/gcc/testsuite/lib/gm2-dg.exp b/gcc/testsuite/lib/gm2-dg.exp
index eaed554..5a36507 100644
--- a/gcc/testsuite/lib/gm2-dg.exp
+++ b/gcc/testsuite/lib/gm2-dg.exp
@@ -65,7 +65,7 @@ proc gm2-dg-runtest { testcases flags default-extra-flags } {
if [expr [search_for $test "dg-do run"]] {
set option_list $TORTURE_OPTIONS
} else {
- set option_list [list { -O } ]
+ set option_list [list { -O -O2 } ]
}
set nshort [file tail [file dirname $test]]/[file tail $test]
@@ -77,3 +77,38 @@ proc gm2-dg-runtest { testcases flags default-extra-flags } {
}
}
+
+# Check if frontend has been configured with option.
+# This checks a configure build option was used and not
+# the availability of a compiler command line option.
+
+proc gm2-dg-frontend-configure-check { option } {
+ global GCC_UNDER_TEST
+
+ # ignore any arguments after the command
+ set compiler [lindex $GCC_UNDER_TEST 0]
+
+ if ![is_remote host] {
+ set compiler_name [which $compiler]
+ } else {
+ set compiler_name $compiler
+ }
+
+ # verify that the compiler exists
+ if { $compiler_name != 0 } then {
+ set tmp [remote_exec host "$compiler -v"]
+ set status [lindex $tmp 0]
+ set output [lindex $tmp 1]
+ regexp "Configured with.*\[\n\r\]" $output config
+ set option "*${option}*"
+ if { [string match $option $config] } {
+ return 1
+ } else {
+ return 0
+ }
+ } else {
+ # compiler does not exist (this should have already been detected)
+ warning "$compiler does not exist"
+ return 0
+ }
+}
diff --git a/gcc/tree-chrec.cc b/gcc/tree-chrec.cc
index 38eb329..a7c2f8d 100644
--- a/gcc/tree-chrec.cc
+++ b/gcc/tree-chrec.cc
@@ -1490,7 +1490,7 @@ convert_affine_scev (class loop *loop, tree type,
new_step = *step;
if (TYPE_PRECISION (step_type) > TYPE_PRECISION (ct) && TYPE_UNSIGNED (ct))
{
- tree signed_ct = build_nonstandard_integer_type (TYPE_PRECISION (ct), 0);
+ tree signed_ct = signed_type_for (ct);
new_step = chrec_convert (signed_ct, new_step, at_stmt,
use_overflow_semantics);
}
diff --git a/gcc/tree-nrv.cc b/gcc/tree-nrv.cc
index 180ce39..3be97af 100644
--- a/gcc/tree-nrv.cc
+++ b/gcc/tree-nrv.cc
@@ -167,16 +167,21 @@ pass_nrv::execute (function *fun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
- tree ret_val;
if (greturn *return_stmt = dyn_cast <greturn *> (stmt))
{
- /* In a function with an aggregate return value, the
- gimplifier has changed all non-empty RETURN_EXPRs to
- return the RESULT_DECL. */
- ret_val = gimple_return_retval (return_stmt);
- if (ret_val)
- gcc_assert (ret_val == result);
+ /* We cannot perform NRV optimizations in a function with an
+ aggregate return value if there is a return that does not
+ return RESULT_DECL. We used to assert this scenario doesn't
+ happen: the gimplifier has changed all non-empty RETURN_EXPRs
+ to return the RESULT_DECL. However, per PR119835 we may run
+ into this scenario for offloading compilation, and therefore
+ gracefully bail out. */
+ if (tree ret_val = gimple_return_retval (return_stmt))
+ {
+ if (ret_val != result)
+ return 0;
+ }
}
else if (gimple_has_lhs (stmt)
&& gimple_get_lhs (stmt) == result)
diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
index 302b73e..4b6daf7 100644
--- a/gcc/tree-sra.cc
+++ b/gcc/tree-sra.cc
@@ -4205,8 +4205,10 @@ sra_modify_expr (tree *expr, bool write, gimple_stmt_iterator *stmt_gsi,
}
else
{
- gassign *stmt;
+ if (TREE_READONLY (access->base))
+ return false;
+ gassign *stmt;
if (access->grp_partial_lhs)
repl = force_gimple_operand_gsi (stmt_gsi, repl, true,
NULL_TREE, true,
diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 225964c..71a46f7 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -3293,7 +3293,8 @@ can_sm_ref_p (class loop *loop, im_mem_ref *ref)
explicitly. */
base = get_base_address (ref->mem.ref);
if ((tree_could_trap_p (ref->mem.ref)
- || (DECL_P (base) && TREE_READONLY (base)))
+ || (DECL_P (base) && TREE_READONLY (base))
+ || TREE_CODE (base) == STRING_CST)
/* ??? We can at least use false here, allowing loads? We
are forcing conditional stores if the ref is not always
stored to later anyway. So this would only guard
diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
index eb03ebe..1954c28 100644
--- a/gcc/tree-ssa-math-opts.cc
+++ b/gcc/tree-ssa-math-opts.cc
@@ -1053,6 +1053,7 @@ pass_cse_reciprocals::execute (function *fun)
continue;
gimple_replace_ssa_lhs (call, arg1);
+ reset_flow_sensitive_info (arg1);
if (gimple_call_internal_p (call) != (ifn != IFN_LAST))
{
auto_vec<tree, 4> args;
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 7f3390b..aaebae6 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -3565,8 +3565,9 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
/* tree_could_trap_p is a predicate for rvalues, so check
for readonly memory explicitly. */
|| ((base = get_base_address (lhs))
- && DECL_P (base)
- && TREE_READONLY (base)))
+ && ((DECL_P (base)
+ && TREE_READONLY (base))
+ || TREE_CODE (base) == STRING_CST)))
return false;
}
diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc
index d0b74b2..3adb83e 100644
--- a/gcc/tree-ssa-threadbackward.cc
+++ b/gcc/tree-ssa-threadbackward.cc
@@ -349,9 +349,6 @@ back_threader::find_paths_to_names (basic_block bb, bitmap interesting,
unsigned overall_paths,
back_threader_profitability &profit)
{
- if (m_visited_bbs.add (bb))
- return;
-
m_path.safe_push (bb);
// Try to resolve the path without looking back. Avoid resolving paths
@@ -377,7 +374,8 @@ back_threader::find_paths_to_names (basic_block bb, bitmap interesting,
// Continue looking for ways to extend the path but limit the
// search space along a branch
else if ((overall_paths = overall_paths * EDGE_COUNT (bb->preds))
- <= (unsigned)param_max_jump_thread_paths)
+ <= (unsigned)param_max_jump_thread_paths
+ && !m_visited_bbs.add (bb))
{
// For further greedy searching we want to remove interesting
// names defined in BB but add ones on the PHI edges for the
@@ -489,6 +487,7 @@ back_threader::find_paths_to_names (basic_block bb, bitmap interesting,
backtracking we have to restore it. */
for (int j : new_imports)
bitmap_clear_bit (m_imports, j);
+ m_visited_bbs.remove (bb);
}
else if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " FAIL: Search space limit %d reached.\n",
@@ -496,7 +495,6 @@ back_threader::find_paths_to_names (basic_block bb, bitmap interesting,
// Reset things to their original state.
m_path.pop ();
- m_visited_bbs.remove (bb);
}
// Search backwards from BB looking for paths where the final
diff --git a/gcc/tree-streamer-in.cc b/gcc/tree-streamer-in.cc
index 215350f..e57e6c65 100644
--- a/gcc/tree-streamer-in.cc
+++ b/gcc/tree-streamer-in.cc
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "asan.h"
#include "opts.h"
#include "stor-layout.h"
+#include "hooks.h" /* For 'hook_bool_const_tree_false'. */
/* Read a STRING_CST from the string table in DATA_IN using input
@@ -386,7 +387,16 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
TYPE_STRING_FLAG (expr) = (unsigned) bp_unpack_value (bp, 1);
if (AGGREGATE_TYPE_P (expr))
TYPE_TYPELESS_STORAGE (expr) = (unsigned) bp_unpack_value (bp, 1);
- TYPE_EMPTY_P (expr) = (unsigned) bp_unpack_value (bp, 1);
+ if (!lto_stream_offload_p)
+ TYPE_EMPTY_P (expr) = (unsigned) bp_unpack_value (bp, 1);
+ else
+ {
+ /* All offload targets use the default ('false') 'TARGET_EMPTY_RECORD_P'.
+ If that ever changes, we'll have to properly initialize 'TYPE_EMPTY_P'
+ here, see 'stor-layout.cc:finalize_type_size' and PR120308. */
+ gcc_assert (targetm.calls.empty_record_p == hook_bool_const_tree_false);
+ TYPE_EMPTY_P (expr) = 0;
+ }
if (FUNC_OR_METHOD_TYPE_P (expr))
TYPE_NO_NAMED_ARGS_STDARG_P (expr) = (unsigned) bp_unpack_value (bp, 1);
if (RECORD_OR_UNION_TYPE_P (expr))
diff --git a/gcc/tree-streamer-out.cc b/gcc/tree-streamer-out.cc
index 3422725..4d008f7 100644
--- a/gcc/tree-streamer-out.cc
+++ b/gcc/tree-streamer-out.cc
@@ -372,7 +372,8 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
bp_pack_value (bp, TYPE_STRING_FLAG (expr), 1);
if (AGGREGATE_TYPE_P (expr))
bp_pack_value (bp, TYPE_TYPELESS_STORAGE (expr), 1);
- bp_pack_value (bp, TYPE_EMPTY_P (expr), 1);
+ if (!lto_stream_offload_p)
+ bp_pack_value (bp, TYPE_EMPTY_P (expr), 1);
if (FUNC_OR_METHOD_TYPE_P (expr))
bp_pack_value (bp, TYPE_NO_NAMED_ARGS_STDARG_P (expr), 1);
if (RECORD_OR_UNION_TYPE_P (expr))
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index d6cd93a..aaeb522 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -7165,7 +7165,8 @@ vect_can_force_dr_alignment_p (const_tree decl, poly_uint64 alignment)
return false;
if (decl_in_symtab_p (decl)
- && !symtab_node::get (decl)->can_increase_alignment_p ())
+ && (!symtab_node::get (decl)
+ || !symtab_node::get (decl)->can_increase_alignment_p ()))
return false;
if (TREE_STATIC (decl))
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 2d35fa1..c824b5a 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -6189,7 +6189,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
/* Create an induction variable. */
gimple_stmt_iterator incr_gsi;
bool insert_after;
- vect_iv_increment_position (loop_exit, &incr_gsi, &insert_after);
+ vect_iv_increment_position (LOOP_VINFO_IV_EXIT (loop_vinfo),
+ &incr_gsi, &insert_after);
create_iv (series_vect, PLUS_EXPR, vec_step, NULL_TREE, loop, &incr_gsi,
insert_after, &indx_before_incr, &indx_after_incr);
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 958f000..f5286e6 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -2616,13 +2616,14 @@ out:
if (oprnds_info[0]->def_stmts[0]
&& is_a<gassign *> (oprnds_info[0]->def_stmts[0]->stmt))
code = gimple_assign_rhs_code (oprnds_info[0]->def_stmts[0]->stmt);
+ basic_block bb = nullptr;
for (unsigned j = 0; j < group_size; ++j)
{
FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info)
{
stmt_vec_info stmt_info = oprnd_info->def_stmts[j];
- if (!stmt_info || !stmt_info->stmt
+ if (!stmt_info
|| !is_a<gassign *> (stmt_info->stmt)
|| gimple_assign_rhs_code (stmt_info->stmt) != code
|| skip_args[i])
@@ -2630,6 +2631,14 @@ out:
success = false;
break;
}
+ /* Avoid mixing lanes with defs in different basic-blocks. */
+ if (!bb)
+ bb = gimple_bb (vect_orig_stmt (stmt_info)->stmt);
+ else if (gimple_bb (vect_orig_stmt (stmt_info)->stmt) != bb)
+ {
+ success = false;
+ break;
+ }
bool exists;
unsigned &stmt_idx
@@ -7833,21 +7842,70 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
node, node_instance, cost_vec);
}
+static int
+sort_ints (const void *a_, const void *b_)
+{
+ int a = *(const int *)a_;
+ int b = *(const int *)b_;
+ return a - b;
+}
+
/* Verify if we can externalize a set of internal defs. */
static bool
vect_slp_can_convert_to_external (const vec<stmt_vec_info> &stmts)
{
+ /* Constant generation uses get_later_stmt which can only handle
+ defs from the same BB or a set of defs that can be ordered
+ with a dominance query. */
basic_block bb = NULL;
+ bool all_same = true;
+ auto_vec<int> bbs;
+ bbs.reserve_exact (stmts.length ());
for (stmt_vec_info stmt : stmts)
- if (!stmt)
- return false;
- /* Constant generation uses get_later_stmt which can only handle
- defs from the same BB. */
- else if (!bb)
- bb = gimple_bb (stmt->stmt);
- else if (gimple_bb (stmt->stmt) != bb)
+ {
+ if (!stmt)
+ return false;
+ else if (!bb)
+ bb = gimple_bb (stmt->stmt);
+ else if (gimple_bb (stmt->stmt) != bb)
+ all_same = false;
+ bbs.quick_push (gimple_bb (stmt->stmt)->index);
+ }
+ if (all_same)
+ return true;
+
+ /* Produce a vector of unique BB indexes for the defs. */
+ bbs.qsort (sort_ints);
+ unsigned i, j;
+ for (i = 1, j = 1; i < bbs.length (); ++i)
+ if (bbs[i] != bbs[j-1])
+ bbs[j++] = bbs[i];
+ gcc_assert (j >= 2);
+ bbs.truncate (j);
+
+ if (bbs.length () == 2)
+ return (dominated_by_p (CDI_DOMINATORS,
+ BASIC_BLOCK_FOR_FN (cfun, bbs[0]),
+ BASIC_BLOCK_FOR_FN (cfun, bbs[1]))
+ || dominated_by_p (CDI_DOMINATORS,
+ BASIC_BLOCK_FOR_FN (cfun, bbs[1]),
+ BASIC_BLOCK_FOR_FN (cfun, bbs[0])));
+
+ /* ??? For more than two BBs we can sort the vector and verify the
+ result is a total order. But we can't use vec::qsort with a
+ compare function using a dominance query since there's no way to
+ signal failure and any fallback for an unordered pair would
+ fail qsort_chk later.
+ For now simply hope that ordering after BB index provides the
+ best candidate total order. If required we can implement our
+ own mergesort or export an entry without checking. */
+ for (unsigned i = 1; i < bbs.length (); ++i)
+ if (!dominated_by_p (CDI_DOMINATORS,
+ BASIC_BLOCK_FOR_FN (cfun, bbs[i]),
+ BASIC_BLOCK_FOR_FN (cfun, bbs[i-1])))
return false;
+
return true;
}
@@ -11162,9 +11220,14 @@ vect_schedule_slp_node (vec_info *vinfo,
== cycle_phi_info_type);
gphi *phi = as_a <gphi *>
(vect_find_last_scalar_stmt_in_slp (child)->stmt);
- if (!last_stmt
- || vect_stmt_dominates_stmt_p (last_stmt, phi))
+ if (!last_stmt)
last_stmt = phi;
+ else if (vect_stmt_dominates_stmt_p (last_stmt, phi))
+ last_stmt = phi;
+ else if (vect_stmt_dominates_stmt_p (phi, last_stmt))
+ ;
+ else
+ gcc_unreachable ();
}
/* We are emitting all vectorized stmts in the same place and
the last one is the last.
@@ -11175,9 +11238,14 @@ vect_schedule_slp_node (vec_info *vinfo,
FOR_EACH_VEC_ELT (SLP_TREE_VEC_DEFS (child), j, vdef)
{
gimple *vstmt = SSA_NAME_DEF_STMT (vdef);
- if (!last_stmt
- || vect_stmt_dominates_stmt_p (last_stmt, vstmt))
+ if (!last_stmt)
+ last_stmt = vstmt;
+ else if (vect_stmt_dominates_stmt_p (last_stmt, vstmt))
last_stmt = vstmt;
+ else if (vect_stmt_dominates_stmt_p (vstmt, last_stmt))
+ ;
+ else
+ gcc_unreachable ();
}
}
else if (!SLP_TREE_VECTYPE (child))
@@ -11190,9 +11258,14 @@ vect_schedule_slp_node (vec_info *vinfo,
&& !SSA_NAME_IS_DEFAULT_DEF (def))
{
gimple *stmt = SSA_NAME_DEF_STMT (def);
- if (!last_stmt
- || vect_stmt_dominates_stmt_p (last_stmt, stmt))
+ if (!last_stmt)
+ last_stmt = stmt;
+ else if (vect_stmt_dominates_stmt_p (last_stmt, stmt))
last_stmt = stmt;
+ else if (vect_stmt_dominates_stmt_p (stmt, last_stmt))
+ ;
+ else
+ gcc_unreachable ();
}
}
else
@@ -11213,9 +11286,14 @@ vect_schedule_slp_node (vec_info *vinfo,
&& !SSA_NAME_IS_DEFAULT_DEF (vdef))
{
gimple *vstmt = SSA_NAME_DEF_STMT (vdef);
- if (!last_stmt
- || vect_stmt_dominates_stmt_p (last_stmt, vstmt))
+ if (!last_stmt)
last_stmt = vstmt;
+ else if (vect_stmt_dominates_stmt_p (last_stmt, vstmt))
+ last_stmt = vstmt;
+ else if (vect_stmt_dominates_stmt_p (vstmt, last_stmt))
+ ;
+ else
+ gcc_unreachable ();
}
}
}
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 01d19c7..63991c3 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -30,6 +30,7 @@ typedef struct _slp_tree *slp_tree;
#include "internal-fn.h"
#include "tree-ssa-operands.h"
#include "gimple-match.h"
+#include "dominance.h"
/* Used for naming of new temporaries. */
enum vect_var_kind {
@@ -1870,11 +1871,25 @@ vect_orig_stmt (stmt_vec_info stmt_info)
inline stmt_vec_info
get_later_stmt (stmt_vec_info stmt1_info, stmt_vec_info stmt2_info)
{
- if (gimple_uid (vect_orig_stmt (stmt1_info)->stmt)
- > gimple_uid (vect_orig_stmt (stmt2_info)->stmt))
+ gimple *stmt1 = vect_orig_stmt (stmt1_info)->stmt;
+ gimple *stmt2 = vect_orig_stmt (stmt2_info)->stmt;
+ if (gimple_bb (stmt1) == gimple_bb (stmt2))
+ {
+ if (gimple_uid (stmt1) > gimple_uid (stmt2))
+ return stmt1_info;
+ else
+ return stmt2_info;
+ }
+ /* ??? We should be really calling this function only with stmts
+ in the same BB but we can recover if there's a domination
+ relationship between them. */
+ else if (dominated_by_p (CDI_DOMINATORS,
+ gimple_bb (stmt1), gimple_bb (stmt2)))
return stmt1_info;
- else
+ else if (dominated_by_p (CDI_DOMINATORS,
+ gimple_bb (stmt2), gimple_bb (stmt1)))
return stmt2_info;
+ gcc_unreachable ();
}
/* If STMT_INFO has been replaced by a pattern statement, return the
diff --git a/gcc/tree.h b/gcc/tree.h
index f3508ba..b36b87d 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -5572,7 +5572,7 @@ storage_order_barrier_p (const_tree t)
&& TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (op)))
return true;
- return false;
+ return reverse_storage_order_for_component_p (op);
}
/* Given a DECL or TYPE, return the scope in which it was declared, or
diff --git a/include/ChangeLog.omp b/include/ChangeLog.omp
index 74413c2..7a8f281 100644
--- a/include/ChangeLog.omp
+++ b/include/ChangeLog.omp
@@ -1,3 +1,11 @@
+2025-06-10 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-02 Tobias Burnus <tburnus@baylibre.com>
+
+ PR libgomp/120444
+ * cuda/cuda.h (cuMemsetD8, cuMemsetD8Async): Declare.
+
2025-05-15 Julian Brown <julian@codesourcery.com>
* gomp-constants.h (gomp_map_kind): Add GOMP_MAP_TO_GRID,
diff --git a/include/cuda/cuda.h b/include/cuda/cuda.h
index 5e4b7f1..6be1ac0 100644
--- a/include/cuda/cuda.h
+++ b/include/cuda/cuda.h
@@ -279,6 +279,9 @@ CUresult cuMemcpy3D (const CUDA_MEMCPY3D *);
CUresult cuMemcpy3DAsync (const CUDA_MEMCPY3D *, CUstream);
CUresult cuMemcpy3DPeer (const CUDA_MEMCPY3D_PEER *);
CUresult cuMemcpy3DPeerAsync (const CUDA_MEMCPY3D_PEER *, CUstream);
+#define cuMemsetD8 cuMemsetD8_v2
+CUresult cuMemsetD8 (CUdeviceptr, unsigned char, size_t);
+CUresult cuMemsetD8Async (CUdeviceptr, unsigned char, size_t, CUstream);
#define cuMemFree cuMemFree_v2
CUresult cuMemFree (CUdeviceptr);
CUresult cuMemFreeHost (void *);
diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog
index 6af4190..f528d23 100644
--- a/libcpp/po/ChangeLog
+++ b/libcpp/po/ChangeLog
@@ -1,3 +1,19 @@
+2025-05-16 Joseph Myers <josmyers@redhat.com>
+
+ * es.po: Update.
+
+2025-05-15 Joseph Myers <josmyers@redhat.com>
+
+ * zh_CN.po: Update.
+
+2025-05-14 Joseph Myers <josmyers@redhat.com>
+
+ * es.po: Update.
+
+2025-05-12 Joseph Myers <josmyers@redhat.com>
+
+ * es.po: Update.
+
2025-04-25 Release Manager
* GCC 15.1.0 released.
diff --git a/libcpp/po/es.po b/libcpp/po/es.po
index 4948e7a..65207a8 100644
--- a/libcpp/po/es.po
+++ b/libcpp/po/es.po
@@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: cpplib 15.1-b20250316\n"
"Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n"
"POT-Creation-Date: 2025-03-14 22:05+0000\n"
-"PO-Revision-Date: 2025-05-12 11:20-0600\n"
+"PO-Revision-Date: 2025-05-16 12:16-0600\n"
"Last-Translator: Cristian Othón Martínez Vera <cfuga@cfuga.mx>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
"Language: es\n"
@@ -58,7 +58,7 @@ msgstr "los nombres universales de carácter de C99 son incompatibles con C90"
#: charset.cc:1556
#, gcc-internal-format
msgid "the meaning of %<\\%c%> is different in traditional C"
-msgstr "el significado de <\\%c> es diferente en C tradicional"
+msgstr "el significado de %<\\%c%> es diferente en C tradicional"
#: charset.cc:1595
#, gcc-internal-format
@@ -95,7 +95,7 @@ msgstr "¿Quiso decir %<\\N{%s}%>?"
#: charset.cc:1693
#, gcc-internal-format
msgid "%<\\N{%> not terminated with %<}%> after %.*s; treating it as separate tokens"
-msgstr "%<\\N{%> no termina con %<}%> después de %.*s; se trata como elemntos separados"
+msgstr "%<\\N{%> no termina con %<}%> después de %.*s; se trata como elementos separados"
#: charset.cc:1702
#, gcc-internal-format
@@ -204,7 +204,7 @@ msgstr "%<\\x{%> no termina con %<}%> después de %.*s"
#: charset.cc:2204
msgid "hex escape sequence out of range"
-msgstr "secuencia de escape hexadecimal fuera de rango"
+msgstr "secuencia de escape hexadecimal fuera de intervalo"
#: charset.cc:2247
#, gcc-internal-format
@@ -218,7 +218,7 @@ msgstr "%<\\o{%> no termina con %<}%> después de %.*s"
#: charset.cc:2314
msgid "octal escape sequence out of range"
-msgstr "secuencia de escape octal fuera de rango"
+msgstr "secuencia de escape octal fuera de intervalo"
#: charset.cc:2366 charset.cc:2376
#, gcc-internal-format
@@ -247,11 +247,11 @@ msgstr "secuencia de escape desconocida: %<\\%s%>"
#: charset.cc:2436
msgid "converting escape sequence to execution character set"
-msgstr "se convierte una secuencia de escape al conjunto de caracteres de ejecución"
+msgstr "se convierte la secuencia de escape al conjunto de caracteres de ejecución"
#: charset.cc:2576
msgid "missing open quote"
-msgstr "falta comilla abierta"
+msgstr "falta comilla al inicio"
#: charset.cc:2807
msgid "character not encodable in a single execution character code unit"
@@ -373,7 +373,7 @@ msgstr "los nombres de macro deben ser identificadores"
#: directives.cc:743 directives.cc:747
#, gcc-internal-format
msgid "undefining %qs"
-msgstr "borrando la definición de %qs"
+msgstr "se borra la definición de %qs"
#: directives.cc:805
#, gcc-internal-format
@@ -383,7 +383,7 @@ msgstr "falta el carácter de terminación %<>%>"
#: directives.cc:865
#, gcc-internal-format
msgid "%<#%s%> expects %<\"FILENAME\"%> or %<<FILENAME>%>"
-msgstr "%<#%s$> espera %<«NOMBREFICHERO»%> o %<<NOMBREFICHERO>%>"
+msgstr "%<#%s$> espera %<\"NOMBREFICHERO\"%> o %<<NOMBREFICHERO>%>"
#: directives.cc:911 directives.cc:1391
#, gcc-internal-format, gfc-internal-format
@@ -398,7 +398,7 @@ msgstr "la profundidad anidada %u de %<#include%> excede el máximo de %u (utili
#: directives.cc:965
#, gcc-internal-format
msgid "%<#include_next%> in primary source file"
-msgstr "%<#include_next%> en fichero primario de código fuente"
+msgstr "%<#include_next%> en fichero de código fuente primario"
#: directives.cc:1037 directives.cc:1059 directives.cc:1062 directives.cc:1065
#, gcc-internal-format, gfc-internal-format
@@ -447,7 +447,7 @@ msgstr "se esperaba %<(%>"
#: directives.cc:1269
#, gcc-internal-format
msgid "too large %<gnu::offset%> argument"
-msgstr "argumento %<gnu::offset%> demasiado grande"
+msgstr "el argumento %<gnu::offset%> es demasiado grande"
#: directives.cc:1316
msgid "expected character string literal"
@@ -485,7 +485,7 @@ msgstr "%qs después de %<#line%> no es un entero positivo"
#: directives.cc:1513 directives.cc:1516
msgid "line number out of range"
-msgstr "número de línea fuera de rango"
+msgstr "número de línea fuera de intervalo"
#: directives.cc:1529 directives.cc:1610
#, gcc-internal-format
@@ -682,7 +682,7 @@ msgstr "uso de una constante de coma flotante hexadecimal C99"
#: expr.cc:789
#, gcc-internal-format
msgid "invalid suffix %<%.*s%> on floating constant"
-msgstr "sufijo %<%.*s%> inválido en la constante de coma flotante"
+msgstr "sufijo %<%.*s%> inválido en una constante de coma flotante"
#: expr.cc:800 expr.cc:870
#, gcc-internal-format
@@ -696,7 +696,7 @@ msgstr "el sufijo para una constante doble es una extensión GCC"
#: expr.cc:815
#, gcc-internal-format
msgid "invalid suffix %<%.*s%> with hexadecimal floating constant"
-msgstr "sufijo %<%.*s%> inválido en la constante de coma flotante hexadecimal"
+msgstr "sufijo %<%.*s%> inválido en una constante de coma flotante hexadecimal"
#: expr.cc:829 expr.cc:833
msgid "decimal floating constants are a C23 feature"
@@ -705,7 +705,7 @@ msgstr "las constantes de coma flotante decimal son una característica de C23"
#: expr.cc:853
#, gcc-internal-format
msgid "invalid suffix %<%.*s%> on integer constant"
-msgstr "sufijo %<%.*s%> inválido en la constante entera"
+msgstr "sufijo %<%.*s%> inválido en una constante entera"
#: expr.cc:878
msgid "use of C++11 long long integer constant"
@@ -744,7 +744,7 @@ msgstr "las constantes imaginarias son una característica de C2Y"
#: expr.cc:956
msgid "binary constants are a C++14 feature or GCC extension"
-msgstr "las constantes binarias son una característica C++14 o una extensión de GCC"
+msgstr "las constantes binarias son una característica de C++14 o una extensión de GCC"
#: expr.cc:961
msgid "binary constants are a C23 feature or GCC extension"
@@ -838,7 +838,7 @@ msgstr "operando de parámetro imbuído demasiado grande"
#: expr.cc:1658
#, gcc-internal-format, gfc-internal-format
msgid "impossible operator '%u'"
-msgstr "operador '%u' imposible"
+msgstr "operador «%u» imposible"
#: expr.cc:1759
#, gcc-internal-format
@@ -852,7 +852,7 @@ msgstr "%<?%> sin %<:%> a continuación"
#: expr.cc:1798
msgid "integer overflow in preprocessor expression"
-msgstr "desbordamiento entero en expresión del preprocesador"
+msgstr "desbordamiento entero en una expresión del preprocesador"
#: expr.cc:1803
#, gcc-internal-format
@@ -871,7 +871,7 @@ msgstr "el operando derecho de %qs cambia de signo cuando es promovido"
#: expr.cc:2099
msgid "traditional C rejects the unary plus operator"
-msgstr "C tradicional rechaza el operador unario mas"
+msgstr "C tradicional rechaza el operador unario más"
#: expr.cc:2197
#, gcc-internal-format, gfc-internal-format
@@ -890,7 +890,7 @@ msgstr "directorio NULL en %<find_file%>"
#: files.cc:603
msgid "one or more PCH files were found, but they were invalid"
-msgstr "se encontró uno o más ficheros PCH, pero eran inválidos"
+msgstr "se encontraron uno o más ficheros PCH, pero eran inválidos"
#: files.cc:607
#, gcc-internal-format
@@ -934,7 +934,7 @@ msgstr "Guardias múltiples de include pueden ser útiles para:\n"
#: files.cc:2306
#, gcc-internal-format
msgid "header guard %qs followed by %<#define%> of a different macro"
-msgstr "guarda de encabezado %qs seguida por %<#define%> de un macro diferente"
+msgstr "guarda de cabecera %qs seguida por %<#define%> de un macro diferente"
#: files.cc:2310
#, gcc-internal-format
@@ -954,7 +954,7 @@ msgstr "la aritmética del preprocesador tiene una precisión máxima de %lu bit
#: init.cc:687
#, gcc-internal-format
msgid "CPP arithmetic must be at least as precise as a target %<int%>"
-msgstr "la aritmética de CPP debe se al menos tan precisa como un %<int%> del objetivo"
+msgstr "la aritmética de CPP debe ser al menos tan precisa como un %<int%> del objetivo"
#: init.cc:691
#, gcc-internal-format
@@ -1111,7 +1111,7 @@ msgstr "%<__VA_OPT__%> solamente puede aparecer en la expansión de una macro va
#: lex.cc:2186
#, gcc-internal-format
msgid "attempt to use poisoned %qs"
-msgstr "intento de utilizar %qs envenenado"
+msgstr "se intenta usar %qs envenenado"
#: lex.cc:2191
msgid "poisoned here"
@@ -1151,7 +1151,7 @@ msgstr "carácter inválido nueva línea en un delimitador de cadena cruda"
#: lex.cc:2731 lex.cc:5671
#, gcc-internal-format, gfc-internal-format
msgid "invalid character '%c' in raw string delimiter"
-msgstr "carácter inválido '%c' en un delimitador de cadena cruda"
+msgstr "carácter inválido «%c» en un delimitador de cadena cruda"
#: lex.cc:2770 lex.cc:2793
msgid "unterminated raw string"
@@ -1168,7 +1168,7 @@ msgstr "falta el carácter de terminación %c"
#: lex.cc:2986
msgid "C++11 requires a space between string literal and macro"
-msgstr "C++11 requiere un espacio entre cadena literal y macro"
+msgstr "C++11 requiere un espacio entre una cadena literal y un macro"
#: lex.cc:3579
msgid "module control-line cannot be in included file"
@@ -1177,7 +1177,7 @@ msgstr "la línea de control del módulo no puede estar en un fichero incluido"
#: lex.cc:3593
#, gcc-internal-format
msgid "module control-line %qs cannot be an object-like macro"
-msgstr "la línea de control del módulo %qs no puede ser una macro de tipo objeto"
+msgstr "la línea de control del módulo %qs no puede ser un macro de tipo objeto"
#: lex.cc:3631
#, gcc-internal-format
@@ -1187,7 +1187,7 @@ msgstr "el nombre de módulo %qs no puede ser una macro de tipo objeto"
#: lex.cc:3637
#, gcc-internal-format
msgid "module partition %qs cannot be an object-like macro"
-msgstr "la partición de módulo %qs no puede ser una macro de tipo objeto"
+msgstr "la partición de módulo %qs no puede ser un macro de tipo objeto"
#: lex.cc:3658
#, gcc-internal-format
@@ -1290,7 +1290,7 @@ msgstr "macro interna %qs inválida"
#: macro.cc:579 macro.cc:687
#, gcc-internal-format
msgid "macro %qs might prevent reproducible builds"
-msgstr "macro %qs quizá previene compilaciones reproducibles"
+msgstr "el macro %qs quizá previene compilaciones reproducibles"
#: macro.cc:610
msgid "could not determine file timestamp"
@@ -1401,7 +1401,7 @@ msgstr "se esperaba %<)%> después de %<...%>"
#: macro.cc:3624
msgid "anonymous variadic macros were introduced in C++11"
-msgstr "las macros variadic anónimas se introdujeron en C++11"
+msgstr "los macros variadic anónimos se introdujeron en C++11"
#: macro.cc:3625 macro.cc:3629
msgid "anonymous variadic macros were introduced in C99"
@@ -1440,7 +1440,7 @@ msgstr "%<#%> no es seguido por un parámetro de macro"
#: macro.cc:3961
#, gcc-internal-format
msgid "%qs redefined"
-msgstr "%qs redefinido"
+msgstr "se redefine %qs"
#: macro.cc:3965
msgid "this is the location of the previous definition"
@@ -1453,7 +1453,7 @@ msgstr "el argumento de macro %qs debería ser convertido a cadena en C tradicio
#: pch.cc:90 pch.cc:342 pch.cc:356 pch.cc:374 pch.cc:380 pch.cc:389 pch.cc:396
msgid "while writing precompiled header"
-msgstr "al escribir el encabezado precompilado"
+msgstr "al escribir la cabecera precompilada"
#: pch.cc:616
#, gcc-internal-format
@@ -1482,7 +1482,7 @@ msgstr "%s: no se usa porque %<__COUNTER__%> es inválido"
#: pch.cc:722 pch.cc:885
msgid "while reading precompiled header"
-msgstr "al leer el encabezado precompilado"
+msgstr "al leer la cabecera precompilada"
#: traditional.cc:891
#, gcc-internal-format
@@ -1523,7 +1523,7 @@ msgstr "error de sintaxis en la lista de parámetros de macro"
#~ msgstr "#include anidado con demasiada profundidad"
#~ msgid "missing ')' after \"__has_include__\""
-#~ msgstr "falta ')' tras \"__has_include__\""
+#~ msgstr "falta ')' después de \"__has_include__\""
#~ msgid "\"%s\" may not appear in macro parameter list"
#~ msgstr "«%s» podría faltar en la lista de parámetro de macro"
diff --git a/libcpp/po/zh_CN.po b/libcpp/po/zh_CN.po
index 467575b..2262520 100644
--- a/libcpp/po/zh_CN.po
+++ b/libcpp/po/zh_CN.po
@@ -2,22 +2,24 @@
# Copyright (C) 2005 Free Software Foundation, Inc.
# This file is distributed under the same license as the gcc package.
# Meng Jie <zuxy.meng@gmail.com>, 2005-2010.
+# Boyuan Yang <073plan@gmail.com>, 2025.
+# Anbang LI <anbangli@foxmail.com>, 2025.
# Zhanhaoxiang Zhang <zzhx2006@outlook.com>, 2024, 2025.
#
msgid ""
msgstr ""
-"Project-Id-Version: cpplib 15-b20250216\n"
+"Project-Id-Version: cpplib 15.1-b20250316\n"
"Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n"
"POT-Creation-Date: 2025-03-14 22:05+0000\n"
-"PO-Revision-Date: 2025-02-20 18:32+0800\n"
-"Last-Translator: Zhanhaoxiang Zhang <zzhx2006@outlook.com>\n"
+"PO-Revision-Date: 2025-05-15 12:47-0400\n"
+"Last-Translator: Boyuan Yang <073plan@gmail.com>\n"
"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Bugs: Report translation errors to the Language-Team address.\n"
-"X-Generator: Poedit 3.5\n"
+"X-Generator: Poedit 3.6\n"
#: charset.cc:759
#, gcc-internal-format, gfc-internal-format
@@ -49,12 +51,12 @@ msgstr "字符 0x%lx 在执行字符集中不是单字节的"
#: charset.cc:1549
msgid "universal character names are only valid in C++ and C99"
-msgstr "Unicode 字符名只在 C++ 和 C99 中有效"
+msgstr "通用字符名只在 C++ 和 C99 中有效"
#: charset.cc:1553
#, gcc-internal-format
msgid "C99%'s universal character names are incompatible with C90"
-msgstr "C99 的 Unicode 字符名与 C90 不兼容"
+msgstr "C99 的通用字符名与 C90 不兼容"
#: charset.cc:1556
#, gcc-internal-format
@@ -64,29 +66,29 @@ msgstr "%<\\%c%> 的意义与在传统 C 中不同"
#: charset.cc:1595
#, gcc-internal-format
msgid "%<\\N%> not followed by %<{%>"
-msgstr "%<\\N%> 后没有 %<{%>"
+msgstr "%<\\N%> 后面没有 %<{%>"
#: charset.cc:1625
msgid "empty named universal character escape sequence; treating it as separate tokens"
-msgstr "空的命名 Unicode 字符转义序列;将其视为独立 token 处理"
+msgstr "空命名通用字符转义序列; 将其视为单独的词元"
#: charset.cc:1632
msgid "empty named universal character escape sequence"
-msgstr "空的命名 Unicode 字符转义序列"
+msgstr "空的命名通用字符转义序列"
#: charset.cc:1639
msgid "named universal character escapes are only valid in C++23"
-msgstr "命名 Unicode 字符转义序列(named universal character escapes)仅在 C++23 中有效"
+msgstr "命名通用字符转义仅在 C++23 中有效"
#: charset.cc:1659
#, gcc-internal-format
msgid "%<\\N{%.*s}%> is not a valid universal character; treating it as separate tokens"
-msgstr "%<\\N{%.*s}%> 不是一个有效的 Unicode 字符;将其视为独立 token 处理"
+msgstr "%<\\N{%.*s}%> 不是有效的通用字符; 将其视为独立的词元"
#: charset.cc:1665
#, gcc-internal-format
msgid "%<\\N{%.*s}%> is not a valid universal character"
-msgstr "%<\\N{%.*s}%> 不是一个有效的 Unicode 字符"
+msgstr "%<\\N{%.*s}%> 不是一个有效的通用字符"
#: charset.cc:1675
#, gcc-internal-format
@@ -96,7 +98,7 @@ msgstr "你是说 %<\\N{%s}%> 吗?"
#: charset.cc:1693
#, gcc-internal-format
msgid "%<\\N{%> not terminated with %<}%> after %.*s; treating it as separate tokens"
-msgstr "在 %.*s 之后 %<\\N{%> 未以 %<}%> 结束;将其视为独立 token 处理"
+msgstr "在 %.*s 之后 %<\\N{%> 未以 %<}%> 结束;将其视为独立词元"
#: charset.cc:1702
#, gcc-internal-format
@@ -110,7 +112,7 @@ msgstr "在 %<_cpp_valid_ucn%> 中但不是一个 UCN"
#: charset.cc:1753
msgid "empty delimited escape sequence; treating it as separate tokens"
-msgstr "空的带分隔符的转义序列;将其视为独立 token 处理"
+msgstr "空的带分隔符的转义序列;将其视为独立词元"
#: charset.cc:1760 charset.cc:2163 charset.cc:2280
msgid "empty delimited escape sequence"
@@ -128,12 +130,12 @@ msgstr "带分隔符的转义序列仅在 C2Y 中有效"
#: charset.cc:1794
#, gcc-internal-format
msgid "%<\\u{%> not terminated with %<}%> after %.*s; treating it as separate tokens"
-msgstr "在 %.*s 之后 %<\\u{%> 未以 %<}%> 结束;将其视为独立 token 处理"
+msgstr "在 %.*s 之后 %<\\u{%> 未以 %<}%> 结束;将其视为独立词元"
#: charset.cc:1806
#, gcc-internal-format
msgid "incomplete universal character name %.*s"
-msgstr "不完全的 Unicode 字符名 %.*s"
+msgstr "不完整的通用字符名 %.*s"
#: charset.cc:1810
#, gcc-internal-format
@@ -143,12 +145,12 @@ msgstr "在 %.*s 之后 %<\\u{%> 未以 %<}%> 结束"
#: charset.cc:1818
#, gcc-internal-format
msgid "%.*s is not a valid universal character"
-msgstr "%.*s 不是一个有效的 Unicode 字符"
+msgstr "%.*s 不是一个有效的通用字符"
#: charset.cc:1834 charset.cc:1838
#, gcc-internal-format
msgid "%.*s is not a valid universal character name before C23"
-msgstr "在C23之前,%.*s 不是一个有效的 Unicode 字符名"
+msgstr "在C23之前,%.*s 不是一个有效的通用字符名"
#: charset.cc:1854 lex.cc:2096
#, gcc-internal-format
@@ -158,17 +160,17 @@ msgstr "%<$%> 出现在标识符或数字中"
#: charset.cc:1864
#, gcc-internal-format
msgid "universal character %.*s is not valid in an identifier"
-msgstr "Unicode 字符 %.*s 在标识符中无效"
+msgstr "通用字符 %.*s 在标识符中无效"
#: charset.cc:1868
#, gcc-internal-format
msgid "universal character %.*s is not valid at the start of an identifier"
-msgstr "Unicode 字符 %.*s 在标识符开头无效"
+msgstr "通用字符 %.*s 在标识符开头无效"
#: charset.cc:1875
#, gcc-internal-format
msgid "%.*s is outside the UCS codespace"
-msgstr "%.*s 超出了 UCS 码空间"
+msgstr "%.*s 在 UCS 码空间之外"
#: charset.cc:1919 charset.cc:3072
msgid "converting UCN to source character set"
@@ -186,7 +188,7 @@ msgstr "扩展字符 %.*s 在标识符中无效"
#: charset.cc:2007
#, gcc-internal-format
msgid "extended character %.*s is not valid at the start of an identifier"
-msgstr "扩展字符 %.*s 在标识符开头无效"
+msgstr "扩展字符 %.*s 在标识符的开头无效"
#: charset.cc:2129
#, gcc-internal-format
@@ -208,10 +210,9 @@ msgid "hex escape sequence out of range"
msgstr "16 进制转义序列越界"
#: charset.cc:2247
-#, fuzzy, gcc-internal-format
-#| msgid "%<\\o%> not followed by %<}%>"
+#, gcc-internal-format
msgid "%<\\o%> not followed by %<{%>"
-msgstr "%<\\o%> 后没有 %<}%>"
+msgstr "%<\\o%> 后面没有 %<{%>"
#: charset.cc:2305
#, gcc-internal-format
@@ -461,16 +462,14 @@ msgid "%<#embed%> not supported in traditional C"
msgstr "在传统C中不支持 %<#embed%>"
#: directives.cc:1370
-#, fuzzy, gcc-internal-format
-#| msgid "%<#%s%> before C++23 is a GCC extension"
+#, gcc-internal-format
msgid "%<#%s%> before C++26 is a GCC extension"
-msgstr "%<#%s%> 在C++23以前是一个 GCC 扩展"
+msgstr "%<#%s%> 在 C++26 以前是一个 GCC 扩展"
#: directives.cc:1379
-#, fuzzy, gcc-internal-format
-#| msgid "%<#%s%> is a GCC extension"
+#, gcc-internal-format
msgid "%<#%s%> is a C23 feature"
-msgstr "%<#%s%> 是一个 GCC 扩展"
+msgstr "%<#%s%> 是一个 C23 特性"
#: directives.cc:1436
#, gcc-internal-format
diff --git a/libgcc/config/avr/libf7/ChangeLog b/libgcc/config/avr/libf7/ChangeLog
index d7637ee..0e6afa0 100644
--- a/libgcc/config/avr/libf7/ChangeLog
+++ b/libgcc/config/avr/libf7/ChangeLog
@@ -1,3 +1,24 @@
+2025-05-27 Georg-Johann Lay <avr@gjlay.de>
+
+ Backported from master:
+ 2025-05-27 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/120442
+ * libf7-common.mk (LIBF_C_PARTS, m_ddd): Add fdim.
+ * libf7.h (f7_fdim): New proto.
+ * libf7.c (f7_fdim): New function.
+ * f7renames.sh (f7_fdim): Add rename.
+ * f7-wraps.h: Rebuild
+ * f7-renames.h: Rebuild
+
+2025-05-27 Georg-Johann Lay <avr@gjlay.de>
+
+ Backported from master:
+ 2025-05-27 Georg-Johann Lay <avr@gjlay.de>
+
+ PR target/120441
+ * libf7.c (f7_exp): Limit aa->expo to 10 (not to 9).
+
2025-04-25 Release Manager
* GCC 15.1.0 released.
diff --git a/libgcc/config/avr/libf7/f7-renames.h b/libgcc/config/avr/libf7/f7-renames.h
index bbe571a..bce2dd3 100644
--- a/libgcc/config/avr/libf7/f7-renames.h
+++ b/libgcc/config/avr/libf7/f7-renames.h
@@ -97,6 +97,7 @@
#define f7_acos __f7_acos
#define f7_atan __f7_atan
#define f7_atan2 __f7_atan2
+#define f7_fdim __f7_fdim
#define f7_mul_noround __f7_mul_noround
#define f7_sqrt16_round __f7_sqrt16_round
#define f7_sqrt16_floor __f7_sqrt16_floor
diff --git a/libgcc/config/avr/libf7/f7-wraps.h b/libgcc/config/avr/libf7/f7-wraps.h
index a455b7d..409492e 100644
--- a/libgcc/config/avr/libf7/f7-wraps.h
+++ b/libgcc/config/avr/libf7/f7-wraps.h
@@ -239,7 +239,7 @@ _ENDF __extendsfdf2
;; Functions that usually live in libm: Depending on [long] double layout,
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
-;; pow fmin fmax fmod hypot atan2
+;; pow fmin fmax fmod hypot atan2 fdim
;; double __pow (double, double)
#ifdef F7MOD_D_pow_
@@ -313,6 +313,18 @@ _DEFUN __atan2
_ENDF __atan2
#endif /* F7MOD_D_atan2_ */
+;; double __fdim (double, double)
+#ifdef F7MOD_D_fdim_
+_DEFUN __fdim
+ DALIAS fdim
+ LALIAS fdiml
+ .global F7_NAME(fdim)
+ ldi ZH, hi8(gs(F7_NAME(fdim)))
+ ldi ZL, lo8(gs(F7_NAME(fdim)))
+ F7jmp call_ddd
+_ENDF __fdim
+#endif /* F7MOD_D_fdim_ */
+
;; Functions that usually live in libm: Depending on [long] double layout,
;; define <name> and <name>l as weak alias(es) of __<name> for <name> in:
;; ldexp frexp
diff --git a/libgcc/config/avr/libf7/f7renames.sh b/libgcc/config/avr/libf7/f7renames.sh
index 7ef251e..4ced423 100755
--- a/libgcc/config/avr/libf7/f7renames.sh
+++ b/libgcc/config/avr/libf7/f7renames.sh
@@ -35,9 +35,9 @@ EOF
c)
if [ x${PRE} != xf7_ ]; then
- echo " "
+ echo ""
echo "/* Renames for libf7.c, libf7.h. */"
- echo " "
+ echo ""
for x in $*; do
echo "#define f7_$x ${PRE}$x"
done
@@ -46,9 +46,9 @@ EOF
cst)
if [ x${PRE} != xf7_ ]; then
- echo " "
+ echo ""
echo "/* Renames for libf7.c, libf7.h. */"
- echo " "
+ echo ""
for x in $*; do
echo "#define f7_const_${x} ${PRE}const_${x}"
echo "#define f7_const_${x}_P ${PRE}const_${x}_P"
@@ -58,9 +58,9 @@ EOF
asm)
if [ x${PRE} != xf7_ ]; then
- echo " "
+ echo ""
echo "/* Renames for libf7-asm.sx, f7-wraps.h. */"
- echo " "
+ echo ""
for x in $*; do
echo "#define f7_${x}_asm ${PRE}${x}_asm"
done
diff --git a/libgcc/config/avr/libf7/libf7-common.mk b/libgcc/config/avr/libf7/libf7-common.mk
index 5d41107..644be2c 100644
--- a/libgcc/config/avr/libf7/libf7-common.mk
+++ b/libgcc/config/avr/libf7/libf7-common.mk
@@ -8,7 +8,7 @@ F7_C_PARTS += set_float get_float get_double set_double set_pdouble
F7_C_PARTS += fabs neg fmin fmax minmax truncx trunc floor ceil round lround
F7_C_PARTS += horner logx log log10 log2 exp pow10 pow powi
F7_C_PARTS += sin cos tan cotan sincos sinh cosh tanh sinhcosh
-F7_C_PARTS += asinacos asin acos atan atan2
+F7_C_PARTS += asinacos asin acos atan atan2 fdim
F7_C_PARTS += abscmp_msb_ge cmp cmp_abs cmp_unordered
F7_C_PARTS += const_1 const_1_2 const_1_3
@@ -34,7 +34,7 @@ g_xdd_cmp += le lt ge gt ne eq unord
g_dx += floatunsidf floatsidf extendsfdf2
g_xd += fixdfsi fixdfdi fixunsdfdi fixunsdfsi truncdfsf2
-m_ddd += pow fmin fmax fmod hypot atan2
+m_ddd += pow fmin fmax fmod hypot atan2 fdim
m_ddx += ldexp frexp
m_dd += sqrt cbrt exp exp10 pow10 log log10 log2 sin cos tan cotan asin acos atan
m_dd += ceil floor trunc round sinh cosh tanh
@@ -59,7 +59,7 @@ F7F += lrint ldexp frexp exp logx log log10 log2
F7F += minmax fmax fmin floor ceil round lround trunc truncx
F7F += horner pow10 exp10 pow powi
F7F += sin cos tan cotan sincos sinh cosh tanh sinhcosh
-F7F += asinacos asin acos atan atan2
+F7F += asinacos asin acos atan atan2 fdim
F7F += mul_noround sqrt16_round sqrt16_floor
F7F += clr_mant_lsbs abscmp_msb_ge lshrdi3 ashldi3
F7F += assert
diff --git a/libgcc/config/avr/libf7/libf7.c b/libgcc/config/avr/libf7/libf7.c
index a64554c..78c218a 100644
--- a/libgcc/config/avr/libf7/libf7.c
+++ b/libgcc/config/avr/libf7/libf7.c
@@ -928,6 +928,21 @@ void f7_sub (f7_t *cc, const f7_t *aa, const f7_t *bb)
#endif // F7MOD_sub_
+#ifdef F7MOD_fdim_
+F7_WEAK
+void f7_fdim (f7_t *cc, const f7_t *aa, const f7_t *bb)
+{
+ int8_t cmp = f7_cmp_unordered (aa, bb, true /*with_sign*/);
+ if (cmp == INT8_MIN)
+ return f7_set_nan (cc);
+ if (cmp < 0)
+ return f7_clr (cc);
+
+ f7_sub (cc, aa, bb);
+}
+#endif // F7MOD_fdim_
+
+
#ifdef F7MOD_addsub_
static void return_with_sign (f7_t *cc, const f7_t *aa, int8_t c_sign)
{
@@ -1649,10 +1664,10 @@ void f7_exp (f7_t *cc, const f7_t *aa)
return f7_set_nan (cc);
/* The maximal exponent of 2 for a double is 1023, hence we may limit
- to |A| < 1023 * ln2 ~ 709. We limit to 1024 ~ 1.99 * 2^9 */
+ to |A| < 1023 * ln2 ~ 709. We limit to 1024 = 2^10 */
if (f7_class_inf (a_class)
- || (f7_class_nonzero (a_class) && aa->expo >= 9))
+ || (f7_class_nonzero (a_class) && aa->expo >= 10))
{
if (f7_class_sign (a_class))
return f7_clr (cc);
diff --git a/libgcc/config/avr/libf7/libf7.h b/libgcc/config/avr/libf7/libf7.h
index 8aa91c7..786e141 100644
--- a/libgcc/config/avr/libf7/libf7.h
+++ b/libgcc/config/avr/libf7/libf7.h
@@ -612,6 +612,7 @@ extern void f7_cos (f7_t*, const f7_t*);
extern void f7_tan (f7_t*, const f7_t*);
extern void f7_atan (f7_t*, const f7_t*);
extern void f7_atan2 (f7_t*, const f7_t*, const f7_t*);
+extern void f7_fdim (f7_t*, const f7_t*, const f7_t*);
extern void f7_asin (f7_t*, const f7_t*);
extern void f7_acos (f7_t*, const f7_t*);
extern void f7_tanh (f7_t*, const f7_t*);
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6749781..a0b9c23 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,68 @@
+2025-06-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ Backported from master:
+ 2025-06-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/119856
+ * io/format.c (parse_format_list): Set the fmt->error
+ message for missing comma.
+ (parse_format): Do not cache the parsed format string
+ if a previous error ocurred.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR libfortran/120196
+ * m4/ifindloc2.m4 (header1, header2): For back use i > 0 rather than
+ i >= 0 as for condition.
+ * generated/findloc2_s1.c: Regenerate.
+ * generated/findloc2_s4.c: Regenerate.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/120191
+ * m4/ifunction-s.m4 (SCALAR_ARRAY_FUNCTION): Don't multiply
+ GFC_DESCRIPTOR_EXTENT(array,) by string_len.
+ * generated/maxloc1_4_s1.c: Regenerate.
+ * generated/maxloc1_4_s4.c: Regenerate.
+ * generated/maxloc1_8_s1.c: Regenerate.
+ * generated/maxloc1_8_s4.c: Regenerate.
+ * generated/maxloc1_16_s1.c: Regenerate.
+ * generated/maxloc1_16_s4.c: Regenerate.
+ * generated/minloc1_4_s1.c: Regenerate.
+ * generated/minloc1_4_s4.c: Regenerate.
+ * generated/minloc1_8_s1.c: Regenerate.
+ * generated/minloc1_8_s4.c: Regenerate.
+ * generated/minloc1_16_s1.c: Regenerate.
+ * generated/minloc1_16_s4.c: Regenerate.
+
+2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-05-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/120191
+ * m4/maxloc2s.m4: For smaxloc2 call maxloc2 if mask is NULL or *mask.
+ Swap back and len arguments.
+ * m4/minloc2s.m4: Likewise.
+ * generated/maxloc2_4_s1.c: Regenerate.
+ * generated/maxloc2_4_s4.c: Regenerate.
+ * generated/maxloc2_8_s1.c: Regenerate.
+ * generated/maxloc2_8_s4.c: Regenerate.
+ * generated/maxloc2_16_s1.c: Regenerate.
+ * generated/maxloc2_16_s4.c: Regenerate.
+ * generated/minloc2_4_s1.c: Regenerate.
+ * generated/minloc2_4_s4.c: Regenerate.
+ * generated/minloc2_8_s1.c: Regenerate.
+ * generated/minloc2_8_s4.c: Regenerate.
+ * generated/minloc2_16_s1.c: Regenerate.
+ * generated/minloc2_16_s4.c: Regenerate.
+
2025-05-08 Jakub Jelinek <jakub@redhat.com>
Backported from master:
diff --git a/libgfortran/generated/findloc2_s1.c b/libgfortran/generated/findloc2_s1.c
index 0dcfcc5..eeea821 100644
--- a/libgfortran/generated/findloc2_s1.c
+++ b/libgfortran/generated/findloc2_s1.c
@@ -49,7 +49,7 @@ findloc2_s1 (gfc_array_s1 * const restrict array, const GFC_UINTEGER_1 * restric
if (back)
{
src = array->base_addr + (extent - 1) * sstride;
- for (i = extent; i >= 0; i--)
+ for (i = extent; i > 0; i--)
{
if (compare_string (len_array, (char *) src, len_value, (char *) value) == 0)
return i;
@@ -112,7 +112,7 @@ mfindloc2_s1 (gfc_array_s1 * const restrict array,
{
src = array->base_addr + (extent - 1) * sstride;
mbase += (extent - 1) * mstride;
- for (i = extent; i >= 0; i--)
+ for (i = extent; i > 0; i--)
{
if (*mbase && (compare_string (len_array, (char *) src, len_value, (char *) value) == 0))
return i;
diff --git a/libgfortran/generated/findloc2_s4.c b/libgfortran/generated/findloc2_s4.c
index 3ac0d00..a336e34 100644
--- a/libgfortran/generated/findloc2_s4.c
+++ b/libgfortran/generated/findloc2_s4.c
@@ -49,7 +49,7 @@ findloc2_s4 (gfc_array_s4 * const restrict array, const GFC_UINTEGER_4 * restric
if (back)
{
src = array->base_addr + (extent - 1) * sstride;
- for (i = extent; i >= 0; i--)
+ for (i = extent; i > 0; i--)
{
if (compare_string_char4 (len_array, src, len_value, value) == 0)
return i;
@@ -112,7 +112,7 @@ mfindloc2_s4 (gfc_array_s4 * const restrict array,
{
src = array->base_addr + (extent - 1) * sstride;
mbase += (extent - 1) * mstride;
- for (i = extent; i >= 0; i--)
+ for (i = extent; i > 0; i--)
{
if (*mbase && (compare_string_char4 (len_array, src, len_value, value) == 0))
return i;
diff --git a/libgfortran/generated/maxloc1_16_s1.c b/libgfortran/generated/maxloc1_16_s1.c
index cbab817..21ea81a 100644
--- a/libgfortran/generated/maxloc1_16_s1.c
+++ b/libgfortran/generated/maxloc1_16_s1.c
@@ -457,7 +457,7 @@ smaxloc1_16_s1 (gfc_array_i16 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ smaxloc1_16_s1 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/maxloc1_16_s4.c b/libgfortran/generated/maxloc1_16_s4.c
index d7d8893..47e14c1 100644
--- a/libgfortran/generated/maxloc1_16_s4.c
+++ b/libgfortran/generated/maxloc1_16_s4.c
@@ -457,7 +457,7 @@ smaxloc1_16_s4 (gfc_array_i16 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ smaxloc1_16_s4 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/maxloc1_4_s1.c b/libgfortran/generated/maxloc1_4_s1.c
index 51740ee..66ee8d0 100644
--- a/libgfortran/generated/maxloc1_4_s1.c
+++ b/libgfortran/generated/maxloc1_4_s1.c
@@ -457,7 +457,7 @@ smaxloc1_4_s1 (gfc_array_i4 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ smaxloc1_4_s1 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/maxloc1_4_s4.c b/libgfortran/generated/maxloc1_4_s4.c
index cf04d6d..7d889c0 100644
--- a/libgfortran/generated/maxloc1_4_s4.c
+++ b/libgfortran/generated/maxloc1_4_s4.c
@@ -457,7 +457,7 @@ smaxloc1_4_s4 (gfc_array_i4 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ smaxloc1_4_s4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/maxloc1_8_s1.c b/libgfortran/generated/maxloc1_8_s1.c
index a35e552..d4711e2 100644
--- a/libgfortran/generated/maxloc1_8_s1.c
+++ b/libgfortran/generated/maxloc1_8_s1.c
@@ -457,7 +457,7 @@ smaxloc1_8_s1 (gfc_array_i8 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ smaxloc1_8_s1 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/maxloc1_8_s4.c b/libgfortran/generated/maxloc1_8_s4.c
index e264779..dea360e 100644
--- a/libgfortran/generated/maxloc1_8_s4.c
+++ b/libgfortran/generated/maxloc1_8_s4.c
@@ -457,7 +457,7 @@ smaxloc1_8_s4 (gfc_array_i8 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ smaxloc1_8_s4 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/maxloc2_16_s1.c b/libgfortran/generated/maxloc2_16_s1.c
index 6e860ee..d38d422 100644
--- a/libgfortran/generated/maxloc2_16_s1.c
+++ b/libgfortran/generated/maxloc2_16_s1.c
@@ -152,8 +152,8 @@ GFC_INTEGER_16
smaxloc2_16_s1 (gfc_array_s1 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return maxloc2_16_s1 (array, len, back);
+ if (mask == NULL || *mask)
+ return maxloc2_16_s1 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/maxloc2_16_s4.c b/libgfortran/generated/maxloc2_16_s4.c
index e4ac04c..09fdbf8 100644
--- a/libgfortran/generated/maxloc2_16_s4.c
+++ b/libgfortran/generated/maxloc2_16_s4.c
@@ -152,8 +152,8 @@ GFC_INTEGER_16
smaxloc2_16_s4 (gfc_array_s4 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return maxloc2_16_s4 (array, len, back);
+ if (mask == NULL || *mask)
+ return maxloc2_16_s4 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/maxloc2_4_s1.c b/libgfortran/generated/maxloc2_4_s1.c
index 78a5012..0804f59 100644
--- a/libgfortran/generated/maxloc2_4_s1.c
+++ b/libgfortran/generated/maxloc2_4_s1.c
@@ -152,8 +152,8 @@ GFC_INTEGER_4
smaxloc2_4_s1 (gfc_array_s1 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return maxloc2_4_s1 (array, len, back);
+ if (mask == NULL || *mask)
+ return maxloc2_4_s1 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/maxloc2_4_s4.c b/libgfortran/generated/maxloc2_4_s4.c
index 399dab7..6dac06e 100644
--- a/libgfortran/generated/maxloc2_4_s4.c
+++ b/libgfortran/generated/maxloc2_4_s4.c
@@ -152,8 +152,8 @@ GFC_INTEGER_4
smaxloc2_4_s4 (gfc_array_s4 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return maxloc2_4_s4 (array, len, back);
+ if (mask == NULL || *mask)
+ return maxloc2_4_s4 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/maxloc2_8_s1.c b/libgfortran/generated/maxloc2_8_s1.c
index 9e1d36f9..5ced3c6 100644
--- a/libgfortran/generated/maxloc2_8_s1.c
+++ b/libgfortran/generated/maxloc2_8_s1.c
@@ -152,8 +152,8 @@ GFC_INTEGER_8
smaxloc2_8_s1 (gfc_array_s1 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return maxloc2_8_s1 (array, len, back);
+ if (mask == NULL || *mask)
+ return maxloc2_8_s1 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/maxloc2_8_s4.c b/libgfortran/generated/maxloc2_8_s4.c
index a44c6f6..78ae1be 100644
--- a/libgfortran/generated/maxloc2_8_s4.c
+++ b/libgfortran/generated/maxloc2_8_s4.c
@@ -152,8 +152,8 @@ GFC_INTEGER_8
smaxloc2_8_s4 (gfc_array_s4 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return maxloc2_8_s4 (array, len, back);
+ if (mask == NULL || *mask)
+ return maxloc2_8_s4 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/minloc1_16_s1.c b/libgfortran/generated/minloc1_16_s1.c
index 8228009..b654608 100644
--- a/libgfortran/generated/minloc1_16_s1.c
+++ b/libgfortran/generated/minloc1_16_s1.c
@@ -457,7 +457,7 @@ sminloc1_16_s1 (gfc_array_i16 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ sminloc1_16_s1 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/minloc1_16_s4.c b/libgfortran/generated/minloc1_16_s4.c
index e40bf54..2e709a7 100644
--- a/libgfortran/generated/minloc1_16_s4.c
+++ b/libgfortran/generated/minloc1_16_s4.c
@@ -457,7 +457,7 @@ sminloc1_16_s4 (gfc_array_i16 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ sminloc1_16_s4 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/minloc1_4_s1.c b/libgfortran/generated/minloc1_4_s1.c
index 199d254..61dad55 100644
--- a/libgfortran/generated/minloc1_4_s1.c
+++ b/libgfortran/generated/minloc1_4_s1.c
@@ -457,7 +457,7 @@ sminloc1_4_s1 (gfc_array_i4 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ sminloc1_4_s1 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/minloc1_4_s4.c b/libgfortran/generated/minloc1_4_s4.c
index 1f0174b..49c25d0 100644
--- a/libgfortran/generated/minloc1_4_s4.c
+++ b/libgfortran/generated/minloc1_4_s4.c
@@ -457,7 +457,7 @@ sminloc1_4_s4 (gfc_array_i4 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ sminloc1_4_s4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/minloc1_8_s1.c b/libgfortran/generated/minloc1_8_s1.c
index 39bdb9b..c0ac6e6 100644
--- a/libgfortran/generated/minloc1_8_s1.c
+++ b/libgfortran/generated/minloc1_8_s1.c
@@ -457,7 +457,7 @@ sminloc1_8_s1 (gfc_array_i8 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ sminloc1_8_s1 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/minloc1_8_s4.c b/libgfortran/generated/minloc1_8_s4.c
index ed74ac9..29624d0 100644
--- a/libgfortran/generated/minloc1_8_s4.c
+++ b/libgfortran/generated/minloc1_8_s4.c
@@ -457,7 +457,7 @@ sminloc1_8_s4 (gfc_array_i8 * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -465,8 +465,7 @@ sminloc1_8_s4 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/generated/minloc2_16_s1.c b/libgfortran/generated/minloc2_16_s1.c
index 6381ad6..9b4a92d 100644
--- a/libgfortran/generated/minloc2_16_s1.c
+++ b/libgfortran/generated/minloc2_16_s1.c
@@ -154,8 +154,8 @@ GFC_INTEGER_16
sminloc2_16_s1 (gfc_array_s1 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return minloc2_16_s1 (array, len, back);
+ if (mask == NULL || *mask)
+ return minloc2_16_s1 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/minloc2_16_s4.c b/libgfortran/generated/minloc2_16_s4.c
index 11011b7..eac46fa 100644
--- a/libgfortran/generated/minloc2_16_s4.c
+++ b/libgfortran/generated/minloc2_16_s4.c
@@ -154,8 +154,8 @@ GFC_INTEGER_16
sminloc2_16_s4 (gfc_array_s4 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return minloc2_16_s4 (array, len, back);
+ if (mask == NULL || *mask)
+ return minloc2_16_s4 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/minloc2_4_s1.c b/libgfortran/generated/minloc2_4_s1.c
index 631484a..bb22f6c 100644
--- a/libgfortran/generated/minloc2_4_s1.c
+++ b/libgfortran/generated/minloc2_4_s1.c
@@ -154,8 +154,8 @@ GFC_INTEGER_4
sminloc2_4_s1 (gfc_array_s1 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return minloc2_4_s1 (array, len, back);
+ if (mask == NULL || *mask)
+ return minloc2_4_s1 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/minloc2_4_s4.c b/libgfortran/generated/minloc2_4_s4.c
index d606437..f3020d6 100644
--- a/libgfortran/generated/minloc2_4_s4.c
+++ b/libgfortran/generated/minloc2_4_s4.c
@@ -154,8 +154,8 @@ GFC_INTEGER_4
sminloc2_4_s4 (gfc_array_s4 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return minloc2_4_s4 (array, len, back);
+ if (mask == NULL || *mask)
+ return minloc2_4_s4 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/minloc2_8_s1.c b/libgfortran/generated/minloc2_8_s1.c
index b02200b..04ec913 100644
--- a/libgfortran/generated/minloc2_8_s1.c
+++ b/libgfortran/generated/minloc2_8_s1.c
@@ -154,8 +154,8 @@ GFC_INTEGER_8
sminloc2_8_s1 (gfc_array_s1 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return minloc2_8_s1 (array, len, back);
+ if (mask == NULL || *mask)
+ return minloc2_8_s1 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/generated/minloc2_8_s4.c b/libgfortran/generated/minloc2_8_s4.c
index 9d33d13..fbb6d08 100644
--- a/libgfortran/generated/minloc2_8_s4.c
+++ b/libgfortran/generated/minloc2_8_s4.c
@@ -154,8 +154,8 @@ GFC_INTEGER_8
sminloc2_8_s4 (gfc_array_s4 * const restrict array,
GFC_LOGICAL_4 *mask, GFC_LOGICAL_4 back, gfc_charlen_type len)
{
- if (mask)
- return minloc2_8_s4 (array, len, back);
+ if (mask == NULL || *mask)
+ return minloc2_8_s4 (array, back, len);
else
return 0;
}
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index eef1d34..87e21a9 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -1235,9 +1235,9 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
default:
/* Assume a missing comma with -std=legacy, GNU extension. */
- if (compile_options.warn_std == 0)
- goto format_item_1;
- format_error (dtp, tail, comma_missing);
+ if (compile_options.warn_std != 0)
+ fmt->error = comma_missing;
+ goto format_item_1;
}
/* Optional comma is a weird between state where we've just finished
@@ -1252,7 +1252,7 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
case FMT_RPAREN:
goto finished;
- default: /* Assume that we have another format item */
+ default: /* Assume that we have another format item */
fmt->saved_token = t;
break;
}
@@ -1419,7 +1419,7 @@ parse_format (st_parameter_dt *dtp)
else
fmt->error = "Missing initial left parenthesis in format";
- if (format_cache_ok)
+ if (format_cache_ok && !fmt->error)
save_parsed_format (dtp);
else
dtp->u.p.format_not_saved = 1;
diff --git a/libgfortran/m4/ifindloc2.m4 b/libgfortran/m4/ifindloc2.m4
index c6f909a..d309d8b 100644
--- a/libgfortran/m4/ifindloc2.m4
+++ b/libgfortran/m4/ifindloc2.m4
@@ -41,7 +41,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
if (back)
{
src = array->base_addr + (extent - 1) * sstride;
- for (i = extent; i >= 0; i--)
+ for (i = extent; i > 0; i--)
{
if ('comparison`'`)
return i;
@@ -94,7 +94,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
{
src = array->base_addr + (extent - 1) * sstride;
mbase += (extent - 1) * mstride;
- for (i = extent; i >= 0; i--)
+ for (i = extent; i > 0; i--)
{
if (*mbase && ('comparison`'`))
return i;
diff --git a/libgfortran/m4/ifunction-s.m4 b/libgfortran/m4/ifunction-s.m4
index 8275f65..22182e9 100644
--- a/libgfortran/m4/ifunction-s.m4
+++ b/libgfortran/m4/ifunction-s.m4
@@ -421,7 +421,7 @@ s'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray,
for (n = 0; n < dim; n++)
{
- extent[n] = GFC_DESCRIPTOR_EXTENT(array,n) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -429,8 +429,7 @@ s'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray,
for (n = dim; n < rank; n++)
{
- extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1) * string_len;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
diff --git a/libgfortran/m4/maxloc2s.m4 b/libgfortran/m4/maxloc2s.m4
index 49ecae7..b6070b4 100644
--- a/libgfortran/m4/maxloc2s.m4
+++ b/libgfortran/m4/maxloc2s.m4
@@ -153,8 +153,8 @@ export_proto(s'name`'rtype_qual`_'atype_code`);
s'name`'rtype_qual`_'atype_code` ('atype` * const restrict array,
GFC_LOGICAL_4 *mask'back_arg`, gfc_charlen_type len)
{
- if (mask)
- return 'name`'rtype_qual`_'atype_code` (array, len, back);
+ if (mask == NULL || *mask)
+ return 'name`'rtype_qual`_'atype_code` (array, back, len);
else
return 0;
}
diff --git a/libgfortran/m4/minloc2s.m4 b/libgfortran/m4/minloc2s.m4
index 8e7b4ab..9524fc4 100644
--- a/libgfortran/m4/minloc2s.m4
+++ b/libgfortran/m4/minloc2s.m4
@@ -155,8 +155,8 @@ export_proto(s'name`'rtype_qual`_'atype_code`);
s'name`'rtype_qual`_'atype_code` ('atype` * const restrict array,
GFC_LOGICAL_4 *mask'back_arg`, gfc_charlen_type len)
{
- if (mask)
- return 'name`'rtype_qual`_'atype_code` (array, len, back);
+ if (mask == NULL || *mask)
+ return 'name`'rtype_qual`_'atype_code` (array, back, len);
else
return 0;
}
diff --git a/libgm2/ChangeLog b/libgm2/ChangeLog
index 0c57c33..a90dccf 100644
--- a/libgm2/ChangeLog
+++ b/libgm2/ChangeLog
@@ -1,3 +1,47 @@
+2025-05-13 Gaius Mulley <gaiusmod2@gmail.com>
+
+ Backported from master:
+ 2025-04-24 Gaius Mulley <gaiusmod2@gmail.com>
+
+ PR modula2/115276
+ * config.h.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac (AC_STRUCT_TIMEZONE): Add.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_year.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_mon.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_mday.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_hour.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_min.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_sec.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_year.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_yday.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_wday.
+ (AC_CHECK_MEMBER): Test for struct tm.tm_isdst.
+ (AC_CHECK_MEMBER): Test for struct timeval.tv_sec.
+ (AC_CHECK_MEMBER): Test for struct timeval.tv_sec.
+ (AC_CHECK_MEMBER): Test for struct timeval.tv_usec.
+ * libm2iso/wraptime.cc (InitTimeval): Guard against lack
+ struct timeval and malloc.
+ (InitTimezone): Guard against lack of struct tm.tm_zone
+ and malloc.
+ (KillTimezone): Ditto.
+ (InitTimeval): Guard against lack of struct timeval
+ and malloc.
+ (KillTimeval): Guard against lack of malloc.
+ (settimeofday): Guard against lack of struct tm.tm_zone.
+ (GetFractions): Guard against lack of struct timeval.
+ (localtime_r): Ditto.
+ (GetYear): Guard against lack of struct tm.
+ (GetMonth): Ditto.
+ (GetDay): Ditto.
+ (GetHour): Ditto.
+ (GetMinute): Ditto.
+ (GetSecond): Ditto.
+ (GetSummerTime): Ditto.
+ (GetDST): Guards against lack of struct timezone.
+ (SetTimezone): Ditto.
+ (SetTimeval): Guard against lack of struct tm.
+
2025-04-25 Release Manager
* GCC 15.1.0 released.
diff --git a/libgm2/config.h.in b/libgm2/config.h.in
index 321ef3b..f9710ff 100644
--- a/libgm2/config.h.in
+++ b/libgm2/config.h.in
@@ -34,6 +34,10 @@
*/
#undef HAVE_DECL_GETENV
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
+ */
+#undef HAVE_DECL_TZNAME
+
/* Define to 1 if you have the <direct.h> header file. */
#undef HAVE_DIRECT_H
@@ -232,6 +236,9 @@
/* Define to 1 if the system has the type `struct tm'. */
#undef HAVE_STRUCT_TM
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */
+#undef HAVE_STRUCT_TM_TM_ZONE
+
/* Define to 1 if you have the <sys/errno.h> header file. */
#undef HAVE_SYS_ERRNO_H
@@ -286,6 +293,10 @@
/* Define if struct tm has a tm_gmtoff field. */
#undef HAVE_TM_TM_GMTOFF
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+ `HAVE_STRUCT_TM_TM_ZONE' instead. */
+#undef HAVE_TM_ZONE
+
/* function tzname exists */
#undef HAVE_TZNAME
@@ -338,6 +349,9 @@
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
@@ -363,6 +377,45 @@
/* Version number of package */
#undef VERSION
+/* struct timeval was found */
+#undef WE_HAVE_STRUCT_TIMEVAL
+
+/* struct timeval.tv_sec was found */
+#undef WE_HAVE_STRUCT_TIMEVAL_TV_SEC
+
+/* struct timeval.tv_usec was found */
+#undef WE_HAVE_STRUCT_TIMEVAL_TV_USEC
+
+/* struct tm was found */
+#undef WE_HAVE_STRUCT_TM
+
+/* struct tm.tm_hour was found */
+#undef WE_HAVE_STRUCT_TM_HOUR
+
+/* struct tm.tm_isdst was found */
+#undef WE_HAVE_STRUCT_TM_ISDST
+
+/* struct tm.tm_mday was found */
+#undef WE_HAVE_STRUCT_TM_MDAY
+
+/* struct tm.tm_min was found */
+#undef WE_HAVE_STRUCT_TM_MIN
+
+/* struct tm.tm_mon was found */
+#undef WE_HAVE_STRUCT_TM_MON
+
+/* struct tm.tm_sec was found */
+#undef WE_HAVE_STRUCT_TM_SEC
+
+/* struct tm.tm_wday was found */
+#undef WE_HAVE_STRUCT_TM_WDAY
+
+/* struct tm.tm_yday was found */
+#undef WE_HAVE_STRUCT_TM_YDAY
+
+/* struct tm.tm_year was found */
+#undef WE_HAVE_STRUCT_TM_YEAR
+
/* Defined if no way to sleep is available. */
#undef _GLIBCXX_NO_SLEEP
diff --git a/libgm2/configure b/libgm2/configure
index efe3b66..8ffdb31 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -2100,6 +2100,109 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_cxx_check_func
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval \${$4+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_member
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
@@ -2269,52 +2372,6 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
-
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@@ -6872,6 +6929,7 @@ $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
fi
+
ac_fn_c_check_header_mongrel "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default"
if test "x$ac_cv_header_math_h" = xyes; then :
@@ -6903,6 +6961,223 @@ fi
done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
+$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
+if ${ac_cv_struct_tm+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm tm;
+ int *p = &tm.tm_sec;
+ return !p;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_struct_tm=time.h
+else
+ ac_cv_struct_tm=sys/time.h
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
+
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+
+"
+if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_TM_TM_ZONE 1
+_ACEOF
+
+
+fi
+
+if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
+
+$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h
+
+else
+ ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include <time.h>
+"
+if test "x$ac_cv_have_decl_tzname" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_TZNAME $ac_have_decl
+_ACEOF
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5
+$as_echo_n "checking for tzname... " >&6; }
+if ${ac_cv_var_tzname+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <time.h>
+#if !HAVE_DECL_TZNAME
+extern char *tzname[];
+#endif
+
+int
+main ()
+{
+return tzname[0][0];
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_var_tzname=yes
+else
+ ac_cv_var_tzname=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5
+$as_echo "$ac_cv_var_tzname" >&6; }
+ if test $ac_cv_var_tzname = yes; then
+
+$as_echo "#define HAVE_TZNAME 1" >>confdefs.h
+
+ fi
+fi
+
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_year" "ac_cv_member_struct_tm_tm_year" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_year" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_year" "ac_cv_member_struct_tm_tm_year" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_year" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_YEAR 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_mon" "ac_cv_member_struct_tm_tm_mon" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_mon" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_MON 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_mday" "ac_cv_member_struct_tm_tm_mday" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_mday" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_MDAY 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_hour" "ac_cv_member_struct_tm_tm_hour" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_hour" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_HOUR 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_min" "ac_cv_member_struct_tm_tm_min" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_min" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_MIN 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_sec" "ac_cv_member_struct_tm_tm_sec" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_sec" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_SEC 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_year" "ac_cv_member_struct_tm_tm_year" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_year" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_YEAR 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_yday" "ac_cv_member_struct_tm_tm_yday" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_yday" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_YDAY 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_wday" "ac_cv_member_struct_tm_tm_wday" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_wday" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_WDAY 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_isdst" "ac_cv_member_struct_tm_tm_isdst" "#include <time.h>
+"
+if test "x$ac_cv_member_struct_tm_tm_isdst" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TM_ISDST 1" >>confdefs.h
+
+fi
+
+
+ac_fn_c_check_member "$LINENO" "struct timeval" "tv_sec" "ac_cv_member_struct_timeval_tv_sec" "$ac_includes_default"
+if test "x$ac_cv_member_struct_timeval_tv_sec" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TIMEVAL 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct timeval" "tv_sec" "ac_cv_member_struct_timeval_tv_sec" "$ac_includes_default"
+if test "x$ac_cv_member_struct_timeval_tv_sec" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TIMEVAL_TV_SEC 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct timeval" "tv_usec" "ac_cv_member_struct_timeval_tv_usec" "$ac_includes_default"
+if test "x$ac_cv_member_struct_timeval_tv_usec" = xyes; then :
+
+$as_echo "#define WE_HAVE_STRUCT_TIMEVAL_TV_USEC 1" >>confdefs.h
+
+fi
+
+
case ${build_alias} in
"") build_noncanonical=${build} ;;
@@ -14579,7 +14854,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 14582 "configure"
+#line 14857 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14685,7 +14960,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 14688 "configure"
+#line 14963 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index c070491..437485f 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -89,6 +89,7 @@ AC_ARG_WITH(cross-host,
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
+
AC_CHECK_HEADER([math.h],
[AC_DEFINE([HAVE_MATH_H], [1], [have math.h])])
@@ -102,6 +103,49 @@ AC_CHECK_HEADERS(getopt.h limits.h stddef.h string.h strings.h \
pthread.h stdarg.h stdio.h sys/types.h termios.h \
netinet/in.h netdb.h sys/uio.h sys/stat.h wchar.h)
+AC_STRUCT_TIMEZONE
+
+AC_CHECK_MEMBER([struct tm.tm_year],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM, [1], [struct tm was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_year],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_YEAR, [1], [struct tm.tm_year was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_mon],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_MON, [1], [struct tm.tm_mon was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_mday],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_MDAY, [1], [struct tm.tm_mday was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_hour],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_HOUR, [1], [struct tm.tm_hour was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_min],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_MIN, [1], [struct tm.tm_min was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_sec],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_SEC, [1], [struct tm.tm_sec was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_year],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_YEAR, [1], [struct tm.tm_year was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_yday],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_YDAY, [1], [struct tm.tm_yday was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_wday],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_WDAY, [1], [struct tm.tm_wday was found])],
+ [], [[#include <time.h>]])
+AC_CHECK_MEMBER([struct tm.tm_isdst],
+ [AC_DEFINE(WE_HAVE_STRUCT_TM_ISDST, [1], [struct tm.tm_isdst was found])],
+ [], [[#include <time.h>]])
+
+AC_CHECK_MEMBER([struct timeval.tv_sec],
+ [AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL, [1], [struct timeval was found])])
+AC_CHECK_MEMBER([struct timeval.tv_sec],
+ [AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL_TV_SEC, [1], [struct timeval.tv_sec was found])])
+AC_CHECK_MEMBER([struct timeval.tv_usec],
+ [AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL_TV_USEC, [1], [struct timeval.tv_usec was found])])
+
AC_CANONICAL_HOST
ACX_NONCANONICAL_HOST
ACX_NONCANONICAL_TARGET
diff --git a/libgm2/libm2iso/wraptime.cc b/libgm2/libm2iso/wraptime.cc
index 4bbd5f9..ed5f05e 100644
--- a/libgm2/libm2iso/wraptime.cc
+++ b/libgm2/libm2iso/wraptime.cc
@@ -58,7 +58,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* InitTimeval returns a newly created opaque type. */
-#if defined(HAVE_STRUCT_TIMEVAL) && defined(HAVE_MALLOC_H)
+#if defined(WE_HAVE_STRUCT_TIMEVAL) && defined(HAVE_MALLOC_H)
extern "C" struct timeval *
EXPORT(InitTimeval) (void)
{
@@ -85,7 +85,7 @@ EXPORT(KillTimeval) (void *tv)
/* InitTimezone returns a newly created opaque type. */
-#if defined(HAVE_STRUCT_TIMEZONE) && defined(HAVE_MALLOC_H)
+#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_MALLOC_H)
extern "C" struct timezone *
EXPORT(InitTimezone) (void)
{
@@ -102,14 +102,20 @@ EXPORT(InitTimezone) (void)
/* KillTimezone - deallocates the memory associated with an opaque
type. */
+#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_MALLOC_H)
extern "C" struct timezone *
EXPORT(KillTimezone) (struct timezone *tv)
{
-#if defined(HAVE_MALLOC_H)
free (tv);
-#endif
return NULL;
}
+#else
+extern "C" void *
+EXPORT(KillTimezone) (void *tv)
+{
+ return NULL;
+}
+#endif
/* InitTM - returns a newly created opaque type. */
@@ -141,7 +147,7 @@ EXPORT(KillTM) (struct tm *tv)
/* gettimeofday - calls gettimeofday(2) with the same parameters, tv,
and, tz. It returns 0 on success. */
-#if defined(HAVE_STRUCT_TIMEZONE) && defined(HAVE_GETTIMEOFDAY)
+#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_GETTIMEOFDAY)
extern "C" int
EXPORT(gettimeofday) (void *tv, struct timezone *tz)
{
@@ -158,7 +164,7 @@ EXPORT(gettimeofday) (void *tv, void *tz)
/* settimeofday - calls settimeofday(2) with the same parameters, tv,
and, tz. It returns 0 on success. */
-#if defined(HAVE_STRUCT_TIMEZONE) && defined(HAVE_SETTIMEOFDAY)
+#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_SETTIMEOFDAY)
extern "C" int
EXPORT(settimeofday) (void *tv, struct timezone *tz)
{
@@ -175,7 +181,7 @@ EXPORT(settimeofday) (void *tv, void *tz)
/* wraptime_GetFractions - returns the tv_usec field inside the
timeval structure. */
-#if defined(HAVE_STRUCT_TIMEVAL)
+#if defined(WE_HAVE_STRUCT_TIMEVAL_TV_USEC)
extern "C" unsigned int
EXPORT(GetFractions) (struct timeval *tv)
{
@@ -194,7 +200,7 @@ EXPORT(GetFractions) (void *tv)
this procedure function expects, timeval, as its first parameter
and not a time_t (as expected by the posix equivalent). */
-#if defined(HAVE_STRUCT_TIMEVAL)
+#if defined(WE_HAVE_STRUCT_TIMEVAL_TV_SEC)
extern "C" struct tm *
EXPORT(localtime_r) (struct timeval *tv, struct tm *m)
{
@@ -210,7 +216,7 @@ EXPORT(localtime_r) (void *tv, struct tm *m)
/* wraptime_GetYear - returns the year from the structure, m. */
-#if defined(HAVE_STRUCT_TM)
+#if defined(WE_HAVE_STRUCT_TM_YEAR)
extern "C" unsigned int
EXPORT(GetYear) (struct tm *m)
{
@@ -226,7 +232,7 @@ EXPORT(GetYear) (void *m)
/* wraptime_GetMonth - returns the month from the structure, m. */
-#if defined(HAVE_STRUCT_TM)
+#if defined(WE_HAVE_STRUCT_TM_MON)
extern "C" unsigned int
EXPORT(GetMonth) (struct tm *m)
{
@@ -243,7 +249,7 @@ EXPORT(GetMonth) (void *m)
/* wraptime_GetDay - returns the day of the month from the structure,
m. */
-#if defined(HAVE_STRUCT_TM)
+#if defined(WE_HAVE_STRUCT_TM_MDAY)
extern "C" unsigned int
EXPORT(GetDay) (struct tm *m)
{
@@ -260,7 +266,7 @@ EXPORT(GetDay) (void *m)
/* wraptime_GetHour - returns the hour of the day from the structure,
m. */
-#if defined(HAVE_STRUCT_TM)
+#if defined(WE_HAVE_STRUCT_TM_HOUR)
extern "C" unsigned int
EXPORT(GetHour) (struct tm *m)
{
@@ -277,7 +283,7 @@ EXPORT(GetHour) (void *m)
/* wraptime_GetMinute - returns the minute within the hour from the
structure, m. */
-#if defined(HAVE_STRUCT_TM)
+#if defined(WE_HAVE_STRUCT_TM_MIN)
extern "C" unsigned int
EXPORT(GetMinute) (struct tm *m)
{
@@ -295,7 +301,7 @@ EXPORT(GetMinute) (void *m)
structure, m. The return value will always be in the range 0..59.
A leap minute of value 60 will be truncated to 59. */
-#if defined(HAVE_STRUCT_TM)
+#if defined(WE_HAVE_STRUCT_TM_SEC)
extern "C" unsigned int
EXPORT(GetSecond) (struct tm *m)
{
@@ -314,7 +320,7 @@ EXPORT(GetSecond) (void *m)
/* wraptime_GetSummerTime - returns true if summer time is in effect. */
-#if defined(HAVE_STRUCT_TIMEZONE)
+#if defined(HAVE_STRUCT_TM_TM_ZONE)
extern "C" bool
EXPORT(GetSummerTime) (struct timezone *tz)
{
@@ -330,7 +336,7 @@ EXPORT(GetSummerTime) (void *tz)
/* wraptime_GetDST - returns the number of minutes west of GMT. */
-#if defined(HAVE_STRUCT_TIMEZONE)
+#if defined(HAVE_STRUCT_TM_TM_ZONE)
extern "C" int
EXPORT(GetDST) (struct timezone *tz)
{
@@ -350,7 +356,7 @@ EXPORT(GetDST) (void *tz)
/* SetTimezone - set the timezone field inside timeval, tv. */
-#if defined(HAVE_STRUCT_TIMEZONE)
+#if defined(HAVE_STRUCT_TM_TM_ZONE)
extern "C" void
EXPORT(SetTimezone) (struct timezone *tz, int zone, int minuteswest)
{
@@ -367,22 +373,40 @@ EXPORT(SetTimezone) (void *tz, int zone, int minuteswest)
/* SetTimeval - sets the fields in tm, t, with: second, minute, hour,
day, month, year, fractions. */
-#if defined(HAVE_STRUCT_TIMEVAL)
+#if defined(WE_HAVE_STRUCT_TM)
extern "C" void
EXPORT(SetTimeval) (struct tm *t, unsigned int second, unsigned int minute,
unsigned int hour, unsigned int day, unsigned int month,
unsigned int year, unsigned int yday, unsigned int wday,
unsigned int isdst)
{
+#if defined(WE_HAVE_STRUCT_TM_SEC)
t->tm_sec = second;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_MIN)
t->tm_min = minute;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_HOUR)
t->tm_hour = hour;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_MDAY)
t->tm_mday = day;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_MON)
t->tm_mon = month;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_YEAR)
t->tm_year = year;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_YDAY)
t->tm_yday = yday;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_WDAY)
t->tm_wday = wday;
+#endif
+#if defined(WE_HAVE_STRUCT_TM_ISDST)
t->tm_isdst = isdst;
+#endif
}
#else
extern "C" void
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index ceec42b..c9035c3 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,152 @@
+2025-05-28 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-28 Tobias Burnus <tburnus@baylibre.com>
+
+ PR middle-end/118694
+ * testsuite/libgomp.fortran/metadirective-1.f90: xfail when
+ compiling (also) for nvptx offloading as an error is then expected.
+
+2025-05-26 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-23 Tobias Burnus <tburnus@baylibre.com>
+
+ PR middle-end/118694
+ * testsuite/libgomp.c-c++-common/metadirective-1.c: xfail when
+ compiling (also) for nvptx offloading as an error is then expected.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-15 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/libgomp.fortran/alloc-comp-4.f90: New test.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-14 Tobias Burnus <tburnus@baylibre.com>
+
+ * target.c (gomp_attach_pointer): Return bool; accept additional
+ bool to optionally silence the fatal pointee-not-found error.
+ (gomp_map_vars_internal): If the pointee could not be found,
+ check whether it was mapped as GOMP_MAP_ZERO_LEN_ARRAY_SECTION.
+ * libgomp.h (gomp_attach_pointer): Update prototype.
+ * oacc-mem.c (acc_attach_async, goacc_enter_data_internal): Update
+ calls.
+ * testsuite/libgomp.c/target-map-zero-sized.c: New test.
+ * testsuite/libgomp.c/target-map-zero-sized-2.c: New test.
+ * testsuite/libgomp.c/target-map-zero-sized-3.c: New test.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-09 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/libgomp.c/interop-cuda-full.c: Use 'link' instead
+ of 'run' when the default device is "! offload_device_nvptx".
+ * testsuite/libgomp.c/interop-cuda-libonly.c: Likewise.
+ * testsuite/libgomp.c/interop-hip-nvidia-full.c: Likewise.
+ * testsuite/libgomp.c/interop-hip-nvidia-no-headers.c: Likewise.
+ * testsuite/libgomp.c/interop-hip-nvidia-no-hip-header.c: Likewise.
+ * testsuite/libgomp.fortran/interop-hip-nvidia-full.F90: Likewise.
+ * testsuite/libgomp.fortran/interop-hip-nvidia-no-module.F90: Likewise.
+ * testsuite/libgomp.c/interop-hip-amd-full.c: Use 'link' instead
+ of 'run' when the default device is "! offload_device_gcn".
+ * testsuite/libgomp.c/interop-hip-amd-no-hip-header.c: Likewise.
+ * testsuite/libgomp.fortran/interop-hip-amd-full.F90: Likewise.
+ * testsuite/libgomp.fortran/interop-hip-amd-no-module.F90: Likewise.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-07 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/libgomp.fortran/map-alloc-comp-9.f90: Process differently
+ when USE_USM_REQUIREMENT is set.
+ * testsuite/libgomp.fortran/map-alloc-comp-9-usm.f90: New test.
+
+2025-05-19 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-05 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * testsuite/libgomp.c/interop-hsa.c: GCN offloading only.
+
+2025-05-19 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from master:
+ 2025-05-01 Tobias Burnus <tobias@codesourcery.com>
+
+ * testsuite/libgomp.fortran/allocate-8a.f90: New test.
+
+2025-05-19 Andrew Stubbs <ams@baylibre.com>
+
+ Backported from master:
+ 2025-04-25 Andrew Stubbs <ams@baylibre.com>
+
+ * testsuite/libgomp.c/interop-hsa.c: New test.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-04-24 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/lib/libgomp.exp
+ (check_effective_target_gomp_hip_header_nvidia): Compile with
+ "-Wno-deprecated-declarations".
+ * testsuite/libgomp.c/interop-hip-nvidia-full.c: Likewise.
+ * testsuite/libgomp.c/interop-hipblas-nvidia-full.c: Likewise.
+ * testsuite/libgomp.c/interop-hipblas.h: Add workarounds
+ when using the HIP headers with __HIP_PLATFORM_NVIDIA__.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-04-24 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/lib/libgomp.exp (check_effective_target_openacc_cublas,
+ check_effective_target_openacc_cudart): Update description as
+ the check requires more.
+ (check_effective_target_openacc_libcuda,
+ check_effective_target_openacc_libcublas,
+ check_effective_target_openacc_libcudart,
+ check_effective_target_gomp_hip_header_amd,
+ check_effective_target_gomp_hip_header_nvidia,
+ check_effective_target_gomp_hipfort_module,
+ check_effective_target_gomp_libamdhip64,
+ check_effective_target_gomp_libhipblas): New.
+ * testsuite/libgomp.c-c++-common/interop-2.c: New test.
+ * testsuite/libgomp.c/interop-cublas-full.c: New test.
+ * testsuite/libgomp.c/interop-cublas-libonly.c: New test.
+ * testsuite/libgomp.c/interop-cuda-full.c: New test.
+ * testsuite/libgomp.c/interop-cuda-libonly.c: New test.
+ * testsuite/libgomp.c/interop-hip-amd-full.c: New test.
+ * testsuite/libgomp.c/interop-hip-amd-no-hip-header.c: New test.
+ * testsuite/libgomp.c/interop-hip-nvidia-full.c: New test.
+ * testsuite/libgomp.c/interop-hip-nvidia-no-headers.c: New test.
+ * testsuite/libgomp.c/interop-hip-nvidia-no-hip-header.c: New test.
+ * testsuite/libgomp.c/interop-hip.h: New test.
+ * testsuite/libgomp.c/interop-hipblas-amd-full.c: New test.
+ * testsuite/libgomp.c/interop-hipblas-amd-no-hip-header.c: New test.
+ * testsuite/libgomp.c/interop-hipblas-nvidia-full.c: New test.
+ * testsuite/libgomp.c/interop-hipblas-nvidia-no-headers.c: New test.
+ * testsuite/libgomp.c/interop-hipblas-nvidia-no-hip-header.c: New test.
+ * testsuite/libgomp.c/interop-hipblas.h: New test.
+ * testsuite/libgomp.fortran/interop-hip-amd-full.F90: New test.
+ * testsuite/libgomp.fortran/interop-hip-amd-no-module.F90: New test.
+ * testsuite/libgomp.fortran/interop-hip-nvidia-full.F90: New test.
+ * testsuite/libgomp.fortran/interop-hip-nvidia-no-module.F90: New test.
+ * testsuite/libgomp.fortran/interop-hip.h: New test.
+
+2025-05-19 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-04-23 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/libgomp.fortran/target-enter-data-8.f90: New test.
+
2025-05-06 Tejas Belagod <tejas.belagod@arm.com>
* testsuite/libgomp.c-target/aarch64/udr-sve.c: Fix test.
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 9823e58..689cfbf 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,266 @@
+2025-07-03 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from master:
+ 2025-06-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR libgomp/120444
+ * testsuite/libgomp.c-c++-common/omp_target_memset-3.c (test_it):
+ Change ptr argument type from void * to int8_t *.
+ (main): Change ptr variable type from void * to int8_t * and cast
+ omp_target_alloc result to the latter type.
+
+2025-06-17 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-17 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/libgomp.c++/declare_target-2.C: New test.
+
+2025-06-10 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-10 Tobias Burnus <tburnus@baylibre.com>
+
+ * testsuite/libgomp.c/declare-variant-4.h (gfx942): New variant function.
+ * testsuite/libgomp.c/declare-variant-4-gfx942.c: New test.
+
+2025-06-10 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-02 Tobias Burnus <tburnus@baylibre.com>
+
+ PR libgomp/120444
+ * libgomp-plugin.h (GOMP_OFFLOAD_memset): Declare.
+ * libgomp.h (struct gomp_device_descr): Add memset_func.
+ * libgomp.map (GOMP_6.0.1): Add omp_target_memset{,_async}.
+ * libgomp.texi (Device Memory Routines): Document them.
+ * omp.h.in (omp_target_memset, omp_target_memset_async): Declare.
+ * omp_lib.f90.in (omp_target_memset, omp_target_memset_async):
+ Add interfaces.
+ * omp_lib.h.in (omp_target_memset, omp_target_memset_async): Likewise.
+ * plugin/cuda-lib.def: Add cuMemsetD8.
+ * plugin/plugin-gcn.c (struct hsa_runtime_fn_info): Add
+ hsa_amd_memory_fill_fn.
+ (init_hsa_runtime_functions): DLSYM_OPT_FN load it.
+ (GOMP_OFFLOAD_memset): New.
+ * plugin/plugin-nvptx.c (GOMP_OFFLOAD_memset): New.
+ * target.c (omp_target_memset_int, omp_target_memset,
+ omp_target_memset_async_helper, omp_target_memset_async): New.
+ (gomp_load_plugin_for_device): Add DLSYM (memset).
+ * testsuite/libgomp.c-c++-common/omp_target_memset.c: New test.
+ * testsuite/libgomp.c-c++-common/omp_target_memset-2.c: New test.
+ * testsuite/libgomp.c-c++-common/omp_target_memset-3.c: New test.
+ * testsuite/libgomp.fortran/omp_target_memset.f90: New test.
+ * testsuite/libgomp.fortran/omp_target_memset-2.f90: New test.
+
+2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+ Sandra Loosemore <sloosemore@baylibre.com>
+
+ * libgomp.texi (omp_get_num_devices, omp_get_intrinsic_device):
+ Document builtin handling.
+
+2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-06-06 Tobias Burnus <tburnus@baylibre.com>
+
+ PR target/120530
+ * testsuite/libgomp.c/target-map-zero-sized-3.c (main): Add missing
+ map clause; remove unused variable.
+
+2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * testsuite/libgomp.c++/target-flex-300.C: XFAIL.
+ * testsuite/libgomp.c++/target-flex-60.C: Likewise.
+ * testsuite/libgomp.c++/target-flex-61.C: Likewise.
+ * testsuite/libgomp.c++/target-flex-62.C: Likewise.
+ * testsuite/libgomp.c++/target-flex-81.C: Likewise.
+
+2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * testsuite/libgomp.c++/target-std__valarray-1.C: New.
+ * testsuite/libgomp.c++/target-std__valarray-1.output: Likewise.
+
+2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * testsuite/libgomp.c++/target-std__array-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__array-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__bitset-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__deque-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__deque-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__list-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__list-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__map-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__map-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__multimap-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__multiset-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__set-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__set-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__span-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__span-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__valarray-concurrent.C: Adjust.
+ * testsuite/libgomp.c++/target-std__vector-concurrent-usm.C: New.
+ * testsuite/libgomp.c++/target-std__vector-concurrent.C: Adjust.
+
+2025-05-30 Kwok Cheung Yeung <kcyeung@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Kwok Cheung Yeung <kcyeung@baylibre.com>
+ Thomas Schwinge <tschwinge@baylibre.com>
+
+ * testsuite/libgomp.c++/target-std__array-concurrent.C: New.
+ * testsuite/libgomp.c++/target-std__bitset-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__deque-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__flat_map-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__flat_set-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__list-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__map-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__multimap-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__multiset-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__set-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__span-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__unordered_map-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__unordered_set-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__valarray-concurrent.C: Likewise.
+ * testsuite/libgomp.c++/target-std__vector-concurrent.C: Likewise.
+
+2025-05-30 Kwok Cheung Yeung <kcyeung@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Kwok Cheung Yeung <kcyeung@baylibre.com>
+
+ * testsuite/libgomp.c++/target-std__cmath.C: New.
+ * testsuite/libgomp.c++/target-std__complex.C: Likewise.
+ * testsuite/libgomp.c++/target-std__numbers.C: Likewise.
+
+2025-05-30 Waffl3x <waffl3x@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Waffl3x <waffl3x@baylibre.com>
+ Thomas Schwinge <tschwinge@baylibre.com>
+
+ * testsuite/libgomp.c++/target-flex-10.C: New test.
+ * testsuite/libgomp.c++/target-flex-100.C: New test.
+ * testsuite/libgomp.c++/target-flex-101.C: New test.
+ * testsuite/libgomp.c++/target-flex-11.C: New test.
+ * testsuite/libgomp.c++/target-flex-12.C: New test.
+ * testsuite/libgomp.c++/target-flex-2000.C: New test.
+ * testsuite/libgomp.c++/target-flex-2001.C: New test.
+ * testsuite/libgomp.c++/target-flex-2002.C: New test.
+ * testsuite/libgomp.c++/target-flex-2003.C: New test.
+ * testsuite/libgomp.c++/target-flex-30.C: New test.
+ * testsuite/libgomp.c++/target-flex-300.C: New test.
+ * testsuite/libgomp.c++/target-flex-31.C: New test.
+ * testsuite/libgomp.c++/target-flex-32.C: New test.
+ * testsuite/libgomp.c++/target-flex-33.C: New test.
+ * testsuite/libgomp.c++/target-flex-41.C: New test.
+ * testsuite/libgomp.c++/target-flex-60.C: New test.
+ * testsuite/libgomp.c++/target-flex-61.C: New test.
+ * testsuite/libgomp.c++/target-flex-62.C: New test.
+ * testsuite/libgomp.c++/target-flex-70.C: New test.
+ * testsuite/libgomp.c++/target-flex-80.C: New test.
+ * testsuite/libgomp.c++/target-flex-81.C: New test.
+ * testsuite/libgomp.c++/target-flex-90.C: New test.
+ * testsuite/libgomp.c++/target-flex-common.h: New test.
+
+2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-30 Thomas Schwinge <tschwinge@baylibre.com>
+ Richard Biener <rguenther@suse.de>
+
+ PR middle-end/119835
+ * testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c:
+ '#pragma GCC optimize "-fno-inline"'.
+ * testsuite/libgomp.c-c++-common/target-abi-struct-1.c: New.
+ * testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c: Adjust.
+
+2025-05-30 Tobias Burnus <tburnus@baylibre.com>
+
+ Backported from master:
+ 2025-05-29 Tobias Burnus <tburnus@baylibre.com>
+
+ PR libgomp/93226
+ * libgomp-plugin.h (GOMP_OFFLOAD_openacc_async_dev2dev): New
+ prototype.
+ * libgomp.h (struct acc_dispatch_t): Add dev2dev_func.
+ (gomp_copy_dev2dev): New prototype.
+ * libgomp.map (OACC_2.6.1): New; add acc_memcpy_device{,_async}.
+ * libgomp.texi (acc_memcpy_device): New.
+ * oacc-mem.c (memcpy_tofrom_device): Change to take from/to
+ device boolean; use memcpy not memmove; add early return if
+ size == 0 or same device + same ptr.
+ (acc_memcpy_to_device, acc_memcpy_to_device_async,
+ acc_memcpy_from_device, acc_memcpy_from_device_async): Update.
+ (acc_memcpy_device, acc_memcpy_device_async): New.
+ * openacc.f90 (acc_memcpy_device, acc_memcpy_device_async):
+ Add interface.
+ * openacc_lib.h (acc_memcpy_device, acc_memcpy_device_async):
+ Likewise.
+ * openacc.h (acc_memcpy_device, acc_memcpy_device_async): Add
+ prototype.
+ * plugin/plugin-gcn.c (GOMP_OFFLOAD_openacc_async_host2dev):
+ Update comment.
+ (GOMP_OFFLOAD_openacc_async_dev2host): Update call.
+ (GOMP_OFFLOAD_openacc_async_dev2dev): New.
+ * plugin/plugin-nvptx.c (cuda_memcpy_dev_sanity_check): New.
+ (GOMP_OFFLOAD_dev2dev): Call it.
+ (GOMP_OFFLOAD_openacc_async_dev2dev): New.
+ * target.c (gomp_copy_dev2dev): New.
+ (gomp_load_plugin_for_device): Load dev2dev and async_dev2dev.
+ * testsuite/libgomp.oacc-c-c++-common/acc_memcpy_device-1.c: New test.
+ * testsuite/libgomp.oacc-fortran/acc_memcpy_device-1.f90: New test.
+
+2025-05-22 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-19 Thomas Schwinge <tschwinge@baylibre.com>
+
+ PR lto/120308
+ * testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c: Add empty
+ structure testing.
+
+2025-05-22 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-19 Thomas Schwinge <tschwinge@baylibre.com>
+
+ * testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c: New.
+ * testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c: Likewise.
+
+2025-05-22 Thomas Schwinge <tschwinge@baylibre.com>
+
+ Backported from master:
+ 2025-05-12 Thomas Schwinge <tschwinge@baylibre.com>
+
+ PR target/119692
+ * testsuite/libgomp.c++/pr119692-1-4.C: '{ dg-timeout 10 }'.
+ * testsuite/libgomp.c++/pr119692-1-5.C: Likewise.
+ * testsuite/libgomp.c++/target-exceptions-bad_cast-1.C: Likewise.
+ * testsuite/libgomp.c++/target-exceptions-bad_cast-2.C: Likewise.
+ * testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C: Likewise.
+ * testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C: Likewise.
+
2025-05-16 Tobias Burnus <tburnus@baylibre.com>
Backported from master:
@@ -860,4 +1123,4 @@
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-3.c: New test.
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-4.c: New test.
* testsuite/libgomp.oacc-c-c++-common/noncontig_array-utils.h: Support
- header for new tests. \ No newline at end of file
+ header for new tests.
diff --git a/libgomp/libgomp-plugin.h b/libgomp/libgomp-plugin.h
index 479264b..d0bcc23 100644
--- a/libgomp/libgomp-plugin.h
+++ b/libgomp/libgomp-plugin.h
@@ -179,6 +179,7 @@ extern int GOMP_OFFLOAD_memcpy3d (int, int, size_t, size_t, size_t, void *,
size_t, size_t, size_t, size_t, size_t,
const void *, size_t, size_t, size_t, size_t,
size_t);
+extern bool GOMP_OFFLOAD_memset (int, void *, int, size_t);
extern bool GOMP_OFFLOAD_can_run (void *);
extern void GOMP_OFFLOAD_run (int, void *, void *, void **);
extern void GOMP_OFFLOAD_async_run (int, void *, void *, void **, void *);
@@ -202,6 +203,8 @@ extern bool GOMP_OFFLOAD_openacc_async_dev2host (int, void *, const void *, size
struct goacc_asyncqueue *);
extern bool GOMP_OFFLOAD_openacc_async_host2dev (int, void *, const void *, size_t,
struct goacc_asyncqueue *);
+extern bool GOMP_OFFLOAD_openacc_async_dev2dev (int, void *, const void *, size_t,
+ struct goacc_asyncqueue *);
extern void *GOMP_OFFLOAD_openacc_cuda_get_current_device (void);
extern void *GOMP_OFFLOAD_openacc_cuda_get_current_context (void);
extern void *GOMP_OFFLOAD_openacc_cuda_get_stream (struct goacc_asyncqueue *);
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 04f3c6d..465f7c1 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -1378,6 +1378,7 @@ typedef struct acc_dispatch_t
__typeof (GOMP_OFFLOAD_openacc_async_exec) *exec_func;
__typeof (GOMP_OFFLOAD_openacc_async_dev2host) *dev2host_func;
__typeof (GOMP_OFFLOAD_openacc_async_host2dev) *host2dev_func;
+ __typeof (GOMP_OFFLOAD_openacc_async_dev2dev) *dev2dev_func;
} async;
__typeof (GOMP_OFFLOAD_openacc_get_property) *get_property_func;
@@ -1440,9 +1441,10 @@ struct gomp_device_descr
__typeof (GOMP_OFFLOAD_page_locked_host_free) *page_locked_host_free_func;
__typeof (GOMP_OFFLOAD_dev2host) *dev2host_func;
__typeof (GOMP_OFFLOAD_host2dev) *host2dev_func;
+ __typeof (GOMP_OFFLOAD_dev2dev) *dev2dev_func;
__typeof (GOMP_OFFLOAD_memcpy2d) *memcpy2d_func;
__typeof (GOMP_OFFLOAD_memcpy3d) *memcpy3d_func;
- __typeof (GOMP_OFFLOAD_dev2dev) *dev2dev_func;
+ __typeof (GOMP_OFFLOAD_memset) *memset_func;
__typeof (GOMP_OFFLOAD_can_run) *can_run_func;
__typeof (GOMP_OFFLOAD_run) *run_func;
__typeof (GOMP_OFFLOAD_async_run) *async_run_func;
@@ -1485,6 +1487,9 @@ extern void gomp_copy_host2dev (struct gomp_device_descr *,
extern void gomp_copy_dev2host (struct gomp_device_descr *,
struct goacc_asyncqueue *, void *, const void *,
size_t);
+extern void gomp_copy_dev2dev (struct gomp_device_descr *,
+ struct goacc_asyncqueue *, void *, const void *,
+ size_t);
extern uintptr_t gomp_map_val (struct target_mem_desc *, void **, size_t);
extern bool gomp_attach_pointer (struct gomp_device_descr *,
struct goacc_asyncqueue *, splay_tree,
diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map
index 6e2cdbf..a6c523b 100644
--- a/libgomp/libgomp.map
+++ b/libgomp/libgomp.map
@@ -454,6 +454,12 @@ GOMP_6.0 {
omp_get_uid_from_device_8_;
} GOMP_5.1.3;
+GOMP_6.0.1 {
+ global:
+ omp_target_memset;
+ omp_target_memset_async;
+} GOMP_6.0;
+
OACC_2.0 {
global:
acc_get_num_devices;
@@ -610,6 +616,12 @@ OACC_2.6 {
acc_get_property_string_h_;
} OACC_2.5.1;
+OACC_2.6.1 {
+ global:
+ acc_memcpy_device;
+ acc_memcpy_device_async;
+} OACC_2.6;
+
GOACC_2.0 {
global:
GOACC_data_end;
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index 658df0e..91259cc 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -603,7 +603,7 @@ to address of matching mapped list item per 5.1, Sect. 2.21.7.2 @tab N @tab
@code{omp_get_device_teams_thread_limit}, and
@code{omp_set_device_teams_thread_limit} routines @tab N @tab
@item @code{omp_target_memset} and @code{omp_target_memset_async} routines
- @tab N @tab
+ @tab Y @tab
@item Fortran version of the interop runtime routines @tab Y @tab
@item Routines for obtaining memory spaces/allocators for shared/device memory
@tab N @tab
@@ -1802,6 +1802,11 @@ Returns the number of available non-host devices.
The effect of running this routine in a @code{target} region is unspecified.
+Note that in GCC the function is marked pure, i.e. as returning always the
+same number. When GCC was not configured to support offloading, it is replaced
+by zero; compile with @option{-fno-builtin-omp_get_num_devices} if a run-time
+function is desired.
+
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_num_devices(void);}
@@ -1812,6 +1817,9 @@ The effect of running this routine in a @code{target} region is unspecified.
@item @emph{Interface}: @tab @code{integer function omp_get_num_devices()}
@end multitable
+@item @emph{See also}:
+@ref{omp_get_initial_device}
+
@item @emph{Reference}:
@uref{https://www.openmp.org, OpenMP specification v4.5}, Section 3.2.31.
@end table
@@ -1950,6 +1958,12 @@ the value of @code{omp_initial_device}.
The effect of running this routine in a @code{target} region is unspecified.
+Note that GCC inlines this function unless you compile with
+@option{-fno-builtin-omp_get_initial_device}. If GCC was not configured to
+support offloading, it expands to constant zero; in non-host code it expands
+to @code{omp_initial_device}; and otherwise it is replaced with a call to
+@code{omp_get_num_devices}.
+
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_initial_device(void);}
@@ -1984,8 +1998,8 @@ pointers on devices. They have C linkage and do not throw exceptions.
* omp_target_memcpy_async:: Copy data between devices asynchronously
* omp_target_memcpy_rect:: Copy a subvolume of data between devices
* omp_target_memcpy_rect_async:: Copy a subvolume of data between devices asynchronously
-@c * omp_target_memset:: <fixme>/TR12
-@c * omp_target_memset_async:: <fixme>/TR12
+* omp_target_memset:: Set bytes in device memory
+* omp_target_memset_async:: Set bytes in device memory asynchronously
* omp_target_associate_ptr:: Associate a device pointer with a host pointer
* omp_target_disassociate_ptr:: Remove device--host pointer association
* omp_get_mapped_ptr:: Return device pointer to a host pointer
@@ -2398,6 +2412,98 @@ the initial device.
@end table
+@node omp_target_memset
+@subsection @code{omp_target_memset} -- Set bytes in device memory
+@table @asis
+@item @emph{Description}:
+This routine fills memory on the device identified by device number
+@var{device_num}. Starting from the device address @var{ptr}, the first
+@var{count} bytes are set to the value @var{val}, converted to
+@code{unsigned char}. If @var{count} is zero, the routine has no effect;
+if @var{ptr} is @code{NULL}, the behavior is unspecified. The function
+returns @var{ptr}.
+
+The @var{device_num} must be a conforming device number and @var{ptr} must be
+a valid device pointer for that device. Running this routine in a
+@code{target} region except on the initial device is not supported.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{void *omp_target_memcpy(void *ptr,}
+@item @tab @code{ int val,}
+@item @tab @code{ size_t count,}
+@item @tab @code{ int device_num)}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{type(c_ptr) function omp_target_memset( &}
+@item @tab @code{ ptr, val, count, device_num) bind(C)}
+@item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int}
+@item @tab @code{type(c_ptr), value :: ptr}
+@item @tab @code{integer(c_size_t), value :: count}
+@item @tab @code{integer(c_int), value :: val, device_num}
+@end multitable
+
+@item @emph{See also}:
+@ref{omp_target_memset_async}
+
+@item @emph{Reference}:
+@uref{https://www.openmp.org, OpenMP specification v6.0}, Section 25.8.1
+@end table
+
+
+
+@node omp_target_memset_async
+@subsection @code{omp_target_memset} -- Set bytes in device memory asynchronously
+@table @asis
+@item @emph{Description}:
+This routine fills memory on the device identified by device number
+@var{device_num}. Starting from the device address @var{ptr}, the first
+@var{count} bytes are set to the value @var{val}, converted to
+@code{unsigned char}. If @var{count} is zero, the routine has no effect;
+if @var{ptr} is @code{NULL}, the behavior is unspecified. Task dependence
+is expressed by passing an array of depend objects to @var{depobj_list}, where
+the number of array elements is passed as @var{depobj_count}; if the count is
+zero, the @var{depobj_list} argument is ignored. In C++ and Fortran, the
+@var{depobj_list} argument can also be omitted in that case. The function
+returns @var{ptr}.
+
+The @var{device_num} must be a conforming device number and @var{ptr} must be
+a valid device pointer for that device. Running this routine in a
+@code{target} region except on the initial device is not supported.
+
+@item @emph{C/C++}
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{void *omp_target_memcpy_async(void *ptr,}
+@item @tab @code{ int val,}
+@item @tab @code{ size_t count,}
+@item @tab @code{ int device_num,}
+@item @tab @code{ int depobj_count,}
+@item @tab @code{ omp_depend_t *depobj_list)}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{type(c_ptr) function omp_target_memset_async( &}
+@item @tab @code{ ptr, val, count, device_num, &}
+@item @tab @code{ depobj_count, depobj_list) bind(C)}
+@item @tab @code{use, intrinsic :: iso_c_binding, only: c_ptr, c_size_t, c_int}
+@item @tab @code{type(c_ptr), value :: ptr}
+@item @tab @code{integer(c_size_t), value :: count}
+@item @tab @code{integer(c_int), value :: val, device_num, depobj_count}
+@item @tab @code{integer(omp_depend_kind), optional :: depobj_list(*)}
+@end multitable
+
+
+@item @emph{See also}:
+@ref{omp_target_memset}
+
+@item @emph{Reference}:
+@uref{https://www.openmp.org, OpenMP specification v6.0}, Section 25.8.2
+@end table
+
+
@node omp_target_associate_ptr
@subsection @code{omp_target_associate_ptr} -- Associate a device pointer with a host pointer
@@ -4780,6 +4886,7 @@ acceleration device.
present on device.
* acc_memcpy_to_device:: Copy host memory to device memory.
* acc_memcpy_from_device:: Copy device memory to host memory.
+* acc_memcpy_device:: Copy memory within a device.
* acc_attach:: Let device pointer point to device-pointer target.
* acc_detach:: Let device pointer point to host-pointer target.
@@ -5854,6 +5961,44 @@ This function copies device memory specified by device address of
+@node acc_memcpy_device
+@section @code{acc_memcpy_device} -- Copy memory within a device.
+@table @asis
+@item @emph{Description}
+This function copies device memory from one memory location to another
+on the current device. It copies @var{bytes} bytes of data from the device
+address, specified by @var{data_dev_src}, to the device address
+@var{data_dev_dest}. The @code{_async} version performs the transfer
+asnychronously using the queue associated with @var{async_arg}.
+
+@item @emph{C/C++}:
+@multitable @columnfractions .20 .80
+@item @emph{Prototype}: @tab @code{void acc_memcpy_device(d_void* data_dev_dest,}
+@item @tab @code{d_void* data_dev_src, size_t bytes);}
+@item @emph{Prototype}: @tab @code{void acc_memcpy_device_async(d_void* data_dev_dest,}
+@item @tab @code{d_void* data_dev_src, size_t bytes, int async_arg);}
+@end multitable
+
+@item @emph{Fortran}:
+@multitable @columnfractions .20 .80
+@item @emph{Interface}: @tab @code{subroutine acc_memcpy_device(data_dev_dest, &}
+@item @tab @code{data_dev_src, bytes)}
+@item @emph{Interface}: @tab @code{subroutine acc_memcpy_device_async(data_dev_dest, &}
+@item @tab @code{data_dev_src, bytes, async_arg)}
+@item @tab @code{type(c_ptr), value :: data_dev_dest}
+@item @tab @code{type(c_ptr), value :: data_dev_src}
+@item @tab @code{integer(c_size_t), value :: bytes}
+@item @tab @code{integer(acc_handle_kind), value :: async_arg}
+@end multitable
+
+@item @emph{Reference}:
+@uref{https://www.openacc.org, OpenACC specification v2.6}, section
+3.2.33. @uref{https://www.openacc.org, OpenACC specification v3.3}, section
+3.2.28.
+@end table
+
+
+
@node acc_attach
@section @code{acc_attach} -- Let device pointer point to device-pointer target.
@table @asis
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index a00ea16..e40b41b 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -171,21 +171,22 @@ acc_free (void *d)
}
static void
-memcpy_tofrom_device (bool from, void *d, void *h, size_t s, int async,
- const char *libfnname)
+memcpy_tofrom_device (bool dev_to, bool dev_from, void *dst, void *src,
+ size_t s, int async, const char *libfnname)
{
/* No need to call lazy open here, as the device pointer must have
been obtained from a routine that did that. */
struct goacc_thread *thr = goacc_thread ();
assert (thr && thr->dev);
+ if (s == 0)
+ return;
if (thr->dev->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
{
- if (from)
- memmove (h, d, s);
- else
- memmove (d, h, s);
+ if (src == dst)
+ return;
+ memcpy (dst, src, s);
return;
}
@@ -199,10 +200,15 @@ memcpy_tofrom_device (bool from, void *d, void *h, size_t s, int async,
}
goacc_aq aq = get_goacc_asyncqueue (async);
- if (from)
- gomp_copy_dev2host (thr->dev, aq, h, d, s);
+ if (dev_to && dev_from)
+ {
+ if (dst != src)
+ gomp_copy_dev2dev (thr->dev, aq, dst, src, s);
+ }
+ else if (dev_from)
+ gomp_copy_dev2host (thr->dev, aq, dst, src, s);
else
- gomp_copy_host2dev (thr->dev, aq, d, h, s, false, /* TODO: cbuf? */ NULL);
+ gomp_copy_host2dev (thr->dev, aq, dst, src, s, false, /* TODO: cbuf? */ NULL);
if (profiling_p)
{
@@ -214,25 +220,37 @@ memcpy_tofrom_device (bool from, void *d, void *h, size_t s, int async,
void
acc_memcpy_to_device (void *d, void *h, size_t s)
{
- memcpy_tofrom_device (false, d, h, s, acc_async_sync, __FUNCTION__);
+ memcpy_tofrom_device (true, false, d, h, s, acc_async_sync, __FUNCTION__);
}
void
acc_memcpy_to_device_async (void *d, void *h, size_t s, int async)
{
- memcpy_tofrom_device (false, d, h, s, async, __FUNCTION__);
+ memcpy_tofrom_device (true, false, d, h, s, async, __FUNCTION__);
}
void
acc_memcpy_from_device (void *h, void *d, size_t s)
{
- memcpy_tofrom_device (true, d, h, s, acc_async_sync, __FUNCTION__);
+ memcpy_tofrom_device (false, true, h, d, s, acc_async_sync, __FUNCTION__);
}
void
acc_memcpy_from_device_async (void *h, void *d, size_t s, int async)
{
- memcpy_tofrom_device (true, d, h, s, async, __FUNCTION__);
+ memcpy_tofrom_device (false, true, h, d, s, async, __FUNCTION__);
+}
+
+void
+acc_memcpy_device (void *dst, void *src, size_t s)
+{
+ memcpy_tofrom_device (true, true, dst, src, s, acc_async_sync, __FUNCTION__);
+}
+
+void
+acc_memcpy_device_async (void *dst, void *src, size_t s, int async)
+{
+ memcpy_tofrom_device (true, true, dst, src, s, async, __FUNCTION__);
}
/* Return the device pointer that corresponds to host data H. Or NULL
diff --git a/libgomp/omp.h.in b/libgomp/omp.h.in
index 8d17db1..4f2bc46 100644
--- a/libgomp/omp.h.in
+++ b/libgomp/omp.h.in
@@ -347,6 +347,10 @@ extern int omp_target_memcpy_rect_async (void *, const void *, __SIZE_TYPE__,
const __SIZE_TYPE__ *, int, int, int,
omp_depend_t * __GOMP_DEFAULT_NULL)
__GOMP_NOTHROW;
+extern void *omp_target_memset (void *, int, __SIZE_TYPE__, int) __GOMP_NOTHROW;
+extern void *omp_target_memset_async (void *, int, __SIZE_TYPE__, int,
+ int, omp_depend_t * __GOMP_DEFAULT_NULL)
+ __GOMP_NOTHROW;
extern int omp_target_associate_ptr (const void *, const void *, __SIZE_TYPE__,
__SIZE_TYPE__, int) __GOMP_NOTHROW;
extern int omp_target_disassociate_ptr (const void *, int) __GOMP_NOTHROW;
diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in
index cb6b95f..ce866c0 100644
--- a/libgomp/omp_lib.f90.in
+++ b/libgomp/omp_lib.f90.in
@@ -904,6 +904,29 @@
end interface
interface
+ function omp_target_memset (ptr, val, count, device_num) bind(c)
+ use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
+ type(c_ptr) :: omp_target_memset
+ type(c_ptr), value :: ptr
+ integer(c_size_t), value :: count
+ integer(c_int), value :: val, device_num
+ end function omp_target_memset
+ end interface
+
+ interface
+ function omp_target_memset_async (ptr, val, count, device_num, &
+ depobj_count, depobj_list) bind(c)
+ use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
+ import :: omp_depend_kind
+ type(c_ptr) :: omp_target_memset_async
+ type(c_ptr), value :: ptr
+ integer(c_size_t), value :: count
+ integer(c_int), value :: val, device_num, depobj_count
+ integer(omp_depend_kind), optional :: depobj_list(*)
+ end function omp_target_memset_async
+ end interface
+
+ interface
function omp_target_associate_ptr (host_ptr, device_ptr, size, &
device_offset, device_num) bind(c)
use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t, c_int
diff --git a/libgomp/omp_lib.h.in b/libgomp/omp_lib.h.in
index f7af5ff..9047095 100644
--- a/libgomp/omp_lib.h.in
+++ b/libgomp/omp_lib.h.in
@@ -505,6 +505,31 @@
end interface
interface
+ function omp_target_memset (ptr, val, count, device_num) bind(c)
+ use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
+ type(c_ptr) omp_target_memset
+ type(c_ptr), value :: ptr
+ integer(c_size_t), value :: count
+ integer(c_int), value :: val, device_num
+ end function omp_target_memset
+ end interface
+
+ interface
+ function omp_target_memset_async (ptr, val, count, device_num, &
+ & depobj_count, depobj_list) &
+ & bind(c)
+ use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t
+ import :: omp_depend_kind
+ type(c_ptr) :: omp_target_memset_async
+ type(c_ptr), value :: ptr
+ integer(c_size_t), value :: count
+ integer(c_int), value :: val, device_num, depobj_count
+ integer(omp_depend_kind), optional :: depobj_list(*)
+ end function omp_target_memset_async
+ end interface
+
+
+ interface
function omp_target_associate_ptr (host_ptr, device_ptr, size, &
& device_offset, device_num) &
& bind(c)
diff --git a/libgomp/openacc.f90 b/libgomp/openacc.f90
index a3d7bcb..55894df 100644
--- a/libgomp/openacc.f90
+++ b/libgomp/openacc.f90
@@ -797,6 +797,7 @@ module openacc
public :: acc_copyout_finalize, acc_delete_finalize
public :: acc_memcpy_to_device, acc_memcpy_to_device_async
public :: acc_memcpy_from_device, acc_memcpy_from_device_async
+ public :: acc_memcpy_device, acc_memcpy_device_async
integer, parameter :: openacc_version = 201811
@@ -1046,6 +1047,27 @@ module openacc
end subroutine
end interface
+ interface
+ subroutine acc_memcpy_device (data_dev_dest, data_dev_src, bytes) bind(C)
+ use iso_c_binding, only: c_ptr, c_size_t
+ type(c_ptr), value :: data_dev_dest
+ type(c_ptr), value :: data_dev_src
+ integer(c_size_t), value :: bytes
+ end subroutine
+ end interface
+
+ interface
+ subroutine acc_memcpy_device_async (data_dev_dest, data_dev_src, &
+ bytes, async_arg) bind(C)
+ use iso_c_binding, only: c_ptr, c_size_t
+ import :: acc_handle_kind
+ type(c_ptr), value :: data_dev_dest
+ type(c_ptr), value :: data_dev_src
+ integer(c_size_t), value :: bytes
+ integer(acc_handle_kind), value :: async_arg
+ end subroutine
+ end interface
+
interface acc_copyin_async
procedure :: acc_copyin_async_32_h
procedure :: acc_copyin_async_64_h
diff --git a/libgomp/openacc.h b/libgomp/openacc.h
index a520bbe..3085b00 100644
--- a/libgomp/openacc.h
+++ b/libgomp/openacc.h
@@ -123,6 +123,7 @@ void *acc_hostptr (void *) __GOACC_NOTHROW;
int acc_is_present (void *, size_t) __GOACC_NOTHROW;
void acc_memcpy_to_device (void *, void *, size_t) __GOACC_NOTHROW;
void acc_memcpy_from_device (void *, void *, size_t) __GOACC_NOTHROW;
+void acc_memcpy_device (void *, void *, size_t) __GOACC_NOTHROW;
void acc_attach (void **) __GOACC_NOTHROW;
void acc_attach_async (void **, int) __GOACC_NOTHROW;
void acc_detach (void **) __GOACC_NOTHROW;
@@ -136,7 +137,7 @@ void acc_delete_finalize_async (void *, size_t, int) __GOACC_NOTHROW;
void acc_detach_finalize (void **) __GOACC_NOTHROW;
void acc_detach_finalize_async (void **, int) __GOACC_NOTHROW;
-/* Async functions, specified in OpenACC 2.5. */
+/* Async functions, specified in OpenACC 2.5, acc_memcpy_device in 2.6. */
void acc_copyin_async (void *, size_t, int) __GOACC_NOTHROW;
void acc_create_async (void *, size_t, int) __GOACC_NOTHROW;
void acc_copyout_async (void *, size_t, int) __GOACC_NOTHROW;
@@ -145,6 +146,7 @@ void acc_update_device_async (void *, size_t, int) __GOACC_NOTHROW;
void acc_update_self_async (void *, size_t, int) __GOACC_NOTHROW;
void acc_memcpy_to_device_async (void *, void *, size_t, int) __GOACC_NOTHROW;
void acc_memcpy_from_device_async (void *, void *, size_t, int) __GOACC_NOTHROW;
+void acc_memcpy_device_async (void *, void *, size_t, int) __GOACC_NOTHROW;
/* CUDA-specific routines. */
void *acc_get_current_cuda_device (void) __GOACC_NOTHROW;
diff --git a/libgomp/openacc_lib.h b/libgomp/openacc_lib.h
index d830574..e0e7788 100644
--- a/libgomp/openacc_lib.h
+++ b/libgomp/openacc_lib.h
@@ -528,6 +528,30 @@
end subroutine
end interface
+ interface
+ subroutine acc_memcpy_device(data_dev_dest, data_dev_src, &
+ & bytes) bind(C)
+ use iso_c_binding, only: c_ptr, c_size_t
+ type(c_ptr), value :: data_dev_dest
+ type(c_ptr), value :: data_dev_src
+ integer(c_size_t), value :: bytes
+ end subroutine
+ end interface
+
+ interface
+ subroutine acc_memcpy_device_async(data_dev_dest, &
+ & data_dev_src, bytes, &
+ & async_arg) bind(C)
+ use iso_c_binding, only: c_ptr, c_size_t
+ import :: acc_handle_kind
+ type(c_ptr), value :: data_dev_dest
+ type(c_ptr), value :: data_dev_src
+ integer(c_size_t), value :: bytes
+ integer(acc_handle_kind), value :: async_arg
+ end subroutine
+ end interface
+
+
interface acc_copyin_async
subroutine acc_copyin_async_32_h (a, len, async)
use iso_c_binding, only: c_int32_t
diff --git a/libgomp/plugin/cuda-lib.def b/libgomp/plugin/cuda-lib.def
index eb562ac..7f4ddcc 100644
--- a/libgomp/plugin/cuda-lib.def
+++ b/libgomp/plugin/cuda-lib.def
@@ -42,6 +42,7 @@ CUDA_ONE_CALL (cuMemcpyHtoDAsync)
CUDA_ONE_CALL (cuMemcpy2D)
CUDA_ONE_CALL (cuMemcpy2DUnaligned)
CUDA_ONE_CALL (cuMemcpy3D)
+CUDA_ONE_CALL (cuMemsetD8)
CUDA_ONE_CALL (cuMemFree)
CUDA_ONE_CALL (cuMemFreeHost)
CUDA_ONE_CALL (cuMemGetAddressRange)
diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c
index b39a94b..ae358f5 100644
--- a/libgomp/plugin/plugin-gcn.c
+++ b/libgomp/plugin/plugin-gcn.c
@@ -208,6 +208,8 @@ struct hsa_runtime_fn_info
hsa_status_t (*hsa_code_object_deserialize_fn)
(void *serialized_code_object, size_t serialized_code_object_size,
const char *options, hsa_code_object_t *code_object);
+ hsa_status_t (*hsa_amd_memory_fill_fn)(void *ptr, uint32_t value,
+ size_t count);
hsa_status_t (*hsa_amd_memory_lock_fn)
(void *host_ptr, size_t size, hsa_agent_t *agents, int num_agent,
void **agent_ptr);
@@ -1456,6 +1458,7 @@ init_hsa_runtime_functions (void)
DLSYM_FN (hsa_signal_load_acquire)
DLSYM_FN (hsa_queue_destroy)
DLSYM_FN (hsa_code_object_deserialize)
+ DLSYM_OPT_FN (hsa_amd_memory_fill)
DLSYM_OPT_FN (hsa_amd_memory_lock)
DLSYM_OPT_FN (hsa_amd_memory_unlock)
DLSYM_OPT_FN (hsa_amd_memory_async_copy_rect)
@@ -4437,6 +4440,83 @@ init_hip_runtime_functions (void)
return true;
}
+bool
+GOMP_OFFLOAD_memset (int ord, void *ptr, int val, size_t count)
+{
+ hsa_status_t status = HSA_STATUS_SUCCESS;
+
+ /* A memset feature is only provided via hsa_amd_memory_fill; while it
+ is fast, it is an HSA extension and it has two requirements: The memory
+ must be aligned to multiples of 4 bytes - and, by construction, only
+ multiples of 4 bytes can be filled (uint32_t value argument).
+
+ This means: Either not using that function or up to three function calls:
+ - copy 1 to 3 bytes to get alignment (hsa_memory_copy), if unaligned
+ - call hsa_amd_memory_fill
+ - copy remaining 1 to 3 bytes (hsa_memory_copy), if after alignment
+ count is not a multiple of 4 bytes.
+
+ Having more than one function call is only profitable if there is
+ enough data to process; see below for the used heuristic values. */
+
+ uint8_t v8 = (uint8_t) val;
+ size_t before = (4 - (uintptr_t) ptr % 4) % 4; /* 0 to 3 bytes. */
+ size_t tail = (count - before) % 4; /* 0 to 3 bytes. */
+
+ /* Heuristic */
+ enum {
+ /* Prefer alloca to malloc up to ... */
+ alloca_size = 256, /* bytes */
+ /* Call hsa_amd_memory_fill also when two copy calls are required. */
+ always_use_fill = 256*1024, /* bytes */
+ /* Call hsa_amd_memory_fill also when on copy call is required. */
+ use_fill_one_copy = (128+64)*1024 /* bytes */
+ };
+
+ /* Do not call hsa_amd_memory_fill when any of the following conditions
+ is true. Note that it is always preferred if available and
+ before == tail == 0. */
+ if (__builtin_expect (!hsa_fns.hsa_amd_memory_fill_fn, 0)
+ || (before && tail && count < always_use_fill)
+ || ((before || tail) && count < use_fill_one_copy))
+ before = count;
+
+ /* Copy call for alignment - or all data, if condition above is true. */
+ if (before)
+ {
+ void *data;
+ if (before > alloca_size)
+ data = malloc (before * sizeof (uint8_t));
+ else
+ data = alloca (before * sizeof (uint8_t));
+ memset (data, val, before);
+ status = hsa_fns.hsa_memory_copy_fn (ptr, data, before);
+ if (before > alloca_size)
+ free (data);
+ if (data == 0 || status != HSA_STATUS_SUCCESS)
+ goto fail;
+ count -= before;
+ }
+
+ if (count == 0)
+ return true;
+
+ ptr += before;
+
+ uint32_t values = v8 | (v8 << 8) | (v8 << 16) | (v8 << 24);
+ status = hsa_fns.hsa_amd_memory_fill_fn (ptr, values, count / 4);
+ if (tail && status == HSA_STATUS_SUCCESS)
+ {
+ ptr += count - tail;
+ status = hsa_fns.hsa_memory_copy_fn (ptr, &values, tail);
+ }
+ if (status == HSA_STATUS_SUCCESS)
+ return true;
+
+fail:
+ GOMP_PLUGIN_error ("memory set failed");
+ return false;
+}
void
GOMP_OFFLOAD_interop (struct interop_obj_t *obj, int ord,
@@ -5081,7 +5161,8 @@ GOMP_OFFLOAD_openacc_async_queue_callback (struct goacc_asyncqueue *aq,
queue_push_callback (aq, fn, data);
}
-/* Queue up an asynchronous data copy from host to DEVICE. */
+/* Queue up an asynchronous data copy from host to DEVICE.
+ (Also handles dev2host and dev2dev.) */
bool
GOMP_OFFLOAD_openacc_async_host2dev (int device, void *dst, const void *src,
@@ -5099,10 +5180,16 @@ bool
GOMP_OFFLOAD_openacc_async_dev2host (int device, void *dst, const void *src,
size_t n, struct goacc_asyncqueue *aq)
{
- struct agent_info *agent = get_agent_info (device);
- assert (agent == aq->agent);
- queue_push_copy (aq, dst, src, n);
- return true;
+ return GOMP_OFFLOAD_openacc_async_host2dev (device, dst, src, n, aq);
+}
+
+/* Queue up an asynchronous data copy from DEVICE to DEVICE. */
+
+bool
+GOMP_OFFLOAD_openacc_async_dev2dev (int device, void *dst, const void *src,
+ size_t n, struct goacc_asyncqueue *aq)
+{
+ return GOMP_OFFLOAD_openacc_async_host2dev (device, dst, src, n, aq);
}
union goacc_property_value
diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c
index a6c8198..90c5916 100644
--- a/libgomp/plugin/plugin-nvptx.c
+++ b/libgomp/plugin/plugin-nvptx.c
@@ -2060,6 +2060,34 @@ GOMP_OFFLOAD_openacc_async_queue_callback (struct goacc_asyncqueue *aq,
}
static bool
+cuda_memcpy_dev_sanity_check (const void *d1, const void *d2, size_t s)
+{
+ CUdeviceptr pb1, pb2;
+ size_t ps1, ps2;
+ if (!s)
+ return true;
+ if (!d1 || !d2)
+ {
+ GOMP_PLUGIN_error ("invalid device address");
+ return false;
+ }
+ CUDA_CALL (cuMemGetAddressRange, &pb1, &ps1, (CUdeviceptr) d1);
+ CUDA_CALL (cuMemGetAddressRange, &pb2, &ps2, (CUdeviceptr) d2);
+ if (!pb1 || !pb2)
+ {
+ GOMP_PLUGIN_error ("invalid device address");
+ return false;
+ }
+ if ((void *)(d1 + s) > (void *)(pb1 + ps1)
+ || (void *)(d2 + s) > (void *)(pb2 + ps2))
+ {
+ GOMP_PLUGIN_error ("invalid size");
+ return false;
+ }
+ return true;
+}
+
+static bool
cuda_memcpy_sanity_check (const void *h, const void *d, size_t s)
{
CUdeviceptr pb;
@@ -2118,6 +2146,9 @@ GOMP_OFFLOAD_dev2host (int ord, void *dst, const void *src, size_t n)
bool
GOMP_OFFLOAD_dev2dev (int ord, void *dst, const void *src, size_t n)
{
+ if (!nvptx_attach_host_thread_to_device (ord)
+ || !cuda_memcpy_dev_sanity_check (dst, src, n))
+ return false;
CUDA_CALL (cuMemcpyDtoDAsync, (CUdeviceptr) dst, (CUdeviceptr) src, n, NULL);
return true;
}
@@ -2308,6 +2339,15 @@ GOMP_OFFLOAD_memcpy3d (int dst_ord, int src_ord, size_t dim2_size,
}
bool
+GOMP_OFFLOAD_memset (int ord, void *ptr, int val, size_t count)
+{
+ if (!nvptx_attach_host_thread_to_device (ord))
+ return false;
+ CUDA_CALL (cuMemsetD8, (CUdeviceptr) ptr, (unsigned char) val, count);
+ return true;
+}
+
+bool
GOMP_OFFLOAD_openacc_async_host2dev (int ord, void *dst, const void *src,
size_t n, struct goacc_asyncqueue *aq)
{
@@ -2329,6 +2369,18 @@ GOMP_OFFLOAD_openacc_async_dev2host (int ord, void *dst, const void *src,
return true;
}
+bool
+GOMP_OFFLOAD_openacc_async_dev2dev (int ord, void *dst, const void *src,
+ size_t n, struct goacc_asyncqueue *aq)
+{
+ if (!nvptx_attach_host_thread_to_device (ord)
+ || !cuda_memcpy_dev_sanity_check (dst, src, n))
+ return false;
+ CUDA_CALL (cuMemcpyDtoDAsync, (CUdeviceptr) dst, (CUdeviceptr) src, n,
+ aq->cuda_stream);
+ return true;
+}
+
union goacc_property_value
GOMP_OFFLOAD_openacc_get_property (int n, enum goacc_property prop)
{
diff --git a/libgomp/target.c b/libgomp/target.c
index 01434f8..1932e2a 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -461,6 +461,19 @@ gomp_copy_dev2host (struct gomp_device_descr *devicep,
gomp_device_copy (devicep, devicep->dev2host_func, "host", h, "dev", d, sz);
}
+attribute_hidden void
+gomp_copy_dev2dev (struct gomp_device_descr *devicep,
+ struct goacc_asyncqueue *aq,
+ void *dst, const void *src, size_t sz)
+{
+ if (__builtin_expect (aq != NULL, 0))
+ goacc_device_copy_async (devicep, devicep->openacc.async.dev2dev_func,
+ "dev", dst, "dev", src, NULL, sz, aq);
+ else
+ gomp_device_copy (devicep, devicep->dev2dev_func, "dev", dst,
+ "dev", src, sz);
+}
+
static void
gomp_free_device_memory (struct gomp_device_descr *devicep, void *devptr)
{
@@ -5727,6 +5740,88 @@ omp_target_memcpy_rect_async (void *dst, const void *src, size_t element_size,
return 0;
}
+static void
+omp_target_memset_int (void *ptr, int val, size_t count,
+ struct gomp_device_descr *devicep)
+{
+ if (__builtin_expect (count == 0, 0))
+ return;
+ if (devicep == NULL)
+ {
+ memset (ptr, val, count);
+ return;
+ }
+
+ gomp_mutex_lock (&devicep->lock);
+ int ret = devicep->memset_func (devicep->target_id, ptr, val, count);
+ gomp_mutex_unlock (&devicep->lock);
+ if (!ret)
+ gomp_fatal ("omp_target_memset failed");
+}
+
+void*
+omp_target_memset (void *ptr, int val, size_t count, int device_num)
+{
+ struct gomp_device_descr *devicep;
+ if (device_num == omp_initial_device
+ || device_num == gomp_get_num_devices ()
+ || (devicep = resolve_device (device_num, false)) == NULL
+ || !(devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400)
+ || devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
+ devicep = NULL;
+
+ omp_target_memset_int (ptr, val, count, devicep);
+ return ptr;
+}
+
+typedef struct
+{
+ void *ptr;
+ size_t count;
+ struct gomp_device_descr *devicep;
+ int val;
+} omp_target_memset_data;
+
+static void
+omp_target_memset_async_helper (void *args)
+{
+ omp_target_memset_data *a = args;
+ omp_target_memset_int (a->ptr, a->val, a->count, a->devicep);
+}
+
+void*
+omp_target_memset_async (void *ptr, int val, size_t count, int device_num,
+ int depobj_count, omp_depend_t *depobj_list)
+{
+ void *depend[depobj_count + 5];
+ struct gomp_device_descr *devicep;
+ unsigned flags = 0;
+ int i;
+
+ if (device_num == omp_initial_device
+ || device_num == gomp_get_num_devices ()
+ || (devicep = resolve_device (device_num, false)) == NULL
+ || !(devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400)
+ || devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM)
+ devicep = NULL;
+
+ omp_target_memset_data s = {.ptr = ptr, .val = val, .count = count,
+ .devicep = devicep};
+ if (depobj_count > 0 && depobj_list != NULL)
+ {
+ flags |= GOMP_TASK_FLAG_DEPEND;
+ depend[0] = 0;
+ depend[1] = (void *) (uintptr_t) depobj_count;
+ depend[2] = depend[3] = depend[4] = 0;
+ for (i = 0; i < depobj_count; ++i)
+ depend[i + 5] = &depobj_list[i];
+ }
+
+ GOMP_task (omp_target_memset_async_helper, &s, NULL, sizeof (s),
+ __alignof__ (s), true, flags, depend, 0, NULL);
+ return ptr;
+}
+
int
omp_target_associate_ptr (const void *host_ptr, const void *device_ptr,
size_t size, size_t device_offset, int device_num)
@@ -6294,6 +6389,7 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
DLSYM_OPT (async_run, async_run);
DLSYM_OPT (can_run, can_run);
DLSYM (dev2dev);
+ DLSYM (memset);
}
if (device->capabilities & GOMP_OFFLOAD_CAP_OPENACC_200)
{
@@ -6312,6 +6408,7 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
|| !DLSYM_OPT (openacc.async.exec, openacc_async_exec)
|| !DLSYM_OPT (openacc.async.dev2host, openacc_async_dev2host)
|| !DLSYM_OPT (openacc.async.host2dev, openacc_async_host2dev)
+ || !DLSYM_OPT (openacc.async.dev2dev, openacc_async_dev2dev)
|| !DLSYM_OPT (openacc.get_property, openacc_get_property))
{
/* Require all the OpenACC handlers if we have
diff --git a/libgomp/testsuite/libgomp.c++/declare_target-2.C b/libgomp/testsuite/libgomp.c++/declare_target-2.C
new file mode 100644
index 0000000..ab94a55
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/declare_target-2.C
@@ -0,0 +1,25 @@
+// { dg-do link }
+
+// Actually not needed: -fipa-cp is default with -O2:
+// { dg-additional-options "-O2 -fipa-cp" }
+
+// The code failed because 'std::endl' becoḿes implicitly 'declare target'
+// but not the 'widen' function it calls. While the linker had no issues
+// (endl is never called, either because it is inlined or optimized away),
+// the IPA-CP (enabled by -O2 and higher) failed as the definition for
+// 'widen' did not exist on the offload side.
+
+#include <iostream>
+
+void func (int m)
+{
+ if (m < 0)
+ std::cout << "should not happen" << std::endl;
+}
+
+
+int main()
+{
+ #pragma omp target
+ func (1);
+}
diff --git a/libgomp/testsuite/libgomp.c++/pr119692-1-4.C b/libgomp/testsuite/libgomp.c++/pr119692-1-4.C
index 6995f26..af9fe1c 100644
--- a/libgomp/testsuite/libgomp.c++/pr119692-1-4.C
+++ b/libgomp/testsuite/libgomp.c++/pr119692-1-4.C
@@ -3,6 +3,9 @@
/* { dg-additional-options -DDEFAULT=defaultmap(firstprivate) }
Wrong code for offloading execution.
{ dg-xfail-run-if PR119692 { offload_device } } */
+/* There are configurations where we 'WARNING: program timed out.' while in
+ 'dynamic_cast', see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119692#c6>.
+ { dg-timeout 10 } ... to make sure that happens quickly. */
/* { dg-additional-options -fdump-tree-gimple } */
#include "pr119692-1-1.C"
diff --git a/libgomp/testsuite/libgomp.c++/pr119692-1-5.C b/libgomp/testsuite/libgomp.c++/pr119692-1-5.C
index 02121b6..e5c6e07 100644
--- a/libgomp/testsuite/libgomp.c++/pr119692-1-5.C
+++ b/libgomp/testsuite/libgomp.c++/pr119692-1-5.C
@@ -3,6 +3,9 @@
/* { dg-additional-options -DDEFAULT=defaultmap(to) }
Wrong code for offloading execution.
{ dg-xfail-run-if PR119692 { offload_device } } */
+/* There are configurations where we 'WARNING: program timed out.' while in
+ 'dynamic_cast', see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119692#c6>.
+ { dg-timeout 10 } ... to make sure that happens quickly. */
/* { dg-additional-options -fdump-tree-gimple } */
#include "pr119692-1-1.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-1.C b/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-1.C
index 3848295..a862652 100644
--- a/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-1.C
+++ b/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-1.C
@@ -23,3 +23,6 @@
PR119692.
{ dg-shouldfail {'std::bad_cast' exception} } */
+/* There are configurations where we 'WARNING: program timed out.' while in
+ 'dynamic_cast', see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119692#c6>.
+ { dg-timeout 10 } ... to make sure that happens quickly. */
diff --git a/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-2.C b/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-2.C
index 8861740..ff15c9f 100644
--- a/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-2.C
+++ b/libgomp/testsuite/libgomp.c++/target-exceptions-bad_cast-2.C
@@ -22,3 +22,6 @@
For GCN, nvptx offload execution, there is no 'catch'ing; any exception is fatal.
{ dg-shouldfail {'MyException' exception} { offload_device } } */
+/* There are configurations where we 'WARNING: program timed out.' while in
+ 'dynamic_cast', see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119692#c6>.
+ { dg-timeout 10 } ... to make sure that happens quickly. */
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-10.C b/libgomp/testsuite/libgomp.c++/target-flex-10.C
new file mode 100644
index 0000000..8fa9af7
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-10.C
@@ -0,0 +1,215 @@
+/* Basic container usage. */
+
+#include <vector>
+#include <deque>
+#include <list>
+#include <set>
+#include <map>
+#if __cplusplus >= 201103L
+#include <array>
+#include <forward_list>
+#include <unordered_set>
+#include <unordered_map>
+#endif
+
+bool vector_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::vector<int> vector;
+ ok = vector.empty();
+ }
+ return ok;
+}
+
+bool deque_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::deque<int> deque;
+ ok = deque.empty();
+ }
+ return ok;
+}
+
+bool list_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::list<int> list;
+ ok = list.empty();
+ }
+ return ok;
+}
+
+bool map_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::map<int, int> map;
+ ok = map.empty();
+ }
+ return ok;
+}
+
+bool set_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::set<int> set;
+ ok = set.empty();
+ }
+ return ok;
+}
+
+bool multimap_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::multimap<int, int> multimap;
+ ok = multimap.empty();
+ }
+ return ok;
+}
+
+bool multiset_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::multiset<int, int> multiset;
+ ok = multiset.empty();
+ }
+ return ok;
+}
+
+#if __cplusplus >= 201103L
+
+bool array_test()
+{
+ static constexpr std::size_t array_size = 42;
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::array<int, array_size> array{};
+ ok = array[0] == 0
+ && array[array_size - 1] == 0;
+ }
+ return ok;
+}
+
+bool forward_list_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::forward_list<int> forward_list;
+ ok = forward_list.empty();
+ }
+ return ok;
+}
+
+bool unordered_map_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::unordered_map<int, int> unordered_map;
+ ok = unordered_map.empty();
+ }
+ return ok;
+}
+
+bool unordered_set_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::unordered_set<int> unordered_set;
+ ok = unordered_set.empty();
+ }
+ return ok;
+}
+
+bool unordered_multimap_test()
+{
+
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::unordered_multimap<int, int> unordered_multimap;
+ ok = unordered_multimap.empty();
+ }
+ return ok;
+}
+
+bool unordered_multiset_test()
+{
+
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ std::unordered_multiset<int> unordered_multiset;
+ ok = unordered_multiset.empty();
+ }
+ return ok;
+}
+
+#else
+bool array_test() { return true; }
+bool forward_list_test() { return true; }
+bool unordered_map_test() { return true; }
+bool unordered_set_test() { return true; }
+bool unordered_multimap_test() { return true; }
+bool unordered_multiset_test() { return true; }
+#endif
+
+int main()
+{
+ const bool vec_res = vector_test();
+ __builtin_printf("vector : %s\n", vec_res ? "PASS" : "FAIL");
+ const bool deque_res = deque_test();
+ __builtin_printf("deque : %s\n", deque_res ? "PASS" : "FAIL");
+ const bool list_res = list_test();
+ __builtin_printf("list : %s\n", list_res ? "PASS" : "FAIL");
+ const bool map_res = map_test();
+ __builtin_printf("map : %s\n", map_res ? "PASS" : "FAIL");
+ const bool set_res = set_test();
+ __builtin_printf("set : %s\n", set_res ? "PASS" : "FAIL");
+ const bool multimap_res = multimap_test();
+ __builtin_printf("multimap : %s\n", multimap_res ? "PASS" : "FAIL");
+ const bool multiset_res = multiset_test();
+ __builtin_printf("multiset : %s\n", multiset_res ? "PASS" : "FAIL");
+ const bool array_res = array_test();
+ __builtin_printf("array : %s\n", array_res ? "PASS" : "FAIL");
+ const bool forward_list_res = forward_list_test();
+ __builtin_printf("forward_list : %s\n", forward_list_res ? "PASS" : "FAIL");
+ const bool unordered_map_res = unordered_map_test();
+ __builtin_printf("unordered_map : %s\n", unordered_map_res ? "PASS" : "FAIL");
+ const bool unordered_set_res = unordered_set_test();
+ __builtin_printf("unordered_set : %s\n", unordered_set_res ? "PASS" : "FAIL");
+ const bool unordered_multimap_res = unordered_multimap_test();
+ __builtin_printf("unordered_multimap: %s\n", unordered_multimap_res ? "PASS" : "FAIL");
+ const bool unordered_multiset_res = unordered_multiset_test();
+ __builtin_printf("unordered_multiset: %s\n", unordered_multiset_res ? "PASS" : "FAIL");
+ const bool ok = vec_res
+ && deque_res
+ && list_res
+ && map_res
+ && set_res
+ && multimap_res
+ && multiset_res
+ && array_res
+ && forward_list_res
+ && unordered_map_res
+ && unordered_set_res
+ && unordered_multimap_res
+ && unordered_multiset_res;
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-100.C b/libgomp/testsuite/libgomp.c++/target-flex-100.C
new file mode 100644
index 0000000..7ab047f
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-100.C
@@ -0,0 +1,210 @@
+/* Container adaptors in target region.
+ Does not test comparison operators other than equality to allow these tests
+ to be generalized to arbitrary input data. */
+
+#include <algorithm>
+#include <cstdio>
+#include <deque>
+#include <queue>
+#include <stack>
+#include <vector>
+
+#include "target-flex-common.h"
+
+template<typename T, std::size_t Size>
+bool test_stack(T (&arr)[Size])
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ const std::size_t half_size = Size / 2;
+ const T first_element = arr[0];
+ const T middle_element = arr[half_size - 1];
+ const T last_element = arr[Size - 1];
+ typedef std::stack<T, std::vector<T> > stack_type;
+ stack_type stack;
+ VERIFY (stack.empty());
+ VERIFY (stack.size() == 0);
+ {
+ /* Do half with push. */
+ std::size_t idx = 0;
+ for (; idx < half_size; ++idx)
+ {
+ stack.push(arr[idx]);
+ VERIFY (stack.top() == arr[idx]);
+ }
+ VERIFY (stack.size() == half_size);
+ VERIFY (static_cast<const stack_type&>(stack).size() == half_size);
+ for (; idx < Size; ++idx)
+ {
+ #if __cplusplus >= 201103L
+ /* Do the rest with emplace if C++11 or higher. */
+ stack.emplace(arr[idx]);
+ #else
+ /* Otherwise just use push again. */
+ stack.push(arr[idx]);
+ #endif
+ VERIFY (stack.top() == arr[idx]);
+ }
+ VERIFY (stack.size() == Size);
+ VERIFY (static_cast<const stack_type&>(stack).size() == Size);
+
+ const stack_type stack_orig = stack_type(std::vector<T>(arr, arr + Size));
+ VERIFY (stack == stack_orig);
+ /* References are contained in their own scope so we don't accidently
+ add tests referencing them after they have been invalidated. */
+ {
+ const T& const_top = static_cast<const stack_type&>(stack).top();
+ VERIFY (const_top == last_element);
+ T& mutable_top = stack.top();
+ mutable_top = first_element;
+ VERIFY (const_top == first_element);
+ }
+ /* Will only compare inequal if the first and last elements are different. */
+ VERIFY (first_element != last_element || stack != stack_orig);
+ for (std::size_t count = Size - half_size; count != 0; --count)
+ stack.pop();
+ VERIFY (stack.top() == middle_element);
+ const stack_type stack_half_orig = stack_type(std::vector<T>(arr, arr + half_size));
+ VERIFY (stack == stack_half_orig);
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+template<typename T, std::size_t Size>
+bool test_queue(T (&arr)[Size])
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ const std::size_t half_size = Size / 2;
+ const T first_element = arr[0];
+ const T last_element = arr[Size - 1];
+ typedef std::queue<T, std::deque<T> > queue_type;
+ queue_type queue;
+ VERIFY (queue.empty());
+ VERIFY (queue.size() == 0);
+ {
+ /* Do half with push. */
+ std::size_t idx = 0;
+ for (; idx < half_size; ++idx)
+ {
+ queue.push(arr[idx]);
+ VERIFY (queue.back() == arr[idx]);
+ VERIFY (queue.front() == first_element);
+ }
+ VERIFY (queue.size() == half_size);
+ VERIFY (static_cast<const queue_type&>(queue).size() == half_size);
+ for (; idx < Size; ++idx)
+ {
+ #if __cplusplus >= 201103L
+ /* Do the rest with emplace if C++11 or higher. */
+ queue.emplace(arr[idx]);
+ #else
+ /* Otherwise just use push again. */
+ queue.push(arr[idx]);
+ #endif
+ VERIFY (queue.back() == arr[idx]);
+ }
+ VERIFY (queue.size() == Size);
+ VERIFY (static_cast<const queue_type&>(queue).size() == Size);
+
+ const queue_type queue_orig = queue_type(std::deque<T>(arr, arr + Size));
+ VERIFY (queue == queue_orig);
+
+ /* References are contained in their own scope so we don't accidently
+ add tests referencing them after they have been invalidated. */
+ {
+ const T& const_front = static_cast<const queue_type&>(queue).front();
+ VERIFY (const_front == first_element);
+ T& mutable_front = queue.front();
+
+ const T& const_back = static_cast<const queue_type&>(queue).back();
+ VERIFY (const_back == last_element);
+ T& mutable_back = queue.back();
+ {
+ using std::swap;
+ swap(mutable_front, mutable_back);
+ }
+ VERIFY (const_front == last_element);
+ VERIFY (const_back == first_element);
+ /* Will only compare inequal if the first and last elements are different. */
+ VERIFY (first_element != last_element || queue != queue_orig);
+ /* Return the last element to normal for the next comparison. */
+ mutable_back = last_element;
+ }
+
+ const T middle_element = arr[half_size];
+ for (std::size_t count = Size - half_size; count != 0; --count)
+ queue.pop();
+ VERIFY (queue.front() == middle_element);
+ const queue_type queue_upper_half = queue_type(std::deque<T>(arr + half_size, arr + Size));
+ VERIFY (queue == queue_upper_half);
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+template<typename T, std::size_t Size>
+bool test_priority_queue(T (&arr)[Size], const T min_value, const T max_value)
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ typedef std::priority_queue<T, std::vector<T> > priority_queue_type;
+ {
+ priority_queue_type pqueue;
+ VERIFY (pqueue.empty());
+ VERIFY (pqueue.size() == 0);
+ }
+ {
+ priority_queue_type pqueue(arr, arr + Size);
+ VERIFY (!pqueue.empty());
+ VERIFY (pqueue.size() == Size);
+ VERIFY (static_cast<const priority_queue_type&>(pqueue).size() == Size);
+
+ const T old_max = pqueue.top();
+
+ #if __cplusplus >= 201103L
+ pqueue.emplace(max_value);
+ #else
+ pqueue.push(max_value);
+ #endif
+ VERIFY (pqueue.top() == max_value);
+ pqueue.pop();
+ VERIFY (pqueue.top() == old_max);
+ pqueue.push(min_value);
+ VERIFY (pqueue.top() == old_max);
+ pqueue.push(max_value);
+ VERIFY (pqueue.top() == max_value);
+ pqueue.pop();
+ VERIFY (pqueue.top() == old_max);
+ VERIFY (pqueue.size() == Size + 1);
+
+ for (std::size_t count = Size; count != 0; --count)
+ pqueue.pop();
+ VERIFY (pqueue.size() == 1);
+ VERIFY (pqueue.top() == min_value);
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+int main()
+{
+ int arr[10] = {0,1,2,3,4,5,6,7,8,9};
+
+ return test_stack(arr)
+ && test_queue(arr)
+ && test_priority_queue(arr, 0, 1000) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-101.C b/libgomp/testsuite/libgomp.c++/target-flex-101.C
new file mode 100644
index 0000000..be9037e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-101.C
@@ -0,0 +1,136 @@
+/* { dg-additional-options -std=c++23 } */
+
+/* C++23 container adaptors in target region.
+ Severely needs additional tests. */
+
+#include <cstdio>
+#include <utility>
+#include <version>
+
+#if __cpp_lib_flat_map >= 202207L
+#define ENABLE_FLAT_MAP 1
+#endif
+#if __cpp_lib_flat_set >= 202207L
+#define ENABLE_FLAT_SET 1
+#endif
+
+#ifdef ENABLE_FLAT_MAP
+#include <flat_map>
+#endif
+#ifdef ENABLE_FLAT_SET
+#include <flat_set>
+#endif
+
+#include "target-flex-common.h"
+
+#ifdef ENABLE_FLAT_MAP
+template<typename K, typename V, typename std::size_t Size>
+bool test_flat_map(std::pair<K, V> (&arr)[Size])
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ using flat_map_type = std::flat_map<K, V>;
+ flat_map_type map = {arr, arr + Size};
+
+ VERIFY (!map.empty());
+ for (const auto& element : arr)
+ VERIFY (map.contains(element.first));
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+template<typename K, typename V, typename std::size_t Size>
+bool test_flat_multimap(std::pair<K, V> (&arr)[Size])
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ using flat_map_type = std::flat_map<K, V>;
+ flat_map_type map = {arr, arr + Size};
+
+ VERIFY (!map.empty());
+ for (const auto& element : arr)
+ VERIFY (map.contains(element.first));
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+#else
+template<typename K, typename V, typename std::size_t Size>
+bool test_flat_map(std::pair<K, V> (&arr)[Size]) { return true; }
+
+template<typename K, typename V, typename std::size_t Size>
+bool test_flat_multimap(std::pair<K, V> (&arr)[Size]) { return true; }
+#endif
+
+#ifdef ENABLE_FLAT_SET
+template<typename T, typename std::size_t Size>
+bool test_flat_set(T (&arr)[Size])
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ using flat_set_type = std::flat_set<T>;
+ flat_set_type set = {arr, arr + Size};
+
+ VERIFY (!set.empty());
+ for (const auto& element : arr)
+ VERIFY (set.contains(element));
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+template<typename T, typename std::size_t Size>
+bool test_flat_multiset(T (&arr)[Size])
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ using flat_multiset_type = std::flat_multiset<T>;
+ flat_multiset_type multiset = {arr, arr + Size};
+
+ VERIFY (!multiset.empty());
+ for (const auto& element : arr)
+ VERIFY (multiset.contains(element));
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+#else
+template<typename T, typename std::size_t Size>
+bool test_flat_set(T (&arr)[Size]) { return true; }
+
+template<typename T, typename std::size_t Size>
+bool test_flat_multiset(T (&arr)[Size]) { return true; }
+#endif
+
+int main()
+{
+ int arr[10] = {0,1,2,3,4,5,6,7,8,9};
+ std::pair<int, int> pairs[10] = {{ 1, 2}, { 2, 4}, { 3, 6}, { 4, 8}, { 5, 10},
+ { 6, 12}, { 7, 14}, { 8, 16}, { 9, 18}, {10, 20}};
+
+ return test_flat_set(arr)
+ && test_flat_multiset(arr)
+ && test_flat_map(pairs)
+ && test_flat_multimap(pairs) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-11.C b/libgomp/testsuite/libgomp.c++/target-flex-11.C
new file mode 100644
index 0000000..6d55129
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-11.C
@@ -0,0 +1,444 @@
+/* Check constructors/destructors are called in containers. */
+
+#include <vector>
+#include <deque>
+#include <list>
+#include <set>
+#include <map>
+#include <utility>
+#if __cplusplus >= 201103L
+#include <array>
+#include <forward_list>
+#include <unordered_set>
+#include <unordered_map>
+#endif
+
+#include "target-flex-common.h"
+
+struct indirect_counter
+{
+ typedef int counter_value_type;
+ counter_value_type *_count_ptr;
+
+ indirect_counter(counter_value_type *count_ptr) BL_NOEXCEPT : _count_ptr(count_ptr) {
+ ++(*_count_ptr);
+ }
+ indirect_counter(const indirect_counter& other) BL_NOEXCEPT : _count_ptr(other._count_ptr) {
+ ++(*_count_ptr);
+ }
+ /* Don't declare a move constructor, we want to copy no matter what. */
+ ~indirect_counter() {
+ --(*_count_ptr);
+ }
+};
+
+bool operator==(indirect_counter const& lhs, indirect_counter const& rhs) BL_NOEXCEPT
+ { return lhs._count_ptr == rhs._count_ptr; }
+bool operator<(indirect_counter const& lhs, indirect_counter const& rhs) BL_NOEXCEPT
+ { return lhs._count_ptr < rhs._count_ptr; }
+
+#if __cplusplus >= 201103L
+template<>
+struct std::hash<indirect_counter>
+{
+ std::size_t operator()(const indirect_counter& ic) const noexcept
+ { return std::hash<indirect_counter::counter_value_type *>{}(ic._count_ptr); }
+};
+#endif
+
+/* Not a container, just a sanity check really. */
+bool automatic_lifetime_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ indirect_counter c = indirect_counter(&counter);
+ indirect_counter(static_cast<int*>(&counter));
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool vector_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::vector<indirect_counter> vec(42, indirect_counter(&counter));
+ VERIFY (counter == 42);
+ vec.resize(32, indirect_counter(&counter));
+ VERIFY (counter == 32);
+ vec.push_back(indirect_counter(&counter));
+ VERIFY (counter == 33);
+ vec.pop_back();
+ VERIFY (counter == 32);
+ vec.pop_back();
+ VERIFY (counter == 31);
+ vec.resize(100, indirect_counter(&counter));
+ VERIFY (counter == 100);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool deque_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::deque<indirect_counter> vec(42, indirect_counter(&counter));
+ VERIFY (counter == 42);
+ vec.resize(32, indirect_counter(&counter));
+ VERIFY (counter == 32);
+ vec.push_back(indirect_counter(&counter));
+ VERIFY (counter == 33);
+ vec.pop_back();
+ VERIFY (counter == 32);
+ vec.pop_back();
+ VERIFY (counter == 31);
+ vec.resize(100, indirect_counter(&counter));
+ VERIFY (counter == 100);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool list_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::list<indirect_counter> list(42, indirect_counter(&counter));
+ VERIFY (counter == 42);
+ list.resize(32, indirect_counter(&counter));
+ VERIFY (counter == 32);
+ list.push_back(indirect_counter(&counter));
+ VERIFY (counter == 33);
+ list.pop_back();
+ VERIFY (counter == 32);
+ list.pop_back();
+ VERIFY (counter == 31);
+ list.resize(100, indirect_counter(&counter));
+ VERIFY (counter == 100);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool map_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::map<int, indirect_counter> map;
+ map.insert(std::make_pair(1, indirect_counter(&counter)));
+ VERIFY (counter == 1);
+ map.insert(std::make_pair(1, indirect_counter(&counter)));
+ VERIFY (counter == 1);
+ map.insert(std::make_pair(2, indirect_counter(&counter)));
+ VERIFY (counter == 2);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool set_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter0 = 0;
+ int counter1 = 0;
+ {
+ std::set<indirect_counter> set;
+ set.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 1);
+ set.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 1);
+ set.insert(indirect_counter(&counter1));
+ VERIFY (counter0 == 1 && counter1 == 1);
+ }
+ VERIFY (counter0 == 0 && counter1 == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool multimap_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::multimap<int, indirect_counter> multimap;
+ multimap.insert(std::make_pair(1, indirect_counter(&counter)));
+ VERIFY (counter == 1);
+ multimap.insert(std::make_pair(1, indirect_counter(&counter)));
+ VERIFY (counter == 2);
+ multimap.insert(std::make_pair(2, indirect_counter(&counter)));
+ VERIFY (counter == 3);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool multiset_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter0 = 0;
+ int counter1 = 0;
+ {
+ std::multiset<indirect_counter> multiset;
+ multiset.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 1);
+ multiset.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 2);
+ multiset.insert(indirect_counter(&counter1));
+ VERIFY (counter0 == 2 && counter1 == 1);
+ }
+ VERIFY (counter0 == 0 && counter1 == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+#if __cplusplus >= 201103L
+
+bool array_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ indirect_counter ic(&counter);
+ std::array<indirect_counter, 10> array{ic, ic, ic, ic, ic,
+ ic, ic, ic, ic, ic};
+ VERIFY (counter == 11);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool forward_list_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::forward_list<indirect_counter> forward_list(42, indirect_counter(&counter));
+ VERIFY (counter == 42);
+ forward_list.resize(32, indirect_counter(&counter));
+ VERIFY (counter == 32);
+ forward_list.push_front(indirect_counter(&counter));
+ VERIFY (counter == 33);
+ forward_list.pop_front();
+ VERIFY (counter == 32);
+ forward_list.pop_front();
+ VERIFY (counter == 31);
+ forward_list.resize(100, indirect_counter(&counter));
+ VERIFY (counter == 100);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool unordered_map_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::unordered_map<int, indirect_counter> unordered_map;
+ unordered_map.insert({1, indirect_counter(&counter)});
+ VERIFY (counter == 1);
+ unordered_map.insert({1, indirect_counter(&counter)});
+ VERIFY (counter == 1);
+ unordered_map.insert({2, indirect_counter(&counter)});
+ VERIFY (counter == 2);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool unordered_set_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter0 = 0;
+ int counter1 = 0;
+ {
+ std::unordered_set<indirect_counter> unordered_set;
+ unordered_set.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 1);
+ unordered_set.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 1);
+ unordered_set.insert(indirect_counter(&counter1));
+ VERIFY (counter0 == 1 && counter1 == 1);
+ }
+ VERIFY (counter0 == 0 && counter1 == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool unordered_multimap_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter = 0;
+ {
+ std::unordered_multimap<int, indirect_counter> unordered_multimap;
+ unordered_multimap.insert({1, indirect_counter(&counter)});
+ VERIFY (counter == 1);
+ unordered_multimap.insert({1, indirect_counter(&counter)});
+ VERIFY (counter == 2);
+ unordered_multimap.insert({2, indirect_counter(&counter)});
+ VERIFY (counter == 3);
+ }
+ VERIFY (counter == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+bool unordered_multiset_test()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ bool inner_ok = true;
+ int counter0 = 0;
+ int counter1 = 0;
+ {
+ std::unordered_multiset<indirect_counter> unordered_multiset;
+ unordered_multiset.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 1);
+ unordered_multiset.insert(indirect_counter(&counter0));
+ VERIFY (counter0 == 2);
+ unordered_multiset.insert(indirect_counter(&counter1));
+ VERIFY (counter0 == 2 && counter1 == 1);
+ }
+ VERIFY (counter0 == 0 && counter1 == 0);
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+#else
+bool array_test() { return true; }
+bool forward_list_test() { return true; }
+bool unordered_map_test() { return true; }
+bool unordered_set_test() { return true; }
+bool unordered_multimap_test() { return true; }
+bool unordered_multiset_test() { return true; }
+#endif
+
+int main()
+{
+ const bool auto_res = automatic_lifetime_test();
+ const bool vec_res = vector_test();
+ const bool deque_res = deque_test();
+ const bool list_res = list_test();
+ const bool map_res = map_test();
+ const bool set_res = set_test();
+ const bool multimap_res = multimap_test();
+ const bool multiset_res = multiset_test();
+ const bool array_res = array_test();
+ const bool forward_list_res = forward_list_test();
+ const bool unordered_map_res = unordered_map_test();
+ const bool unordered_set_res = unordered_set_test();
+ const bool unordered_multimap_res = unordered_multimap_test();
+ const bool unordered_multiset_res = unordered_multiset_test();
+ std::printf("sanity check : %s\n", auto_res ? "PASS" : "FAIL");
+ std::printf("vector : %s\n", vec_res ? "PASS" : "FAIL");
+ std::printf("deque : %s\n", deque_res ? "PASS" : "FAIL");
+ std::printf("list : %s\n", list_res ? "PASS" : "FAIL");
+ std::printf("map : %s\n", map_res ? "PASS" : "FAIL");
+ std::printf("set : %s\n", set_res ? "PASS" : "FAIL");
+ std::printf("multimap : %s\n", multimap_res ? "PASS" : "FAIL");
+ std::printf("multiset : %s\n", multiset_res ? "PASS" : "FAIL");
+ std::printf("array : %s\n", array_res ? "PASS" : "FAIL");
+ std::printf("forward_list : %s\n", forward_list_res ? "PASS" : "FAIL");
+ std::printf("unordered_map : %s\n", unordered_map_res ? "PASS" : "FAIL");
+ std::printf("unordered_set : %s\n", unordered_set_res ? "PASS" : "FAIL");
+ std::printf("unordered_multimap: %s\n", unordered_multimap_res ? "PASS" : "FAIL");
+ std::printf("unordered_multiset: %s\n", unordered_multiset_res ? "PASS" : "FAIL");
+ const bool ok = auto_res
+ && vec_res
+ && deque_res
+ && list_res
+ && map_res
+ && set_res
+ && multimap_res
+ && multiset_res
+ && array_res
+ && forward_list_res
+ && unordered_map_res
+ && unordered_set_res
+ && unordered_multimap_res
+ && unordered_multiset_res;
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-12.C b/libgomp/testsuite/libgomp.c++/target-flex-12.C
new file mode 100644
index 0000000..024fb73
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-12.C
@@ -0,0 +1,736 @@
+/* Populated with mapped data, validate, mutate, validate again.
+ The cases using sets do not mutate.
+ Note: Some of the code in here really sucks due to being made to be
+ compatible with c++98. */
+
+#include <vector>
+#include <deque>
+#include <list>
+#include <set>
+#include <map>
+#if __cplusplus >= 201103L
+#include <array>
+#include <forward_list>
+#include <unordered_set>
+#include <unordered_map>
+#endif
+
+#include <limits>
+#include <iterator>
+
+#include "target-flex-common.h"
+
+template<bool B, class T = void>
+struct enable_if {};
+
+template<class T>
+struct enable_if<true, T> { typedef T type; };
+
+struct identity_func
+{
+#if __cplusplus < 201103L
+ template<typename T>
+ T& operator()(T& arg) const BL_NOEXCEPT { return arg; }
+ template<typename T>
+ T const& operator()(T const& arg) const BL_NOEXCEPT { return arg; }
+#else
+ template<typename T>
+ constexpr T&& operator()(T&& arg) const BL_NOEXCEPT { return std::forward<T>(arg); }
+#endif
+};
+
+/* Applies projection to the second iterator. */
+template<typename It0, typename It1, typename Proj>
+bool validate_sequential_elements(const It0 begin0, const It0 end0,
+ const It1 begin1, const It1 end1,
+ Proj proj) BL_NOEXCEPT
+{
+ It0 it0 = begin0;
+ It1 it1 = begin1;
+ for (; it0 != end0; ++it0, ++it1)
+ {
+ /* Sizes mismatch, don't bother aborting though just fail the test. */
+ if (it1 == end1)
+ return false;
+ if (*it0 != proj(*it1))
+ return false;
+ }
+ /* Sizes mismatch, do as above. */
+ if (it1 != end1)
+ return false;
+ return true;
+}
+
+template<typename It0, typename It1>
+bool validate_sequential_elements(const It0 begin0, const It0 end0,
+ const It1 begin1, const It1 end1) BL_NOEXCEPT
+{
+ return validate_sequential_elements(begin0, end0, begin1, end1, identity_func());
+}
+
+/* Inefficient, but simple. */
+template<typename It, typename OutIt>
+void simple_copy(const It begin, const It end, OutIt out) BL_NOEXCEPT
+{
+ for (It it = begin; it != end; ++it, ++out)
+ *out = *it;
+}
+
+template<typename It, typename MutateFn>
+void simple_mutate(const It begin, const It end, MutateFn mut_fn) BL_NOEXCEPT
+{
+ for (It it = begin; it != end; ++it)
+ *it = mut_fn(*it);
+}
+
+template<typename MutationFunc, typename T, std::size_t Size>
+bool vector_test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_arr[Size];
+ T out_mut_arr[Size];
+ #pragma omp target map(from: ok, out_arr[:Size], out_mut_arr[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::vector<T> vector(arr, arr + Size);
+ VERIFY (validate_sequential_elements(vector.begin(), vector.end(),
+ arr, arr + Size));
+ simple_copy(vector.begin(), vector.end(), out_arr);
+ simple_mutate(vector.begin(), vector.end(), MutationFunc());
+ VERIFY (validate_sequential_elements(vector.begin(), vector.end(),
+ arr, arr + Size, MutationFunc()));
+ simple_copy(vector.begin(), vector.end(), out_mut_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_sequential_elements(out_arr, out_arr + Size,
+ arr, arr + Size));
+ VERIFY_NON_TARGET (validate_sequential_elements(out_mut_arr, out_mut_arr + Size,
+ arr, arr + Size, MutationFunc()));
+ return true;
+}
+
+template<typename MutationFunc, typename T, std::size_t Size>
+bool deque_test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_arr[Size];
+ T out_mut_arr[Size];
+ #pragma omp target map(from: ok, out_arr[:Size], out_mut_arr[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::deque<T> deque(arr, arr + Size);
+ VERIFY (validate_sequential_elements(deque.begin(), deque.end(),
+ arr, arr + Size));
+ simple_copy(deque.begin(), deque.end(), out_arr);
+ simple_mutate(deque.begin(), deque.end(), MutationFunc());
+ VERIFY (validate_sequential_elements(deque.begin(), deque.end(),
+ arr, arr + Size, MutationFunc()));
+ simple_copy(deque.begin(), deque.end(), out_mut_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_sequential_elements(out_arr, out_arr + Size,
+ arr, arr + Size));
+ VERIFY_NON_TARGET (validate_sequential_elements(out_mut_arr, out_mut_arr + Size,
+ arr, arr + Size, MutationFunc()));
+ return true;
+}
+
+template<typename MutationFunc, typename T, std::size_t Size>
+bool list_test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_arr[Size];
+ T out_mut_arr[Size];
+ #pragma omp target map(from: ok, out_arr[:Size], out_mut_arr[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::list<T> list(arr, arr + Size);
+ VERIFY (validate_sequential_elements(list.begin(), list.end(),
+ arr, arr + Size));
+ simple_copy(list.begin(), list.end(), out_arr);
+ simple_mutate(list.begin(), list.end(), MutationFunc());
+ VERIFY (validate_sequential_elements(list.begin(), list.end(),
+ arr, arr + Size, MutationFunc()));
+ simple_copy(list.begin(), list.end(), out_mut_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_sequential_elements(out_arr, out_arr + Size,
+ arr, arr + Size));
+ VERIFY_NON_TARGET (validate_sequential_elements(out_mut_arr, out_mut_arr + Size,
+ arr, arr + Size, MutationFunc()));
+ return true;
+}
+
+template<typename T>
+const T& get_key(const T& arg) BL_NOEXCEPT
+ { return arg; }
+template<typename K, typename V>
+const K& get_key(const std::pair<K, V>& pair) BL_NOEXCEPT
+ { return pair.first; }
+template<typename T>
+const T& get_value(const T& arg) BL_NOEXCEPT
+ { return arg; }
+template<typename K, typename V>
+const K& get_value(const std::pair<K, V>& pair) BL_NOEXCEPT
+ { return pair.second; }
+
+template<typename T>
+struct key_type { typedef T type; };
+template<typename K, typename V>
+struct key_type<std::pair<K, V> > { typedef K type; };
+
+template<typename Proj, typename Container, typename It>
+bool validate_associative(const Container& container,
+ const It compare_begin,
+ const It compare_end,
+ Proj proj) BL_NOEXCEPT
+{
+ const typename Container::const_iterator elem_end = container.end();
+ for (It compare_it = compare_begin; compare_it != compare_end; ++compare_it)
+ {
+ const typename Container::const_iterator elem_it = container.find(get_key(*compare_it));
+ VERIFY_NON_TARGET (elem_it != elem_end);
+ VERIFY_NON_TARGET (proj(get_value(*compare_it)) == get_value(*elem_it));
+ }
+ return true;
+}
+
+template<typename Container, typename It>
+bool validate_associative(const Container& container,
+ const It compare_begin,
+ const It compare_end) BL_NOEXCEPT
+{
+ return validate_associative(container, compare_begin, compare_end, identity_func());
+}
+
+template<typename It, typename MutateFn>
+void simple_mutate_map(const It begin, const It end, MutateFn mut_fn) BL_NOEXCEPT
+{
+ for (It it = begin; it != end; ++it)
+ it->second = mut_fn(it->second);
+}
+
+template<typename It, typename OutIter>
+void simple_copy_unique(const It begin, const It end, OutIter out) BL_NOEXCEPT
+{
+ /* In case anyone reads this, I want it to be known that I hate c++98. */
+ typedef typename key_type<typename std::iterator_traits<It>::value_type>::type key_t;
+ std::set<key_t> already_seen;
+ for (It it = begin; it != end; ++it, ++out)
+ {
+ key_t key = get_key(*it);
+ if (already_seen.find(key) != already_seen.end())
+ continue;
+ already_seen.insert(key);
+ *out = *it;
+ }
+}
+
+template<typename MutationFunc, typename K, typename V, std::size_t Size>
+bool map_test(const std::pair<K, V> (&arr)[Size])
+{
+ std::map<K, V> reference_map(arr, arr + Size);
+ bool ok;
+ /* Both sizes should be the same. */
+ std::pair<K, V> out_pairs[Size];
+ std::size_t out_size;
+ std::pair<K, V> out_pairs_mut[Size];
+ std::size_t out_size_mut;
+ #pragma omp target map(from: ok, out_pairs[:Size], out_size, \
+ out_pairs_mut[:Size], out_size_mut) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::vector<std::pair<K, V> > unique_elems;
+ simple_copy_unique(arr, arr + Size,
+ std::back_insert_iterator<std::vector<std::pair<K, V> > >(unique_elems));
+
+ std::map<K, V> map(arr, arr + Size);
+ VERIFY (validate_associative(map, unique_elems.begin(), unique_elems.end()));
+ simple_copy(map.begin(), map.end(), out_pairs);
+ out_size = map.size();
+ simple_mutate_map(map.begin(), map.end(), MutationFunc());
+ VERIFY (validate_associative(map, unique_elems.begin(), unique_elems.end(),
+ MutationFunc()));
+ simple_copy(map.begin(), map.end(), out_pairs_mut);
+ out_size_mut = map.size();
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (out_size == out_size_mut);
+ VERIFY_NON_TARGET (validate_associative(reference_map,
+ out_pairs, out_pairs + out_size));
+ simple_mutate_map(reference_map.begin(), reference_map.end(), MutationFunc());
+ VERIFY_NON_TARGET (validate_associative(reference_map,
+ out_pairs_mut, out_pairs_mut + out_size_mut));
+ return true;
+}
+
+template<typename T, std::size_t Size>
+bool set_test(const T (&arr)[Size])
+{
+ std::set<T> reference_set(arr, arr + Size);
+ bool ok;
+ /* Both sizes should be the same. */
+ T out_arr[Size];
+ std::size_t out_size;
+ #pragma omp target map(from: ok, out_arr[:Size], out_size) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::vector<T> unique_elems;
+ simple_copy_unique(arr, arr + Size,
+ std::back_insert_iterator<std::vector<T> >(unique_elems));
+
+ std::set<T> set(arr, arr + Size);
+ VERIFY (validate_associative(set, unique_elems.begin(), unique_elems.end()));
+ simple_copy(set.begin(), set.end(), out_arr);
+ out_size = set.size();
+ /* Sets can't be mutated, we could create another set with mutated
+ but it gets a little annoying and probably isn't an interesting test. */
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_associative(reference_set,
+ out_arr, out_arr + out_size));
+ return true;
+}
+
+template<typename Proj, typename Container, typename It>
+bool validate_multi_associative(const Container& container,
+ const It compare_begin,
+ const It compare_end,
+ Proj proj) BL_NOEXCEPT
+{
+ /* Once again, for the poor soul reviewing these, I hate c++98. */
+ typedef typename key_type<typename std::iterator_traits<It>::value_type>::type key_t;
+ typedef std::map<key_t, std::size_t> counter_map;
+ counter_map key_count_map;
+ for (It it = compare_begin; it != compare_end; ++it)
+ {
+ const key_t& key = get_key(*it);
+ typename counter_map::iterator counter_it
+ = key_count_map.find(key);
+ if (counter_it != key_count_map.end())
+ ++counter_it->second;
+ else
+ key_count_map.insert(std::pair<const key_t, std::size_t>(key, std::size_t(1)));
+ }
+ const typename Container::const_iterator elem_end = container.end();
+ for (It compare_it = compare_begin; compare_it != compare_end; ++compare_it)
+ {
+ const key_t& key = get_key(*compare_it);
+ typename counter_map::iterator count_it = key_count_map.find(key);
+ std::size_t key_count = count_it != key_count_map.end() ? count_it->second
+ : std::size_t(0);
+ VERIFY_NON_TARGET (key_count > std::size_t(0) && "this will never happen");
+ /* This gets tested multiple times but that should be fine. */
+ VERIFY_NON_TARGET (key_count == container.count(key));
+ typename Container::const_iterator elem_it = container.find(key);
+ /* This will never happen if the previous case passed. */
+ VERIFY_NON_TARGET (elem_it != elem_end);
+ bool found_element = false;
+ for (; elem_it != elem_end; ++elem_it)
+ if (proj(get_value(*compare_it)) == get_value(*elem_it))
+ {
+ found_element = true;
+ break;
+ }
+ VERIFY_NON_TARGET (found_element);
+ }
+ return true;
+}
+
+template<typename Container, typename It>
+bool validate_multi_associative(const Container& container,
+ const It compare_begin,
+ const It compare_end) BL_NOEXCEPT
+{
+ return validate_multi_associative(container, compare_begin, compare_end, identity_func());
+}
+
+template<typename MutationFunc, typename K, typename V, std::size_t Size>
+bool multimap_test(const std::pair<K, V> (&arr)[Size])
+{
+ std::multimap<K, V> reference_multimap(arr, arr + Size);
+ bool ok;
+ std::pair<K, V> out_pairs[Size];
+ std::pair<K, V> out_pairs_mut[Size];
+ #pragma omp target map(from: ok, out_pairs[:Size], out_pairs_mut[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::multimap<K, V> multimap(arr, arr + Size);
+ VERIFY (validate_multi_associative(multimap, arr, arr + Size));
+ simple_copy(multimap.begin(), multimap.end(), out_pairs);
+ simple_mutate_map(multimap.begin(), multimap.end(), MutationFunc());
+ VERIFY (validate_multi_associative(multimap, arr, arr + Size, MutationFunc()));
+ simple_copy(multimap.begin(), multimap.end(), out_pairs_mut);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_multi_associative(reference_multimap,
+ out_pairs, out_pairs + Size));
+ simple_mutate_map(reference_multimap.begin(), reference_multimap.end(), MutationFunc());
+ VERIFY_NON_TARGET (validate_multi_associative(reference_multimap,
+ out_pairs_mut, out_pairs_mut + Size));
+ return true;
+}
+
+template<typename T, std::size_t Size>
+bool multiset_test(const T (&arr)[Size])
+{
+ std::multiset<T> reference_multiset(arr, arr + Size);
+ bool ok;
+ T out_arr[Size];
+ #pragma omp target map(from: ok, out_arr[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::multiset<T> set(arr, arr + Size);
+ VERIFY (validate_multi_associative(set, arr, arr + Size));
+ simple_copy(set.begin(), set.end(), out_arr);
+ /* Sets can't be mutated, we could create another set with mutated
+ but it gets a little annoying and probably isn't an interesting test. */
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_multi_associative(reference_multiset,
+ out_arr, out_arr + Size));
+ return true;
+}
+
+#if __cplusplus >= 201103L
+
+template<typename MutationFunc, typename T, std::size_t Size>
+bool array_test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_arr[Size];
+ T out_mut_arr[Size];
+ #pragma omp target map(from: ok, out_arr[:Size], out_mut_arr[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::array<T, Size> std_array{};
+ /* Special case for std::array since it can't be initialized
+ with iterators. */
+ {
+ T zero_val = T{};
+ for (auto it = std_array.begin(); it != std_array.end(); ++it)
+ VERIFY (*it == zero_val);
+ }
+ simple_copy(arr, arr + Size, std_array.begin());
+ VERIFY (validate_sequential_elements(std_array.begin(), std_array.end(),
+ arr, arr + Size));
+ simple_copy(std_array.begin(), std_array.end(), out_arr);
+ simple_mutate(std_array.begin(), std_array.end(), MutationFunc());
+ VERIFY (validate_sequential_elements(std_array.begin(), std_array.end(),
+ arr, arr + Size, MutationFunc()));
+ simple_copy(std_array.begin(), std_array.end(), out_mut_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_sequential_elements(out_arr, out_arr + Size,
+ arr, arr + Size));
+ VERIFY_NON_TARGET (validate_sequential_elements(out_mut_arr, out_mut_arr + Size,
+ arr, arr + Size, MutationFunc()));
+ return true;
+}
+
+template<typename MutationFunc, typename T, std::size_t Size>
+bool forward_list_test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_arr[Size];
+ T out_mut_arr[Size];
+ #pragma omp target map(from: ok, out_arr[:Size], out_mut_arr[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::forward_list<T> fwd_list(arr, arr + Size);
+ VERIFY (validate_sequential_elements(fwd_list.begin(), fwd_list.end(),
+ arr, arr + Size));
+ simple_copy(fwd_list.begin(), fwd_list.end(), out_arr);
+ simple_mutate(fwd_list.begin(), fwd_list.end(), MutationFunc());
+ VERIFY (validate_sequential_elements(fwd_list.begin(), fwd_list.end(),
+ arr, arr + Size, MutationFunc()));
+ simple_copy(fwd_list.begin(), fwd_list.end(), out_mut_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_sequential_elements(out_arr, out_arr + Size,
+ arr, arr + Size));
+ VERIFY_NON_TARGET (validate_sequential_elements(out_mut_arr, out_mut_arr + Size,
+ arr, arr + Size, MutationFunc()));
+ return true;
+}
+
+template<typename MutationFunc, typename K, typename V, std::size_t Size>
+bool unordered_map_test(const std::pair<K, V> (&arr)[Size])
+{
+ std::unordered_map<K, V> reference_map(arr, arr + Size);
+ bool ok;
+ /* Both sizes should be the same. */
+ std::pair<K, V> out_pairs[Size];
+ std::size_t out_size;
+ std::pair<K, V> out_pairs_mut[Size];
+ std::size_t out_size_mut;
+ #pragma omp target map(from: ok, out_pairs[:Size], out_size, \
+ out_pairs_mut[:Size], out_size_mut) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::vector<std::pair<K, V> > unique_elems;
+ simple_copy_unique(arr, arr + Size,
+ std::back_insert_iterator<std::vector<std::pair<K, V> > >(unique_elems));
+
+ std::unordered_map<K, V> map(arr, arr + Size);
+ VERIFY (validate_associative(map, unique_elems.begin(), unique_elems.end()));
+ simple_copy(map.begin(), map.end(), out_pairs);
+ out_size = map.size();
+ simple_mutate_map(map.begin(), map.end(), MutationFunc());
+ VERIFY (validate_associative(map, unique_elems.begin(), unique_elems.end(),
+ MutationFunc()));
+ simple_copy(map.begin(), map.end(), out_pairs_mut);
+ out_size_mut = map.size();
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (out_size == out_size_mut);
+ VERIFY_NON_TARGET (validate_associative(reference_map,
+ out_pairs, out_pairs + out_size));
+ simple_mutate_map(reference_map.begin(), reference_map.end(), MutationFunc());
+ VERIFY_NON_TARGET (validate_associative(reference_map,
+ out_pairs_mut, out_pairs_mut + out_size_mut));
+ return true;
+}
+
+template<typename T, std::size_t Size>
+bool unordered_set_test(const T (&arr)[Size])
+{
+ std::unordered_set<T> reference_set(arr, arr + Size);
+ bool ok;
+ /* Both sizes should be the same. */
+ T out_arr[Size];
+ std::size_t out_size;
+ #pragma omp target map(from: ok, out_arr[:Size], out_size) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::vector<T> unique_elems;
+ simple_copy_unique(arr, arr + Size,
+ std::back_insert_iterator<std::vector<T> >(unique_elems));
+
+ std::unordered_set<T> set(arr, arr + Size);
+ VERIFY (validate_associative(set, unique_elems.begin(), unique_elems.end()));
+ simple_copy(set.begin(), set.end(), out_arr);
+ out_size = set.size();
+ /* Sets can't be mutated, we could create another set with mutated
+ but it gets a little annoying and probably isn't an interesting test. */
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_associative(reference_set,
+ out_arr, out_arr + out_size));
+ return true;
+}
+
+template<typename MutationFunc, typename K, typename V, std::size_t Size>
+bool unordered_multimap_test(const std::pair<K, V> (&arr)[Size])
+{
+ std::unordered_multimap<K, V> reference_multimap(arr, arr + Size);
+ bool ok;
+ std::pair<K, V> out_pairs[Size];
+ std::pair<K, V> out_pairs_mut[Size];
+ #pragma omp target map(from: ok, out_pairs[:Size], out_pairs_mut[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::unordered_multimap<K, V> multimap(arr, arr + Size);
+ VERIFY (validate_multi_associative(multimap, arr, arr + Size));
+ simple_copy(multimap.begin(), multimap.end(), out_pairs);
+ simple_mutate_map(multimap.begin(), multimap.end(), MutationFunc());
+ VERIFY (validate_multi_associative(multimap, arr, arr + Size, MutationFunc()));
+ simple_copy(multimap.begin(), multimap.end(), out_pairs_mut);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_multi_associative(reference_multimap,
+ out_pairs, out_pairs + Size));
+ simple_mutate_map(reference_multimap.begin(), reference_multimap.end(), MutationFunc());
+ VERIFY_NON_TARGET (validate_multi_associative(reference_multimap,
+ out_pairs_mut, out_pairs_mut + Size));
+ return true;
+}
+
+template<typename T, std::size_t Size>
+bool unordered_multiset_test(const T (&arr)[Size])
+{
+ std::unordered_multiset<T> reference_multiset(arr, arr + Size);
+ bool ok;
+ T out_arr[Size];
+ #pragma omp target map(from: ok, out_arr[:Size]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::unordered_multiset<T> set(arr, arr + Size);
+ VERIFY (validate_multi_associative(set, arr, arr + Size));
+ simple_copy(set.begin(), set.end(), out_arr);
+ /* Sets can't be mutated, we could create another set with mutated
+ but it gets a little annoying and probably isn't an interesting test. */
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (validate_multi_associative(reference_multiset,
+ out_arr, out_arr + Size));
+ return true;
+}
+
+#else
+template<typename, typename T, std::size_t Size> bool array_test(const T (&arr)[Size]) { return true; }
+template<typename, typename T, std::size_t Size> bool forward_list_test(const T (&arr)[Size]) { return true; }
+template<typename, typename T, std::size_t Size> bool unordered_map_test(const T (&arr)[Size]) { return true; }
+template<typename T, std::size_t Size> bool unordered_set_test(const T (&arr)[Size]) { return true; }
+template<typename, typename T, std::size_t Size> bool unordered_multimap_test(const T (&arr)[Size]) { return true; }
+template<typename T, std::size_t Size> bool unordered_multiset_test(const T (&arr)[Size]) { return true; }
+#endif
+
+/* This clamps to the maximum value to guard against overflowing,
+ assuming std::numeric_limits is specialized for T. */
+struct multiply_by_2
+{
+ template<typename T>
+ typename enable_if<std::numeric_limits<T>::is_specialized, T>::type
+ operator()(T arg) const BL_NOEXCEPT {
+ if (arg < static_cast<T>(0))
+ {
+ if (std::numeric_limits<T>::min() / static_cast<T>(2) >= arg)
+ return std::numeric_limits<T>::min();
+ }
+ else
+ {
+ if (std::numeric_limits<T>::max() / static_cast<T>(2) <= arg)
+ return std::numeric_limits<T>::max();
+ }
+ return arg * 2;
+ }
+ template<typename T>
+ typename enable_if<!std::numeric_limits<T>::is_specialized, T>::type
+ operator()(T arg) const BL_NOEXCEPT {
+ return arg * 2;
+ }
+};
+
+int main()
+{
+ int data[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ std::pair<int, int> pairs[10] = {std::pair<int, int>( 1, 2),
+ std::pair<int, int>( 2, 4),
+ std::pair<int, int>( 3, 6),
+ std::pair<int, int>( 4, 8),
+ std::pair<int, int>( 5, 10),
+ std::pair<int, int>( 6, 12),
+ std::pair<int, int>( 7, 14),
+ std::pair<int, int>( 8, 16),
+ std::pair<int, int>( 9, 18),
+ std::pair<int, int>(10, 20)};
+ const bool vec_res = vector_test<multiply_by_2>(data);
+ const bool deque_res = deque_test<multiply_by_2>(data);
+ const bool list_res = list_test<multiply_by_2>(data);
+ const bool map_res = map_test<multiply_by_2>(pairs);
+ const bool set_res = set_test(data);
+ const bool multimap_res = multimap_test<multiply_by_2>(pairs);
+ const bool multiset_res = multiset_test(data);
+ const bool array_res = array_test<multiply_by_2>(data);
+ const bool forward_list_res = forward_list_test<multiply_by_2>(data);
+ const bool unordered_map_res = unordered_map_test<multiply_by_2>(pairs);
+ const bool unordered_set_res = unordered_set_test(data);
+ const bool unordered_multimap_res = unordered_multimap_test<multiply_by_2>(pairs);
+ const bool unordered_multiset_res = unordered_multiset_test(data);
+ std::printf("vector : %s\n", vec_res ? "PASS" : "FAIL");
+ std::printf("deque : %s\n", deque_res ? "PASS" : "FAIL");
+ std::printf("list : %s\n", list_res ? "PASS" : "FAIL");
+ std::printf("map : %s\n", map_res ? "PASS" : "FAIL");
+ std::printf("set : %s\n", set_res ? "PASS" : "FAIL");
+ std::printf("multimap : %s\n", multimap_res ? "PASS" : "FAIL");
+ std::printf("multiset : %s\n", multiset_res ? "PASS" : "FAIL");
+ std::printf("array : %s\n", array_res ? "PASS" : "FAIL");
+ std::printf("forward_list : %s\n", forward_list_res ? "PASS" : "FAIL");
+ std::printf("unordered_map : %s\n", unordered_map_res ? "PASS" : "FAIL");
+ std::printf("unordered_set : %s\n", unordered_set_res ? "PASS" : "FAIL");
+ std::printf("unordered_multimap: %s\n", unordered_multimap_res ? "PASS" : "FAIL");
+ std::printf("unordered_multiset: %s\n", unordered_multiset_res ? "PASS" : "FAIL");
+ const bool ok = vec_res
+ && deque_res
+ && list_res
+ && map_res
+ && set_res
+ && multimap_res
+ && multiset_res
+ && array_res
+ && forward_list_res
+ && unordered_map_res
+ && unordered_set_res
+ && unordered_multimap_res
+ && unordered_multiset_res;
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-2000.C b/libgomp/testsuite/libgomp.c++/target-flex-2000.C
new file mode 100644
index 0000000..688c014
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-2000.C
@@ -0,0 +1,32 @@
+/* Tiny tuple test. */
+
+#include <tuple>
+
+#include "target-flex-common.h"
+
+bool test(int arg)
+{
+ bool ok;
+ int out;
+ std::tuple tup = {'a', arg, 3.14f};
+ #pragma omp target map(from: ok, out) map(to: tup)
+ {
+ bool inner_ok = true;
+ {
+ VERIFY (std::get<0>(tup) == 'a');
+ out = std::get<1>(tup);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (out == arg);
+ return true;
+}
+
+int main()
+{
+ volatile int arg = 42u;
+ return test(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-2001.C b/libgomp/testsuite/libgomp.c++/target-flex-2001.C
new file mode 100644
index 0000000..f1a6c12
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-2001.C
@@ -0,0 +1,61 @@
+/* { dg-additional-options "-std=c++20" } */
+
+/* Functional */
+
+#include <functional>
+#include <utility>
+
+#include "target-flex-common.h"
+
+template<typename T,typename Fn>
+auto invoke_unary(T&& a, Fn&& fn) noexcept
+{
+ return std::invoke(std::forward<Fn>(fn),
+ std::forward<T>(a));
+}
+
+template<typename T, typename U, typename Fn>
+auto invoke_binary(T&& a, U&& b, Fn&& fn) noexcept
+{
+ return std::invoke(std::forward<Fn>(fn),
+ std::forward<T>(a),
+ std::forward<U>(b));
+}
+
+bool test(unsigned arg)
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ VERIFY (std::plus{}(arg, 2) == arg + 2);
+ auto bound_plus_arg = std::bind_front(std::plus{}, arg);
+ VERIFY (bound_plus_arg(10) == arg + 10);
+ VERIFY (bound_plus_arg(20) == arg + 20);
+
+ VERIFY (std::not_fn(std::not_equal_to{})(arg, arg));
+ VERIFY (invoke_binary(arg, arg, std::not_fn(std::not_equal_to{})));
+ auto bound_equals_arg = std::bind_front(std::not_fn(std::not_equal_to{}), arg);
+ VERIFY (bound_equals_arg(arg));
+ VERIFY (std::not_fn(bound_equals_arg)(arg + 1));
+ VERIFY (invoke_unary(arg, bound_equals_arg));
+
+ VERIFY (std::not_fn(std::ranges::not_equal_to{})(arg, arg));
+ VERIFY (invoke_binary(arg, arg, std::not_fn(std::ranges::not_equal_to{})));
+ auto bound_ranges_equals_arg = std::bind_front(std::not_fn(std::ranges::not_equal_to{}), arg);
+ VERIFY (bound_ranges_equals_arg(arg));
+ VERIFY (std::not_fn(bound_ranges_equals_arg)(arg + 1));
+ VERIFY (invoke_unary(arg, bound_ranges_equals_arg));
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+int main()
+{
+ volatile unsigned arg = 42u;
+ return test(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-2002.C b/libgomp/testsuite/libgomp.c++/target-flex-2002.C
new file mode 100644
index 0000000..f738806
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-2002.C
@@ -0,0 +1,97 @@
+/* { dg-additional-options "-std=c++23" } */
+
+/* expected/optional */
+
+#include <optional>
+#include <expected>
+
+#include "target-flex-common.h"
+
+std::optional<unsigned> make_optional(bool b, unsigned arg = 0u) noexcept
+{
+ if (!b)
+ return std::nullopt;
+ return {arg};
+}
+
+bool test_optional(unsigned arg)
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ auto null_opt = make_optional(false);
+ VERIFY (!null_opt);
+ VERIFY (!null_opt.has_value());
+ VERIFY (null_opt.value_or(arg * 2u) == arg * 2u);
+ VERIFY (null_opt.or_else([&](){ return std::optional<unsigned>{arg}; })
+ .transform([](int a){ return a * 2u; })
+ .value_or(0) == arg * 2u);
+
+ auto opt = make_optional(true, arg);
+ VERIFY (opt);
+ VERIFY (opt.has_value());
+ VERIFY (opt.value() == arg);
+ VERIFY (*opt == arg);
+ VERIFY (opt.value_or(arg + 42) == arg);
+ VERIFY (opt.or_else([&](){ return std::optional<unsigned>{arg + 42}; })
+ .transform([](int a){ return a * 2u; })
+ .value_or(0) == arg * 2u);
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+struct my_error
+{
+ int _e;
+};
+
+std::expected<unsigned, my_error> make_expected(bool b, unsigned arg = 0u) noexcept
+{
+ if (!b)
+ return std::unexpected{my_error{-1}};
+ return {arg};
+}
+
+bool test_expected(unsigned arg)
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ auto unexpected = make_expected(false);
+ VERIFY (!unexpected);
+ VERIFY (!unexpected.has_value());
+ VERIFY (unexpected.error()._e == -1);
+ VERIFY (unexpected.value_or(arg * 2u) == arg * 2u);
+ VERIFY (unexpected.or_else([&](my_error e){ return std::expected<unsigned, my_error>{arg}; })
+ .transform([](int a){ return a * 2u; })
+ .value_or(0) == arg * 2u);
+
+ auto expected = make_expected(true, arg);
+ VERIFY (expected);
+ VERIFY (expected.has_value());
+ VERIFY (expected.value() == arg);
+ VERIFY (*expected == arg);
+ VERIFY (expected.value_or(arg + 42) == arg);
+ VERIFY (expected.or_else([&](my_error e){ return std::expected<unsigned, my_error>{std::unexpected{e}}; })
+ .transform([](int a){ return a * 2u; })
+ .value_or(0) == arg * 2u);
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+int main()
+{
+ volatile unsigned arg = 42;
+ return test_optional(arg)
+ && test_expected(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-2003.C b/libgomp/testsuite/libgomp.c++/target-flex-2003.C
new file mode 100644
index 0000000..8e8ca8e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-2003.C
@@ -0,0 +1,176 @@
+/* { dg-additional-options "-std=c++20" } */
+
+/* bit_cast and memcpy */
+
+#include <bit>
+#include <cstring>
+
+#include "target-flex-common.h"
+
+struct S0
+{
+ int _v0;
+ char _v1;
+ long long _v2;
+};
+
+struct S1
+{
+ int _v0;
+ char _v1;
+ long long _v2;
+};
+
+bool test_bit_cast(int arg)
+{
+ bool ok;
+ S1 s1_out;
+ #pragma omp target map(from: ok, s1_out) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ long long v = static_cast<long long>(arg + 42ll);
+ S0 s = {arg, 'a', v};
+ VERIFY (std::bit_cast<S1>(s)._v0 == arg);
+ VERIFY (std::bit_cast<S1>(s)._v1 == 'a');
+ VERIFY (std::bit_cast<S1>(s)._v2 == v);
+ s1_out = std::bit_cast<S1>(s);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ long long v = static_cast<long long>(arg + 42ll);
+ VERIFY_NON_TARGET (std::bit_cast<S0>(s1_out)._v0 == arg);
+ VERIFY_NON_TARGET (std::bit_cast<S0>(s1_out)._v1 == 'a');
+ VERIFY_NON_TARGET (std::bit_cast<S0>(s1_out)._v2 == v);
+ return true;
+}
+
+
+struct OutStruct
+{
+ std::size_t _id;
+ void *_next;
+};
+
+struct Extendable1
+{
+ std::size_t _id;
+ void *_next;
+ int _v;
+};
+
+struct Extendable2
+{
+ std::size_t _id;
+ void *_next;
+ char _str[256];
+};
+
+struct Extendable3
+{
+ std::size_t _id;
+ void *_next;
+ const int *_nums;
+ std::size_t _size;
+};
+
+struct ExtendableUnknown
+{
+ std::size_t _id;
+ void *_next;
+};
+
+template<typename To, std::size_t Id>
+To *get_extendable(void *p)
+{
+ while (p != nullptr)
+ {
+ OutStruct out;
+ std::memcpy(&out, p, sizeof(OutStruct));
+ if (out._id == Id)
+ return static_cast<To *>(p);
+ p = out._next;
+ }
+ return nullptr;
+}
+
+bool test_memcpy(int arg, const int *nums, std::size_t nums_size)
+{
+ bool ok;
+ Extendable2 e2_out;
+ #pragma omp target map(from: ok, e2_out) map(to: arg, nums[:nums_size], nums_size)
+ {
+ bool inner_ok = true;
+ {
+ Extendable3 e3 = {3u, nullptr, nums, nums_size};
+ ExtendableUnknown u1 = {100u, &e3};
+ Extendable2 e2 = {2u, &u1, {'H', 'e', 'l', 'l', 'o', '!', '\000'}};
+ ExtendableUnknown u2 = {101u, &e2};
+ ExtendableUnknown u3 = {102u, &u2};
+ ExtendableUnknown u4 = {142u, &u3};
+ Extendable1 e1 = {1u, &u4, arg};
+
+ void *p = &e1;
+ while (p != nullptr)
+ {
+ /* You can always cast a pointer to a struct to a pointer to
+ the type of it's first member. */
+ switch (*static_cast<std::size_t *>(p))
+ {
+ case 1:
+ {
+ Extendable1 *e1_p = static_cast<Extendable1 *>(p);
+ p = e1_p->_next;
+ VERIFY (e1_p->_v == arg);
+ break;
+ }
+ case 2:
+ {
+ Extendable2 *e2_p = static_cast<Extendable2 *>(p);
+ p = e2_p->_next;
+ VERIFY (std::strcmp(e2_p->_str, "Hello!") == 0);
+ break;
+ }
+ case 3:
+ {
+ Extendable3 *e3_p = static_cast<Extendable3 *>(p);
+ p = e3_p->_next;
+ VERIFY (nums == e3_p->_nums);
+ VERIFY (nums_size == e3_p->_size);
+ break;
+ }
+ default:
+ {
+ /* Casting to a pointer to OutStruct invokes undefined
+ behavior though, memcpy is required to extract the _next
+ member. */
+ OutStruct out;
+ std::memcpy(&out, p, sizeof(OutStruct));
+ p = out._next;
+ }
+ }
+ }
+ Extendable2 *e2_p = get_extendable<Extendable2, 2u>(&e1);
+ VERIFY (e2_p != nullptr);
+ e2_out = *e2_p;
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (e2_out._id == 2u);
+ VERIFY_NON_TARGET (std::strcmp(e2_out._str, "Hello!") == 0);
+ return true;
+}
+
+int main()
+{
+ volatile int arg = 42;
+ int arr[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ return test_bit_cast(arg)
+ && test_memcpy(arg, arr, 8) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-30.C b/libgomp/testsuite/libgomp.c++/target-flex-30.C
new file mode 100644
index 0000000..c66075b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-30.C
@@ -0,0 +1,51 @@
+/* std::initializer_list in target region. */
+
+#include <initializer_list>
+#include <array>
+
+#include "target-flex-common.h"
+
+bool test_initializer_list(int arg)
+{
+ static constexpr std::size_t out_arr_size = 7;
+ int out_arr[out_arr_size];
+ bool ok;
+ #pragma omp target map(from: ok, out_arr[:out_arr_size]) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ auto il = {0, 1, 2, 3, 4, 5, arg};
+
+ int sum = 0;
+ for (auto const& e : il)
+ sum += e;
+ VERIFY (sum == 0 + 1 + 2 + 3 + 4 + 5 + arg);
+
+ auto* out_it = out_arr;
+ const auto* const out_end = out_arr + out_arr_size;
+ for (auto const& e : il)
+ {
+ VERIFY (out_it != out_end);
+ *out_it = e;
+ ++out_it;
+ }
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+
+ std::array<int, out_arr_size> reference_array = {0, 1, 2, 3, 4, 5, arg};
+ const auto *out_arr_it = out_arr;
+ for (auto const& e : reference_array)
+ VERIFY_NON_TARGET (e == *(out_arr_it++));
+
+ return true;
+}
+
+int main()
+{
+ volatile int arg = 42;
+ return test_initializer_list(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-300.C b/libgomp/testsuite/libgomp.c++/target-flex-300.C
new file mode 100644
index 0000000..329a189
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-300.C
@@ -0,0 +1,51 @@
+/* { dg-additional-options -std=c++23 } */
+
+/* numerics */
+
+#include <algorithm>
+#include <numeric>
+#include <ranges>
+#include <span>
+#include <vector>
+
+//TODO PR120454 "C++ constexpr vs. OpenMP implicit mapping"
+#pragma omp declare target(std::ranges::all_of, std::ranges::iota)
+
+#include "target-flex-common.h"
+
+namespace stdr = std::ranges;
+
+bool test(std::size_t arg)
+{
+ bool ok;
+ int midpoint_out;
+ std::vector<int> vec(arg);
+ int *data = vec.data();
+ std::size_t size = vec.size();
+ #pragma omp target defaultmap(none) map(from: ok, midpoint_out) map(tofrom: data[:size]) map(to: arg, size)
+ /* <https://baylibre.slack.com/archives/C06TTV7HMMG/p1748508583437829>
+ { dg-bogus {sorry, unimplemented: unsupported map expression '<lambda closure object>.*} TODO { xfail *-*-* } .-2 } */
+ {
+ std::span span = {data, size};
+ bool inner_ok = true;
+ {
+ VERIFY (stdr::all_of(span, [](int v){ return v == int{}; }));
+ stdr::iota(span, 0);
+ midpoint_out = *std::midpoint(span.data(), span.data() + span.size());
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (stdr::equal(vec, std::views::iota(0, static_cast<int>(vec.size()))));
+ VERIFY_NON_TARGET (*std::midpoint(vec.data(), vec.data() + vec.size())
+ == midpoint_out);
+ return true;
+}
+
+int main()
+{
+ volatile std::size_t arg = 42;
+ return test(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-31.C b/libgomp/testsuite/libgomp.c++/target-flex-31.C
new file mode 100644
index 0000000..adaf18f
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-31.C
@@ -0,0 +1,80 @@
+/* std::initializer_list in target region. */
+
+#include <initializer_list>
+
+#include "target-flex-common.h"
+
+struct S0
+{
+ int _v;
+ S0(std::initializer_list<int> il)
+ : _v(0)
+ {
+ for (auto const& e : il)
+ _v += e;
+ }
+};
+
+struct S1
+{
+ int _v;
+ template<typename T>
+ S1(std::initializer_list<T> il)
+ : _v(0)
+ {
+ for (auto const& e : il)
+ _v += e;
+ }
+};
+
+template<typename T>
+struct S2
+{
+ T _v;
+ S2(std::initializer_list<T> il)
+ : _v(0)
+ {
+ for (auto const& e : il)
+ _v += e;
+ }
+};
+
+#if __cplusplus >= 201703L
+template<typename T>
+S2(std::initializer_list<T>) -> S2<T>;
+#endif
+
+bool test_initializer_list(int arg)
+{
+ bool ok;
+ #pragma omp target map(from: ok) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ static constexpr int partial_sum = 0 + 1 + 2 + 3 + 4 + 5;
+
+ S0 s0{0, 1, 2, 3, 4, 5, arg};
+ VERIFY (s0._v == partial_sum + arg);
+
+ S1 s1{0, 1, 2, 3, 4, 5, arg};
+ VERIFY (s1._v == partial_sum + arg);
+
+ S2<int> s2{0, 1, 2, 3, 4, 5, arg};
+ VERIFY (s2._v == partial_sum + arg);
+
+ #if __cplusplus >= 201703L
+ S2 s2_ctad{0, 1, 2, 3, 4, 5, arg};
+ VERIFY (s2_ctad._v == partial_sum + arg);
+ #endif
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+int main()
+{
+ volatile int arg = 42;
+ return test_initializer_list(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-32.C b/libgomp/testsuite/libgomp.c++/target-flex-32.C
new file mode 100644
index 0000000..7f74401a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-32.C
@@ -0,0 +1,50 @@
+/* std::initializer_list constructor of std::vector (explicit template arg) */
+
+#include <vector>
+#include <array>
+
+#include "target-flex-common.h"
+
+bool test_initializer_list(int arg)
+{
+ static constexpr std::size_t out_arr_size = 7;
+ int out_arr[out_arr_size];
+ bool ok;
+ #pragma omp target map(from: ok, out_arr[:out_arr_size]) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ std::vector<int> vec{0, 1, 2, 3, 4, 5, arg};
+ int sum = 0;
+ for (auto const& e : vec)
+ sum += e;
+ VERIFY (sum == 0 + 1 + 2 + 3 + 4 + 5 + arg);
+
+ auto* out_it = out_arr;
+ const auto* const out_end = out_arr + out_arr_size;
+ for (auto const& e : vec)
+ {
+ VERIFY (out_it != out_end);
+ *out_it = e;
+ ++out_it;
+ }
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+
+ std::array<int, out_arr_size> reference_array = {0, 1, 2, 3, 4, 5, arg};
+ const auto *out_arr_it = out_arr;
+ for (auto const& e : reference_array)
+ VERIFY_NON_TARGET (e == *(out_arr_it++));
+
+ return true;
+}
+
+int main()
+{
+ volatile int arg = 42;
+ return test_initializer_list(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-33.C b/libgomp/testsuite/libgomp.c++/target-flex-33.C
new file mode 100644
index 0000000..bb8a39b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-33.C
@@ -0,0 +1,52 @@
+/* { dg-additional-options "-std=c++17" } */
+
+/* deduced std::initializer_list constructor of std::vector (CTAD) */
+
+#include <vector>
+#include <array>
+
+#include "target-flex-common.h"
+
+bool test_initializer_list(int arg)
+{
+ static constexpr std::size_t out_arr_size = 7;
+ int out_arr[out_arr_size];
+ bool ok;
+ #pragma omp target map(from: ok, out_arr[:out_arr_size]) map(to: arg)
+ {
+ bool inner_ok = true;
+ {
+ std::vector vec{0, 1, 2, 3, 4, 5, arg};
+ int sum = 0;
+ for (auto const& e : vec)
+ sum += e;
+ VERIFY (sum == 0 + 1 + 2 + 3 + 4 + 5 + arg);
+
+ auto* out_it = out_arr;
+ const auto* const out_end = out_arr + out_arr_size;
+ for (auto const& e : vec)
+ {
+ VERIFY (out_it != out_end);
+ *out_it = e;
+ ++out_it;
+ }
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+
+ std::array<int, out_arr_size> reference_array = {0, 1, 2, 3, 4, 5, arg};
+ const auto *out_arr_it = out_arr;
+ for (auto const& e : reference_array)
+ VERIFY_NON_TARGET (e == *(out_arr_it++));
+
+ return true;
+}
+
+int main()
+{
+ volatile int arg = 42;
+ return test_initializer_list(arg) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-41.C b/libgomp/testsuite/libgomp.c++/target-flex-41.C
new file mode 100644
index 0000000..4d36341
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-41.C
@@ -0,0 +1,94 @@
+/* { dg-additional-options "-std=c++20" } */
+
+/* <iterator> c++20 */
+
+/* std::common_iterator uses std::variant. */
+
+#include <vector>
+#include <iterator>
+#include <span>
+
+//TODO PR120454 "C++ constexpr vs. OpenMP implicit mapping"
+#pragma omp declare target(std::ranges::distance, std::ranges::next)
+
+#include "target-flex-common.h"
+
+namespace stdr = std::ranges;
+
+template<typename It0, typename It1>
+bool simple_equal(const It0 begin0, const It0 end0,
+ const It1 begin1, const It1 end1) BL_NOEXCEPT
+{
+ It0 it0 = begin0;
+ It1 it1 = begin1;
+ for (; it0 != end0; ++it0, ++it1)
+ if (it1 == end1 || *it0 != *it1)
+ return false;
+ return true;
+}
+
+template<typename It, typename OutIt>
+void simple_copy(const It begin, const It end, OutIt out) BL_NOEXCEPT
+{
+ for (It it = begin; it != end; ++it, ++out)
+ *out = *it;
+}
+
+template<typename T, std::size_t Size>
+bool test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_rev_arr[Size];
+ T out_fwd_arr[Size];
+ T out_first_half_arr[Size / 2];
+ #pragma omp target defaultmap(none) \
+ map(from: ok, out_rev_arr[:Size], out_fwd_arr[:Size], \
+ out_first_half_arr[:Size / 2]) \
+ map(to: arr[:Size])
+ {
+ bool inner_ok = true;
+ {
+ std::span<const T> span = {arr, Size};
+ std::vector<T> rev_vec(std::reverse_iterator{span.end()},
+ std::reverse_iterator{span.begin()});
+ VERIFY (std::distance(span.begin(), span.end())
+ == std::distance(rev_vec.begin(), rev_vec.end()));
+ VERIFY (stdr::distance(span.begin(), span.end())
+ == stdr::distance(rev_vec.begin(), rev_vec.end()));
+ VERIFY (stdr::distance(span) == stdr::distance(rev_vec));
+ VERIFY (simple_equal(span.begin(), span.end(),
+ std::reverse_iterator{rev_vec.end()},
+ std::reverse_iterator{rev_vec.begin()}));
+ simple_copy(rev_vec.begin(), rev_vec.end(), out_rev_arr);
+ simple_copy(std::reverse_iterator{rev_vec.end()},
+ std::reverse_iterator{rev_vec.begin()},
+ out_fwd_arr);
+ using counted_iter = std::counted_iterator<decltype(span.begin())>;
+ using common_iter = std::common_iterator<counted_iter,
+ std::default_sentinel_t>;
+ std::vector<T> front_half;
+ simple_copy(common_iter{counted_iter{span.begin(), Size / 2}},
+ common_iter{std::default_sentinel},
+ std::back_insert_iterator{front_half});
+ VERIFY (simple_equal(span.begin(), stdr::next(span.begin(), Size / 2),
+ front_half.begin(), front_half.end()));
+ simple_copy(front_half.begin(), front_half.end(), out_first_half_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ VERIFY_NON_TARGET (simple_equal(std::reverse_iterator{arr + Size},
+ std::reverse_iterator{arr},
+ out_rev_arr, out_rev_arr + Size));
+ VERIFY_NON_TARGET (simple_equal(arr, arr + Size,
+ out_fwd_arr, out_fwd_arr + Size));
+ VERIFY_NON_TARGET (simple_equal(arr, arr + Size / 2,
+ out_first_half_arr, out_first_half_arr + Size / 2));
+ return ok;
+}
+
+int main()
+{
+ int arr[] = {0, 1, 2, 3, 4, 5, 6, 7};
+ return test(arr) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-60.C b/libgomp/testsuite/libgomp.c++/target-flex-60.C
new file mode 100644
index 0000000..393bb3c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-60.C
@@ -0,0 +1,48 @@
+/* algorithms pre c++20 */
+
+#include <algorithm>
+#include <vector>
+
+#include "target-flex-common.h"
+
+template<typename T, std::size_t Size>
+bool test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_2x_arr[Size];
+ T out_shifted_arr[Size];
+ #pragma omp target map(from: ok, out_2x_arr[:Size], out_shifted_arr[:Size]) \
+ map(to: arr[:Size])
+ /* <https://baylibre.slack.com/archives/C06TTV7HMMG/p1748508583437829>
+ { dg-bogus {sorry, unimplemented: unsupported map expression '<lambda closure object>.*} TODO { xfail *-*-* } .-3 } */
+ {
+ std::vector<T> vec(Size);
+ std::vector<T> mutated(Size);
+ bool inner_ok = true;
+ {
+ std::copy(arr, arr + Size, vec.begin());
+ VERIFY (std::equal(arr, arr + Size, vec.begin()));
+ std::transform(vec.begin(), vec.end(), mutated.begin(),
+ [](const T& v){ return v * 2; });
+ std::copy(mutated.begin(), mutated.end(), out_2x_arr);
+ std::rotate(vec.begin(), std::next(vec.begin(), Size / 2), vec.end());
+ std::copy(vec.begin(), vec.end(), out_shifted_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (std::equal(arr, arr + Size, out_2x_arr,
+ [](const T& a, const T& b){ return a * 2 == b; }));
+ std::vector<T> shifted(arr, arr + Size);
+ std::rotate(shifted.begin(), std::next(shifted.begin(), Size / 2), shifted.end());
+ VERIFY_NON_TARGET (std::equal(out_shifted_arr, out_shifted_arr + Size, shifted.begin()));
+ return true;
+}
+
+int main()
+{
+ int arr[] = {0, 1, 2, 3, 4, 5, 6, 7};
+ return test(arr) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-61.C b/libgomp/testsuite/libgomp.c++/target-flex-61.C
new file mode 100644
index 0000000..e06133a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-61.C
@@ -0,0 +1,56 @@
+/* { dg-additional-options "-std=c++20" } */
+
+/* ranged algorithms c++20 */
+
+#include <algorithm>
+#include <ranges>
+#include <vector>
+
+//TODO PR120454 "C++ constexpr vs. OpenMP implicit mapping"
+#pragma omp declare target(std::ranges::copy, std::ranges::equal, std::ranges::rotate, std::ranges::transform)
+
+#include "target-flex-common.h"
+
+namespace stdr = std::ranges;
+
+template<typename T, std::size_t Size>
+bool test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_2x_arr[Size];
+ T out_shifted_arr[Size];
+ #pragma omp target defaultmap(none) \
+ map(from: ok, out_2x_arr[:Size], out_shifted_arr[:Size]) \
+ map(to: arr[:Size])
+ /* <https://baylibre.slack.com/archives/C06TTV7HMMG/p1748508583437829>
+ { dg-bogus {sorry, unimplemented: unsupported map expression '<lambda closure object>.*} TODO { xfail *-*-* } .-4 } */
+ {
+ std::vector<T> vec(Size);
+ std::vector<T> mutated(Size);
+ bool inner_ok = true;
+ {
+ stdr::copy(arr, vec.begin());
+ VERIFY (stdr::equal(arr, vec));
+ stdr::transform(vec, mutated.begin(),
+ [](const T& v){ return v * 2; });
+ stdr::copy(mutated, out_2x_arr);
+ stdr::rotate(vec, std::next(vec.begin(), Size / 2));
+ stdr::copy(vec, out_shifted_arr);
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (stdr::equal(arr, out_2x_arr, stdr::equal_to{}, [](const T& v){ return v * 2; }));
+ std::vector<T> shifted(arr, arr + Size);
+ stdr::rotate(shifted, std::next(shifted.begin(), Size / 2));
+ VERIFY_NON_TARGET (stdr::equal(out_shifted_arr, shifted));
+ return true;
+}
+
+int main()
+{
+ int arr[] = {0, 1, 2, 3, 4, 5, 6, 7};
+ return test(arr) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-62.C b/libgomp/testsuite/libgomp.c++/target-flex-62.C
new file mode 100644
index 0000000..2e74b20
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-62.C
@@ -0,0 +1,52 @@
+/* { dg-additional-options -std=c++23 } */
+
+/* std::views stuff. Also tests std::tuple with std::views::zip. */
+
+#include <algorithm>
+#include <ranges>
+#include <span>
+
+//TODO PR120454 "C++ constexpr vs. OpenMP implicit mapping"
+#pragma omp declare target(std::ranges::all_of, std::ranges::equal, std::ranges::fold_left, std::views::reverse, std::views::zip)
+
+#include "target-flex-common.h"
+
+namespace stdr = std::ranges;
+namespace stdv = std::views;
+
+bool f()
+{
+ const int arr_fwd[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ const int arr_rev[8] = {7, 6, 5, 4, 3, 2, 1, 0};
+
+ bool ok;
+ #pragma omp target defaultmap(none) map(from: ok) map(to: arr_fwd[:8], arr_rev[:8])
+ /* <https://baylibre.slack.com/archives/C06TTV7HMMG/p1748508583437829>
+ { dg-bogus {sorry, unimplemented: unsupported map expression '<lambda closure object>.*} TODO { xfail *-*-* } .-2 } */
+ {
+ std::span<const int> fwd = {arr_fwd, 8};
+ std::span<const int> rev = {arr_rev, 8};
+ bool inner_ok = true;
+ {
+ VERIFY(stdr::equal(fwd, rev | stdv::reverse));
+ VERIFY(stdr::equal(fwd | stdv::drop(4) | stdv::reverse,
+ rev | stdv::take(4)));
+ for (auto [first, second] : stdv::zip(fwd, rev))
+ VERIFY(first + second == 7);
+ auto plus = [](int a, int b){ return a + b; };
+ auto is_even = [](int v){ return v % 2 == 0; };
+ VERIFY(stdr::fold_left(fwd | stdv::filter(is_even), 0, plus)
+ == 12);
+ VERIFY(stdr::all_of(fwd | stdv::transform([](int v){ return v * 2; }),
+ is_even));
+ }
+ end:
+ ok = inner_ok;
+ }
+ return ok;
+}
+
+int main()
+{
+ return f() ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-70.C b/libgomp/testsuite/libgomp.c++/target-flex-70.C
new file mode 100644
index 0000000..9e9383d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-70.C
@@ -0,0 +1,26 @@
+/* CTAD in target regions. */
+
+template<typename T>
+struct S
+{
+ T _v;
+};
+
+template<typename T>
+S(T) -> S<T>;
+
+bool f()
+{
+ bool ok;
+ #pragma omp target map(from: ok)
+ {
+ S s{42};
+ ok = s._v == 42;
+ }
+ return ok;
+}
+
+int main()
+{
+ return f() ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-80.C b/libgomp/testsuite/libgomp.c++/target-flex-80.C
new file mode 100644
index 0000000..f41a1bb
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-80.C
@@ -0,0 +1,49 @@
+// { dg-additional-options "-std=c++20" }
+
+/* std::span */
+
+#include <span>
+
+#include "target-flex-common.h"
+
+template<typename It0, typename It1>
+bool simple_equal(It0 it0, const It0 end0,
+ It1 it1, const It1 end1) noexcept
+{
+ for (; it0 != end0; ++it0, ++it1)
+ if (it1 == end1 || *it0 != *it1)
+ return false;
+ return true;
+}
+
+template<typename T, std::size_t Size>
+bool test(const T (&arr)[Size])
+{
+ bool ok;
+ T out_arr[Size];
+ #pragma omp target map(from: ok) map(to: arr[:Size])
+ {
+ std::span span = {arr, Size};
+ bool inner_ok = true;
+ {
+ VERIFY (!span.empty());
+ VERIFY (span.size() == Size);
+ auto out_it = out_arr;
+ for (auto elem : span)
+ *(out_it++) = elem;
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (simple_equal(arr, arr + Size,
+ out_arr, out_arr + Size));
+ return true;
+}
+
+int main()
+{
+ int arr[8] = {0, 1, 2, 3, 4, 5, 6, 7};
+ return test(arr) ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-81.C b/libgomp/testsuite/libgomp.c++/target-flex-81.C
new file mode 100644
index 0000000..950c122
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-81.C
@@ -0,0 +1,77 @@
+/* { dg-additional-options "-std=c++20" } */
+
+#include <ranges>
+#include <span>
+#include <type_traits>
+#include <vector>
+
+#include "target-flex-common.h"
+
+namespace stdr = std::ranges;
+
+template<typename It0, typename It1>
+bool simple_equal(It0 it0, const It0 end0,
+ It1 it1, const It1 end1) noexcept
+{
+ for (; it0 != end0; ++it0, ++it1)
+ if (it1 == end1 || *it0 != *it1)
+ return false;
+ return true;
+}
+
+template<typename Rn0, typename Rn1>
+bool simple_equal(Rn0&& rn0, Rn1&& rn1) noexcept
+{
+ return simple_equal(stdr::begin(rn0), stdr::end(rn0),
+ stdr::begin(rn1), stdr::end(rn1));
+}
+
+template<typename Rn>
+bool test(Rn&& range)
+{
+ using value_type = stdr::range_value_t<std::remove_cvref_t<Rn>>;
+ std::vector<value_type> vec = {stdr::begin(range), stdr::end(range)};
+ value_type *data = vec.data();
+ std::size_t size = vec.size();
+ bool ok;
+ #pragma omp target map(from: ok) map(tofrom: data[:size]) map(to: size)
+ /* <https://baylibre.slack.com/archives/C06TTV7HMMG/p1748508583437829>
+ { dg-bogus {sorry, unimplemented: unsupported map expression '<lambda closure object>.*} TODO { xfail *-*-* } .-2 } */
+ {
+ std::vector<value_type> orig = {data, data + size};
+ std::span<value_type> span = {data, size};
+ bool inner_ok = true;
+ {
+ auto mul_by_2 = [](const value_type& v){ return v * 2; };
+ VERIFY (simple_equal(orig, span));
+ for (auto& elem : span)
+ elem = mul_by_2(elem);
+ VERIFY (simple_equal(orig | std::views::transform(mul_by_2), span));
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ auto mul_by_2 = [](const value_type& v){ return v * 2; };
+ VERIFY_NON_TARGET (simple_equal(range | std::views::transform(mul_by_2), vec));
+ return true;
+}
+
+struct my_int
+{
+ int _v;
+ bool operator==(my_int const&) const = default;
+ my_int operator*(int rhs) const noexcept {
+ return {_v * rhs};
+ }
+};
+
+int main()
+{
+ std::vector<int> ints = {1, 2, 3, 4, 5};
+ const bool ints_res = test(ints);
+ std::vector<my_int> my_ints = {my_int{1}, my_int{2}, my_int{3}, my_int{4}, my_int{5}};
+ const bool my_ints_res = test(my_ints);
+ return ints_res && my_ints_res ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-90.C b/libgomp/testsuite/libgomp.c++/target-flex-90.C
new file mode 100644
index 0000000..b3f1197
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-90.C
@@ -0,0 +1,107 @@
+/* structured bindings */
+
+#include <array>
+#include <tuple>
+
+#include "target-flex-common.h"
+
+template<typename Array, typename Tuple, typename Struct>
+bool test(Array array, Tuple tuple, Struct s)
+{
+ bool ok;
+ auto array_2nd_in = std::get<2>(array);
+ auto tuple_2nd_in = std::get<2>(tuple);
+ auto s_2nd_in = s._2;
+ decltype(array_2nd_in) array_2nd_out_0;
+ decltype(tuple_2nd_in) tuple_2nd_out_0;
+ decltype(s_2nd_in) s_2nd_out_0;
+ decltype(array_2nd_in) array_2nd_out_1;
+ decltype(tuple_2nd_in) tuple_2nd_out_1;
+ decltype(s_2nd_in) s_2nd_out_1;
+ decltype(array_2nd_in) array_2nd_out_2;
+ decltype(tuple_2nd_in) tuple_2nd_out_2;
+ decltype(s_2nd_in) s_2nd_out_2;
+ #pragma omp target map(from: ok, \
+ array_2nd_out_0, tuple_2nd_out_0, s_2nd_out_0, \
+ array_2nd_out_1, tuple_2nd_out_1, s_2nd_out_1, \
+ array_2nd_out_2, tuple_2nd_out_2, s_2nd_out_2) \
+ map(to: array_2nd_in, tuple_2nd_in, s_2nd_in, array, tuple, s)
+ {
+ bool inner_ok = true;
+ {
+ {
+ auto [array_0th, array_1st, array_2nd] = array;
+ VERIFY (array_2nd_in == array_2nd);
+ VERIFY (std::get<2>(array) == array_2nd);
+ array_2nd_out_0 = array_2nd;
+ auto [tuple_0th, tuple_1st, tuple_2nd] = tuple;
+ VERIFY (tuple_2nd_in == tuple_2nd);
+ VERIFY (std::get<2>(tuple) == tuple_2nd);
+ tuple_2nd_out_0 = tuple_2nd;
+ auto [s_0th, s_1st, s_2nd] = s;
+ VERIFY (s_2nd_in == s_2nd);
+ VERIFY (s._2 == s_2nd);
+ s_2nd_out_0 = s_2nd;
+ }
+ {
+ auto& [array_0th, array_1st, array_2nd] = array;
+ VERIFY (array_2nd_in == array_2nd);
+ VERIFY (std::get<2>(array) == array_2nd);
+ array_2nd_out_1 = array_2nd;
+ auto& [tuple_0th, tuple_1st, tuple_2nd] = tuple;
+ VERIFY (tuple_2nd_in == tuple_2nd);
+ VERIFY (std::get<2>(tuple) == tuple_2nd);
+ tuple_2nd_out_1 = tuple_2nd;
+ auto& [s_0th, s_1st, s_2nd] = s;
+ VERIFY (s_2nd_in == s_2nd);
+ VERIFY (s._2 == s_2nd);
+ s_2nd_out_1 = s_2nd;
+ }
+ {
+ const auto& [array_0th, array_1st, array_2nd] = array;
+ VERIFY (array_2nd_in == array_2nd);
+ VERIFY (std::get<2>(array) == array_2nd);
+ array_2nd_out_2 = array_2nd;
+ const auto& [tuple_0th, tuple_1st, tuple_2nd] = tuple;
+ VERIFY (tuple_2nd_in == tuple_2nd);
+ VERIFY (std::get<2>(tuple) == tuple_2nd);
+ tuple_2nd_out_2 = tuple_2nd;
+ const auto& [s_0th, s_1st, s_2nd] = s;
+ VERIFY (s_2nd_in == s_2nd);
+ VERIFY (s._2 == s_2nd);
+ s_2nd_out_2 = s_2nd;
+ }
+ }
+ end:
+ ok = inner_ok;
+ }
+ if (!ok)
+ return false;
+ VERIFY_NON_TARGET (array_2nd_out_0 == array_2nd_in);
+ VERIFY_NON_TARGET (tuple_2nd_out_0 == tuple_2nd_in);
+ VERIFY_NON_TARGET (s_2nd_out_0 == s_2nd_in);
+ VERIFY_NON_TARGET (array_2nd_out_1 == array_2nd_in);
+ VERIFY_NON_TARGET (tuple_2nd_out_1 == tuple_2nd_in);
+ VERIFY_NON_TARGET (s_2nd_out_1 == s_2nd_in);
+ VERIFY_NON_TARGET (array_2nd_out_2 == array_2nd_in);
+ VERIFY_NON_TARGET (tuple_2nd_out_2 == tuple_2nd_in);
+ VERIFY_NON_TARGET (s_2nd_out_2 == s_2nd_in);
+
+ return true;
+}
+
+struct S
+{
+ char _0;
+ float _1;
+ int _2;
+};
+
+int main()
+{
+ const bool test_res
+ = test(std::array{0, 1, 2},
+ std::tuple{'a', 3.14f, 42},
+ S{'a', 3.14f, 42});
+ return test_res ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-flex-common.h b/libgomp/testsuite/libgomp.c++/target-flex-common.h
new file mode 100644
index 0000000..14523c4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-flex-common.h
@@ -0,0 +1,40 @@
+#include <cstdio>
+
+#if __cplusplus >= 201103L
+ #define BL_NOEXCEPT noexcept
+#else
+ #define BL_NOEXCEPT throw()
+#endif
+
+#if defined __has_builtin
+# if __has_builtin (__builtin_LINE)
+# define VERIFY_LINE __builtin_LINE ()
+# endif
+#endif
+#if !defined VERIFY_LINE
+# define VERIFY_LINE __LINE__
+#endif
+
+/* I'm not a huge fan of macros but in the interest of keeping the code that
+ isn't being tested as simple as possible, we use them. */
+
+#define VERIFY(EXPR) \
+ do { \
+ if (!(EXPR)) \
+ { \
+ std::printf("VERIFY ln: %d `" #EXPR "` evaluated to false\n", \
+ VERIFY_LINE); \
+ inner_ok = false; \
+ goto end; \
+ } \
+ } while (false)
+
+#define VERIFY_NON_TARGET(EXPR) \
+ do { \
+ if (!(EXPR)) \
+ { \
+ std::printf("VERIFY ln: %d `" #EXPR "` evaluated to false\n", \
+ VERIFY_LINE); \
+ return false; \
+ } \
+ } while (false)
diff --git a/libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C
new file mode 100644
index 0000000..9923783
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__array-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C
new file mode 100644
index 0000000..c42105a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C
@@ -0,0 +1,62 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <array>
+#include <algorithm>
+
+#define N 50000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand ();
+}
+
+#pragma omp declare target
+bool validate (const std::array<int,N> &arr, int data[])
+{
+ for (int i = 0; i < N; ++i)
+ if (arr[i] != data[i] * data[i])
+ return false;
+ return true;
+}
+#pragma omp end declare target
+
+int main (void)
+{
+ int data[N];
+ bool ok;
+ std::array<int,N> arr;
+
+ srand (time (NULL));
+ init (data);
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: arr)
+#endif
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&arr) std::array<int,N> ();
+#endif
+ std::copy (data, data + N, arr.begin ());
+ }
+
+ #pragma omp target teams distribute parallel for
+ for (int i = 0; i < N; ++i)
+ arr[i] *= arr[i];
+
+ #pragma omp target map (from: ok)
+ {
+ ok = validate (arr, data);
+#ifndef MEM_SHARED
+ arr.~array ();
+#endif
+ }
+ }
+
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C
new file mode 100644
index 0000000..9023ef8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__bitset-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C
new file mode 100644
index 0000000..4fcce93
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C
@@ -0,0 +1,69 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <bitset>
+#include <set>
+#include <algorithm>
+
+#define N 4000
+#define MAX 16384
+
+void init (int data[])
+{
+ std::set<int> _set;
+ for (int i = 0; i < N; ++i)
+ {
+ // Avoid duplicates in data array.
+ do
+ data[i] = rand () % MAX;
+ while (_set.find (data[i]) != _set.end ());
+ _set.insert (data[i]);
+ }
+}
+
+bool validate (int sum, int data[])
+{
+ int total = 0;
+ for (int i = 0; i < N; ++i)
+ total += data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int data[N];
+ std::bitset<MAX> _set;
+ int sum = 0;
+
+ srand (time (NULL));
+ init (data);
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: _set)
+#endif
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_set) std::bitset<MAX> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _set[data[i]] = true;
+ }
+
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < MAX; ++i)
+ if (_set[i])
+ sum += i;
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _set.~bitset ();
+#endif
+ }
+
+ bool ok = validate (sum, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__cmath.C b/libgomp/testsuite/libgomp.c++/target-std__cmath.C
new file mode 100644
index 0000000..aaf7152
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__cmath.C
@@ -0,0 +1,340 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++20" }
+
+#include <cmath>
+#include <numbers>
+
+#define FP_EQUAL(x,y) (std::abs ((x) - (y)) < 1E-6)
+
+#pragma omp declare target
+template<typename T> bool test_basic ()
+{
+ T x = -3.456789;
+ T y = 1.234567;
+ T z = 5.678901;
+
+ if (std::abs (x) != -x)
+ return false;
+ if (!FP_EQUAL (std::trunc (x / y) * y + std::fmod (x, y), x))
+ return false;
+ if (!FP_EQUAL (x - std::round (x / y) * y, std::remainder (x, y)))
+ return false;
+ if (!FP_EQUAL (std::fma (x, y, z), x * y + z))
+ return false;
+ if (std::fmax (x, y) != (x > y ? x : y))
+ return false;
+ if (std::fmin (x, y) != (x < y ? x : y))
+ return false;
+ if (std::fdim (x, y) != std::max(x - y, (T) 0.0))
+ return false;
+ if (std::fdim (y, x) != std::max(y - x, (T) 0.0))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_exp ()
+{
+ T x = -4.567890;
+ T y = 2.345678;
+
+ if (!FP_EQUAL (std::exp (x), std::pow (std::numbers::e_v<T>, x)))
+ return false;
+ if (!FP_EQUAL (std::exp2 (y), std::pow ((T) 2.0, y)))
+ return false;
+ if (!FP_EQUAL (std::expm1 (y), std::exp (y) - (T) 1.0))
+ return false;
+ if (!FP_EQUAL (std::log (std::exp (x)), x))
+ return false;
+ if (!FP_EQUAL (std::log10 (std::pow ((T) 10.0, y)), y))
+ return false;
+ if (!FP_EQUAL (std::log2 (std::exp2 (y)), y))
+ return false;
+ if (!FP_EQUAL (std::log1p (std::expm1 (y)), y))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_power ()
+{
+ T x = 7.234251;
+ T y = 0.340128;
+
+ if (!FP_EQUAL (std::log (std::pow (x, y)) / std::log (x), y))
+ return false;
+ if (!FP_EQUAL (std::sqrt (x) * std::sqrt (x), x))
+ return false;
+ if (!FP_EQUAL (std::cbrt (x) * std::cbrt (x) * std::cbrt (x), x))
+ return false;
+ if (!FP_EQUAL (std::hypot (x, y), std::sqrt (x * x + y * y)))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_trig ()
+{
+ T theta = std::numbers::pi / 4;
+ T phi = std::numbers::pi / 6;
+
+ if (!FP_EQUAL (std::sin (theta), std::sqrt ((T) 2) / 2))
+ return false;
+ if (!FP_EQUAL (std::sin (phi), 0.5))
+ return false;
+ if (!FP_EQUAL (std::cos (theta), std::sqrt ((T) 2) / 2))
+ return false;
+ if (!FP_EQUAL (std::cos (phi), std::sqrt ((T) 3) / 2))
+ return false;
+ if (!FP_EQUAL (std::tan (theta), 1.0))
+ return false;
+ if (!FP_EQUAL (std::tan (phi), std::sqrt ((T) 3) / 3))
+ return false;
+
+ T x = 0.33245623;
+
+ if (!FP_EQUAL (std::asin (std::sin (x)), x))
+ return false;
+ if (!FP_EQUAL (std::acos (std::cos (x)), x))
+ return false;
+ if (!FP_EQUAL (std::atan (std::tan (x)), x))
+ return false;
+ if (!FP_EQUAL (std::atan2 (std::sin (x), std::cos (x)), x))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_hyperbolic ()
+{
+ T x = 0.7423532;
+
+ if (!FP_EQUAL (std::sinh (x), (std::exp (x) - std::exp (-x)) / (T) 2.0))
+ return false;
+ if (!FP_EQUAL (std::cosh (x), (std::exp (x) + std::exp (-x)) / (T) 2.0))
+ return false;
+ if (!FP_EQUAL (std::tanh (x), std::sinh (x) / std::cosh (x)))
+ return false;
+ if (!FP_EQUAL (std::asinh (std::sinh (x)), x))
+ return false;
+ if (!FP_EQUAL (std::acosh (std::cosh (x)), x))
+ return false;
+ if (!FP_EQUAL (std::atanh (std::tanh (x)), x))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_erf ()
+{
+ if (!FP_EQUAL (std::erf ((T) 0), 0))
+ return false;
+ if (!FP_EQUAL (std::erf ((T) INFINITY), 1))
+ return false;
+ if (!FP_EQUAL (std::erf ((T) -INFINITY), -1))
+ return false;
+
+ if (!FP_EQUAL (std::erfc (0), 1))
+ return false;
+ if (!FP_EQUAL (std::erfc ((T) INFINITY), 0))
+ return false;
+ if (!FP_EQUAL (std::erfc ((T) -INFINITY), 2))
+ return false;
+
+ return true;
+}
+
+template<typename T> bool test_gamma ()
+{
+ if (!FP_EQUAL (std::tgamma ((T) 5), 4*3*2*1))
+ return false;
+ if (!FP_EQUAL (std::tgamma ((T) 0.5), std::sqrt (std::numbers::pi_v<T>)))
+ return false;
+ if (!FP_EQUAL (std::tgamma ((T) -0.5), (T) -2 * std::sqrt (std::numbers::pi_v<T>)))
+ return false;
+ if (!FP_EQUAL (std::tgamma ((T) 2.5), (T) 0.75 * std::sqrt (std::numbers::pi_v<T>)))
+ return false;
+ if (!FP_EQUAL (std::tgamma ((T) -2.5), (T) -8.0/15 * std::sqrt (std::numbers::pi_v<T>)))
+ return false;
+
+ if (!FP_EQUAL (std::lgamma ((T) 5), std::log ((T) 4*3*2*1)))
+ return false;
+ if (!FP_EQUAL (std::lgamma ((T) 0.5), std::log (std::sqrt (std::numbers::pi_v<T>))))
+ return false;
+ if (!FP_EQUAL (std::lgamma ((T) 2.5),
+ std::log ((T) 0.75 * std::sqrt (std::numbers::pi_v<T>))))
+ return false;
+
+ return true;
+}
+
+template<typename T> bool test_rounding ()
+{
+ T x = -2.5678;
+ T y = 3.6789;
+
+ if (std::ceil (x) != -2)
+ return false;
+ if (std::floor (x) != -3)
+ return false;
+ if (std::trunc (x) != -2)
+ return false;
+ if (std::round (x) != -3)
+ return false;
+
+ if (std::ceil (y) != 4)
+ return false;
+ if (std::floor (y) != 3)
+ return false;
+ if (std::trunc (y) != 3)
+ return false;
+ if (std::round (y) != 4)
+ return false;
+
+ /* Not testing std::rint and std::nearbyint due to dependence on
+ floating-point environment. */
+
+ return true;
+}
+
+template<typename T> bool test_fpmanip ()
+{
+ T x = -2.3456789;
+ T y = 3.6789012;
+ int exp;
+
+ T mantissa = std::frexp (x, &exp);
+ if (std::ldexp (mantissa, exp) != x)
+ return false;
+ if (std::logb (x) + 1 != exp)
+ return false;
+ if (std::ilogb (x) + 1 != exp)
+ return false;
+ if (std::scalbn (x, -exp) != mantissa)
+ return false;
+
+ T next = std::nextafter (x, y);
+ if (!(next > x && next < y))
+ return false;
+
+#if 0
+ /* TODO Due to 'std::nexttoward' using 'long double to', this triggers a
+ '80-bit-precision floating-point numbers unsupported (mode ‘XF’)' error
+ with x86_64 host and nvptx, GCN offload compilers, or
+ '128-bit-precision floating-point numbers unsupported (mode ‘TF’)' error
+ with powerpc64le host and nvptx offload compiler, for example;
+ PR71064 'nvptx offloading: "long double" data type'.
+ It ought to work on systems where the host's 'long double' is the same as
+ 'double' ('DF'): aarch64, for example? */
+ next = std::nexttoward (x, y);
+ if (!(next > x && next < y))
+ return false;
+#endif
+
+ if (std::copysign (x, y) != std::abs (x))
+ return false;
+ if (std::copysign (y, x) != -y)
+ return false;
+
+ return true;
+}
+
+template<typename T> bool test_classify ()
+{
+ T x = -2.3456789;
+ T y = 3.6789012;
+
+ if (std::fpclassify (x) != FP_NORMAL || std::fpclassify (y) != FP_NORMAL)
+ return false;
+ if (std::fpclassify ((T) INFINITY) != FP_INFINITE
+ || std::fpclassify ((T) -INFINITY) != FP_INFINITE)
+ return false;
+ if (std::fpclassify ((T) 0.0) != FP_ZERO)
+ return false;
+ if (std::fpclassify ((T) NAN) != FP_NAN)
+ return false;
+ if (!std::isfinite (x) || !std::isfinite (y))
+ return false;
+ if (std::isfinite ((T) INFINITY) || std::isfinite ((T) -INFINITY))
+ return false;
+ if (std::isinf (x) || std::isinf (y))
+ return false;
+ if (!std::isinf ((T) INFINITY) || !std::isinf ((T) -INFINITY))
+ return false;
+ if (std::isnan (x) || std::isnan (y))
+ return false;
+ if (!std::isnan ((T) 0.0 / (T) 0.0))
+ return false;
+ if (std::isnan (x) || std::isnan (y))
+ return false;
+ if (!std::isnormal (x) || !std::isnormal (y))
+ return false;
+ if (std::isnormal ((T) 0.0) || std::isnormal ((T) INFINITY) || std::isnormal ((T) NAN))
+ return false;
+ if (!std::signbit (x) || std::signbit (y))
+ return false;
+
+ return true;
+}
+
+template<typename T> bool test_compare ()
+{
+ T x = 5.6789012;
+ T y = 8.9012345;
+
+ if (std::isgreater (x, y))
+ return false;
+ if (std::isgreater (x, x))
+ return false;
+ if (std::isgreaterequal (x, y))
+ return false;
+ if (!std::isgreaterequal (x, x))
+ return false;
+ if (!std::isless (x, y))
+ return false;
+ if (std::isless (x, x))
+ return false;
+ if (!std::islessequal (x, y))
+ return false;
+ if (!std::islessequal (x, x))
+ return false;
+ if (!std::islessgreater (x, y))
+ return false;
+ if (std::islessgreater (x, x))
+ return false;
+ if (std::isunordered (x, y))
+ return false;
+ if (!std::isunordered (x, NAN))
+ return false;
+ return true;
+}
+#pragma omp end declare target
+
+#define RUN_TEST(func) \
+{ \
+ pass++; \
+ bool ok = test_##func<float> (); \
+ if (!ok) { result = pass; break; } \
+ pass++; \
+ ok = test_##func<double> (); \
+ if (!ok) { result = pass; break; } \
+}
+
+int main (void)
+{
+ int result = 0;
+
+ #pragma omp target map (tofrom: result)
+ do {
+ int pass = 0;
+
+ RUN_TEST (basic);
+ RUN_TEST (exp);
+ RUN_TEST (power);
+ RUN_TEST (trig);
+ RUN_TEST (hyperbolic);
+ RUN_TEST (erf);
+ RUN_TEST (gamma);
+ RUN_TEST (rounding);
+ RUN_TEST (fpmanip);
+ RUN_TEST (classify);
+ RUN_TEST (compare);
+ } while (false);
+
+ return result;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__complex.C b/libgomp/testsuite/libgomp.c++/target-std__complex.C
new file mode 100644
index 0000000..e392d17
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__complex.C
@@ -0,0 +1,175 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++20" }
+
+#include <cmath>
+#include <complex>
+#include <numbers>
+
+using namespace std::complex_literals;
+
+#define FP_EQUAL(x,y) (std::abs ((x) - (y)) < 1E-6)
+#define COMPLEX_EQUAL(x,y) (FP_EQUAL ((x).real (), (y).real ()) \
+ && FP_EQUAL ((x).imag (), (y).imag ()))
+
+#pragma omp declare target
+template<typename T> bool test_complex ()
+{
+ std::complex<T> z (-1.334, 5.763);
+
+ if (!FP_EQUAL (z.real (), (T) -1.334))
+ return false;
+ if (!FP_EQUAL (z.imag (), (T) 5.763))
+ return false;
+ if (!FP_EQUAL (std::abs (z),
+ std::sqrt (z.real () * z.real () + z.imag () * z.imag ())))
+ return false;
+ if (!FP_EQUAL (std::arg (z), std::atan2 (z.imag (), z.real ())))
+ return false;
+ if (!FP_EQUAL (std::norm (z), z.real () * z.real () + z.imag () * z.imag ()))
+ return false;
+
+ auto conj = std::conj (z);
+ if (!FP_EQUAL (conj.real (), z.real ())
+ || !FP_EQUAL (conj.imag (), -z.imag ()))
+ return false;
+
+ if (std::proj (z) != z)
+ return false;
+
+ auto infz1 = std::proj (std::complex<float> (INFINITY, -1));
+ if (infz1.real () != INFINITY || infz1.imag () != (T) -0.0)
+ return false;
+ auto infz2 = std::proj (std::complex<float> (0, -INFINITY));
+ if (infz2.real () != INFINITY || infz2.imag () != (T) -0.0)
+ return false;
+
+ auto polarz = std::polar ((T) 1.5, std::numbers::pi_v<T> / 4);
+ if (!FP_EQUAL (polarz.real (), (T) 1.5 * std::cos (std::numbers::pi_v<T> / 4))
+ || !FP_EQUAL (polarz.imag (),
+ (T) 1.5* std::sin (std::numbers::pi_v<T> / 4)))
+ return false;
+
+ return true;
+}
+
+template<typename T> bool test_complex_exp_log ()
+{
+ std::complex<T> z (-1.724, -3.763);
+
+ // Euler's identity
+ auto eulerz = std::exp (std::complex<T> (0, std::numbers::pi));
+ eulerz += 1.0;
+ if (!COMPLEX_EQUAL (eulerz, std::complex<T> ()))
+ return false;
+
+ auto my_exp_z
+ = std::complex<T> (std::exp (z.real ()) * std::cos (z.imag ()),
+ std::exp (z.real ()) * std::sin (z.imag ()));
+ if (!COMPLEX_EQUAL (std::exp (z), my_exp_z))
+ return false;
+
+ if (!COMPLEX_EQUAL (std::log10 (z),
+ std::log (z) / std::log (std::complex<T> (10))))
+ return false;
+
+ return true;
+}
+
+template<typename T> bool test_complex_trig ()
+{
+ std::complex<T> z (std::numbers::pi / 8, std::numbers::pi / 10);
+ const std::complex<T> i (0, 1);
+
+ auto my_sin_z
+ = std::complex<T> (std::sin (z.real ()) * std::cosh (z.imag ()),
+ std::cos (z.real ()) * std::sinh (z.imag ()));
+ if (!COMPLEX_EQUAL (std::sin (z), my_sin_z))
+ return false;
+
+ auto my_cos_z
+ = std::complex<T> (std::cos (z.real ()) * std::cosh (z.imag ()),
+ -std::sin (z.real ()) * std::sinh (z.imag ()));
+ if (!COMPLEX_EQUAL (std::cos (z), my_cos_z))
+ return false;
+
+ auto my_tan_z
+ = std::complex<T> (std::sin (2*z.real ()), std::sinh (2*z.imag ()))
+ / (std::cos (2*z.real ()) + std::cosh (2*z.imag ()));
+ if (!COMPLEX_EQUAL (std::tan (z), my_tan_z))
+ return false;
+
+ auto my_sinh_z
+ = std::complex<T> (std::sinh (z.real ()) * std::cos (z.imag ()),
+ std::cosh (z.real ()) * std::sin (z.imag ()));
+ if (!COMPLEX_EQUAL (std::sinh (z), my_sinh_z))
+ return false;
+
+ auto my_cosh_z
+ = std::complex<T> (std::cosh (z.real ()) * std::cos (z.imag ()),
+ std::sinh (z.real ()) * std::sin (z.imag ()));
+ if (!COMPLEX_EQUAL (std::cosh (z), my_cosh_z))
+ return false;
+
+ auto my_tanh_z
+ = std::complex<T> (std::sinh (2*z.real ()),
+ std::sin (2*z.imag ()))
+ / (std::cosh (2*z.real ()) + std::cos (2*z.imag ()));
+ if (!COMPLEX_EQUAL (std::tanh (z), my_tanh_z))
+ return false;
+
+ auto my_asin_z = -i * std::log (i * z + std::sqrt ((T) 1.0 - z*z));
+ if (!COMPLEX_EQUAL (std::asin (z), my_asin_z))
+ return false;
+
+ auto my_acos_z
+ = std::complex<T> (std::numbers::pi / 2)
+ + i * std::log (i * z + std::sqrt ((T) 1.0 - z*z));
+ if (!COMPLEX_EQUAL (std::acos (z), my_acos_z))
+ return false;
+
+ auto my_atan_z = std::complex<T> (0, -0.5) * (std::log ((i - z) / (i + z)));
+ if (!COMPLEX_EQUAL (std::atan (z), my_atan_z))
+ return false;
+
+ auto my_asinh_z = std::log (z + std::sqrt (z*z + (T) 1.0));
+ if (!COMPLEX_EQUAL (std::asinh (z), my_asinh_z))
+ return false;
+
+ auto my_acosh_z = std::log (z + std::sqrt (z*z - (T) 1.0));
+ if (!COMPLEX_EQUAL (std::acosh (z), my_acosh_z))
+ return false;
+
+ auto my_atanh_z
+ = std::complex<T> (0.5) * (std::log ((T) 1.0 + z) - std::log ((T) 1.0 - z));
+ if (!COMPLEX_EQUAL (std::atanh (z), my_atanh_z))
+ return false;
+
+ return true;
+}
+#pragma omp end declare target
+
+#define RUN_TEST(func) \
+{ \
+ pass++; \
+ bool ok = test_##func<float> (); \
+ if (!ok) { result = pass; break; } \
+ pass++; \
+ ok = test_##func<double> (); \
+ if (!ok) { result = pass; break; } \
+}
+
+int main (void)
+{
+ int result = 0;
+
+ #pragma omp target map (tofrom: result)
+ do {
+ int pass = 0;
+
+ RUN_TEST (complex);
+ RUN_TEST (complex_exp_log);
+ RUN_TEST (complex_trig);
+ } while (false);
+
+ return result;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C
new file mode 100644
index 0000000..863a1de
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__deque-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C
new file mode 100644
index 0000000..9c2d6fa
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C
@@ -0,0 +1,64 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <deque>
+#include <algorithm>
+
+#define N 50000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand ();
+}
+
+#pragma omp declare target
+bool validate (const std::deque<int> &_deque, int data[])
+{
+ for (int i = 0; i < N; ++i)
+ if (_deque[i] != data[i] * data[i])
+ return false;
+ return true;
+}
+#pragma omp end declare target
+
+int main (void)
+{
+ int data[N];
+ bool ok;
+
+ srand (time (NULL));
+ init (data);
+
+#ifdef MEM_SHARED
+ std::deque<int> _deque (std::begin (data), std::end (data));
+#else
+ std::deque<int> _deque;
+#endif
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: _deque)
+#endif
+ {
+#ifndef MEM_SHARED
+ #pragma omp target
+ new (&_deque) std::deque<int> (std::begin (data), std::end (data));
+#endif
+
+ #pragma omp target teams distribute parallel for
+ for (int i = 0; i < N; ++i)
+ _deque[i] *= _deque[i];
+
+ #pragma omp target map (from: ok)
+ {
+ ok = validate (_deque, data);
+#ifndef MEM_SHARED
+ _deque.~deque ();
+#endif
+ }
+ }
+
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__flat_map-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__flat_map-concurrent.C
new file mode 100644
index 0000000..9e59907
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__flat_map-concurrent.C
@@ -0,0 +1,71 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++23" }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+/* { dg-ice {TODO PR120450} { offload_target_amdgcn && { ! offload_device_shared_as } } }
+ { dg-excess-errors {'mkoffload' failure etc.} { xfail { offload_target_amdgcn && { ! offload_device_shared_as } } } }
+ (For effective-target 'offload_device_shared_as', we've got '-DMEM_SHARED', and therefore don't invoke the constructor with placement new.) */
+
+#include <stdlib.h>
+#include <time.h>
+#include <set>
+#include <flat_map>
+
+#define N 3000
+
+void init (int data[], bool unique)
+{
+ std::set<int> _set;
+ for (int i = 0; i < N; ++i)
+ {
+ // Avoid duplicates in data array if unique is true.
+ do
+ data[i] = rand ();
+ while (unique && _set.count (data[i]) > 0);
+ _set.insert (data[i]);
+ }
+}
+
+bool validate (long long sum, int keys[], int data[])
+{
+ long long total = 0;
+ for (int i = 0; i < N; ++i)
+ total += (long long) keys[i] * data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int keys[N], data[N];
+ std::flat_map<int,int> _map;
+
+ srand (time (NULL));
+ init (keys, true);
+ init (data, false);
+
+ #pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_map) std::flat_map<int,int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _map[keys[i]] = data[i];
+ }
+
+ long long sum = 0;
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < N; ++i)
+ sum += (long long) keys[i] * _map[keys[i]];
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _map.~flat_map ();
+#endif
+
+ #pragma omp target exit data map (release: _map)
+
+ bool ok = validate (sum, keys, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C
new file mode 100644
index 0000000..1dc60c8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__flat_multimap-concurrent.C
@@ -0,0 +1,70 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++23" }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+/* { dg-ice {TODO PR120450} { offload_target_amdgcn && { ! offload_device_shared_as } } }
+ { dg-excess-errors {'mkoffload' failure etc.} { xfail { offload_target_amdgcn && { ! offload_device_shared_as } } } }
+ (For effective-target 'offload_device_shared_as', we've got '-DMEM_SHARED', and therefore don't invoke the constructor with placement new.) */
+
+#include <stdlib.h>
+#include <time.h>
+#include <flat_map>
+
+// Make sure that KEY_MAX is less than N to ensure some duplicate keys.
+#define N 3000
+#define KEY_MAX 1000
+
+void init (int data[], int max)
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = i % max;
+}
+
+bool validate (long long sum, int keys[], int data[])
+{
+ long long total = 0;
+ for (int i = 0; i < N; ++i)
+ total += (long long) keys[i] * data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int keys[N], data[N];
+ std::flat_multimap<int,int> _map;
+
+ srand (time (NULL));
+ init (keys, KEY_MAX);
+ init (data, RAND_MAX);
+
+ #pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_map) std::flat_multimap<int,int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _map.insert({keys[i], data[i]});
+ }
+
+ long long sum = 0;
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < KEY_MAX; ++i)
+ {
+ auto range = _map.equal_range (i);
+ for (auto it = range.first; it != range.second; ++it) {
+ sum += (long long) it->first * it->second;
+ }
+ }
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _map.~flat_multimap ();
+#endif
+
+ #pragma omp target exit data map (release: _map)
+
+ bool ok = validate (sum, keys, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C
new file mode 100644
index 0000000..59b59bf
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__flat_multiset-concurrent.C
@@ -0,0 +1,60 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++23" }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <flat_set>
+#include <algorithm>
+
+// MAX should be less than N to ensure that some duplicates occur.
+#define N 4000
+#define MAX 1000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand () % MAX;
+}
+
+bool validate (int sum, int data[])
+{
+ int total = 0;
+ for (int i = 0; i < N; ++i)
+ total += data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int data[N];
+ std::flat_multiset<int> set;
+ int sum = 0;
+
+ srand (time (NULL));
+ init (data);
+
+ #pragma omp target data map (to: data[:N]) map (alloc: set)
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&set) std::flat_multiset<int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ set.insert (data[i]);
+ }
+
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < MAX; ++i)
+ sum += i * set.count (i);
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ set.~flat_multiset ();
+#endif
+ }
+
+ bool ok = validate (sum, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__flat_set-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__flat_set-concurrent.C
new file mode 100644
index 0000000..b255cd5
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__flat_set-concurrent.C
@@ -0,0 +1,67 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++23" }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <flat_set>
+#include <algorithm>
+
+#define N 4000
+#define MAX 16384
+
+void init (int data[])
+{
+ std::flat_set<int> _set;
+ for (int i = 0; i < N; ++i)
+ {
+ // Avoid duplicates in data array.
+ do
+ data[i] = rand () % MAX;
+ while (_set.count (data[i]) != 0);
+ _set.insert (data[i]);
+ }
+}
+
+bool validate (int sum, int data[])
+{
+ int total = 0;
+ for (int i = 0; i < N; ++i)
+ total += data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int data[N];
+ std::flat_set<int> _set;
+ int sum = 0;
+
+ srand (time (NULL));
+ init (data);
+
+ #pragma omp target data map (to: data[:N]) map (alloc: _set)
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_set) std::flat_set<int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _set.insert (data[i]);
+ }
+
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < MAX; ++i)
+ if (_set.count (i) > 0)
+ sum += i;
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _set.~flat_set ();
+#endif
+ }
+
+ bool ok = validate (sum, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C
new file mode 100644
index 0000000..60d5cee
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__forward_list-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C
new file mode 100644
index 0000000..6b0ee65
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C
@@ -0,0 +1,83 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <omp.h>
+#include <forward_list>
+#include <algorithm>
+
+#define N 3000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand ();
+}
+
+#pragma omp declare target
+bool validate (const std::forward_list<int> &list, int data[])
+{
+ int i = 0;
+ for (auto &v : list)
+ {
+ if (v != data[i] * data[i])
+ return false;
+ ++i;
+ }
+ return true;
+}
+#pragma omp end declare target
+
+int main (void)
+{
+ int data[N];
+ bool ok;
+
+ srand (time (NULL));
+ init (data);
+
+#ifdef MEM_SHARED
+ std::forward_list<int> list (std::begin (data), std::end (data));
+#else
+ std::forward_list<int> list;
+#endif
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: list)
+#endif
+ {
+#ifndef MEM_SHARED
+ #pragma omp target
+ new (&list) std::forward_list<int> (std::begin (data), std::end (data));
+#endif
+
+ #pragma omp target teams
+ do
+ {
+ int len = N / omp_get_num_teams () + (N % omp_get_num_teams () > 0);
+ int start = len * omp_get_team_num ();
+ if (start >= N)
+ break;
+ if (start + len >= N)
+ len = N - start;
+ auto it = list.begin ();
+ std::advance (it, start);
+ for (int i = 0; i < len; ++i)
+ {
+ *it *= *it;
+ ++it;
+ }
+ } while (false);
+
+ #pragma omp target map (from: ok)
+ {
+ ok = validate (list, data);
+#ifndef MEM_SHARED
+ list.~forward_list ();
+#endif
+ }
+ }
+
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C
new file mode 100644
index 0000000..5057bf9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__list-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C
new file mode 100644
index 0000000..1f44a17
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C
@@ -0,0 +1,83 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <omp.h>
+#include <list>
+#include <algorithm>
+
+#define N 3000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand ();
+}
+
+#pragma omp declare target
+bool validate (const std::list<int> &_list, int data[])
+{
+ int i = 0;
+ for (auto &v : _list)
+ {
+ if (v != data[i] * data[i])
+ return false;
+ ++i;
+ }
+ return true;
+}
+#pragma omp end declare target
+
+int main (void)
+{
+ int data[N];
+ bool ok;
+
+ srand (time (NULL));
+ init (data);
+
+#ifdef MEM_SHARED
+ std::list<int> _list (std::begin (data), std::end (data));
+#else
+ std::list<int> _list;
+#endif
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: _list)
+#endif
+ {
+#ifndef MEM_SHARED
+ #pragma omp target
+ new (&_list) std::list<int> (std::begin (data), std::end (data));
+#endif
+
+ #pragma omp target teams
+ do
+ {
+ int len = N / omp_get_num_teams () + (N % omp_get_num_teams () > 0);
+ int start = len * omp_get_team_num ();
+ if (start >= N)
+ break;
+ if (start + len >= N)
+ len = N - start;
+ auto it = _list.begin ();
+ std::advance (it, start);
+ for (int i = 0; i < len; ++i)
+ {
+ *it *= *it;
+ ++it;
+ }
+ } while (false);
+
+ #pragma omp target map (from: ok)
+ {
+ ok = validate (_list, data);
+#ifndef MEM_SHARED
+ _list.~list ();
+#endif
+ }
+ }
+
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C
new file mode 100644
index 0000000..fe37426
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__map-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C
new file mode 100644
index 0000000..36556ef
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C
@@ -0,0 +1,70 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <set>
+#include <map>
+
+#define N 3000
+
+void init (int data[], bool unique)
+{
+ std::set<int> _set;
+ for (int i = 0; i < N; ++i)
+ {
+ // Avoid duplicates in data array if unique is true.
+ do
+ data[i] = rand ();
+ while (unique && _set.find (data[i]) != _set.end ());
+ _set.insert (data[i]);
+ }
+}
+
+bool validate (long long sum, int keys[], int data[])
+{
+ long long total = 0;
+ for (int i = 0; i < N; ++i)
+ total += (long long) keys[i] * data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int keys[N], data[N];
+ std::map<int,int> _map;
+
+ srand (time (NULL));
+ init (keys, true);
+ init (data, false);
+
+#ifndef MEM_SHARED
+ #pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+#endif
+
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_map) std::map<int,int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _map[keys[i]] = data[i];
+ }
+
+ long long sum = 0;
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < N; ++i)
+ sum += (long long) keys[i] * _map[keys[i]];
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _map.~map ();
+#endif
+
+#ifndef MEM_SHARED
+ #pragma omp target exit data map (release: _map)
+#endif
+
+ bool ok = validate (sum, keys, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C
new file mode 100644
index 0000000..79f9245
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__multimap-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C
new file mode 100644
index 0000000..6a4a4e8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C
@@ -0,0 +1,68 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <map>
+
+// Make sure that KEY_MAX is less than N to ensure some duplicate keys.
+#define N 3000
+#define KEY_MAX 1000
+
+void init (int data[], int max)
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand () % max;
+}
+
+bool validate (long long sum, int keys[], int data[])
+{
+ long long total = 0;
+ for (int i = 0; i < N; ++i)
+ total += (long long) keys[i] * data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int keys[N], data[N];
+ std::multimap<int,int> _map;
+
+ srand (time (NULL));
+ init (keys, KEY_MAX);
+ init (data, RAND_MAX);
+
+#ifndef MEM_SHARED
+ #pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+#endif
+
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_map) std::multimap<int,int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _map.insert({keys[i], data[i]});
+ }
+
+ long long sum = 0;
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < KEY_MAX; ++i)
+ {
+ auto range = _map.equal_range (i);
+ for (auto it = range.first; it != range.second; ++it)
+ sum += (long long) it->first * it->second;
+ }
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _map.~multimap ();
+#endif
+
+#ifndef MEM_SHARED
+ #pragma omp target exit data map (release: _map)
+#endif
+
+ bool ok = validate (sum, keys, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C
new file mode 100644
index 0000000..2d80756
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__multiset-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C
new file mode 100644
index 0000000..b12402e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C
@@ -0,0 +1,62 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <set>
+#include <algorithm>
+
+// MAX should be less than N to ensure that some duplicates occur.
+#define N 4000
+#define MAX 1000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand () % MAX;
+}
+
+bool validate (int sum, int data[])
+{
+ int total = 0;
+ for (int i = 0; i < N; ++i)
+ total += data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int data[N];
+ std::multiset<int> set;
+ int sum = 0;
+
+ srand (time (NULL));
+ init (data);
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: set)
+#endif
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&set) std::multiset<int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ set.insert (data[i]);
+ }
+
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < MAX; ++i)
+ sum += i * set.count (i);
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ set.~multiset ();
+#endif
+ }
+
+ bool ok = validate (sum, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__numbers.C b/libgomp/testsuite/libgomp.c++/target-std__numbers.C
new file mode 100644
index 0000000..a6b3665
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__numbers.C
@@ -0,0 +1,93 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++20" }
+
+#include <cmath>
+#include <numbers>
+
+#define FP_EQUAL(x,y) (std::abs ((x) - (y)) < 1E-6)
+
+#pragma omp declare target
+template<typename T> bool test_pi ()
+{
+ if (!FP_EQUAL (std::sin (std::numbers::pi_v<T>), (T) 0.0))
+ return false;
+ if (!FP_EQUAL (std::cos (std::numbers::pi_v<T>), (T) -1.0))
+ return false;
+ if (!FP_EQUAL (std::numbers::pi_v<T> * std::numbers::inv_pi_v<T>, (T) 1.0))
+ return false;
+ if (!FP_EQUAL (std::numbers::pi_v<T> * std::numbers::inv_sqrtpi_v<T>
+ * std::numbers::inv_sqrtpi_v<T>, (T) 1.0))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_sqrt ()
+{
+ if (!FP_EQUAL (std::numbers::sqrt2_v<T> * std::numbers::sqrt2_v<T>, (T) 2.0))
+ return false;
+ if (!FP_EQUAL (std::numbers::sqrt3_v<T> * std::numbers::sqrt3_v<T>, (T) 3.0))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_phi ()
+{
+ T myphi = ((T) 1.0 + std::sqrt ((T) 5.0)) / (T) 2.0;
+ if (!FP_EQUAL (myphi, std::numbers::phi_v<T>))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_log ()
+{
+ if (!FP_EQUAL (std::log ((T) 2.0), std::numbers::ln2_v<T>))
+ return false;
+ if (!FP_EQUAL (std::log ((T) 10.0), std::numbers::ln10_v<T>))
+ return false;
+ if (!FP_EQUAL (std::log2 ((T) std::numbers::e), std::numbers::log2e_v<T>))
+ return false;
+ if (!FP_EQUAL (std::log10 ((T) std::numbers::e), std::numbers::log10e_v<T>))
+ return false;
+ return true;
+}
+
+template<typename T> bool test_egamma ()
+{
+ T myegamma = 0.0;
+ #pragma omp parallel for reduction(+:myegamma)
+ for (int k = 2; k < 100000; ++k)
+ myegamma += (std::riemann_zeta (k) - 1) / k;
+ myegamma = (T) 1 - myegamma;
+ if (!FP_EQUAL (myegamma, std::numbers::egamma_v<T>))
+ return false;
+ return true;
+}
+#pragma omp end declare target
+
+#define RUN_TEST(func) \
+{ \
+ pass++; \
+ bool ok = test_##func<float> (); \
+ if (!ok) { result = pass; break; } \
+ pass++; \
+ ok = test_##func<double> (); \
+ if (!ok) { result = pass; break; } \
+}
+
+int main (void)
+{
+ int result = 0;
+
+ #pragma omp target map (tofrom: result)
+ do {
+ int pass = 0;
+
+ RUN_TEST (pi);
+ RUN_TEST (sqrt);
+ RUN_TEST (phi);
+ RUN_TEST (log);
+ RUN_TEST (egamma);
+ } while (false);
+
+ return result;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C
new file mode 100644
index 0000000..54f62e3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__set-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C
new file mode 100644
index 0000000..cd23128
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C
@@ -0,0 +1,68 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <set>
+#include <algorithm>
+
+#define N 4000
+#define MAX 16384
+
+void init (int data[])
+{
+ std::set<int> _set;
+ for (int i = 0; i < N; ++i)
+ {
+ // Avoid duplicates in data array.
+ do
+ data[i] = rand () % MAX;
+ while (_set.find (data[i]) != _set.end ());
+ _set.insert (data[i]);
+ }
+}
+
+bool validate (int sum, int data[])
+{
+ int total = 0;
+ for (int i = 0; i < N; ++i)
+ total += data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int data[N];
+ std::set<int> _set;
+ int sum = 0;
+
+ srand (time (NULL));
+ init (data);
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: _set)
+#endif
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_set) std::set<int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _set.insert (data[i]);
+ }
+
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < MAX; ++i)
+ if (_set.find (i) != _set.end ())
+ sum += i;
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _set.~set ();
+#endif
+ }
+
+ bool ok = validate (sum, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C
new file mode 100644
index 0000000..7ef16bf
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C
@@ -0,0 +1,7 @@
+// { dg-additional-options "-std=c++20" }
+
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__span-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C
new file mode 100644
index 0000000..046b3c1
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C
@@ -0,0 +1,66 @@
+// { dg-do run }
+// { dg-additional-options "-std=c++20" }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <span>
+
+#define N 64
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand ();
+}
+
+#pragma omp declare target
+bool validate (const std::span<int, N> &span, int data[])
+{
+ for (int i = 0; i < N; ++i)
+ if (span[i] != data[i] * data[i])
+ return false;
+ return true;
+}
+#pragma omp end declare target
+
+int main (void)
+{
+ int data[N];
+ bool ok;
+ int elements[N];
+ std::span<int, N> span(elements);
+
+ srand (time (NULL));
+ init (data);
+
+#ifndef MEM_SHARED
+ #pragma omp target enter data map (to: data[:N]) map (alloc: elements, span)
+#endif
+
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&span) std::span<int, N> (elements);
+#endif
+ std::copy (data, data + N, span.begin ());
+ }
+
+ #pragma omp target teams distribute parallel for
+ for (int i = 0; i < N; ++i)
+ span[i] *= span[i];
+
+ #pragma omp target map (from: ok)
+ {
+ ok = validate (span, data);
+#ifndef MEM_SHARED
+ span.~span ();
+#endif
+ }
+
+#ifndef MEM_SHARED
+ #pragma omp target exit data map (release: elements, span)
+#endif
+
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent.C
new file mode 100644
index 0000000..00d7943
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent.C
@@ -0,0 +1,66 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <set>
+#include <unordered_map>
+
+#define N 3000
+
+void init (int data[], bool unique)
+{
+ std::set<int> _set;
+ for (int i = 0; i < N; ++i)
+ {
+ // Avoid duplicates in data array if unique is true.
+ do
+ data[i] = rand ();
+ while (unique && _set.count (data[i]) > 0);
+ _set.insert (data[i]);
+ }
+}
+
+bool validate (long long sum, int keys[], int data[])
+{
+ long long total = 0;
+ for (int i = 0; i < N; ++i)
+ total += (long long) keys[i] * data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int keys[N], data[N];
+ std::unordered_map<int,int> _map;
+
+ srand (time (NULL));
+ init (keys, true);
+ init (data, false);
+
+ #pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_map) std::unordered_map<int,int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _map[keys[i]] = data[i];
+ }
+
+ long long sum = 0;
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < N; ++i)
+ sum += (long long) keys[i] * _map[keys[i]];
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _map.~unordered_map ();
+#endif
+
+ #pragma omp target exit data map (release: _map)
+
+ bool ok = validate (sum, keys, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C
new file mode 100644
index 0000000..2567634
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C
@@ -0,0 +1,65 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <unordered_map>
+
+// Make sure that KEY_MAX is less than N to ensure some duplicate keys.
+#define N 3000
+#define KEY_MAX 1000
+
+void init (int data[], int max)
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = i % max;
+}
+
+bool validate (long long sum, int keys[], int data[])
+{
+ long long total = 0;
+ for (int i = 0; i < N; ++i)
+ total += (long long) keys[i] * data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int keys[N], data[N];
+ std::unordered_multimap<int,int> _map;
+
+ srand (time (NULL));
+ init (keys, KEY_MAX);
+ init (data, RAND_MAX);
+
+ #pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_map) std::unordered_multimap<int,int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _map.insert({keys[i], data[i]});
+ }
+
+ long long sum = 0;
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < KEY_MAX; ++i)
+ {
+ auto range = _map.equal_range (i);
+ for (auto it = range.first; it != range.second; ++it) {
+ sum += (long long) it->first * it->second;
+ }
+ }
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _map.~unordered_multimap ();
+#endif
+
+ #pragma omp target exit data map (release: _map)
+
+ bool ok = validate (sum, keys, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C
new file mode 100644
index 0000000..da6c875
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C
@@ -0,0 +1,59 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <unordered_set>
+#include <algorithm>
+
+// MAX should be less than N to ensure that some duplicates occur.
+#define N 4000
+#define MAX 1000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand () % MAX;
+}
+
+bool validate (int sum, int data[])
+{
+ int total = 0;
+ for (int i = 0; i < N; ++i)
+ total += data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int data[N];
+ std::unordered_multiset<int> set;
+ int sum = 0;
+
+ srand (time (NULL));
+ init (data);
+
+ #pragma omp target data map (to: data[:N]) map (alloc: set)
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&set) std::unordered_multiset<int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ set.insert (data[i]);
+ }
+
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < MAX; ++i)
+ sum += i * set.count (i);
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ set.~unordered_multiset ();
+#endif
+ }
+
+ bool ok = validate (sum, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent.C
new file mode 100644
index 0000000..b7bd935
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent.C
@@ -0,0 +1,66 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <unordered_set>
+#include <algorithm>
+
+#define N 4000
+#define MAX 16384
+
+void init (int data[])
+{
+ std::unordered_set<int> _set;
+ for (int i = 0; i < N; ++i)
+ {
+ // Avoid duplicates in data array.
+ do
+ data[i] = rand () % MAX;
+ while (_set.count (data[i]) != 0);
+ _set.insert (data[i]);
+ }
+}
+
+bool validate (int sum, int data[])
+{
+ int total = 0;
+ for (int i = 0; i < N; ++i)
+ total += data[i];
+ return sum == total;
+}
+
+int main (void)
+{
+ int data[N];
+ std::unordered_set<int> _set;
+ int sum = 0;
+
+ srand (time (NULL));
+ init (data);
+
+ #pragma omp target data map (to: data[:N]) map (alloc: _set)
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&_set) std::unordered_set<int> ();
+#endif
+ for (int i = 0; i < N; ++i)
+ _set.insert (data[i]);
+ }
+
+ #pragma omp target teams distribute parallel for reduction (+:sum)
+ for (int i = 0; i < MAX; ++i)
+ if (_set.count (i) > 0)
+ sum += i;
+
+#ifndef MEM_SHARED
+ #pragma omp target
+ _set.~unordered_set ();
+#endif
+ }
+
+ bool ok = validate (sum, data);
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__valarray-1.C b/libgomp/testsuite/libgomp.c++/target-std__valarray-1.C
new file mode 100644
index 0000000..865cde2
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__valarray-1.C
@@ -0,0 +1,179 @@
+// { dg-additional-options -std=c++20 }
+// { dg-output-file target-std__valarray-1.output }
+
+#include <valarray>
+#include <ostream>
+#include <sstream>
+
+
+/*TODO Work around PR118484 "ICE during IPA pass: cp, segfault in determine_versionability ipa-cp.cc:467".
+
+We can't:
+
+ #pragma omp declare target(std::basic_streambuf<char, std::char_traits<char>>::basic_streambuf)
+
+... because:
+
+ error: overloaded function name ‘std::basic_streambuf<char>::__ct ’ in clause ‘enter’
+
+Therefore, use dummy classes in '#pragma omp declare target':
+*/
+
+#pragma omp declare target
+
+// For 'std::basic_streambuf<char, std::char_traits<char> >::basic_streambuf':
+
+class dummy_basic_streambuf__char
+ : public std::basic_streambuf<char>
+{
+public:
+ dummy_basic_streambuf__char() {}
+};
+
+// For 'std::basic_ios<char, std::char_traits<char> >::basic_ios()':
+
+class dummy_basic_ios__char
+ : public std::basic_ios<char>
+{
+public:
+ dummy_basic_ios__char() {}
+};
+
+#pragma omp end declare target
+
+
+int main()
+{
+ // Due to PR120021 "Offloading vs. C++ 'std::initializer_list'", we can't construct these on the device.
+ std::initializer_list<int> v1_i = {10, 20, 30, 40, 50};
+ const int *v1_i_data = std::data(v1_i);
+ size_t v1_i_size = v1_i.size();
+ std::initializer_list<int> v2_i = {5, 4, 3, 2, 1};
+ const int *v2_i_data = std::data(v2_i);
+ size_t v2_i_size = v2_i.size();
+ std::initializer_list<int> shiftData_i = {1, 2, 3, 4, 5};
+ const int *shiftData_i_data = std::data(shiftData_i);
+ size_t shiftData_i_size = shiftData_i.size();
+#pragma omp target \
+ defaultmap(none) \
+ map(to: v1_i_data[:v1_i_size], v1_i_size, \
+ v2_i_data[:v2_i_size], v2_i_size, \
+ shiftData_i_data[:shiftData_i_size], shiftData_i_size)
+ {
+ /* Manually set up a buffer we can stream into, similar to 'cout << [...]', and print it at the end of region. */
+ std::stringbuf out_b;
+ std::ostream out(&out_b);
+
+ std::valarray<int> v1(v1_i_data, v1_i_size);
+ out << "\nv1:";
+ for (auto val : v1)
+ out << " " << val;
+
+ std::valarray<int> v2(v2_i_data, v2_i_size);
+ out << "\nv2:";
+ for (auto val : v2)
+ out << " " << val;
+
+ std::valarray<int> sum = v1 + v2;
+ out << "\nv1 + v2:";
+ for (auto val : sum)
+ out << " " << val;
+
+ std::valarray<int> diff = v1 - v2;
+ out << "\nv1 - v2:";
+ for (auto val : diff)
+ out << " " << val;
+
+ std::valarray<int> product = v1 * v2;
+ out << "\nv1 * v2:";
+ for (auto val : product)
+ out << " " << val;
+
+ std::valarray<int> quotient = v1 / v2;
+ out << "\nv1 / v2:";
+ for (auto val : quotient)
+ out << " " << val;
+
+ std::valarray<int> squares = pow(v1, 2);
+ out << "\npow(v1, 2):";
+ for (auto val : squares)
+ out << " " << val;
+
+ std::valarray<int> sinhs = sinh(v2);
+ out << "\nsinh(v2):";
+ for (auto val : sinhs)
+ out << " " << val;
+
+ std::valarray<int> logs = log(v1 * v2);
+ out << "\nlog(v1 * v2):";
+ for (auto val : logs)
+ out << " " << val;
+
+ std::valarray<int> data(12);
+ for (size_t i = 0; i < data.size(); ++i)
+ data[i] = i;
+ out << "\nOriginal array:";
+ for (auto val : data)
+ out << " " << val;
+
+ std::slice slice1(2, 5, 1);
+ std::valarray<int> sliced1 = data[slice1];
+ out << "\nSlice(2, 5, 1):";
+ for (auto val : sliced1)
+ out << " " << val;
+
+ std::slice slice2(1, 4, 3);
+ std::valarray<int> sliced2 = data[slice2];
+ out << "\nSlice(1, 4, 3):";
+ for (auto val : sliced2)
+ out << " " << val;
+
+ data[slice1] = 99;
+ out << "\nArray after slice modification:";
+ for (auto val : data)
+ out << " " << val;
+
+ std::valarray<bool> mask = (v1 > 20);
+ out << "\nElements of v1 > 20:";
+ for (size_t i = 0; i < v1.size(); ++i)
+ {
+ if (mask[i])
+ out << " " << v1[i];
+ }
+
+ std::valarray<int> masked = v1[mask];
+ out << "\nMasked array:";
+ for (auto val : masked)
+ out << " " << val;
+
+ std::valarray<int> shiftData(shiftData_i_data, shiftData_i_size);
+ out << "\nOriginal shiftData:";
+ for (auto val : shiftData)
+ out << " " << val;
+
+ std::valarray<int> shifted = shiftData.shift(2);
+ out << "\nshift(2):";
+ for (auto val : shifted)
+ out << " " << val;
+
+ std::valarray<int> cshifted = shiftData.cshift(-1);
+ out << "\ncshift(-1):";
+ for (auto val : cshifted)
+ out << " " << val;
+
+ out << "\nSum(v1): " << v1.sum();
+ out << "\nMin(v1): " << v1.min();
+ out << "\nMax(v1): " << v1.max();
+
+ out << "\n";
+
+ /* Terminate with a NUL. Otherwise, we'd have to use:
+ __builtin_printf("%.*s", (int) out_b_sv.size(), out_b_sv.data());
+ ... which nvptx 'printf', as implemented via PTX 'vprintf', doesn't support (TODO). */
+ out << '\0';
+ std::string_view out_b_sv = out_b.view();
+ __builtin_printf("%s", out_b_sv.data());
+ }
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__valarray-1.output b/libgomp/testsuite/libgomp.c++/target-std__valarray-1.output
new file mode 100644
index 0000000..c441e06
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__valarray-1.output
@@ -0,0 +1,22 @@
+
+v1: 10 20 30 40 50
+v2: 5 4 3 2 1
+v1 + v2: 15 24 33 42 51
+v1 - v2: 5 16 27 38 49
+v1 * v2: 50 80 90 80 50
+v1 / v2: 2 5 10 20 50
+pow(v1, 2): 100 400 900 1600 2500
+sinh(v2): 74 27 10 3 1
+log(v1 * v2): 3 4 4 4 3
+Original array: 0 1 2 3 4 5 6 7 8 9 10 11
+Slice(2, 5, 1): 2 3 4 5 6
+Slice(1, 4, 3): 1 4 7 10
+Array after slice modification: 0 1 99 99 99 99 99 7 8 9 10 11
+Elements of v1 > 20: 30 40 50
+Masked array: 30 40 50
+Original shiftData: 1 2 3 4 5
+shift(2): 3 4 5 0 0
+cshift(-1): 5 1 2 3 4
+Sum(v1): 150
+Min(v1): 10
+Max(v1): 50
diff --git a/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C
new file mode 100644
index 0000000..41ec80e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__valarray-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C
new file mode 100644
index 0000000..8933072b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C
@@ -0,0 +1,66 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <valarray>
+
+#define N 50000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand ();
+}
+
+#pragma omp declare target
+bool validate (const std::valarray<int> &arr, int data[])
+{
+ for (int i = 0; i < N; ++i)
+ if (arr[i] != data[i] * data[i] + i)
+ return false;
+ return true;
+}
+#pragma omp end declare target
+
+int main (void)
+{
+ int data[N];
+ bool ok;
+
+ srand (time (NULL));
+ init (data);
+
+#ifdef MEM_SHARED
+ std::valarray<int> arr (data, N);
+#else
+ std::valarray<int> arr;
+#endif
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: arr)
+#endif
+ {
+ #pragma omp target
+ {
+#ifndef MEM_SHARED
+ new (&arr) std::valarray<int> (data, N);
+#endif
+ arr *= arr;
+ }
+
+ #pragma omp target teams distribute parallel for
+ for (int i = 0; i < N; ++i)
+ arr[i] += i;
+
+ #pragma omp target map (from: ok)
+ {
+ ok = validate (arr, data);
+#ifndef MEM_SHARED
+ arr.~valarray ();
+#endif
+ }
+ }
+
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C
new file mode 100644
index 0000000..967bff3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__vector-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C
new file mode 100644
index 0000000..a94b4cf
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C
@@ -0,0 +1,63 @@
+// { dg-do run }
+// { dg-additional-options -DMEM_SHARED { target offload_device_shared_as } }
+
+#include <stdlib.h>
+#include <time.h>
+#include <vector>
+
+#define N 50000
+
+void init (int data[])
+{
+ for (int i = 0; i < N; ++i)
+ data[i] = rand ();
+}
+
+#pragma omp declare target
+bool validate (const std::vector<int> &vec, int data[])
+{
+ for (int i = 0; i < N; ++i)
+ if (vec[i] != data[i] * data[i])
+ return false;
+ return true;
+}
+#pragma omp end declare target
+
+int main (void)
+{
+ int data[N];
+ bool ok;
+
+ srand (time (NULL));
+ init (data);
+
+#ifdef MEM_SHARED
+ std::vector<int> vec (data, data + N);
+#else
+ std::vector<int> vec;
+#endif
+
+#ifndef MEM_SHARED
+ #pragma omp target data map (to: data[:N]) map (alloc: vec)
+#endif
+ {
+#ifndef MEM_SHARED
+ #pragma omp target
+ new (&vec) std::vector<int> (data, data + N);
+#endif
+
+ #pragma omp target teams distribute parallel for
+ for (int i = 0; i < N; ++i)
+ vec[i] *= vec[i];
+
+ #pragma omp target map (from: ok)
+ {
+ ok = validate (vec, data);
+#ifndef MEM_SHARED
+ vec.~vector ();
+#endif
+ }
+ }
+
+ return ok ? 0 : 1;
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/metadirective-1.c b/libgomp/testsuite/libgomp.c-c++-common/metadirective-1.c
index a57d6fd..fbe4ac3 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/metadirective-1.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/metadirective-1.c
@@ -1,4 +1,5 @@
-/* { dg-do run } */
+/* { dg-do run { target { ! offload_target_nvptx } } } */
+/* { dg-do compile { target offload_target_nvptx } } */
#define N 100
@@ -7,12 +8,17 @@ f (int x[], int y[], int z[])
{
int i;
+ // The following fails as on the host the target side cannot be
+ // resolved - and the 'teams' or not status affects how 'target'
+ // is called.
+ // Note also the dg-do compile above for offload_target_nvptx
#pragma omp target map(to: x[0:N], y[0:N]) map(from: z[0:N])
#pragma omp metadirective \
when (device={arch("nvptx")}: teams loop) \
default (parallel loop)
for (i = 0; i < N; i++)
z[i] = x[i] * y[i];
+ /* { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_target_nvptx } .-6 } */
}
int
diff --git a/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-2.c b/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-2.c
new file mode 100644
index 0000000..b36d2f5
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-2.c
@@ -0,0 +1,62 @@
+// PR libgomp/120444
+// Async version
+
+#include <omp.h>
+
+int main()
+{
+ #pragma omp parallel for
+ for (int dev = omp_initial_device; dev <= omp_get_num_devices (); dev++)
+ {
+ char *ptr = (char *) omp_target_alloc (sizeof(int) * 1024, dev);
+
+ omp_depend_t dep;
+ #pragma omp depobj(dep) depend(inout: ptr)
+
+ /* Play also around with the alignment - as hsa_amd_memory_fill operates
+ on multiples of 4 bytes (uint32_t). */
+
+ for (int start = 0; start < 32; start++)
+ for (int tail = 0; tail < 32; tail++)
+ {
+ unsigned char val = '0' + start + tail;
+#if __cplusplus
+ void *ptr2 = omp_target_memset_async (ptr + start, val,
+ 1024 - start - tail, dev, 0);
+#else
+ void *ptr2 = omp_target_memset_async (ptr + start, val,
+ 1024 - start - tail, dev, 0, nullptr);
+#endif
+ if (ptr + start != ptr2)
+ __builtin_abort ();
+
+ #pragma omp taskwait
+
+ #pragma omp target device(dev) is_device_ptr(ptr) depend(depobj: dep) nowait
+ for (int i = start; i < 1024 - start - tail; i++)
+ {
+ if (ptr[i] != val)
+ __builtin_abort ();
+ ptr[i] += 2;
+ }
+
+ omp_target_memset_async (ptr + start, val + 3,
+ 1024 - start - tail, dev, 1, &dep);
+
+ #pragma omp target device(dev) is_device_ptr(ptr) depend(depobj: dep) nowait
+ for (int i = start; i < 1024 - start - tail; i++)
+ {
+ if (ptr[i] != val + 3)
+ __builtin_abort ();
+ ptr[i] += 1;
+ }
+
+ omp_target_memset_async (ptr + start, val - 3,
+ 1024 - start - tail, dev, 1, &dep);
+
+ #pragma omp taskwait depend (depobj: dep)
+ }
+ #pragma omp depobj(dep) destroy
+ omp_target_free (ptr, dev);
+ }
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-3.c b/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-3.c
new file mode 100644
index 0000000..c0e4fa9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset-3.c
@@ -0,0 +1,80 @@
+#include <stddef.h>
+#include <stdint.h>
+#include <omp.h>
+
+#define MIN(x,y) ((x) < (y) ? x : y)
+
+enum { N = 524288 + 8 };
+
+static void
+init_val (int8_t *ptr, int val, size_t count)
+{
+ #pragma omp target is_device_ptr(ptr) firstprivate(val, count)
+ __builtin_memset (ptr, val, count);
+}
+
+static void
+check_val (int8_t *ptr, int val, size_t count)
+{
+ if (count == 0)
+ return;
+ #pragma omp target is_device_ptr(ptr) firstprivate(val, count)
+ for (size_t i = 0; i < count; i++)
+ if (ptr[i] != val) __builtin_abort ();
+}
+
+static void
+test_it (int8_t *ptr, int lshift, size_t count)
+{
+ if (N < count + lshift) __builtin_abort ();
+ if (lshift >= 4) __builtin_abort ();
+ ptr += lshift;
+
+ init_val (ptr, 'z', MIN (count + 32, N - lshift));
+
+ omp_target_memset (ptr, '1', count, omp_get_default_device());
+
+ check_val (ptr, '1', count);
+ check_val (ptr + count, 'z', MIN (32, N - lshift - count));
+}
+
+
+int main()
+{
+ size_t size;
+ int8_t *ptr = (int8_t *) omp_target_alloc (N + 3, omp_get_default_device());
+ ptr += (4 - (uintptr_t) ptr % 4) % 4;
+ if ((uintptr_t) ptr % 4 != 0) __builtin_abort ();
+
+ test_it (ptr, 0, 1);
+ test_it (ptr, 3, 1);
+ test_it (ptr, 0, 4);
+ test_it (ptr, 3, 4);
+ test_it (ptr, 0, 5);
+ test_it (ptr, 3, 5);
+ test_it (ptr, 0, 6);
+ test_it (ptr, 3, 6);
+
+ for (int i = 1; i <= 9; i++)
+ {
+ switch (i)
+ {
+ case 1: size = 16; break; // = 2^4 bytes
+ case 2: size = 32; break; // = 2^5 bytes
+ case 3: size = 64; break; // = 2^7 bytes
+ case 4: size = 128; break; // = 2^7 bytes
+ case 5: size = 256; break; // = 2^8 bytes
+ case 6: size = 512; break; // = 2^9 bytes
+ case 7: size = 65536; break; // = 2^16 bytes
+ case 8: size = 262144; break; // = 2^18 bytes
+ case 9: size = 524288; break; // = 2^20 bytes
+ default: __builtin_abort ();
+ }
+ test_it (ptr, 0, size);
+ test_it (ptr, 3, size);
+ test_it (ptr, 0, size + 1);
+ test_it (ptr, 3, size + 1);
+ test_it (ptr, 3, size + 2);
+ }
+ omp_target_free (ptr, omp_get_default_device());
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset.c b/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset.c
new file mode 100644
index 0000000..01909f8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/omp_target_memset.c
@@ -0,0 +1,62 @@
+// PR libgomp/120444
+
+#include <omp.h>
+
+int main()
+{
+ for (int dev = omp_initial_device; dev < omp_get_num_devices (); dev++)
+ {
+ char *ptr = (char *) omp_target_alloc (sizeof(int) * 1024, dev);
+
+ /* Play also around with the alignment - as hsa_amd_memory_fill operates
+ on multiples of 4 bytes (uint32_t). */
+
+ for (int start = 0; start < 32; start++)
+ for (int tail = 0; tail < 32; tail++)
+ {
+ unsigned char val = '0' + start + tail;
+ void *ptr2 = omp_target_memset (ptr + start, val,
+ 1024 - start - tail, dev);
+ if (ptr + start != ptr2)
+ __builtin_abort ();
+
+ #pragma omp target device(dev) is_device_ptr(ptr)
+ for (int i = start; i < 1024 - start - tail; i++)
+ if (ptr[i] != val)
+ __builtin_abort ();
+
+ }
+
+ /* Check 'small' values for correctness. */
+
+ for (int start = 0; start < 32; start++)
+ for (int size = 0; size <= 64 + 32; size++)
+ {
+ omp_target_memset (ptr, 'a' - 2, 1024, dev);
+
+ unsigned char val = '0' + start + size % 32;
+ void *ptr2 = omp_target_memset (ptr + start, val, size, dev);
+
+ if (ptr + start != ptr2)
+ __builtin_abort ();
+
+ if (size == 0)
+ continue;
+
+ #pragma omp target device(dev) is_device_ptr(ptr)
+ {
+ for (int i = 0; i < start; i++)
+ if (ptr[i] != 'a' - 2)
+ __builtin_abort ();
+ for (int i = start; i < start + size; i++)
+ if (ptr[i] != val)
+ __builtin_abort ();
+ for (int i = start + size + 1; i < 1024; i++)
+ if (ptr[i] != 'a' - 2)
+ __builtin_abort ();
+ }
+ }
+
+ omp_target_free (ptr, dev);
+ }
+}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c b/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c
new file mode 100644
index 0000000..9bf949a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c
@@ -0,0 +1,3 @@
+/* { dg-additional-options -O0 } */
+
+#include "target-abi-struct-1.c"
diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1.c b/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1.c
new file mode 100644
index 0000000..d9268af
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1.c
@@ -0,0 +1 @@
+#include "../libgomp.oacc-c-c++-common/abi-struct-1.c"
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c
new file mode 100644
index 0000000..d1df550
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c
@@ -0,0 +1,8 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx942 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx942 \\(\\);" "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4.h b/libgomp/testsuite/libgomp.c/declare-variant-4.h
index 53788d2..2257f4c 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4.h
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4.h
@@ -37,6 +37,13 @@ gfx90c (void)
__attribute__ ((noipa))
int
+gfx942 (void)
+{
+ return 0x942;
+}
+
+__attribute__ ((noipa))
+int
gfx1030 (void)
{
return 0x1030;
@@ -68,6 +75,7 @@ gfx1103 (void)
#pragma omp declare variant(gfx908) match(device = {isa("gfx908")})
#pragma omp declare variant(gfx90a) match(device = {isa("gfx90a")})
#pragma omp declare variant(gfx90c) match(device = {isa("gfx90c")})
+#pragma omp declare variant(gfx942) match(device = {isa("gfx942")})
#pragma omp declare variant(gfx1030) match(device = {isa("gfx1030")})
#pragma omp declare variant(gfx1036) match(device = {isa("gfx1036")})
#pragma omp declare variant(gfx1100) match(device = {isa("gfx1100")})
diff --git a/libgomp/testsuite/libgomp.c/interop-hsa.c b/libgomp/testsuite/libgomp.c/interop-hsa.c
index cf8bc90..21ac91c 100644
--- a/libgomp/testsuite/libgomp.c/interop-hsa.c
+++ b/libgomp/testsuite/libgomp.c/interop-hsa.c
@@ -1,5 +1,7 @@
/* { dg-additional-options "-ldl" } */
-/* { dg-require-effective-target offload_device_gcn } */
+/* { dg-require-effective-target offload_device_gcn }
+ The 'asm' insert is valid for GCN only:
+ { dg-additional-options -foffload=amdgcn-amdhsa } */
#include <stdio.h>
#include <stdlib.h>
diff --git a/libgomp/testsuite/libgomp.c/target-map-zero-sized-3.c b/libgomp/testsuite/libgomp.c/target-map-zero-sized-3.c
index f968bd3..580c6ad 100644
--- a/libgomp/testsuite/libgomp.c/target-map-zero-sized-3.c
+++ b/libgomp/testsuite/libgomp.c/target-map-zero-sized-3.c
@@ -1,7 +1,7 @@
int
main ()
{
- int i, n, n2;
+ int i, n;
int data[] = {1,2};
struct S {
int **ptrset;
@@ -33,16 +33,17 @@ main ()
i = 1;
n = 0;
- n2 = 2;
+ #pragma omp target enter data map(data)
#pragma omp target enter data map(sptr1[:1], sptr1->ptrset[:3], sptr1->ptrset2[:3])
#pragma omp target enter data map(sptr1->ptrset[i][:n], sptr1->ptrset2[i][:n])
- #pragma omp target
+ #pragma omp target map(sptr1->ptrset[i][:n], sptr1->ptrset2[i][:n])
if (sptr1->ptrset2[1][0] != 1 || sptr1->ptrset2[1][1] != 2)
__builtin_abort ();
#pragma omp target exit data map(sptr1->ptrset[i][:n], sptr1->ptrset2[i][:n])
#pragma omp target exit data map(sptr1[:1], sptr1->ptrset[:3], sptr1->ptrset2[:3])
+ #pragma omp target exit data map(data)
__builtin_free (s1.ptrset);
__builtin_free (s1.ptrset2);
diff --git a/libgomp/testsuite/libgomp.fortran/alloc-comp-4.f90 b/libgomp/testsuite/libgomp.fortran/alloc-comp-4.f90
new file mode 100644
index 0000000..d5e982b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/alloc-comp-4.f90
@@ -0,0 +1,75 @@
+!
+! Check that mapping with map(var%tiles(1)) works.
+!
+! This uses deep mapping to handle the allocatable
+! derived-type components
+!
+! The tricky part is that GCC generates intermittently
+! an SSA_NAME that needs to be resolved.
+!
+module m
+type t
+ integer, allocatable :: den1(:,:), den2(:,:)
+end type t
+
+type t2
+ type(t), allocatable :: tiles(:)
+end type t2
+end
+
+use m
+use iso_c_binding
+implicit none (type, external)
+type(t2), target :: var
+logical :: is_self_map
+type(C_ptr) :: pden1, pden2, ptiles, ptiles1
+
+allocate(var%tiles(1))
+var%tiles(1)%den1 = reshape([1,2,3,4],[2,2])
+var%tiles(1)%den2 = reshape([11,22,33,44],[2,2])
+
+ptiles = c_loc(var%tiles)
+ptiles1 = c_loc(var%tiles(1))
+pden1 = c_loc(var%tiles(1)%den1)
+pden2 = c_loc(var%tiles(1)%den2)
+
+
+is_self_map = .false.
+!$omp target map(to: is_self_map)
+ is_self_map = .true.
+!$omp end target
+
+!$omp target enter data map(var%tiles(1))
+
+!$omp target firstprivate(ptiles, ptiles1, pden1, pden2)
+ if (any (var%tiles(1)%den1 /= reshape([1,2,3,4],[2,2]))) stop 1
+ if (any (var%tiles(1)%den2 /= reshape([11,22,33,44],[2,2]))) stop 2
+ var%tiles(1)%den1 = var%tiles(1)%den1 + 5
+ var%tiles(1)%den2 = var%tiles(1)%den2 + 7
+
+ if (is_self_map) then
+ if (.not. c_associated (ptiles, c_loc(var%tiles))) stop 3
+ if (.not. c_associated (ptiles1, c_loc(var%tiles(1)))) stop 4
+ if (.not. c_associated (pden1, c_loc(var%tiles(1)%den1))) stop 5
+ if (.not. c_associated (pden2, c_loc(var%tiles(1)%den2))) stop 6
+ else
+ if (c_associated (ptiles, c_loc(var%tiles))) stop 3
+ if (c_associated (ptiles1, c_loc(var%tiles(1)))) stop 4
+ if (c_associated (pden1, c_loc(var%tiles(1)%den1))) stop 5
+ if (c_associated (pden2, c_loc(var%tiles(1)%den2))) stop 6
+ endif
+!$omp end target
+
+if (is_self_map) then
+ if (any (var%tiles(1)%den1 /= 5 + reshape([1,2,3,4],[2,2]))) stop 7
+ if (any (var%tiles(1)%den2 /= 7 + reshape([11,22,33,44],[2,2]))) stop 8
+else
+ if (any (var%tiles(1)%den1 /= reshape([1,2,3,4],[2,2]))) stop 7
+ if (any (var%tiles(1)%den2 /= reshape([11,22,33,44],[2,2]))) stop 8
+endif
+
+!$omp target exit data map(var%tiles(1))
+
+if (any (var%tiles(1)%den1 /= 5 + reshape([1,2,3,4],[2,2]))) stop 7
+if (any (var%tiles(1)%den2 /= 7 + reshape([11,22,33,44],[2,2]))) stop 8
+end
diff --git a/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9-usm.f90 b/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9-usm.f90
new file mode 100644
index 0000000..90378c0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9-usm.f90
@@ -0,0 +1,11 @@
+! { dg-additional-options "-cpp -DUSE_USM_REQUIREMENT=1 -Wno-openmp" }
+!
+! We silence the warning:
+! Mapping of polymorphic list item '...' is unspecified behavior [-Wopenmp]
+!
+! Ensure that polymorphic mapping is diagnosed as undefined behavior
+! Ensure that static access to polymorphic variables works
+
+! Run map-alloc-comp-9.f90 in unified-shared-memory mode
+
+#include "map-alloc-comp-9.f90"
diff --git a/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9.f90 b/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9.f90
index 3cec392..26c73d7 100644
--- a/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9.f90
+++ b/libgomp/testsuite/libgomp.fortran/map-alloc-comp-9.f90
@@ -1,8 +1,19 @@
+! { dg-additional-options "-cpp" }
+!
! Ensure that polymorphic mapping is diagnosed as undefined behavior
! Ensure that static access to polymorphic variables works
+! Some extended tests are only run with shared memory
+! To enforce this (where possible) on the device side:
+! #define USE_USM_REQUIREMENT
+! which is done in map-alloc-comp-9-usm.f90
+
subroutine test(case)
implicit none(type, external)
+#ifdef USE_USM_REQUIREMENT
+ !$omp requires unified_shared_memory
+#endif
+
type t
integer :: x(4)
end type t
@@ -73,10 +84,14 @@ var4%y2(2)%y%x%x = -7 * [1111,2222,3333,4444]
var4%y2(2)%y%x2(1)%x = -8 * [1111,2222,3333,4444]
var4%y2(2)%y%x2(2)%x = -9 * [1111,2222,3333,4444]
+#ifdef USE_USM_REQUIREMENT
+is_shared_mem = .true.
+#else
is_shared_mem = .false.
!$omp target map(to: is_shared_mem)
is_shared_mem = .true.
!$omp end target
+#endif
if (case == 1) then
! implicit mapping
@@ -532,6 +547,10 @@ end subroutine test
program main
use omp_lib
implicit none(type, external)
+#ifdef USE_USM_REQUIREMENT
+ !$omp requires unified_shared_memory
+#endif
+
interface
subroutine test(case)
integer, value :: case
diff --git a/libgomp/testsuite/libgomp.fortran/metadirective-1.f90 b/libgomp/testsuite/libgomp.fortran/metadirective-1.f90
index 7b3e09f..d6f4d5b 100644
--- a/libgomp/testsuite/libgomp.fortran/metadirective-1.f90
+++ b/libgomp/testsuite/libgomp.fortran/metadirective-1.f90
@@ -1,4 +1,5 @@
-! { dg-do run }
+! { dg-do run { target { ! offload_target_nvptx } } }
+! { dg-do compile { target offload_target_nvptx } }
program test
implicit none
@@ -33,6 +34,10 @@ program test
contains
subroutine f (x, y, z)
integer :: x(N), y(N), z(N)
+ ! The following fails as on the host the target side cannot be
+ ! resolved - and the 'teams' or not status affects how 'target'
+ ! is called. -> See PR118694, esp. comment 9.
+ ! Note also the dg-do compile above for offload_target_nvptx
!$omp target map (to: x, y) map(from: z)
block
@@ -43,6 +48,7 @@ contains
z(i) = x(i) * y(i)
enddo
end block
+ ! { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_target_nvptx } .-9 } */
end subroutine
subroutine g (x, y, z)
integer :: x(N), y(N), z(N)
@@ -56,6 +62,7 @@ contains
z(i) = x(i) * y(i)
enddo
end block
+ ! { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_target_nvptx } .-9 } */
!$omp end target
end subroutine
end program
diff --git a/libgomp/testsuite/libgomp.fortran/omp_target_memset-2.f90 b/libgomp/testsuite/libgomp.fortran/omp_target_memset-2.f90
new file mode 100644
index 0000000..2641086
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/omp_target_memset-2.f90
@@ -0,0 +1,67 @@
+! PR libgomp/120444
+! Async version
+
+use omp_lib
+use iso_c_binding
+implicit none (type, external)
+integer(c_int) :: dev
+
+!$omp parallel do
+do dev = omp_initial_device, omp_get_num_devices ()
+block
+ integer(c_int) :: i, val, start, tail
+ type(c_ptr) :: ptr, ptr2, tmpptr
+ integer(c_int8_t), pointer, contiguous :: fptr(:)
+ integer(c_intptr_t) :: intptr
+ integer(c_size_t), parameter :: count = 1024
+ integer(omp_depend_kind) :: dep(1)
+
+ ptr = omp_target_alloc (count, dev)
+
+ !$omp depobj(dep(1)) depend(inout: ptr)
+
+ ! Play also around with the alignment - as hsa_amd_memory_fill operates
+ ! on multiples of 4 bytes (c_int32_t)
+
+ do start = 0, 31
+ do tail = 0, 31
+ val = iachar('0') + start + tail
+
+ tmpptr = transfer (transfer (ptr, intptr) + start, tmpptr)
+ ptr2 = omp_target_memset_async (tmpptr, val, count - start - tail, dev, 0)
+
+ if (.not. c_associated (tmpptr, ptr2)) stop 1
+
+ !$omp taskwait
+
+ !$omp target device(dev) is_device_ptr(ptr) depend(depobj: dep(1)) nowait
+ do i = 1 + start, int(count, c_int) - start - tail
+ call c_f_pointer (ptr, fptr, [count])
+ if (fptr(i) /= int (val, c_int8_t)) stop 2
+ fptr(i) = fptr(i) + 2_c_int8_t
+ end do
+ !$omp end target
+
+ ptr2 = omp_target_memset_async (tmpptr, val + 3, &
+ count - start - tail, dev, 1, dep)
+
+ !$omp target device(dev) is_device_ptr(ptr) depend(depobj: dep(1)) nowait
+ do i = 1 + start, int(count, c_int) - start - tail
+ call c_f_pointer (ptr, fptr, [count])
+ if (fptr(i) /= int (val + 3, c_int8_t)) stop 3
+ fptr(i) = fptr(i) - 1_c_int8_t
+ end do
+ !$omp end target
+
+ ptr2 = omp_target_memset_async (tmpptr, val - 3, &
+ count - start - tail, dev, 1, dep)
+
+ !$omp taskwait depend (depobj: dep(1))
+ end do
+ end do
+
+ !$omp depobj(dep(1)) destroy
+ call omp_target_free (ptr, dev);
+end block
+end do
+end
diff --git a/libgomp/testsuite/libgomp.fortran/omp_target_memset.f90 b/libgomp/testsuite/libgomp.fortran/omp_target_memset.f90
new file mode 100644
index 0000000..1ee184a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/omp_target_memset.f90
@@ -0,0 +1,39 @@
+! PR libgomp/120444
+
+use omp_lib
+use iso_c_binding
+implicit none (type, external)
+
+integer(c_int) :: dev, i, val, start, tail
+type(c_ptr) :: ptr, ptr2, tmpptr
+integer(c_int8_t), pointer, contiguous :: fptr(:)
+integer(c_intptr_t) :: intptr
+integer(c_size_t), parameter :: count = 1024
+
+do dev = omp_initial_device, omp_get_num_devices ()
+ ptr = omp_target_alloc (count, dev)
+
+ ! Play also around with the alignment - as hsa_amd_memory_fill operates
+ ! on multiples of 4 bytes (c_int32_t)
+
+ do start = 0, 31
+ do tail = 0, 31
+ val = iachar('0') + start + tail
+
+ tmpptr = transfer (transfer (ptr, intptr) + start, tmpptr)
+ ptr2 = omp_target_memset (tmpptr, val, count - start - tail, dev)
+
+ if (.not. c_associated (tmpptr, ptr2)) stop 1
+
+ !$omp target device(dev) is_device_ptr(ptr)
+ do i = 1 + start, int(count, c_int) - start - tail
+ call c_f_pointer (ptr, fptr, [count])
+ if (fptr(i) /= int (val, c_int8_t)) stop 2
+ end do
+ !$omp end target
+ end do
+ end do
+
+ call omp_target_free (ptr, dev);
+end do
+end
diff --git a/libgomp/testsuite/libgomp.fortran/target-enter-data-8.f90 b/libgomp/testsuite/libgomp.fortran/target-enter-data-8.f90
new file mode 100644
index 0000000..c6d671c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-enter-data-8.f90
@@ -0,0 +1,532 @@
+! { dg-additional-options "-cpp" }
+
+! FIXME: Some tests do not work yet. Those are for now in '#if 0'
+
+! Check that 'map(alloc:' properly works with
+! - deferred-length character strings
+! - arrays with array descriptors
+! For those, the array descriptor / string length must be mapped with 'to:'
+
+program main
+implicit none
+
+type t
+ integer :: ic(2:5), ic2
+ character(len=11) :: ccstr(3:4), ccstr2
+ character(len=11,kind=4) :: cc4str(3:7), cc4str2
+ integer, pointer :: pc(:), pc2
+ character(len=:), pointer :: pcstr(:), pcstr2
+ character(len=:,kind=4), pointer :: pc4str(:), pc4str2
+end type t
+
+type(t) :: dt
+
+integer :: ii(5), ii2
+character(len=11) :: clstr(-1:1), clstr2
+character(len=11,kind=4) :: cl4str(0:3), cl4str2
+integer, pointer :: ip(:), ip2
+integer, allocatable :: ia(:), ia2
+character(len=:), pointer :: pstr(:), pstr2
+character(len=:), allocatable :: astr(:), astr2
+character(len=:,kind=4), pointer :: p4str(:), p4str2
+character(len=:,kind=4), allocatable :: a4str(:), a4str2
+
+
+allocate(dt%pc(5), dt%pc2)
+allocate(character(len=2) :: dt%pcstr(2))
+allocate(character(len=4) :: dt%pcstr2)
+
+allocate(character(len=3,kind=4) :: dt%pc4str(2:3))
+allocate(character(len=5,kind=4) :: dt%pc4str2)
+
+allocate(ip(5), ip2, ia(8), ia2)
+allocate(character(len=2) :: pstr(-2:0))
+allocate(character(len=4) :: pstr2)
+allocate(character(len=6) :: astr(3:5))
+allocate(character(len=8) :: astr2)
+
+allocate(character(len=3,kind=4) :: p4str(2:4))
+allocate(character(len=5,kind=4) :: p4str2)
+allocate(character(len=7,kind=4) :: a4str(-2:3))
+allocate(character(len=9,kind=4) :: a4str2)
+
+
+! integer :: ic(2:5), ic2
+
+!$omp target enter data map(alloc: dt%ic)
+!$omp target map(alloc: dt%ic)
+ if (size(dt%ic) /= 4) error stop
+ if (lbound(dt%ic, 1) /= 2) error stop
+ if (ubound(dt%ic, 1) /= 5) error stop
+ dt%ic = [22, 33, 44, 55]
+!$omp end target
+!$omp target exit data map(from: dt%ic)
+if (size(dt%ic) /= 4) error stop
+if (lbound(dt%ic, 1) /= 2) error stop
+if (ubound(dt%ic, 1) /= 5) error stop
+if (any (dt%ic /= [22, 33, 44, 55])) error stop
+
+!$omp target enter data map(alloc: dt%ic2)
+!$omp target map(alloc: dt%ic2)
+ dt%ic2 = 42
+!$omp end target
+!$omp target exit data map(from: dt%ic2)
+if (dt%ic2 /= 42) error stop
+
+
+! character(len=11) :: ccstr(3:4), ccstr2
+
+!$omp target enter data map(alloc: dt%ccstr)
+!$omp target map(alloc: dt%ccstr)
+ if (len(dt%ccstr) /= 11) error stop
+ if (size(dt%ccstr) /= 2) error stop
+ if (lbound(dt%ccstr, 1) /= 3) error stop
+ if (ubound(dt%ccstr, 1) /= 4) error stop
+ dt%ccstr = ["12345678901", "abcdefghijk"]
+!$omp end target
+!$omp target exit data map(from: dt%ccstr)
+if (len(dt%ccstr) /= 11) error stop
+if (size(dt%ccstr) /= 2) error stop
+if (lbound(dt%ccstr, 1) /= 3) error stop
+if (ubound(dt%ccstr, 1) /= 4) error stop
+if (any (dt%ccstr /= ["12345678901", "abcdefghijk"])) error stop
+
+!$omp target enter data map(alloc: dt%ccstr2)
+!$omp target map(alloc: dt%ccstr2)
+ if (len(dt%ccstr2) /= 11) error stop
+ dt%ccstr2 = "ABCDEFGHIJK"
+!$omp end target
+!$omp target exit data map(from: dt%ccstr2)
+if (len(dt%ccstr2) /= 11) error stop
+if (dt%ccstr2 /= "ABCDEFGHIJK") error stop
+
+
+! character(len=11,kind=4) :: cc4str(3:7), cc4str2
+
+#if 0
+! Value check fails
+!$omp target map(alloc: dt%cc4str)
+ if (len(dt%cc4str) /= 11) error stop
+ if (size(dt%cc4str) /= 5) error stop
+ if (lbound(dt%cc4str, 1) /= 3) error stop
+ if (ubound(dt%cc4str, 1) /= 7) error stop
+ dt%cc4str = [4_"12345678901", 4_"abcdefghijk", &
+ 4_"qerftcea6ds", 4_"a1f9g37ga4.", &
+ 4_"45ngwj56sj2"]
+!$omp end target
+!$omp target exit data map(from: dt%cc4str)
+if (len(dt%cc4str) /= 11) error stop
+if (size(dt%cc4str) /= 5) error stop
+if (lbound(dt%cc4str, 1) /= 3) error stop
+if (ubound(dt%cc4str, 1) /= 7) error stop
+if (dt%cc4str(3) /= 4_"12345678901") error stop
+if (dt%cc4str(4) /= 4_"abcdefghijk") error stop
+if (dt%cc4str(5) /= 4_"qerftcea6ds") error stop
+if (dt%cc4str(6) /= 4_"a1f9g37ga4.") error stop
+if (dt%cc4str(7) /= 4_"45ngwj56sj2") error stop
+#endif
+
+!$omp target enter data map(alloc: dt%cc4str2)
+!$omp target map(alloc: dt%cc4str2)
+ if (len(dt%cc4str2) /= 11) error stop
+ dt%cc4str2 = 4_"ABCDEFGHIJK"
+!$omp end target
+!$omp target exit data map(from: dt%cc4str2)
+if (len(dt%cc4str2) /= 11) error stop
+if (dt%cc4str2 /= 4_"ABCDEFGHIJK") error stop
+
+
+! integer, pointer :: pc(:), pc2
+! allocate(dt%pc(5), dt%pc2)
+
+!$omp target enter data map(alloc: dt%pc)
+!$omp target map(alloc: dt%pc)
+ if (.not. associated(dt%pc)) error stop
+ if (size(dt%pc) /= 5) error stop
+ if (lbound(dt%pc, 1) /= 1) error stop
+ if (ubound(dt%pc, 1) /= 5) error stop
+ dt%pc = [11, 22, 33, 44, 55]
+!$omp end target
+!$omp target exit data map(from: dt%pc)
+if (.not. associated(dt%pc)) error stop
+if (size(dt%pc) /= 5) error stop
+if (lbound(dt%pc, 1) /= 1) error stop
+if (ubound(dt%pc, 1) /= 5) error stop
+if (any (dt%pc /= [11, 22, 33, 44, 55])) error stop
+
+!$omp target enter data map(alloc: dt%pc2)
+!$omp target map(alloc: dt%pc2)
+ if (.not. associated(dt%pc2)) error stop
+ dt%pc2 = 99
+!$omp end target
+!$omp target exit data map(from: dt%pc2)
+if (dt%pc2 /= 99) error stop
+if (.not. associated(dt%pc2)) error stop
+
+
+! character(len=:), pointer :: pcstr(:), pcstr2
+! allocate(character(len=2) :: dt%pcstr(2))
+! allocate(character(len=4) :: dt%pcstr2)
+
+!$omp target enter data map(alloc: dt%pcstr)
+!$omp target map(alloc: dt%pcstr)
+ if (.not. associated(dt%pcstr)) error stop
+ if (len(dt%pcstr) /= 2) error stop
+ if (size(dt%pcstr) /= 2) error stop
+ if (lbound(dt%pcstr, 1) /= 1) error stop
+ if (ubound(dt%pcstr, 1) /= 2) error stop
+ dt%pcstr = ["01", "jk"]
+!$omp end target
+!$omp target exit data map(from: dt%pcstr)
+if (.not. associated(dt%pcstr)) error stop
+if (len(dt%pcstr) /= 2) error stop
+if (size(dt%pcstr) /= 2) error stop
+if (lbound(dt%pcstr, 1) /= 1) error stop
+if (ubound(dt%pcstr, 1) /= 2) error stop
+if (any (dt%pcstr /= ["01", "jk"])) error stop
+
+
+!$omp target enter data map(alloc: dt%pcstr2)
+!$omp target map(alloc: dt%pcstr2)
+ if (.not. associated(dt%pcstr2)) error stop
+ if (len(dt%pcstr2) /= 4) error stop
+ dt%pcstr2 = "HIJK"
+!$omp end target
+!$omp target exit data map(from: dt%pcstr2)
+if (.not. associated(dt%pcstr2)) error stop
+if (len(dt%pcstr2) /= 4) error stop
+if (dt%pcstr2 /= "HIJK") error stop
+
+
+! character(len=:,kind=4), pointer :: pc4str(:), pc4str2
+! allocate(character(len=3,kind=4) :: dt%pc4str(2:3))
+! allocate(character(len=5,kind=4) :: dt%pc4str2)
+
+!$omp target enter data map(alloc: dt%pc4str)
+!$omp target map(alloc: dt%pc4str)
+ if (.not. associated(dt%pc4str)) error stop
+ if (len(dt%pc4str) /= 3) error stop
+ if (size(dt%pc4str) /= 2) error stop
+ if (lbound(dt%pc4str, 1) /= 2) error stop
+ if (ubound(dt%pc4str, 1) /= 3) error stop
+ dt%pc4str = [4_"456", 4_"tzu"]
+!$omp end target
+!$omp target exit data map(from: dt%pc4str)
+if (.not. associated(dt%pc4str)) error stop
+if (len(dt%pc4str) /= 3) error stop
+if (size(dt%pc4str) /= 2) error stop
+if (lbound(dt%pc4str, 1) /= 2) error stop
+if (ubound(dt%pc4str, 1) /= 3) error stop
+if (dt%pc4str(2) /= 4_"456") error stop
+if (dt%pc4str(3) /= 4_"tzu") error stop
+
+!$omp target enter data map(alloc: dt%pc4str2)
+!$omp target map(alloc: dt%pc4str2)
+ if (.not. associated(dt%pc4str2)) error stop
+ if (len(dt%pc4str2) /= 5) error stop
+ dt%pc4str2 = 4_"98765"
+!$omp end target
+!$omp target exit data map(from: dt%pc4str2)
+if (.not. associated(dt%pc4str2)) error stop
+if (len(dt%pc4str2) /= 5) error stop
+if (dt%pc4str2 /= 4_"98765") error stop
+
+
+! integer :: ii(5), ii2
+
+!$omp target enter data map(alloc: ii)
+!$omp target map(alloc: ii)
+ if (size(ii) /= 5) error stop
+ if (lbound(ii, 1) /= 1) error stop
+ if (ubound(ii, 1) /= 5) error stop
+ ii = [-1, -2, -3, -4, -5]
+!$omp end target
+!$omp target exit data map(from: ii)
+if (size(ii) /= 5) error stop
+if (lbound(ii, 1) /= 1) error stop
+if (ubound(ii, 1) /= 5) error stop
+if (any (ii /= [-1, -2, -3, -4, -5])) error stop
+
+!$omp target enter data map(alloc: ii2)
+!$omp target map(alloc: ii2)
+ ii2 = -410
+!$omp end target
+!$omp target exit data map(from: ii2)
+if (ii2 /= -410) error stop
+
+
+! character(len=11) :: clstr(-1:1), clstr2
+
+!$omp target enter data map(alloc: clstr)
+!$omp target map(alloc: clstr)
+ if (len(clstr) /= 11) error stop
+ if (size(clstr) /= 3) error stop
+ if (lbound(clstr, 1) /= -1) error stop
+ if (ubound(clstr, 1) /= 1) error stop
+ clstr = ["12345678901", "abcdefghijk", "ABCDEFGHIJK"]
+!$omp end target
+!$omp target exit data map(from: clstr)
+if (len(clstr) /= 11) error stop
+if (size(clstr) /= 3) error stop
+if (lbound(clstr, 1) /= -1) error stop
+if (ubound(clstr, 1) /= 1) error stop
+if (any (clstr /= ["12345678901", "abcdefghijk", "ABCDEFGHIJK"])) error stop
+
+!$omp target enter data map(alloc: clstr2)
+!$omp target map(alloc: clstr2)
+ if (len(clstr2) /= 11) error stop
+ clstr2 = "ABCDEFghijk"
+!$omp end target
+!$omp target exit data map(from: clstr2)
+if (len(clstr2) /= 11) error stop
+if (clstr2 /= "ABCDEFghijk") error stop
+
+
+! character(len=11,kind=4) :: cl4str(0:3), cl4str2
+
+!$omp target enter data map(alloc: cl4str)
+!$omp target map(alloc: cl4str)
+ if (len(cl4str) /= 11) error stop
+ if (size(cl4str) /= 4) error stop
+ if (lbound(cl4str, 1) /= 0) error stop
+ if (ubound(cl4str, 1) /= 3) error stop
+ cl4str = [4_"12345678901", 4_"abcdefghijk", &
+ 4_"qerftcea6ds", 4_"a1f9g37ga4."]
+!$omp end target
+!$omp target exit data map(from: cl4str)
+if (len(cl4str) /= 11) error stop
+if (size(cl4str) /= 4) error stop
+if (lbound(cl4str, 1) /= 0) error stop
+if (ubound(cl4str, 1) /= 3) error stop
+if (cl4str(0) /= 4_"12345678901") error stop
+if (cl4str(1) /= 4_"abcdefghijk") error stop
+if (cl4str(2) /= 4_"qerftcea6ds") error stop
+if (cl4str(3) /= 4_"a1f9g37ga4.") error stop
+
+!$omp target enter data map(alloc: cl4str2)
+!$omp target map(alloc: cl4str2)
+ if (len(cl4str2) /= 11) error stop
+ cl4str2 = 4_"ABCDEFGHIJK"
+!$omp end target
+!$omp target exit data map(from: cl4str2)
+if (len(cl4str2) /= 11) error stop
+if (cl4str2 /= 4_"ABCDEFGHIJK") error stop
+
+
+! allocate(ip(5), ip2, ia(8), ia2)
+
+!$omp target enter data map(alloc: ip)
+!$omp target map(alloc: ip)
+ if (.not. associated(ip)) error stop
+ if (size(ip) /= 5) error stop
+ if (lbound(ip, 1) /= 1) error stop
+ if (ubound(ip, 1) /= 5) error stop
+ ip = [11, 22, 33, 44, 55]
+!$omp end target
+!$omp target exit data map(from: ip)
+if (.not. associated(ip)) error stop
+if (size(ip) /= 5) error stop
+if (lbound(ip, 1) /= 1) error stop
+if (ubound(ip, 1) /= 5) error stop
+if (any (ip /= [11, 22, 33, 44, 55])) error stop
+
+!$omp target enter data map(alloc: ip2)
+!$omp target map(alloc: ip2)
+ if (.not. associated(ip2)) error stop
+ ip2 = 99
+!$omp end target
+!$omp target exit data map(from: ip2)
+if (ip2 /= 99) error stop
+if (.not. associated(ip2)) error stop
+
+
+! allocate(ip(5), ip2, ia(8), ia2)
+
+!$omp target enter data map(alloc: ia)
+!$omp target map(alloc: ia)
+ if (.not. allocated(ia)) error stop
+ if (size(ia) /= 8) error stop
+ if (lbound(ia, 1) /= 1) error stop
+ if (ubound(ia, 1) /= 8) error stop
+ ia = [1,2,3,4,5,6,7,8]
+!$omp end target
+!$omp target exit data map(from: ia)
+if (.not. allocated(ia)) error stop
+if (size(ia) /= 8) error stop
+if (lbound(ia, 1) /= 1) error stop
+if (ubound(ia, 1) /= 8) error stop
+if (any (ia /= [1,2,3,4,5,6,7,8])) error stop
+
+!$omp target enter data map(alloc: ia2)
+!$omp target map(alloc: ia2)
+ if (.not. allocated(ia2)) error stop
+ ia2 = 102
+!$omp end target
+!$omp target exit data map(from: ia2)
+if (ia2 /= 102) error stop
+if (.not. allocated(ia2)) error stop
+
+
+! character(len=:), pointer :: pstr(:), pstr2
+! allocate(character(len=2) :: pstr(-2:0))
+! allocate(character(len=4) :: pstr2)
+
+!$omp target enter data map(alloc: pstr)
+!$omp target map(alloc: pstr)
+ if (.not. associated(pstr)) error stop
+ if (len(pstr) /= 2) error stop
+ if (size(pstr) /= 3) error stop
+ if (lbound(pstr, 1) /= -2) error stop
+ if (ubound(pstr, 1) /= 0) error stop
+ pstr = ["01", "jk", "aq"]
+!$omp end target
+!$omp target exit data map(from: pstr)
+if (.not. associated(pstr)) error stop
+if (len(pstr) /= 2) error stop
+if (size(pstr) /= 3) error stop
+if (lbound(pstr, 1) /= -2) error stop
+if (ubound(pstr, 1) /= 0) error stop
+if (any (pstr /= ["01", "jk", "aq"])) error stop
+
+!$omp target enter data map(alloc: pstr2)
+!$omp target map(alloc: pstr2)
+ if (.not. associated(pstr2)) error stop
+ if (len(pstr2) /= 4) error stop
+ pstr2 = "HIJK"
+!$omp end target
+!$omp target exit data map(from: pstr2)
+if (.not. associated(pstr2)) error stop
+if (len(pstr2) /= 4) error stop
+if (pstr2 /= "HIJK") error stop
+
+
+! character(len=:), allocatable :: astr(:), astr2
+! allocate(character(len=6) :: astr(3:5))
+! allocate(character(len=8) :: astr2)
+
+
+!$omp target enter data map(alloc: astr)
+!$omp target map(alloc: astr)
+ if (.not. allocated(astr)) error stop
+ if (len(astr) /= 6) error stop
+ if (size(astr) /= 3) error stop
+ if (lbound(astr, 1) /= 3) error stop
+ if (ubound(astr, 1) /= 5) error stop
+ astr = ["01db45", "jk$D%S", "zutg47"]
+!$omp end target
+!$omp target exit data map(from: astr)
+if (.not. allocated(astr)) error stop
+if (len(astr) /= 6) error stop
+if (size(astr) /= 3) error stop
+if (lbound(astr, 1) /= 3) error stop
+if (ubound(astr, 1) /= 5) error stop
+if (any (astr /= ["01db45", "jk$D%S", "zutg47"])) error stop
+
+
+!$omp target enter data map(alloc: astr2)
+!$omp target map(alloc: astr2)
+ if (.not. allocated(astr2)) error stop
+ if (len(astr2) /= 8) error stop
+ astr2 = "HIJKhijk"
+!$omp end target
+!$omp target exit data map(from: astr2)
+if (.not. allocated(astr2)) error stop
+if (len(astr2) /= 8) error stop
+if (astr2 /= "HIJKhijk") error stop
+
+
+! character(len=:,kind=4), pointer :: p4str(:), p4str2
+! allocate(character(len=3,kind=4) :: p4str(2:4))
+! allocate(character(len=5,kind=4) :: p4str2)
+
+! FAILS with value check
+
+!$omp target enter data map(alloc: p4str)
+!$omp target map(alloc: p4str)
+ if (.not. associated(p4str)) error stop
+ if (len(p4str) /= 3) error stop
+ if (size(p4str) /= 3) error stop
+ if (lbound(p4str, 1) /= 2) error stop
+ if (ubound(p4str, 1) /= 4) error stop
+ p4str(:) = [4_"f85", 4_"8af", 4_"A%F"]
+!$omp end target
+!$omp target exit data map(from: p4str)
+if (.not. associated(p4str)) error stop
+if (len(p4str) /= 3) error stop
+if (size(p4str) /= 3) error stop
+if (lbound(p4str, 1) /= 2) error stop
+if (ubound(p4str, 1) /= 4) error stop
+if (p4str(2) /= 4_"f85") error stop
+if (p4str(3) /= 4_"8af") error stop
+if (p4str(4) /= 4_"A%F") error stop
+
+!$omp target enter data map(alloc: p4str2)
+!$omp target map(alloc: p4str2)
+ if (.not. associated(p4str2)) error stop
+ if (len(p4str2) /= 5) error stop
+ p4str2 = 4_"9875a"
+!$omp end target
+!$omp target exit data map(from: p4str2)
+if (.not. associated(p4str2)) error stop
+if (len(p4str2) /= 5) error stop
+if (p4str2 /= 4_"9875a") error stop
+
+
+! character(len=:,kind=4), allocatable :: a4str(:), a4str2
+! allocate(character(len=7,kind=4) :: a4str(-2:3))
+! allocate(character(len=9,kind=4) :: a4str2)
+
+!$omp target enter data map(alloc: a4str)
+!$omp target map(alloc: a4str)
+ if (.not. allocated(a4str)) error stop
+ if (len(a4str) /= 7) error stop
+ if (size(a4str) /= 6) error stop
+ if (lbound(a4str, 1) /= -2) error stop
+ if (ubound(a4str, 1) /= 3) error stop
+ ! See PR fortran/107508 why '(:)' is required
+ a4str(:) = [4_"sf456aq", 4_"3dtzu24", 4_"_4fh7sm", 4_"=ff85s7", 4_"j=8af4d", 4_".,A%Fsz"]
+!$omp end target
+!$omp target exit data map(from: a4str)
+if (.not. allocated(a4str)) error stop
+if (len(a4str) /= 7) error stop
+if (size(a4str) /= 6) error stop
+if (lbound(a4str, 1) /= -2) error stop
+if (ubound(a4str, 1) /= 3) error stop
+if (a4str(-2) /= 4_"sf456aq") error stop
+if (a4str(-1) /= 4_"3dtzu24") error stop
+if (a4str(0) /= 4_"_4fh7sm") error stop
+if (a4str(1) /= 4_"=ff85s7") error stop
+if (a4str(2) /= 4_"j=8af4d") error stop
+if (a4str(3) /= 4_".,A%Fsz") error stop
+
+!$omp target enter data map(alloc: a4str2)
+!$omp target map(alloc: a4str2)
+ if (.not. allocated(a4str2)) error stop
+ if (len(a4str2) /= 9) error stop
+ a4str2 = 4_"98765a23d"
+!$omp end target
+!$omp target exit data map(from: a4str2)
+if (.not. allocated(a4str2)) error stop
+if (len(a4str2) /= 9) error stop
+if (a4str2 /= 4_"98765a23d") error stop
+
+
+deallocate(dt%pc, dt%pc2)
+deallocate(dt%pcstr)
+deallocate(dt%pcstr2)
+
+deallocate(dt%pc4str)
+deallocate(dt%pc4str2)
+
+deallocate(ip, ip2, ia, ia2)
+deallocate(pstr)
+deallocate(pstr2)
+deallocate(astr)
+deallocate(astr2)
+
+deallocate(p4str)
+deallocate(p4str2)
+deallocate(a4str)
+deallocate(a4str2)
+
+end
diff --git a/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C b/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C
index 0545601..6957a6c 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C
+++ b/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-1.C
@@ -52,3 +52,6 @@ int main()
PR119692.
{ dg-shouldfail {'std::bad_cast' exception} } */
+/* There are configurations where we 'WARNING: program timed out.' while in
+ 'dynamic_cast', see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119692#c6>.
+ { dg-timeout 10 } ... to make sure that happens quickly. */
diff --git a/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C b/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C
index 24399ef..0f84cf2 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C
+++ b/libgomp/testsuite/libgomp.oacc-c++/exceptions-bad_cast-2.C
@@ -58,3 +58,6 @@ int main()
For GCN, nvptx offload execution, there is no 'catch'ing; any exception is fatal.
{ dg-shouldfail {'std::bad_cast' exception} { ! openacc_host_selected } } */
+/* There are configurations where we 'WARNING: program timed out.' while in
+ 'dynamic_cast', see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119692#c6>.
+ { dg-timeout 10 } ... to make sure that happens quickly. */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c
new file mode 100644
index 0000000..4b54171
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c
@@ -0,0 +1,125 @@
+/* Inspired by 'gcc.target/nvptx/abi-struct-arg.c', 'gcc.target/nvptx/abi-struct-ret.c'. */
+
+/* See also '../libgomp.c-c++-common/target-abi-struct-1.c'. */
+
+/* To exercise PR119835 (if optimizations enabled): disable inlining, so that
+ GIMPLE passes still see the functions that return aggregate types. */
+#pragma GCC optimize "-fno-inline"
+
+typedef struct {} empty; /* See 'gcc/doc/extend.texi', "Empty Structures". */
+typedef struct {char a;} schar;
+typedef struct {short a;} sshort;
+typedef struct {int a;} sint;
+typedef struct {long long a;} slonglong;
+typedef struct {int a, b[12];} sint_13;
+
+#pragma omp declare target
+
+#define M(T) ({T t; t.a = sizeof t; t;})
+
+static __SIZE_TYPE__ empty_a;
+#pragma acc declare create(empty_a)
+#pragma acc routine
+static empty rempty(void)
+{
+ return ({empty t; empty_a = sizeof t; t;});
+}
+
+#pragma acc routine
+static schar rschar(void)
+{
+ return M(schar);
+}
+
+#pragma acc routine
+static sshort rsshort(void)
+{
+ return M(sshort);
+}
+
+#pragma acc routine
+static sint rsint(void)
+{
+ return M(sint);
+}
+
+#pragma acc routine
+static slonglong rslonglong(void)
+{
+ return M(slonglong);
+}
+
+#pragma acc routine
+static sint_13 rsint_13(void)
+{
+ return M(sint_13);
+}
+
+#pragma acc routine
+static void aempty(empty empty)
+{
+ (void) empty;
+
+ __SIZE_TYPE__ empty_a_exp;
+#ifndef __cplusplus
+ empty_a_exp = 0;
+#else
+ empty_a_exp = sizeof (char);
+#endif
+ if (empty_a != empty_a_exp)
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void aschar(schar schar)
+{
+ if (schar.a != sizeof (char))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void asshort(sshort sshort)
+{
+ if (sshort.a != sizeof (short))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void asint(sint sint)
+{
+ if (sint.a != sizeof (int))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void aslonglong(slonglong slonglong)
+{
+ if (slonglong.a != sizeof (long long))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void asint_13(sint_13 sint_13)
+{
+ if (sint_13.a != (sizeof (int) * 13))
+ __builtin_abort();
+}
+
+#pragma omp end declare target
+
+int main()
+{
+#pragma omp target
+#pragma acc serial
+ /* { dg-bogus {using 'vector_length \(32\)', ignoring 1} {} { target openacc_nvidia_accel_selected xfail *-*-* } .-1 } */
+ {
+ aempty(rempty());
+ aschar(rschar());
+ asshort(rsshort());
+ asint(rsint());
+ aslonglong(rslonglong());
+ asint_13(rsint_13());
+ }
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_memcpy_device-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_memcpy_device-1.c
new file mode 100644
index 0000000..eda651d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_memcpy_device-1.c
@@ -0,0 +1,96 @@
+/* { dg-prune-output "using .vector_length \\(32\\)" } */
+
+/* PR libgomp/93226 */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <openacc.h>
+
+enum { N = 1024 };
+
+static int D[N];
+#pragma acc declare device_resident(D)
+
+#pragma acc routine
+intptr_t init_d()
+{
+ for (int i = 0; i < N; i++)
+ D[i] = 27*i;
+ return (intptr_t) &D[0];
+}
+
+int
+main ()
+{
+ int *a, *b, *e;
+ void *d_a, *d_b, *d_c, *d_d, *d_e, *d_f;
+ intptr_t intptr;
+ bool fail = false;
+
+ a = (int *) malloc (N*sizeof (int));
+ b = (int *) malloc (N*sizeof (int));
+ e = (int *) malloc (N*sizeof (int));
+ d_c = acc_malloc (N*sizeof (int));
+ d_f = acc_malloc (N*sizeof (int));
+
+ memset (e, 0xff, N*sizeof (int));
+ d_e = acc_copyin (e, N*sizeof (int));
+
+ #pragma acc serial copyout(intptr)
+ intptr = init_d ();
+ d_d = (void*) intptr;
+ acc_memcpy_device (d_c, d_d, N*sizeof (int));
+
+ #pragma acc serial copy(fail) deviceptr(d_c) firstprivate(intptr)
+ {
+ int *cc = (int *) d_c;
+ int *dd = (int *) intptr;
+ for (int i = 0; i < N; i++)
+ if (dd[i] != 27*i || cc[i] != 27*i)
+ {
+ fail = true;
+ __builtin_abort ();
+ }
+ }
+ if (fail) __builtin_abort ();
+
+ for (int i = 0; i < N; i++)
+ a[i] = 11*i;
+ for (int i = 0; i < N; i++)
+ b[i] = 31*i;
+
+ d_a = acc_copyin (a, N*sizeof (int));
+ acc_copyin_async (b, N*sizeof (int), acc_async_noval);
+
+ #pragma acc parallel deviceptr(d_c) async
+ {
+ int *cc = (int *) d_c;
+ #pragma acc loop
+ for (int i = 0; i < N; i++)
+ cc[i] = -17*i;
+ }
+
+ acc_memcpy_device_async (d_d, d_a, N*sizeof (int), acc_async_noval);
+ acc_memcpy_device_async (d_f, d_c, N*sizeof (int), acc_async_noval);
+ acc_wait (acc_async_noval);
+ d_b = acc_deviceptr (b);
+ acc_memcpy_device_async (d_e, d_b, N*sizeof (int), acc_async_noval);
+ acc_wait (acc_async_noval);
+
+ #pragma acc serial deviceptr(d_d, d_e, d_f) copy(fail)
+ {
+ int *dd = (int *) d_d;
+ int *ee = (int *) d_e;
+ int *ff = (int *) d_f;
+ for (int i = 0; i < N; i++)
+ if (dd[i] != 11*i
+ || ee[i] != 31*i
+ || ff[i] != -17*i)
+ {
+ fail = true;
+ __builtin_abort ();
+ }
+ }
+ if (fail) __builtin_abort ();
+}
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/acc_memcpy_device-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/acc_memcpy_device-1.f90
new file mode 100644
index 0000000..8f3a8f0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/acc_memcpy_device-1.f90
@@ -0,0 +1,113 @@
+! { dg-prune-output "using .vector_length \\(32\\)" }
+
+! PR libgomp/93226 */
+
+module m
+ use iso_c_binding
+ use openacc
+ implicit none (external, type)
+
+ integer, parameter :: N = 1024
+
+ integer :: D(N)
+ !$acc declare device_resident(D)
+
+contains
+
+ integer(c_intptr_t) function init_d()
+ !$acc routine
+ integer :: i
+ do i = 1, N
+ D(i) = 27*i
+ end do
+ init_d = loc(D)
+ end
+end module
+
+program main
+ use m
+ implicit none (external, type)
+
+ integer, allocatable, target :: a(:), b(:), e(:)
+ type(c_ptr) :: d_a, d_b, d_c, d_d, d_e, d_f
+ integer(c_intptr_t) intptr
+ integer :: i
+ logical fail
+
+ fail = .false.
+
+ allocate(a(N), b(N), e(N))
+ d_c = acc_malloc (N*c_sizeof (i))
+ d_f = acc_malloc (N*c_sizeof (i))
+
+ e = huge(e)
+ call acc_copyin (e, N*c_sizeof (i));
+ d_e = acc_deviceptr (e);
+
+ !$acc serial copyout(intptr)
+ intptr = init_d ()
+ !$acc end serial
+ d_d = transfer(intptr, d_d)
+ call acc_memcpy_device (d_c, d_d, N*c_sizeof (i))
+
+ !$acc serial copy(fail) copy(a) deviceptr(d_c, d_d) firstprivate(intptr)
+ block
+ integer, pointer :: cc(:), dd(:)
+ call c_f_pointer (d_c, cc, [N])
+ call c_f_pointer (d_d, dd, [N])
+ a = cc
+ do i = 1, N
+ if (dd(i) /= 27*i .or. cc(i) /= 27*i) then
+ fail = .true.
+ stop 1
+ end if
+ end do
+ end block
+ !$acc end serial
+ if (fail) error stop 1
+
+ do i = 1, N
+ a(i) = 11*i
+ b(i) = 31*i
+ end do
+
+ call acc_copyin (a, N*c_sizeof (i))
+ d_a = acc_deviceptr (a)
+ call acc_copyin_async (b, N*c_sizeof (i), acc_async_noval)
+
+ !$acc parallel deviceptr(d_c) private(i) async
+ block
+ integer, pointer :: cc(:)
+ call c_f_pointer (d_c, cc, [N])
+ !$acc loop
+ do i = 1, N
+ cc(i) = -17*i
+ end do
+ end block
+ !$acc end parallel
+
+ call acc_memcpy_device_async (d_d, d_a, N*c_sizeof (i), acc_async_noval)
+ call acc_memcpy_device_async (d_f, d_c, N*c_sizeof (i), acc_async_noval)
+ call acc_wait (acc_async_noval)
+ d_b = acc_deviceptr (b)
+ call acc_memcpy_device_async (d_e, d_b, N*c_sizeof (i), acc_async_noval)
+ call acc_wait (acc_async_noval)
+
+ !$acc serial deviceptr(d_d, d_e, d_f) private(i) copy(fail)
+ block
+ integer, pointer :: dd(:), ee(:), ff(:)
+ call c_f_pointer (d_d, dd, [N])
+ call c_f_pointer (d_e, ee, [N])
+ call c_f_pointer (d_f, ff, [N])
+ do i = 1, N
+ if (dd(i) /= 11*i &
+ .or. ee(i) /= 31*i &
+ .or. ff(i) /= -17*i) then
+ fail = .true.
+ stop 2
+ end if
+ end do
+ end block
+ !$acc end serial
+ if (fail) error stop 2
+end
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ac09899..0742cdb 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,257 @@
+2025-06-12 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-06-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120625
+ * include/std/format (__format::__disabled): Remove.
+ (__formatter_disabled): New type.
+ (formatter<char*, wchar_t>, formatter<const char*, wchar_t>)
+ (formatter<char[N], wchar_t>, formatter<string, wchar_t>)
+ (formatter<string_view, wchar_t>): Use __formatter_disabled as
+ base class instead of formatter<__disabled, wchar_t>.
+ * testsuite/std/format/formatter/120625.cc: New test.
+
+2025-06-10 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-06-04 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/99832
+ * include/bits/chrono.h (system_clock::to_time_t): Add
+ always_inline attribute to be agnostic to the underlying type of
+ time_t.
+ (system_clock::from_time_t): Add always_inline for consistency
+ with to_time_t.
+ * testsuite/20_util/system_clock/99832.cc: New test.
+
+2025-06-10 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-06-05 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120548
+ * include/std/format (__formatter_fp::_M_localize): Do not
+ include a leading sign character in the string to be grouped.
+ * testsuite/std/format/functions/format.cc: Check grouping when
+ sign is present in the output.
+
+2025-06-06 Patrick Palka <ppalka@redhat.com>
+
+ Backported from master:
+ 2025-06-06 Patrick Palka <ppalka@redhat.com>
+
+ PR libstdc++/120432
+ * include/std/flat_map (flat_map::operator[]): Make the
+ non-template overloads call try_emplace directly. Remove
+ non-standard same_as constraint on the template overload.
+ * testsuite/23_containers/flat_map/1.cc (test08): New test.
+
+2025-06-06 Tomasz Kamiński <tkaminsk@redhat.com>
+
+ Backported from master:
+ 2025-06-04 Tomasz Kamiński <tkaminsk@redhat.com>
+
+ * include/bits/chrono_io.h (__formatter_chrono:_M_s): Add missing
+ __out argument to format_to call.
+
+2025-06-01 Patrick Palka <ppalka@redhat.com>
+
+ Backported from master:
+ 2025-05-29 Patrick Palka <ppalka@redhat.com>
+
+ * include/std/flat_map (_Flat_map_impl::operator==): Compare
+ keys and values separately.
+
+2025-06-01 Patrick Palka <ppalka@redhat.com>
+
+ Backported from master:
+ 2025-05-29 Patrick Palka <ppalka@redhat.com>
+ Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120465
+ * include/std/flat_map (_Flat_map_impl::_M_erase_if): Use a
+ projection with ranges::remove_if to pass a pair instead of
+ a tuple to the predicate.
+ * testsuite/23_containers/flat_map/1.cc (test07): Strengthen
+ to expect the argument passed to the predicate is a pair.
+ * testsuite/23_containers/flat_multimap/1.cc (test07): Likewise.
+
+2025-05-27 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-22 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/util/pstl/test_utils.h (ForwardIterator::operator++):
+ Fix return type.
+ (BidirectionalIterator::operator++): Likewise.
+ (BidirectionalIterator::operator--): Likewise.
+
+2025-05-27 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-22 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120367
+ * include/bits/stl_vector.h (_M_range_initialize): Initialize
+ _M_impl._M_finish.
+ * testsuite/23_containers/vector/cons/from_range.cc: Check with
+ a type that throws on construction.
+ exceptions during construction.
+
+2025-05-20 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-20 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/xml/faq.xml: Update URL for archived SGI STL docs.
+ * doc/xml/manual/containers.xml: Likewise.
+ * doc/xml/manual/extensions.xml: Likewise.
+ * doc/xml/manual/using.xml: Likewise.
+ * doc/xml/manual/utilities.xml: Likewise.
+ * doc/html/*: Regenerate.
+
+2025-05-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-19 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/std/ranges (_ZipTransform::operator()): Remove name of
+ unused parameter.
+ (chunk_view::_Iterator, stride_view::_Iterator): Likewise.
+ (join_with_view): Declare _Iterator and _Sentinel as class
+ instead of struct.
+ (repeat_view): Declare _Iterator as class instead of struct.
+
+2025-05-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-19 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120293
+ * include/bits/chrono_io.h (_M_format_to_ostream): Add special
+ case for local_time convertible to local_days.
+ * testsuite/std/time/clock/local/io.cc: Check formatting of
+ chrono::local_days.
+
+2025-05-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-06 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120029
+ * src/c++17/fs_path.cc (path::operator+=(const path&)): Handle
+ parameters that alias the path or one of its components.
+ * testsuite/27_io/filesystem/path/concat/120029.cc: New test.
+ * testsuite/experimental/filesystem/path/concat/120029.cc: New
+ test.
+
+2025-05-19 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-15 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120190
+ * include/std/format (format_kind): Adjust primary template to
+ not depend on itself.
+ * testsuite/std/format/ranges/format_kind_neg.cc: Adjust
+ expected errors. Check more invalid specializations.
+
+2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120187
+ * include/c_global/ciso646: Only give deprecated warning for
+ C++20 and later.
+ * include/c_global/ccomplex: Add @since to Doxygen comment.
+ * include/c_global/cstdalign: Likewise.
+ * include/c_global/cstdbool: Likewise.
+ * include/c_global/ctgmath: Likewise.
+ * testsuite/18_support/headers/ciso646/macros.cc: Remove
+ dg-warning for c++17_only effective target.
+ * testsuite/18_support/headers/ciso646/macros-2.cc: New test.
+
+2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/120198
+ * include/bits/version.def (scoped_lock): Do not depend on
+ gthreads or hosted.
+ * include/bits/version.h: Regenerate.
+ * include/std/mutex (scoped_lock): Update comment.
+ * testsuite/30_threads/scoped_lock/requirements/typedefs.cc:
+ Remove dg-require-gthreads and use custom lockable type instead
+ of std::mutex. Check that typedef is only present for a single
+ template argument.
+
+2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/xml/manual/status_cxx2023.xml: Update status of proposals
+ implemented after GCC 14.2 release.
+ * doc/html/*: Regenerate.
+
+2025-05-12 Patrick Palka <ppalka@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Patrick Palka <ppalka@redhat.com>
+
+ PR libstdc++/119714
+ PR libstdc++/112490
+ * include/std/expected (expected::operator==): Replace
+ non-dependent std::expected function parameter with a dependent
+ one of type expected<_Vp, _Er> where _Vp matches _Tp.
+ * testsuite/20_util/expected/119714.cc: New test.
+
+2025-05-12 Patrick Palka <ppalka@redhat.com>
+
+ Backported from master:
+ 2025-04-29 Patrick Palka <ppalka@redhat.com>
+
+ PR libstdc++/119427
+ * include/std/flat_map (_Flat_map_impl::erase_if): Replace
+ this hidden friend with ...
+ (_Flat_map_impl::_M_erase_if): ... this member function.
+ (flat_map): Export _Flat_map_impl::_M_erase_if.
+ (erase_if(flat_map)): Define.
+ (flat_multimap): Export _Flat_map_impl::_M_erase_if.
+ (erase_if(flat_multimap)): Define.
+ * include/std/flat_set (_Flat_set_impl::erase_if): Replace
+ with ...
+ (_Flat_set_impl::_M_erase_if): ... this member function.
+ (flat_set): Export _Flat_set_impl::_M_erase_if.
+ (erase_if(flat_set)): Define.
+ (flat_multiset): Export _Flat_set_impl::_M_erase_if.
+ (erase_if(flat_multiset)): Define.
+ * testsuite/23_containers/flat_map/1.cc (test07): New test.
+ * testsuite/23_containers/flat_multimap/1.cc (test07): New test.
+ * testsuite/23_containers/flat_multiset/1.cc (test09): New test.
+ * testsuite/23_containers/flat_set/1.cc (test09): New test.
+
+2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/118260
+ * python/hook.in: Suppress output from gdb.execute calls to
+ register skips.
+
+2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ Backported from master:
+ 2025-05-12 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/xml/manual/status_cxx2017.xml: Update status for
+ std::to_chars and std::from_chars.
+ * doc/html/manual/*: Regenerate.
+
2025-05-07 Jonathan Wakely <jwakely@redhat.com>
Backported from master:
diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html
index 5075558..9bd477f 100644
--- a/libstdc++-v3/doc/html/faq.html
+++ b/libstdc++-v3/doc/html/faq.html
@@ -796,7 +796,7 @@
Libstdc++-v3 incorporates a lot of code from
<a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/" target="_top">the SGI STL</a>
(the final merge was from
- <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/whats_new.html" target="_top">release 3.3</a>).
+ <a class="link" href="https://web.archive.org/web/20171206110416/http://www.sgi.com/tech/stl/whats_new.html" target="_top">release 3.3</a>).
The code in libstdc++ contains many fixes and changes compared to the
original SGI code.
</p><p>
diff --git a/libstdc++-v3/doc/html/manual/containers.html b/libstdc++-v3/doc/html/manual/containers.html
index 7035a94..dcd609a 100644
--- a/libstdc++-v3/doc/html/manual/containers.html
+++ b/libstdc++-v3/doc/html/manual/containers.html
@@ -11,7 +11,7 @@
Yes it is, at least using the <a class="link" href="using_dual_abi.html" title="Dual ABI">old
ABI</a>, and that's okay. This is a decision that we preserved
when we imported SGI's STL implementation. The following is
- quoted from <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/FAQ.html" target="_top">their FAQ</a>:
+ quoted from <a class="link" href="https://web.archive.org/web/20161222192301/http://www.sgi.com/tech/stl/FAQ.html" target="_top">their FAQ</a>:
</p><div class="blockquote"><blockquote class="blockquote"><p>
The size() member function, for list and slist, takes time
proportional to the number of elements in the list. This was a
diff --git a/libstdc++-v3/doc/html/manual/ext_numerics.html b/libstdc++-v3/doc/html/manual/ext_numerics.html
index 9b864e1..c3a5623 100644
--- a/libstdc++-v3/doc/html/manual/ext_numerics.html
+++ b/libstdc++-v3/doc/html/manual/ext_numerics.html
@@ -14,7 +14,7 @@
The operation functor must be associative.
</p><p>The <code class="code">iota</code> function wins the award for Extension With the
Coolest Name (the name comes from Ken Iverson's APL language.) As
- described in the <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/iota.html" target="_top">SGI
+ described in the <a class="link" href="https://web.archive.org/web/20170201044840/http://www.sgi.com/tech/stl/iota.html" target="_top">SGI
documentation</a>, it "assigns sequentially increasing values to a range.
That is, it assigns <code class="code">value</code> to <code class="code">*first</code>,
<code class="code">value + 1</code> to<code class="code"> *(first + 1)</code> and so on."
diff --git a/libstdc++-v3/doc/html/manual/ext_sgi.html b/libstdc++-v3/doc/html/manual/ext_sgi.html
index ae20629..2310857 100644
--- a/libstdc++-v3/doc/html/manual/ext_sgi.html
+++ b/libstdc++-v3/doc/html/manual/ext_sgi.html
@@ -28,12 +28,12 @@
and sets.
</p><p>Each of the associative containers map, multimap, set, and multiset
have a counterpart which uses a
- <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/HashFunction.html" target="_top">hashing
+ <a class="link" href="https://web.archive.org/web/20171230172024/http://www.sgi.com/tech/stl/HashFunction.html" target="_top">hashing
function</a> to do the arranging, instead of a strict weak ordering
function. The classes take as one of their template parameters a
function object that will return the hash value; by default, an
instantiation of
- <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/hash.html" target="_top">hash</a>.
+ <a class="link" href="https://web.archive.org/web/20171230172200/http://www.sgi.com/tech/stl/hash.html" target="_top">hash</a>.
You should specialize this functor for your class, or define your own,
before trying to use one of the hashing classes.
</p><p>The hashing classes support all the usual associative container
diff --git a/libstdc++-v3/doc/html/manual/using_concurrency.html b/libstdc++-v3/doc/html/manual/using_concurrency.html
index d570d3a..98875f3 100644
--- a/libstdc++-v3/doc/html/manual/using_concurrency.html
+++ b/libstdc++-v3/doc/html/manual/using_concurrency.html
@@ -40,7 +40,7 @@ The standard places requirements on the library to ensure that no data
races are caused by the library itself or by programs which use the
library correctly (as described below).
The C++11 memory model and library requirements are a more formal version
-of the <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI STL</a> definition of thread safety, which the library used
+of the <a class="link" href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI STL</a> definition of thread safety, which the library used
prior to the 2011 standard.
</p><p>The library strives to be thread-safe when all of the following
conditions are met:
@@ -243,10 +243,10 @@ gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
threaded and non-threaded code), see Chapter 17.
</p><p>Two excellent pages to read when working with the Standard C++
containers and threads are
- <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI's
- https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html</a> and
- <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html" target="_top">SGI's
- https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html</a>.
+ <a class="link" href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html" target="_top">SGI's
+ https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html</a> and
+ <a class="link" href="https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html" target="_top">SGI's
+ https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html</a>.
</p><p><span class="emphasis"><em>However, please ignore all discussions about the user-level
configuration of the lock implementation inside the STL
container-memory allocator on those pages. For the sake of this
diff --git a/libstdc++-v3/doc/html/manual/utilities.html b/libstdc++-v3/doc/html/manual/utilities.html
index 15c9a9d..1216b72 100644
--- a/libstdc++-v3/doc/html/manual/utilities.html
+++ b/libstdc++-v3/doc/html/manual/utilities.html
@@ -11,6 +11,6 @@
get slightly the wrong idea. In the interest of not reinventing
the wheel, we will refer you to the introduction to the functor
concept written by SGI as part of their STL, in
- <a class="link" href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html" target="_top">their
- https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html</a>.
+ <a class="link" href="https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html" target="_top">their
+ https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html</a>.
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="concept_checking.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="std_contents.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pairs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Concept Checking </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> Pairs</td></tr></table></div></body></html> \ No newline at end of file
diff --git a/libstdc++-v3/doc/xml/faq.xml b/libstdc++-v3/doc/xml/faq.xml
index bccbb98..a1d6a21 100644
--- a/libstdc++-v3/doc/xml/faq.xml
+++ b/libstdc++-v3/doc/xml/faq.xml
@@ -1130,7 +1130,7 @@
Libstdc++-v3 incorporates a lot of code from
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/">the SGI STL</link>
(the final merge was from
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/whats_new.html">release 3.3</link>).
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171206110416/http://www.sgi.com/tech/stl/whats_new.html">release 3.3</link>).
The code in libstdc++ contains many fixes and changes compared to the
original SGI code.
</para>
diff --git a/libstdc++-v3/doc/xml/manual/containers.xml b/libstdc++-v3/doc/xml/manual/containers.xml
index 6d9a387..1758762 100644
--- a/libstdc++-v3/doc/xml/manual/containers.xml
+++ b/libstdc++-v3/doc/xml/manual/containers.xml
@@ -28,7 +28,7 @@
Yes it is, at least using the <link linkend="manual.intro.using.abi">old
ABI</link>, and that's okay. This is a decision that we preserved
when we imported SGI's STL implementation. The following is
- quoted from <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/FAQ.html">their FAQ</link>:
+ quoted from <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20161222192301/http://www.sgi.com/tech/stl/FAQ.html">their FAQ</link>:
</para>
<blockquote>
<para>
diff --git a/libstdc++-v3/doc/xml/manual/extensions.xml b/libstdc++-v3/doc/xml/manual/extensions.xml
index d0460b0..a8b7088 100644
--- a/libstdc++-v3/doc/xml/manual/extensions.xml
+++ b/libstdc++-v3/doc/xml/manual/extensions.xml
@@ -227,12 +227,12 @@ extensions, be aware of two things:
</para>
<para>Each of the associative containers map, multimap, set, and multiset
have a counterpart which uses a
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/HashFunction.html">hashing
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171230172024/http://www.sgi.com/tech/stl/HashFunction.html">hashing
function</link> to do the arranging, instead of a strict weak ordering
function. The classes take as one of their template parameters a
function object that will return the hash value; by default, an
instantiation of
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/hash.html">hash</link>.
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171230172200/http://www.sgi.com/tech/stl/hash.html">hash</link>.
You should specialize this functor for your class, or define your own,
before trying to use one of the hashing classes.
</para>
@@ -394,7 +394,7 @@ get_temporary_buffer(5, (int*)0);
</para>
<para>The <code>iota</code> function wins the award for Extension With the
Coolest Name (the name comes from Ken Iverson's APL language.) As
- described in the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/iota.html">SGI
+ described in the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20170201044840/http://www.sgi.com/tech/stl/iota.html">SGI
documentation</link>, it "assigns sequentially increasing values to a range.
That is, it assigns <code>value</code> to <code>*first</code>,
<code>value + 1</code> to<code> *(first + 1)</code> and so on."
diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml
index bf92c49..4b8f53d 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -1951,7 +1951,7 @@ The standard places requirements on the library to ensure that no data
races are caused by the library itself or by programs which use the
library correctly (as described below).
The C++11 memory model and library requirements are a more formal version
-of the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html">SGI STL</link> definition of thread safety, which the library used
+of the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html">SGI STL</link> definition of thread safety, which the library used
prior to the 2011 standard.
</para>
@@ -2236,10 +2236,10 @@ gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
</para>
<para>Two excellent pages to read when working with the Standard C++
containers and threads are
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html">SGI's
- https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/thread_safety.html</link> and
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html">SGI's
- https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/Allocators.html</link>.
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html">SGI's
+ https://web.archive.org/web/20171221154911/http://www.sgi.com/tech/stl/thread_safety.html</link> and
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html">SGI's
+ https://web.archive.org/web/20171108142526/http://www.sgi.com/tech/stl/Allocators.html</link>.
</para>
<para><emphasis>However, please ignore all discussions about the user-level
configuration of the lock implementation inside the STL
diff --git a/libstdc++-v3/doc/xml/manual/utilities.xml b/libstdc++-v3/doc/xml/manual/utilities.xml
index e155c8c..c2e013e 100644
--- a/libstdc++-v3/doc/xml/manual/utilities.xml
+++ b/libstdc++-v3/doc/xml/manual/utilities.xml
@@ -22,8 +22,8 @@
get slightly the wrong idea. In the interest of not reinventing
the wheel, we will refer you to the introduction to the functor
concept written by SGI as part of their STL, in
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html">their
- https://web.archive.org/web/20171225062613/http://www.sgi.com/tech/stl/functors.html</link>.
+ <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html">their
+ https://web.archive.org/web/20171209002754/http://www.sgi.com/tech/stl/functors.html</link>.
</para>
</section>
diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h
index fad2162..8de8e75 100644
--- a/libstdc++-v3/include/bits/chrono.h
+++ b/libstdc++-v3/include/bits/chrono.h
@@ -1244,6 +1244,7 @@ _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
now() noexcept;
// Map to C API
+ [[__gnu__::__always_inline__]]
static std::time_t
to_time_t(const time_point& __t) noexcept
{
@@ -1251,6 +1252,7 @@ _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
(__t.time_since_epoch()).count());
}
+ [[__gnu__::__always_inline__]]
static time_point
from_time_t(std::time_t __t) noexcept
{
diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index f5aa8a3..32ef353 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -782,6 +782,9 @@ namespace __format
// sys_time with period greater or equal to days:
if constexpr (is_convertible_v<_Tp, chrono::sys_days>)
__os << _S_date(__t);
+ // Or a local_time with period greater or equal to days:
+ else if constexpr (is_convertible_v<_Tp, chrono::local_days>)
+ __os << _S_date(__t);
else // Or it's formatted as "{:L%F %T}":
{
auto __days = chrono::floor<chrono::days>(__t);
@@ -1315,7 +1318,8 @@ namespace __format
else
{
auto __str = std::format(_S_empty_spec, __ss.count());
- __out = std::format_to(_GLIBCXX_WIDEN("{:0>{}s}"),
+ __out = std::format_to(std::move(__out),
+ _GLIBCXX_WIDEN("{:0>{}s}"),
__str,
__hms.fractional_width);
}
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index aff9d5d..4861edb 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -1981,8 +1981,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_range_initialize_n(_Iterator __first, _Sentinel __last,
size_type __n)
{
- pointer __start = this->_M_impl._M_start =
+ pointer __start =
this->_M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator()));
+ this->_M_impl._M_start = this->_M_impl._M_finish = __start;
this->_M_impl._M_end_of_storage = __start + __n;
this->_M_impl._M_finish
= std::__uninitialized_copy_a(_GLIBCXX_MOVE(__first), __last,
diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def
index 737b3f4..a08b0b9 100644
--- a/libstdc++-v3/include/bits/version.def
+++ b/libstdc++-v3/include/bits/version.def
@@ -679,8 +679,6 @@ ftms = {
values = {
v = 201703;
cxxmin = 17;
- hosted = yes;
- gthread = yes;
};
};
diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h
index 59ff0ce..3f1562c 100644
--- a/libstdc++-v3/include/bits/version.h
+++ b/libstdc++-v3/include/bits/version.h
@@ -751,7 +751,7 @@
#undef __glibcxx_want_parallel_algorithm
#if !defined(__cpp_lib_scoped_lock)
-# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED
+# if (__cplusplus >= 201703L)
# define __glibcxx_scoped_lock 201703L
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_scoped_lock)
# define __cpp_lib_scoped_lock 201703L
diff --git a/libstdc++-v3/include/c_global/ccomplex b/libstdc++-v3/include/c_global/ccomplex
index 7044cf7..a39273f 100644
--- a/libstdc++-v3/include/c_global/ccomplex
+++ b/libstdc++-v3/include/c_global/ccomplex
@@ -24,6 +24,8 @@
/** @file include/ccomplex
* This is a Standard C++ Library header.
+ *
+ * @since C++11 (removed in C++20)
*/
#ifndef _GLIBCXX_CCOMPLEX
diff --git a/libstdc++-v3/include/c_global/ciso646 b/libstdc++-v3/include/c_global/ciso646
index a663e04..6dec7df 100644
--- a/libstdc++-v3/include/c_global/ciso646
+++ b/libstdc++-v3/include/c_global/ciso646
@@ -28,6 +28,8 @@
*
* This is the C++ version of the Standard C Library header @c iso646.h,
* which is empty in C++.
+ *
+ * @since C++11 (removed in C++20)
*/
#ifndef _GLIBCXX_CISO646
#define _GLIBCXX_CISO646
@@ -38,13 +40,15 @@
#include <bits/c++config.h>
-#if __cplusplus >= 202002L && ! _GLIBCXX_USE_DEPRECATED
-# error "<ciso646> is not a standard header in C++20, use <version> to detect implementation-specific macros"
-#elif __cplusplus >= 201703L && defined __DEPRECATED
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wc++23-extensions"
-# warning "<ciso646> is deprecated in C++17, use <version> to detect implementation-specific macros"
-# pragma GCC diagnostic pop
+#if __cplusplus >= 202002L
+# if ! _GLIBCXX_USE_DEPRECATED
+# error "<ciso646> is not a standard header since C++20, use <version> to detect implementation-specific macros"
+# elif defined __DEPRECATED
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wc++23-extensions"
+# warning "<ciso646> is not a standard header since C++20, use <version> to detect implementation-specific macros"
+# pragma GCC diagnostic pop
+# endif
#endif
#endif
diff --git a/libstdc++-v3/include/c_global/cstdalign b/libstdc++-v3/include/c_global/cstdalign
index 92e0ad6..41ce506 100644
--- a/libstdc++-v3/include/c_global/cstdalign
+++ b/libstdc++-v3/include/c_global/cstdalign
@@ -24,6 +24,8 @@
/** @file include/cstdalign
* This is a Standard C++ Library header.
+ *
+ * @since C++11 (removed in C++20)
*/
#ifndef _GLIBCXX_CSTDALIGN
diff --git a/libstdc++-v3/include/c_global/cstdbool b/libstdc++-v3/include/c_global/cstdbool
index e75f56c..5933d7d 100644
--- a/libstdc++-v3/include/c_global/cstdbool
+++ b/libstdc++-v3/include/c_global/cstdbool
@@ -24,6 +24,8 @@
/** @file include/cstdbool
* This is a Standard C++ Library header.
+ *
+ * @since C++11 (removed in C++20)
*/
#ifndef _GLIBCXX_CSTDBOOL
diff --git a/libstdc++-v3/include/c_global/ctgmath b/libstdc++-v3/include/c_global/ctgmath
index 0a5a0e7..b708878 100644
--- a/libstdc++-v3/include/c_global/ctgmath
+++ b/libstdc++-v3/include/c_global/ctgmath
@@ -24,6 +24,8 @@
/** @file include/ctgmath
* This is a Standard C++ Library header.
+ *
+ * @since C++11 (removed in C++20)
*/
#ifndef _GLIBCXX_CTGMATH
diff --git a/libstdc++-v3/include/std/flat_map b/libstdc++-v3/include/std/flat_map
index 6593988..de006ad 100644
--- a/libstdc++-v3/include/std/flat_map
+++ b/libstdc++-v3/include/std/flat_map
@@ -873,7 +873,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
[[nodiscard]]
friend bool
operator==(const _Derived& __x, const _Derived& __y)
- { return std::equal(__x.begin(), __x.end(), __y.begin(), __y.end()); }
+ {
+ return __x._M_cont.keys == __y._M_cont.keys
+ && __x._M_cont.values == __y._M_cont.values;
+ }
template<typename _Up = value_type>
[[nodiscard]]
@@ -895,7 +898,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
auto __guard = _M_make_clear_guard();
auto __zv = views::zip(_M_cont.keys, _M_cont.values);
- auto __sr = ranges::remove_if(__zv, __pred);
+ auto __sr = ranges::remove_if(__zv, __pred,
+ [](const auto& __e) {
+ return const_reference(__e);
+ });
auto __erased = __sr.size();
erase(end() - __erased, end());
__guard._M_disable();
@@ -1142,14 +1148,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// element access
mapped_type&
operator[](const key_type& __x)
- { return operator[]<const key_type>(__x); }
+ { return try_emplace(__x).first->second; }
mapped_type&
operator[](key_type&& __x)
- { return operator[]<key_type>(std::move(__x)); }
+ { return try_emplace(std::move(__x)).first->second; }
template<typename _Key2>
- requires same_as<remove_cvref_t<_Key2>, _Key> || __transparent_comparator<_Compare>
+ requires __transparent_comparator<_Compare>
mapped_type&
operator[](_Key2&& __x)
{ return try_emplace(std::forward<_Key2>(__x)).first->second; }
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 7d30670..7d6b752 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -2362,9 +2362,16 @@ namespace __format
const size_t __r = __str.size() - __e; // Length of remainder.
auto __overwrite = [&](_CharT* __p, size_t) {
// Apply grouping to the digits before the radix or exponent.
- auto __end = std::__add_grouping(__p, __np.thousands_sep(),
+ int __off = 0;
+ if (auto __c = __str.front(); __c == '-' || __c == '+' || __c == ' ')
+ {
+ *__p = __c;
+ __off = 1;
+ }
+ auto __end = std::__add_grouping(__p + __off, __np.thousands_sep(),
__grp.data(), __grp.size(),
- __str.data(), __str.data() + __e);
+ __str.data() + __off,
+ __str.data() + __e);
if (__r) // If there's a fractional part or exponent
{
if (__d != __str.npos)
@@ -3010,24 +3017,28 @@ namespace __format
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3944. Formatters converting sequences of char to sequences of wchar_t
- namespace __format { struct __disabled; }
+ struct __formatter_disabled
+ {
+ __formatter_disabled() = delete; // Cannot format char sequence to wchar_t
+ __formatter_disabled(const __formatter_disabled&) = delete;
+ __formatter_disabled& operator=(const __formatter_disabled&) = delete;
+ };
- // std::formatter<__disabled, C> uses the primary template, which is disabled.
template<>
struct formatter<char*, wchar_t>
- : private formatter<__format::__disabled, wchar_t> { };
+ : private __formatter_disabled { };
template<>
struct formatter<const char*, wchar_t>
- : private formatter<__format::__disabled, wchar_t> { };
+ : private __formatter_disabled { };
template<size_t _Nm>
struct formatter<char[_Nm], wchar_t>
- : private formatter<__format::__disabled, wchar_t> { };
+ : private __formatter_disabled { };
template<class _Traits, class _Allocator>
struct formatter<basic_string<char, _Traits, _Allocator>, wchar_t>
- : private formatter<__format::__disabled, wchar_t> { };
+ : private __formatter_disabled { };
template<class _Traits>
struct formatter<basic_string_view<char, _Traits>, wchar_t>
- : private formatter<__format::__disabled, wchar_t> { };
+ : private __formatter_disabled { };
#endif
/// An iterator after the last character written, and the number of
@@ -5111,13 +5122,22 @@ namespace __format
debug_string
};
- /// @cond undocumented
+ /** @brief A constant determining how a range should be formatted.
+ *
+ * The primary template of `std::format_kind` cannot be instantiated.
+ * There is a partial specialization for input ranges and you can
+ * specialize the variable template for your own cv-unqualified types
+ * that satisfy the `ranges::input_range` concept.
+ *
+ * @since C++23
+ */
template<typename _Rg>
- constexpr auto format_kind =
- __primary_template_not_defined(
- format_kind<_Rg> // you can specialize this for non-const input ranges
- );
+ constexpr auto format_kind = []{
+ static_assert(false, "cannot use primary template of 'std::format_kind'");
+ return type_identity<_Rg>{};
+ }();
+ /// @cond undocumented
template<typename _Tp>
consteval range_format
__fmt_kind()
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index b3f89c0..e575a81 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -733,7 +733,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
-#ifdef __cpp_lib_scoped_lock // C++ >= 17 && hosted && gthread
+#ifdef __cpp_lib_scoped_lock // C++ >= 17
/** @brief A scoped lock type for multiple lockable objects.
*
* A scoped_lock controls mutex ownership within a scope, releasing
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 9300c36..210ac82 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -5336,7 +5336,7 @@ namespace views::__adaptor
requires move_constructible<decay_t<_Fp>> && regular_invocable<decay_t<_Fp>&>
&& is_object_v<decay_t<invoke_result_t<decay_t<_Fp>&>>>
constexpr auto
- operator() [[nodiscard]] (_Fp&& __f) const
+ operator() [[nodiscard]] (_Fp&&) const
{
return views::empty<decay_t<invoke_result_t<decay_t<_Fp>&>>>;
}
@@ -6598,7 +6598,7 @@ namespace views::__adaptor
}
friend constexpr difference_type
- operator-(default_sentinel_t __y, const _Iterator& __x)
+ operator-(default_sentinel_t, const _Iterator& __x)
requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base>>
{ return __detail::__div_ceil(__x._M_end - __x._M_current, __x._M_n); }
@@ -7287,8 +7287,8 @@ namespace views::__adaptor
using iterator_category = decltype(_S_iter_cat());
};
- template<bool> struct _Iterator;
- template<bool> struct _Sentinel;
+ template<bool> class _Iterator;
+ template<bool> class _Sentinel;
public:
join_with_view() requires (default_initializable<_Vp>
@@ -7743,7 +7743,7 @@ namespace views::__adaptor
__detail::__box<_Tp> _M_value;
[[no_unique_address]] _Bound _M_bound = _Bound();
- struct _Iterator;
+ class _Iterator;
template<typename _Range>
friend constexpr auto
@@ -8303,7 +8303,7 @@ namespace views::__adaptor
}
friend constexpr difference_type
- operator-(default_sentinel_t __y, const _Iterator& __x)
+ operator-(default_sentinel_t, const _Iterator& __x)
requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base>>
{ return __detail::__div_ceil(__x._M_end - __x._M_current, __x._M_stride); }
diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc
index 6582f10..215afa0 100644
--- a/libstdc++-v3/src/c++17/fs_path.cc
+++ b/libstdc++-v3/src/c++17/fs_path.cc
@@ -880,6 +880,16 @@ path::operator+=(const path& p)
return *this;
}
+ // Handle p += p which would otherwise access dangling pointers after
+ // reallocating _M_cmpts and _M_pathname.
+ if (&p == this) [[unlikely]]
+ return *this += p.native();
+ // Handle p += *i where i is in [p.begin(),p.end()), for the same reason.
+ if (_M_type() == _Type::_Multi && p._M_type() != _Type::_Multi)
+ for (const path& cmpt : *this)
+ if (&cmpt == &p) [[unlikely]]
+ return *this += p.native();
+
#if _GLIBCXX_FILESYSTEM_IS_WINDOWS
if (_M_type() == _Type::_Root_name
|| (_M_type() == _Type::_Filename && _M_pathname.size() == 1))
diff --git a/libstdc++-v3/testsuite/18_support/headers/ciso646/macros-2.cc b/libstdc++-v3/testsuite/18_support/headers/ciso646/macros-2.cc
new file mode 100644
index 0000000..a492924
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/headers/ciso646/macros-2.cc
@@ -0,0 +1,7 @@
+// { dg-options " -Wdeprecated -fno-operator-names" }
+// { dg-do preprocess }
+
+// Should get a warning for C++20 and up without -D_GLIBCXX_USE_DEPRECATED=0
+// { dg-warning "not a standard header" "" { target c++20 } 0 }
+
+#include "macros.cc"
diff --git a/libstdc++-v3/testsuite/18_support/headers/ciso646/macros.cc b/libstdc++-v3/testsuite/18_support/headers/ciso646/macros.cc
index ab3a041..0cb5168 100644
--- a/libstdc++-v3/testsuite/18_support/headers/ciso646/macros.cc
+++ b/libstdc++-v3/testsuite/18_support/headers/ciso646/macros.cc
@@ -3,7 +3,6 @@
#include <ciso646>
-// { dg-warning "deprecated" "" { target c++17_only } 0 }
// { dg-error "not a standard header" "" { target c++20 } 0 }
#ifdef and
diff --git a/libstdc++-v3/testsuite/20_util/system_clock/99832.cc b/libstdc++-v3/testsuite/20_util/system_clock/99832.cc
new file mode 100644
index 0000000..693d4d6
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/system_clock/99832.cc
@@ -0,0 +1,14 @@
+// { dg-options "-O0 -g0" }
+// { dg-do compile { target c++20 } }
+// { dg-final { scan-assembler-not "system_clock9to_time_t" } }
+
+// Bug libstdc++/99832
+// std::chrono::system_clock::to_time_t needs ABI tag for 32-bit time_t
+
+#include <chrono>
+
+std::time_t
+test_pr99832(std::chrono::system_clock::time_point t)
+{
+ return std::chrono::system_clock::to_time_t(t);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/flat_map/1.cc b/libstdc++-v3/testsuite/23_containers/flat_map/1.cc
index 38fd449..d7f27a0 100644
--- a/libstdc++-v3/testsuite/23_containers/flat_map/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/flat_map/1.cc
@@ -245,12 +245,22 @@ void
test07()
{
// PR libstdc++/119427 - std::erase_if(std::flat_foo) does not work
+ // PR libstdc++/120465 - erase_if for flat_map calls predicate with incorrect type
std::flat_map<int, int> m = {std::pair{1, 2}, {3, 4}, {5, 6}};
- auto n = std::erase_if(m, [](auto x) { auto [k,v] = x; return k == 1 || v == 6; });
+ auto n = std::erase_if(m, [](auto x) { return x.first == 1 || x.second == 6; });
VERIFY( n == 2 );
VERIFY( std::ranges::equal(m, (std::pair<int,int>[]){{3,4}}) );
}
+void
+test08()
+{
+ // PR libstdc++/120432 - flat_map operator[] is broken for const lvalue keys
+ std::flat_map<int, int> m;
+ const int k = 42;
+ m[k] = 0;
+}
+
int
main()
{
@@ -264,4 +274,5 @@ main()
test05();
test06();
test07();
+ test08();
}
diff --git a/libstdc++-v3/testsuite/23_containers/flat_multimap/1.cc b/libstdc++-v3/testsuite/23_containers/flat_multimap/1.cc
index 79fbc1a..0010955 100644
--- a/libstdc++-v3/testsuite/23_containers/flat_multimap/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/flat_multimap/1.cc
@@ -223,8 +223,9 @@ void
test07()
{
// PR libstdc++/119427 - std::erase_if(std::flat_foo) does not work
+ // PR libstdc++/120465 - erase_if for flat_map calls predicate with incorrect type
std::flat_multimap<int, int> m = {std::pair{1, 2}, {3, 4}, {3, 3}, {5, 6}, {6, 6}};
- auto n = std::erase_if(m, [](auto x) { auto [k,v] = x; return k == 1 || v == 6; });
+ auto n = std::erase_if(m, [](auto x) { return x.first == 1 || x.second == 6; });
VERIFY( n == 3 );
VERIFY( std::ranges::equal(m, (std::pair<int,int>[]){{3,4},{3,3}}) );
}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc
index 7a62645..3784b9c 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/from_range.cc
@@ -106,8 +106,30 @@ test_constexpr()
return true;
}
+void
+test_pr120367()
+{
+#ifdef __cpp_exceptions
+ struct X
+ {
+ X(int) { throw 1; } // Cannot successfully construct an X.
+ ~X() { VERIFY(false); } // So should never need to destroy one.
+ };
+
+ try
+ {
+ int i[1]{};
+ std::vector<X> v(std::from_range, i);
+ }
+ catch (int)
+ {
+ }
+#endif
+}
+
int main()
{
test_ranges();
static_assert( test_constexpr() );
+ test_pr120367();
}
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/concat/120029.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/concat/120029.cc
new file mode 100644
index 0000000..5153d59
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/concat/120029.cc
@@ -0,0 +1,72 @@
+// { dg-do run { target c++17 } }
+
+// Bug libstdc++/120029
+// Dangling iterator usage in path::operator+=(const path& p) when this == p
+
+#include <filesystem>
+#include <testsuite_hooks.h>
+
+namespace fs = std::filesystem;
+
+void
+test_root_dir()
+{
+ fs::path p = "/";
+ p += p;
+ p += p;
+ VERIFY( p == "////" );
+ p += p.filename();
+ VERIFY( p == "////" );
+ p += *std::prev(p.end());
+ VERIFY( p == "////" );
+}
+
+void
+test_root_name()
+{
+ fs::path p = "C:/";
+ p += p;
+ p += p;
+ VERIFY( p == "C:/C:/C:/C:/" );
+ p += p.filename();
+ VERIFY( p == "C:/C:/C:/C:/" );
+ p += *std::prev(p.end());
+ VERIFY( p == "C:/C:/C:/C:/" );
+}
+
+void
+test_filename()
+{
+ fs::path p = "file";
+ p += p;
+ p += p;
+ VERIFY( p == "filefilefilefile" );
+ p += p.filename();
+ VERIFY( p == "filefilefilefilefilefilefilefile" );
+ p += *std::prev(p.end());
+ VERIFY( p == "filefilefilefilefilefilefilefilefilefilefilefilefilefilefilefile" );
+}
+
+void
+test_multi()
+{
+ fs::path p = "/home/username/Documents/mu";
+ p += p;
+ p += p;
+ VERIFY( p == "/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu" );
+ p += p.filename();
+ VERIFY( p == "/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mumu" );
+ p += *std::prev(p.end());
+ VERIFY( p == "/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mumumumu" );
+ auto n = std::distance(p.begin(), p.end());
+ for (int i = 0; i < n; ++i)
+ p += *std::next(p.begin(), i);
+}
+
+int main()
+{
+ test_root_dir();
+ test_root_name();
+ test_filename();
+ test_multi();
+}
diff --git a/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc
index 4cd07da..ba52b36 100644
--- a/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/30_threads/scoped_lock/requirements/typedefs.cc
@@ -1,5 +1,4 @@
// { dg-do compile { target c++17 } }
-// { dg-require-gthreads "" }
// { dg-add-options no_pch }
// Copyright (C) 2017-2025 Free Software Foundation, Inc.
@@ -29,9 +28,30 @@
# error "Feature-test macro for scoped_lock has wrong value"
#endif
+struct BasicLockable
+{
+ BasicLockable() = default;
+ ~BasicLockable() = default;
+ void lock() { }
+ void unlock() { }
+};
+
void test01()
{
- // Check for required typedefs
- typedef std::scoped_lock<std::mutex> test_type;
- typedef test_type::mutex_type mutex_type;
+ // Check for required typedef.
+ using test_type = std::scoped_lock<BasicLockable>;
+ static_assert(std::is_same_v<test_type::mutex_type, BasicLockable>);
+}
+
+template<typename T, typename = void>
+constexpr bool has_mutex_type = false;
+
+template<typename T>
+constexpr bool has_mutex_type<T, std::void_t<typename T::mutex_type>> = true;
+
+void test02()
+{
+ // Check that typedef is absent as required.
+ using test_type = std::scoped_lock<BasicLockable, BasicLockable>;
+ static_assert(!has_mutex_type<test_type>);
}
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/concat/120029.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/concat/120029.cc
new file mode 100644
index 0000000..209d968
--- /dev/null
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/concat/120029.cc
@@ -0,0 +1,74 @@
+// { dg-options "-DUSE_FILESYSTEM_TS -lstdc++fs" }
+// { dg-do run { target c++11 } }
+// { dg-require-filesystem-ts "" }
+
+// Bug libstdc++/120029
+// Dangling iterator usage in path::operator+=(const path& p) when this == p
+
+#include <experimental/filesystem>
+#include <testsuite_hooks.h>
+
+namespace fs = std::experimental::filesystem;
+
+void
+test_root_dir()
+{
+ fs::path p = "/";
+ p += p;
+ p += p;
+ VERIFY( p == "////" );
+ p += p.filename();
+ VERIFY( p == "////////" );
+ p += *std::prev(p.end());
+ VERIFY( p == "////////////////" );
+}
+
+void
+test_root_name()
+{
+ fs::path p = "C:/";
+ p += p;
+ p += p;
+ VERIFY( p == "C:/C:/C:/C:/" );
+ p += p.filename(); // For Filesystem TS the filename is "."
+ VERIFY( p == "C:/C:/C:/C:/." );
+ p += *std::prev(p.end());
+ VERIFY( p == "C:/C:/C:/C:/.." );
+}
+
+void
+test_filename()
+{
+ fs::path p = "file";
+ p += p;
+ p += p;
+ VERIFY( p == "filefilefilefile" );
+ p += p.filename();
+ VERIFY( p == "filefilefilefilefilefilefilefile" );
+ p += *std::prev(p.end());
+ VERIFY( p == "filefilefilefilefilefilefilefilefilefilefilefilefilefilefilefile" );
+}
+
+void
+test_multi()
+{
+ fs::path p = "/home/username/Documents/mu";
+ p += p;
+ p += p;
+ VERIFY( p == "/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu" );
+ p += p.filename();
+ VERIFY( p == "/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mumu" );
+ p += *std::prev(p.end());
+ VERIFY( p == "/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mu/home/username/Documents/mumumumu" );
+ auto n = std::distance(p.begin(), p.end());
+ for (int i = 0; i < n; ++i)
+ p += *std::next(p.begin(), i);
+}
+
+int main()
+{
+ test_root_dir();
+ test_root_name();
+ test_filename();
+ test_multi();
+}
diff --git a/libstdc++-v3/testsuite/std/format/formatter/120625.cc b/libstdc++-v3/testsuite/std/format/formatter/120625.cc
new file mode 100644
index 0000000..6b03af9
--- /dev/null
+++ b/libstdc++-v3/testsuite/std/format/formatter/120625.cc
@@ -0,0 +1,19 @@
+// { dg-do compile { target c++20 } }
+
+// Bug libstdc++/120625
+// std::formatter<__disabled> specializations cause errors in user code
+
+#include <format>
+
+enum X { };
+
+// A concept that cannot be used with incomplete types:
+template<typename T>
+concept is_X = !std::is_empty_v<T> && std::is_same_v<X, T>;
+
+// A valid program-defined specialization:
+template<typename T, typename C> requires is_X<T>
+struct std::formatter<T, C> : std::formatter<int, C> { };
+
+// Instantiate the program-defined formatter specialization:
+auto s = sizeof(std::formatter<X, char>);
diff --git a/libstdc++-v3/testsuite/std/format/functions/format.cc b/libstdc++-v3/testsuite/std/format/functions/format.cc
index 93c33b4..6f6f1f1 100644
--- a/libstdc++-v3/testsuite/std/format/functions/format.cc
+++ b/libstdc++-v3/testsuite/std/format/functions/format.cc
@@ -260,6 +260,16 @@ test_locale()
s = std::format(eloc, "{0:Le} {0:Lf} {0:Lg}", -nan);
VERIFY( s == "-nan -nan -nan" );
+ // PR libstdc++/120548 format confuses a negative sign for a thousands digit
+ s = std::format(bloc, "{:L}", -123.45);
+ VERIFY( s == "-123.45" );
+ s = std::format(bloc, "{:-L}", -876543.21);
+ VERIFY( s == "-876,543.21" );
+ s = std::format(bloc, "{:+L}", 333.22);
+ VERIFY( s == "+333.22" );
+ s = std::format(bloc, "{: L}", 999.44);
+ VERIFY( s == " 999.44" );
+
// Restore
std::locale::global(cloc);
}
diff --git a/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc b/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc
index bf8619d..0d761ae 100644
--- a/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc
+++ b/libstdc++-v3/testsuite/std/format/ranges/format_kind_neg.cc
@@ -5,9 +5,14 @@
#include <format>
-template<auto> struct Tester { };
+void test()
+{
+ (void) std::format_kind<void>; // { dg-error "here" }
+ (void) std::format_kind<const void>; // { dg-error "here" }
+ (void) std::format_kind<int>; // { dg-error "here" }
+ (void) std::format_kind<int&>; // { dg-error "here" }
+ (void) std::format_kind<const int(&)[10]>; // { dg-error "here" }
+ (void) std::format_kind<void()>; // { dg-error "here" }
+}
-Tester<std::format_kind<const int(&)[1]>> t; // { dg-error "here" }
-
-// { dg-error "use of 'std::format_kind" "" { target *-*-* } 0 }
-// { dg-error "primary_template_not_defined" "" { target *-*-* } 0 }
+// { dg-error "cannot use primary template of 'std::format_kind'" "" { target *-*-* } 0 }
diff --git a/libstdc++-v3/testsuite/std/time/clock/local/io.cc b/libstdc++-v3/testsuite/std/time/clock/local/io.cc
index b4d562f..67818e8 100644
--- a/libstdc++-v3/testsuite/std/time/clock/local/io.cc
+++ b/libstdc++-v3/testsuite/std/time/clock/local/io.cc
@@ -89,6 +89,9 @@ test_format()
s = std::format("{}", local_seconds{});
VERIFY( s == "1970-01-01 00:00:00" );
+
+ s = std::format("{}", local_days{}); // PR libstdc++/120293
+ VERIFY( s == "1970-01-01" );
}
void
diff --git a/libstdc++-v3/testsuite/util/pstl/test_utils.h b/libstdc++-v3/testsuite/util/pstl/test_utils.h
index 55b5100..9c61a714 100644
--- a/libstdc++-v3/testsuite/util/pstl/test_utils.h
+++ b/libstdc++-v3/testsuite/util/pstl/test_utils.h
@@ -154,7 +154,7 @@ class ForwardIterator
explicit ForwardIterator(Iterator i) : my_iterator(i) {}
reference operator*() const { return *my_iterator; }
Iterator operator->() const { return my_iterator; }
- ForwardIterator
+ ForwardIterator&
operator++()
{
++my_iterator;
@@ -194,13 +194,13 @@ class BidirectionalIterator : public ForwardIterator<Iterator, IteratorTag>
explicit BidirectionalIterator(Iterator i) : base_type(i) {}
BidirectionalIterator(const base_type& i) : base_type(i.iterator()) {}
- BidirectionalIterator
+ BidirectionalIterator&
operator++()
{
++base_type::my_iterator;
return *this;
}
- BidirectionalIterator
+ BidirectionalIterator&
operator--()
{
--base_type::my_iterator;