aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog117
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/avoid-store-forwarding.cc18
-rw-r--r--gcc/c-family/c-attribs.cc3
-rw-r--r--gcc/c-family/c-opts.cc11
-rw-r--r--gcc/c/c-decl.cc8
-rw-r--r--gcc/c/c-parser.cc48
-rw-r--r--gcc/c/c-typeck.cc31
-rw-r--r--gcc/cobol/ChangeLog69
-rw-r--r--gcc/cobol/cobol1.cc8
-rw-r--r--gcc/cobol/dts.h2
-rw-r--r--gcc/cobol/except.cc2
-rw-r--r--gcc/cobol/gcobolspec.cc13
-rw-r--r--gcc/cobol/genapi.cc3
-rw-r--r--gcc/cobol/gengen.cc15
-rw-r--r--gcc/cobol/genmath.cc25
-rw-r--r--gcc/cobol/genutil.cc80
-rw-r--r--gcc/cobol/genutil.h6
-rw-r--r--gcc/cobol/lexio.cc31
-rw-r--r--gcc/cobol/lexio.h4
-rw-r--r--gcc/cobol/scan_ante.h3
-rw-r--r--gcc/cobol/symbols.cc50
-rw-r--r--gcc/cobol/symfind.cc14
-rw-r--r--gcc/cobol/util.cc79
-rw-r--r--gcc/common.opt10
-rw-r--r--gcc/common.opt.urls6
-rw-r--r--gcc/config/aarch64/aarch64-simd.md25
-rw-r--r--gcc/config/aarch64/aarch64-sme.md6
-rw-r--r--gcc/config/aarch64/aarch64-sve.md26
-rw-r--r--gcc/config/aarch64/aarch64-tuning-flags.def2
-rw-r--r--gcc/config/aarch64/aarch64.cc7
-rw-r--r--gcc/config/aarch64/aarch64.h5
-rw-r--r--gcc/config/aarch64/aarch64.md11
-rw-r--r--gcc/config/aarch64/atomics.md20
-rw-r--r--gcc/config/aarch64/tuning_models/cortexx925.h3
-rw-r--r--gcc/config/aarch64/tuning_models/neoversev2.h3
-rw-r--r--gcc/config/aarch64/tuning_models/neoversev3.h3
-rw-r--r--gcc/config/aarch64/tuning_models/neoversev3ae.h3
-rw-r--r--gcc/config/gcn/gcn-valu.md6
-rw-r--r--gcc/config/riscv/mips-insn.md35
-rw-r--r--gcc/config/riscv/riscv-cores.def3
-rw-r--r--gcc/config/riscv/riscv-ext-mips.def35
-rw-r--r--gcc/config/riscv/riscv-ext.def1
-rw-r--r--gcc/config/riscv/riscv-ext.opt4
-rw-r--r--gcc/config/riscv/riscv.cc107
-rw-r--r--gcc/config/riscv/riscv.md3
-rw-r--r--gcc/config/riscv/t-riscv3
-rw-r--r--gcc/cp/constexpr.cc18
-rw-r--r--gcc/cp/cp-gimplify.cc13
-rw-r--r--gcc/cp/cvt.cc13
-rw-r--r--gcc/cp/decl.cc8
-rw-r--r--gcc/cp/expr.cc14
-rw-r--r--gcc/cp/module.cc3
-rw-r--r--gcc/cp/semantics.cc5
-rw-r--r--gcc/cp/typeck.cc28
-rw-r--r--gcc/diagnostic-spec.cc4
-rw-r--r--gcc/doc/invoke.texi75
-rw-r--r--gcc/doc/riscv-ext.texi4
-rw-r--r--gcc/fortran/gfortran.h4
-rw-r--r--gcc/fortran/resolve.cc20
-rw-r--r--gcc/fortran/trans-array.cc229
-rw-r--r--gcc/fortran/trans-expr.cc35
-rw-r--r--gcc/fortran/trans-openmp.cc5
-rw-r--r--gcc/gimple-ssa-store-merging.cc4
-rw-r--r--gcc/go/gofrontend/gogo.cc3
-rw-r--r--gcc/ipa-strub.cc2
-rw-r--r--gcc/testsuite/ChangeLog166
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-1.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-2.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-3.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-4.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-5.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-parm-6.c50
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-19.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-20.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-21.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-22.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-23.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-24.c60
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-7.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp26/decomp25.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp26/name-independent-decl1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-union9.C33
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-parm-12.C59
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-parm-13.C59
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-2.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-40.C69
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-41.C69
-rw-r--r--gcc/testsuite/gcc.dg/memchr-3.c3
-rw-r--r--gcc/testsuite/gcc.dg/unused-9.c9
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr121059.c24
-rw-r--r--gcc/testsuite/gcc.target/aarch64/avoid-store-forwarding-be.c23
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldapr-sext.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldapur.c77
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ldapur_avoid.c37
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/eor3_d.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_2.c35
-rw-r--r--gcc/testsuite/gcc.target/riscv/mipscondmov.c29
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/pr104428.f9015
-rw-r--r--gcc/tree-vect-stmts.cc7
-rw-r--r--gcc/tree.cc1
-rw-r--r--libgcc/config/libbid/bid_binarydecimal.c1
-rw-r--r--libstdc++-v3/ChangeLog48
-rw-r--r--libstdc++-v3/include/bits/chrono_io.h154
-rw-r--r--libstdc++-v3/include/bits/functional_hash.h9
-rw-r--r--libstdc++-v3/include/bits/move.h30
-rw-r--r--libstdc++-v3/include/bits/ranges_base.h20
-rw-r--r--libstdc++-v3/include/bits/ranges_uninitialized.h26
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h2
-rw-r--r--libstdc++-v3/include/bits/unique_ptr.h2
-rw-r--r--libstdc++-v3/include/experimental/memory22
-rw-r--r--libstdc++-v3/include/std/array2
-rw-r--r--libstdc++-v3/include/std/optional2
-rw-r--r--libstdc++-v3/include/std/ranges9
-rw-r--r--libstdc++-v3/include/std/tuple4
-rw-r--r--libstdc++-v3/include/std/type_traits7
-rw-r--r--libstdc++-v3/include/std/variant2
-rwxr-xr-xlibstdc++-v3/scripts/gen_windows_zones_map.py115
-rw-r--r--libstdc++-v3/src/c++20/tzdb.cc136
-rw-r--r--libstdc++-v3/src/c++20/windows_zones-map.h399
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/int128.cc20
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/int128.cc14
-rw-r--r--libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/121024.cc77
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/copy/debug/constexpr_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/equal/debug/constexpr_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/memory/observer_ptr/make_observer.cc11
-rw-r--r--libstdc++-v3/testsuite/experimental/memory/observer_ptr/relops/relops.cc28
-rw-r--r--libstdc++-v3/testsuite/experimental/memory/observer_ptr/swap/swap.cc20
-rw-r--r--libstdc++-v3/testsuite/std/ranges/adaptors/join.cc8
-rw-r--r--libstdc++-v3/testsuite/std/ranges/adaptors/join_with/1.cc8
-rw-r--r--libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc8
141 files changed, 3484 insertions, 602 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5d5acc6..6c139d7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,120 @@
+2025-07-14 Andrew Stubbs <ams@baylibre.com>
+
+ * config/gcn/gcn-valu.md (vec_cmpu<mode>di_exec): Call gen_vec_cmp*,
+ not gen_vec_cmpu*.
+
+2025-07-14 Richard Biener <rguenther@suse.de>
+
+ Revert:
+ 2025-07-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121059
+ * tree-vect-stmts.cc (vectorizable_operation): Record a
+ loop mask for mask AND operations.
+
+2025-07-14 Juergen Christ <jchrist@linux.ibm.com>
+
+ * config/s390/vector.md (reduc_plus_scal_<mode>): Implement.
+ (reduc_plus_scal_v2df): Implement.
+ (reduc_plus_scal_v4sf): Implement.
+ (REDUC_FMINMAX): New int iterator.
+ (reduc_fminmax_name): New int attribute.
+ (reduc_minmax): New code iterator.
+ (reduc_minmax_name): New code attribute.
+ (reduc_<reduc_fminmax_name>_scal_v2df): Implement.
+ (reduc_<reduc_fminmax_name>_scal_v4sf): Implement.
+ (reduc_<reduc_minmax_name>_scal_v2df): Implement.
+ (reduc_<reduc_minmax_name>_scal_v4sf): Implement.
+ (REDUCBIN): New code iterator.
+ (reduc_bin_insn): New code attribute.
+ (reduc_<reduc_bin_insn>_scal_v2di): Implement.
+ (reduc_<reduc_bin_insn>_scal_v4si): Implement.
+ (reduc_<reduc_bin_insn>_scal_v8hi): Implement.
+ (reduc_<reduc_bin_insn>_scal_v16qi): Implement.
+
+2025-07-14 Juergen Christ <jchrist@linux.ibm.com>
+
+ * config/s390/s390.cc (s390_option_override_internal): Remove override.
+
+2025-07-14 Andrew Stubbs <ams@baylibre.com>
+
+ * config/gcn/gcn-valu.md (add<mode>3<exec_clobber>): Rename ...
+ (add<mode>3<exec>): ... to this, remove the clobber, and change the
+ instruction from v_add_co_u32 to v_add_u32.
+ (add<mode>3_dup<exec_clobber>): Rename ...
+ (add<mode>3_dup<exec>): ... to this, and likewise.
+ (sub<mode>3<exec_clobber>): Rename ...
+ (sub<mode>3<exec>): ... to this, and likewise
+ * config/gcn/gcn.md (addsi3): Remove the DI clobber, and change the
+ instruction from v_add_co_u32 to v_add_u32.
+ (addsi3_scc): Likewise.
+ (subsi3): Likewise, but for v_sub_co_u32.
+ (muldi3): Likewise.
+
+2025-07-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121059
+ * tree-vect-stmts.cc (vectorizable_operation): Record a
+ loop mask for mask AND operations.
+
+2025-07-14 Pan Li <pan2.li@intel.com>
+
+ * match.pd: Make sure widen mul has twice bitsize
+ of the inputs in SAT_MUL pattern.
+
+2025-07-14 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/121015
+ * config/i386/i386-features.cc (ix86_broadcast_inner): Check all
+ 0s/1s vectors with standard_sse_constant_p.
+
+2025-07-14 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/120881
+ * config.in: Regenerated.
+ * configure: Likewise.
+ * configure.ac: Add --enable-x86-64-mfentry.
+ * config/i386/i386-options.cc (ix86_option_override_internal):
+ Enable __fentry__ in 64-bit mode if ENABLE_X86_64_MFENTRY is set
+ to 1. Warn -pg without -mfentry with shrink wrapping enabled.
+ * doc/install.texi: Document --enable-x86-64-mfentry.
+
+2025-07-14 François-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR target/120645
+ * config/darwin-driver.cc: Account for latest macOS numbering
+ scheme.
+
+2025-07-14 Paul-Antoine Arras <parras@baylibre.com>
+
+ PR target/119100
+ * config/riscv/autovec-opt.md (*vfwmacc_vf_<mode>): New pattern to
+ handle both vfwmacc and vfwmsac.
+ (*extend_vf_<mode>): New pattern that serves as an intermediate combine
+ step.
+ * config/riscv/vector-iterators.md (vsubel): New mode attribute. This is
+ just the lower-case version of VSUBEL.
+ * config/riscv/vector.md (@pred_widen_mul_<optab><mode>_scalar): Reorder
+ and swap operands to match the RTL emitted by expand, i.e. first
+ float_extend then vec_duplicate.
+
+2025-07-14 Alfie Richards <alfie.richards@arm.com>
+
+ * config/aarch64/aarch64-sme.md (@aarch64_sme_<faminmax_uns_op><mode>):
+ New patterns.
+ * config/aarch64/aarch64-sve-builtins-sme.def (svamin): New intrinsics.
+ (svamax): New intrinsics.
+ * config/aarch64/aarch64-sve-builtins-sve2.cc (class faminmaximpl): New
+ class.
+ (svamin): New function.
+ (svamax): New function.
+
+2025-07-14 Haochen Jiang <haochen.jiang@intel.com>
+
+ * config/i386/i386.h (PTA_PANTHERLAKE): Revmoe KL and WIDEKL.
+ (PTA_CLEARWATERFOREST): Ditto.
+ * doc/invoke.texi: Revise documentation.
+
2025-07-13 Andrew Pinski <quic_apinski@quicinc.com>
PR middle-end/120866
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index eaad352..5c2a452 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20250714
+20250715
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 49b4b95..b66c7ba 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2025-07-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/121056
+ * sem_ch4.adb (Try_Object_Operation.Try_Primitive_Operation): Add
+ test on Is_Record_Type before accessing Underlying_Record_View.
+
2025-07-10 Jakub Jelinek <jakub@redhat.com>
* par-load.adb: Comment spelling fix: bellow -> below.
diff --git a/gcc/avoid-store-forwarding.cc b/gcc/avoid-store-forwarding.cc
index 37e0953..785efd2 100644
--- a/gcc/avoid-store-forwarding.cc
+++ b/gcc/avoid-store-forwarding.cc
@@ -119,17 +119,6 @@ generate_bit_insert_sequence (store_fwd_info *store_info, rtx dest)
unsigned HOST_WIDE_INT bitsize = store_size * BITS_PER_UNIT;
unsigned HOST_WIDE_INT start = store_info->offset * BITS_PER_UNIT;
- /* Adjust START for machines with BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN.
- Given that the bytes will be reversed in this case, we need to
- calculate the starting position from the end of the destination
- register. */
- if (BITS_BIG_ENDIAN != BYTES_BIG_ENDIAN)
- {
- unsigned HOST_WIDE_INT load_mode_bitsize
- = (GET_MODE_BITSIZE (GET_MODE (dest))).to_constant ();
- start = load_mode_bitsize - bitsize - start;
- }
-
rtx mov_reg = store_info->mov_reg;
store_bit_field (dest, bitsize, start, 0, 0, GET_MODE (mov_reg), mov_reg,
false, false);
@@ -248,11 +237,14 @@ process_store_forwarding (vec<store_fwd_info> &stores, rtx_insn *load_insn,
{
it->mov_reg = gen_reg_rtx (GET_MODE (it->store_mem));
rtx_insn *insns = NULL;
- const bool has_zero_offset = it->offset == 0;
+ const bool has_base_offset
+ = known_eq (poly_uint64 (it->offset),
+ subreg_size_lowpart_offset (MEM_SIZE (it->store_mem),
+ load_size));
/* If we're eliminating the load then find the store with zero offset
and use it as the base register to avoid a bit insert if possible. */
- if (load_elim && has_zero_offset)
+ if (load_elim && has_base_offset)
{
start_sequence ();
diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc
index 5d7a31f..ac21534 100644
--- a/gcc/c-family/c-attribs.cc
+++ b/gcc/c-family/c-attribs.cc
@@ -5858,8 +5858,7 @@ build_attr_access_from_parms (tree parms, bool skip_voidptr)
order. */
vblist = tree_cons (NULL_TREE, argvbs, vblist);
- unsigned nelts = 0;
- for (tree vb = argvbs; vb; vb = TREE_CHAIN (vb), ++nelts)
+ for (tree vb = argvbs; vb; vb = TREE_CHAIN (vb))
{
tree bound = TREE_VALUE (vb);
if (const unsigned *psizpos = arg2pos.get (bound))
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index 872bdf4..795f5a3 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -1226,6 +1226,17 @@ c_common_post_options (const char **pfilename)
SET_OPTION_IF_UNSET (&global_options, &global_options_set,
flag_range_for_ext_temps, cxx_dialect >= cxx23);
+ /* EnabledBy unfortunately can't specify value to use if set and
+ LangEnabledBy can't specify multiple options with &&. For -Wunused
+ or -Wunused -Wextra we want these to default to 3 unless user specified
+ some other level explicitly. */
+ if (warn_unused_but_set_parameter == 1)
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_unused_but_set_parameter, 3);
+ if (warn_unused_but_set_variable == 1)
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_unused_but_set_variable, 3);
+
/* -fimmediate-escalation has no effect when immediate functions are not
supported. */
if (flag_immediate_escalation && cxx_dialect < cxx20)
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index 8bbd6eb..acbe2b88 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -1363,7 +1363,7 @@ pop_scope (void)
case VAR_DECL:
/* Warnings for unused variables. */
if ((!TREE_USED (p) || !DECL_READ_P (p))
- && !warning_suppressed_p (p, OPT_Wunused_but_set_variable)
+ && !warning_suppressed_p (p, OPT_Wunused_but_set_variable_)
&& !DECL_IN_SYSTEM_HEADER (p)
&& DECL_NAME (p)
&& !DECL_ARTIFICIAL (p)
@@ -1377,7 +1377,7 @@ pop_scope (void)
}
else if (DECL_CONTEXT (p) == current_function_decl)
warning_at (DECL_SOURCE_LOCATION (p),
- OPT_Wunused_but_set_variable,
+ OPT_Wunused_but_set_variable_,
"variable %qD set but not used", p);
}
@@ -11465,9 +11465,9 @@ finish_function (location_t end_loc)
&& !DECL_READ_P (decl)
&& DECL_NAME (decl)
&& !DECL_ARTIFICIAL (decl)
- && !warning_suppressed_p (decl, OPT_Wunused_but_set_parameter))
+ && !warning_suppressed_p (decl, OPT_Wunused_but_set_parameter_))
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_parameter,
+ OPT_Wunused_but_set_parameter_,
"parameter %qD set but not used", decl);
}
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 0c3e3e2..5119841 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -10547,15 +10547,31 @@ c_parser_unary_expression (c_parser *parser)
c_parser_consume_token (parser);
exp_loc = c_parser_peek_token (parser)->location;
op = c_parser_cast_expression (parser, NULL);
-
- op = default_function_array_read_conversion (exp_loc, op);
+ if ((VAR_P (op.value) || TREE_CODE (op.value) == PARM_DECL)
+ && !DECL_READ_P (op.value)
+ && (VAR_P (op.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1)
+ {
+ op = default_function_array_read_conversion (exp_loc, op);
+ DECL_READ_P (op.value) = 0;
+ }
+ else
+ op = default_function_array_read_conversion (exp_loc, op);
return parser_build_unary_op (op_loc, PREINCREMENT_EXPR, op);
case CPP_MINUS_MINUS:
c_parser_consume_token (parser);
exp_loc = c_parser_peek_token (parser)->location;
op = c_parser_cast_expression (parser, NULL);
-
- op = default_function_array_read_conversion (exp_loc, op);
+ if ((VAR_P (op.value) || TREE_CODE (op.value) == PARM_DECL)
+ && !DECL_READ_P (op.value)
+ && (VAR_P (op.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1)
+ {
+ op = default_function_array_read_conversion (exp_loc, op);
+ DECL_READ_P (op.value) = 0;
+ }
+ else
+ op = default_function_array_read_conversion (exp_loc, op);
return parser_build_unary_op (op_loc, PREDECREMENT_EXPR, op);
case CPP_AND:
c_parser_consume_token (parser);
@@ -13933,7 +13949,17 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
start = expr.get_start ();
finish = c_parser_peek_token (parser)->get_finish ();
c_parser_consume_token (parser);
- expr = default_function_array_read_conversion (expr_loc, expr);
+ if ((VAR_P (expr.value) || TREE_CODE (expr.value) == PARM_DECL)
+ && !DECL_READ_P (expr.value)
+ && (VAR_P (expr.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1
+ && TREE_CODE (TREE_TYPE (expr.value)) != ARRAY_TYPE)
+ {
+ expr = default_function_array_read_conversion (expr_loc, expr);
+ DECL_READ_P (expr.value) = 0;
+ }
+ else
+ expr = default_function_array_read_conversion (expr_loc, expr);
expr.value = build_unary_op (op_loc, POSTINCREMENT_EXPR,
expr.value, false);
set_c_expr_source_range (&expr, start, finish);
@@ -13945,7 +13971,17 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
start = expr.get_start ();
finish = c_parser_peek_token (parser)->get_finish ();
c_parser_consume_token (parser);
- expr = default_function_array_read_conversion (expr_loc, expr);
+ if ((VAR_P (expr.value) || TREE_CODE (expr.value) == PARM_DECL)
+ && !DECL_READ_P (expr.value)
+ && (VAR_P (expr.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1
+ && TREE_CODE (TREE_TYPE (expr.value)) != ARRAY_TYPE)
+ {
+ expr = default_function_array_read_conversion (expr_loc, expr);
+ DECL_READ_P (expr.value) = 0;
+ }
+ else
+ expr = default_function_array_read_conversion (expr_loc, expr);
expr.value = build_unary_op (op_loc, POSTDECREMENT_EXPR,
expr.value, false);
set_c_expr_source_range (&expr, start, finish);
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 9a5eb0d..5d11e57 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -2310,14 +2310,30 @@ mark_exp_read (tree exp)
case PARM_DECL:
DECL_READ_P (exp) = 1;
break;
+ CASE_CONVERT:
+ if (VOID_TYPE_P (TREE_TYPE (exp)))
+ switch (TREE_CODE (TREE_OPERAND (exp, 0)))
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ return;
+ default:
+ break;
+ }
+ /* FALLTHRU */
case ARRAY_REF:
case COMPONENT_REF:
case MODIFY_EXPR:
case REALPART_EXPR:
case IMAGPART_EXPR:
- CASE_CONVERT:
case ADDR_EXPR:
case VIEW_CONVERT_EXPR:
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
mark_exp_read (TREE_OPERAND (exp, 0));
break;
case COMPOUND_EXPR:
@@ -7308,8 +7324,21 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype,
newrhs = build1 (EXCESS_PRECISION_EXPR, TREE_TYPE (rhs),
newrhs);
}
+ bool clear_decl_read = false;
+ if ((VAR_P (lhs) || TREE_CODE (lhs) == PARM_DECL)
+ && !DECL_READ_P (lhs)
+ && (VAR_P (lhs) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 2)
+ {
+ mark_exp_read (newrhs);
+ if (!DECL_READ_P (lhs))
+ clear_decl_read = true;
+ }
+
newrhs = build_binary_op (location,
modifycode, lhs, newrhs, true);
+ if (clear_decl_read)
+ DECL_READ_P (lhs) = 0;
/* The original type of the right hand side is no longer
meaningful. */
diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog
index 9ab294d..c294ade 100644
--- a/gcc/cobol/ChangeLog
+++ b/gcc/cobol/ChangeLog
@@ -1,3 +1,72 @@
+2025-07-14 Robert Dubner <rdubner@symas.com>
+
+ * cobol1.cc (cobol_langhook_handle_option): Eliminate cppcheck warnings.
+ * dts.h: Likewise.
+ * except.cc (cbl_enabled_exceptions_t::dump): Likewise.
+ * gcobolspec.cc (lang_specific_driver): Likewise.
+ * genapi.cc (parser_file_merge): Likewise.
+ * gengen.cc (gg_unique_in_function): Likewise.
+ (gg_declare_variable): Likewise.
+ (gg_peek_fn_decl): Likewise.
+ (gg_define_function): Likewise.
+ * genmath.cc (set_up_on_exception_label): Likewise.
+ (set_up_compute_error_label): Likewise.
+ (arithmetic_operation): Likewise.
+ (fast_divide): Likewise.
+ * genutil.cc (get_and_check_refstart_and_reflen): Likewise.
+ (get_depending_on_value_from_odo): Likewise.
+ (get_data_offset): Likewise.
+ (get_binary_value): Likewise.
+ (process_this_exception): Likewise.
+ (copy_little_endian_into_place): Likewise.
+ (refer_is_clean): Likewise.
+ (refer_fill_depends): Likewise.
+ * genutil.h (process_this_exception): Likewise.
+ (copy_little_endian_into_place): Likewise.
+ (refer_is_clean): Likewise.
+ * lexio.cc (check_push_pop_directive): Likewise.
+ (check_source_format_directive): Likewise.
+ (location_in): Likewise.
+ (lexer_input): Likewise.
+ (cdftext::lex_open): Likewise.
+ (lexio_dialect_mf): Likewise.
+ (valid_sequence_area): Likewise.
+ (cdftext::free_form_reference_format): Likewise.
+ (cdftext::segment_line): Likewise.
+ * lexio.h (struct span_t): Likewise.
+ * scan_ante.h (trim_location): Likewise.
+ * symbols.cc (symbol_elem_cmp): Likewise.
+ (symbol_alphabet): Likewise.
+ (end_of_group): Likewise.
+ (cbl_field_t::attr_str): Likewise.
+ (symbols_update): Likewise.
+ (symbol_typedef_add): Likewise.
+ (symbol_field_add): Likewise.
+ (new_temporary_impl): Likewise.
+ (symbol_label_section_exists): Likewise.
+ (symbol_program_callables): Likewise.
+ (file_status_status_of): Likewise.
+ * symfind.cc (is_data_field): Likewise.
+ (finalize_symbol_map2): Likewise.
+ (class in_scope): Likewise.
+ (symbol_match2): Likewise.
+ * util.cc (get_current_dir_name): Likewise.
+ (gb4): Likewise.
+ (class cdf_directives_t): Likewise.
+ (cbl_field_t::report_invalid_initial_value): Likewise.
+ (literal_subscript_oob): Likewise.
+ (cbl_refer_t::str): Likewise.
+ (date_time_fmt): Likewise.
+ (class unique_stack): Likewise.
+ (cobol_set_pp_option): Likewise.
+ (cobol_filename): Likewise.
+ (cobol_filename_restore): Likewise.
+ (gcc_location_set_impl): Likewise.
+ (ydferror): Likewise.
+ (error_msg_direct): Likewise.
+ (yyerror): Likewise.
+ (cbl_unimplemented_at): Likewise.
+
2025-07-13 Robert Dubner <rdubner@symas.com>
* Make-lang.in: Eliminate the .cc.o override.
diff --git a/gcc/cobol/cobol1.cc b/gcc/cobol/cobol1.cc
index 4bd79f1..3146da5 100644
--- a/gcc/cobol/cobol1.cc
+++ b/gcc/cobol/cobol1.cc
@@ -357,7 +357,7 @@ cobol_langhook_handle_option (size_t scode,
return true;
case OPT_M:
- cobol_set_pp_option('M');
+ cobol_set_pp_option('M');
return true;
case OPT_fstatic_call:
@@ -368,16 +368,18 @@ cobol_langhook_handle_option (size_t scode,
wsclear(cobol_default_byte);
return true;
- case OPT_fflex_debug:
+ case OPT_fflex_debug: // cppcheck-suppress syntaxError // The need for this is a mystery
yy_flex_debug = 1;
cobol_set_debugging( true, yy_debug == 1, cobol_trace_debug == 1 );
return true;
+
case OPT_fyacc_debug:
yy_debug = 1;
cobol_set_debugging(yy_flex_debug == 1,
true,
cobol_trace_debug == 1 );
return true;
+
case OPT_ftrace_debug:
cobol_set_debugging( yy_flex_debug == 1, yy_debug == 1, true );
return true;
@@ -406,11 +408,13 @@ cobol_langhook_handle_option (size_t scode,
case OPT_fsyntax_only:
mode_syntax_only(identification_div_e);
break;
+
case OPT_preprocess:
if( ! preprocess_filter_add(arg) ) {
cbl_errx( "could not execute preprocessor %s", arg);
}
return true;
+
case OPT_include:
if( ! include_file_add(arg) ) {
cbl_errx( "could not include %s", arg);
diff --git a/gcc/cobol/dts.h b/gcc/cobol/dts.h
index e12b979..c900c45 100644
--- a/gcc/cobol/dts.h
+++ b/gcc/cobol/dts.h
@@ -110,6 +110,6 @@ namespace dts {
} );
return true;
}
-};
+}
diff --git a/gcc/cobol/except.cc b/gcc/cobol/except.cc
index e42aea2..df1c7df 100644
--- a/gcc/cobol/except.cc
+++ b/gcc/cobol/except.cc
@@ -96,7 +96,7 @@ cbl_enabled_exceptions_t::dump() const {
return;
}
int i = 1;
- for( auto& elem : *this ) {
+ for( auto& elem : *this ) { // cppcheck-suppress constVariableReference
dbgmsg("cbl_enabled_exceptions_t: %2d {%s, %s, %lu}",
i++,
elem.location? "with location" : " no location",
diff --git a/gcc/cobol/gcobolspec.cc b/gcc/cobol/gcobolspec.cc
index 70784d7..038aaec 100644
--- a/gcc/cobol/gcobolspec.cc
+++ b/gcc/cobol/gcobolspec.cc
@@ -142,9 +142,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
int n_infiles = 0;
int n_outfiles = 0;
- // The number of input files when the language is "none" or "cobol"
- int n_cobol_files = 0;
-
// saw_OPT_no_main means "don't expect -main"
bool saw_OPT_no_main = false;
@@ -234,11 +231,6 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
case OPT_SPECIAL_input_file:
no_files_error = false;
n_infiles += 1;
- if( strcmp(language, "none") == 0
- || strcmp(language, "cobol") == 0 )
- {
- n_cobol_files += 1;
- }
if( strstr(decoded_options[i].orig_option_with_args_text, "libgcobol.a") )
{
// We have been given an explicit libgcobol.a. We need to note that.
@@ -529,7 +521,8 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
// cl_decoded_option
size_t new_option_count = new_opt.size();
- struct cl_decoded_option *new_options = XNEWVEC (struct cl_decoded_option, new_option_count);
+ struct cl_decoded_option *new_options = XNEWVEC (struct cl_decoded_option,
+ new_option_count);
for(size_t i=0; i<new_option_count; i++)
{
@@ -539,7 +532,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
#ifdef NOISY
verbose = true;
#endif
- if( verbose && new_options != original_options )
+ if( verbose && new_options != original_options ) // cppcheck-suppress knownConditionTrueFalse
{
fprintf(stderr, _("Driving: (" HOST_SIZE_T_PRINT_DEC ")\n"),
(fmt_size_t)new_option_count);
diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index 23a6622..a293912 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -12315,7 +12315,8 @@ parser_file_merge( cbl_file_t *workfile,
ELSE
ENDIF
- cbl_enabled_exceptions_t& enabled_exceptions( cdf_enabled_exceptions() );
+ const cbl_enabled_exceptions_t&
+ enabled_exceptions( cdf_enabled_exceptions() );
for(size_t i=0; i<ninputs; i++)
{
diff --git a/gcc/cobol/gengen.cc b/gcc/cobol/gengen.cc
index 2b688d6..7395350 100644
--- a/gcc/cobol/gengen.cc
+++ b/gcc/cobol/gengen.cc
@@ -140,7 +140,7 @@ struct cbl_translation_unit_t gg_trans_unit;
// the compiler when a source code module makes that mistake.
static std::unordered_set<std::string> names_we_have_seen;
-// This vector is used to process the function_decls at the point we leave
+// This vector is used to process the function_decls at the point we leave
// the file.
static std::vector<tree> finalized_function_decls;
@@ -893,7 +893,7 @@ gg_create_assembler_name(const char *cobol_name)
static char *
gg_unique_in_function(const char *var_name, gg_variable_scope_t vs_scope)
{
- char *retval = (char *)xmalloc(strlen(var_name)+32);
+ char *retval = static_cast<char *>(xmalloc(strlen(var_name)+32));
if( (vs_scope == vs_stack || vs_scope == vs_static) )
{
sprintf(retval, "%s." HOST_SIZE_T_PRINT_DEC, var_name,
@@ -1028,10 +1028,7 @@ gg_declare_variable(tree type_decl,
break;
}
DECL_INITIAL(var_decl) = initial_value;
- if( unique_name )
- {
- free(unique_name);
- }
+ free(unique_name);
return var_decl;
}
@@ -2521,12 +2518,12 @@ gg_peek_fn_decl(const char *funcname, tree fndecl_type)
}
return retval;
}
-
+
tree
gg_build_fn_decl(const char *funcname, tree fndecl_type)
{
tree function_decl;
-
+
std::string key = function_decl_key(funcname, fndecl_type);
std::unordered_map<std::string, tree>::const_iterator it =
map_of_function_decls.find(key);
@@ -2617,13 +2614,13 @@ gg_define_function( tree return_type,
}
va_end(params);
+ char ach[32];
std::unordered_set<std::string>::const_iterator it =
names_we_have_seen.find(funcname);
if( it != names_we_have_seen.end() )
{
static int bum_counter = 1;
// We have seen this name before. Replace it with something unique:
- char ach[32];
sprintf(ach, "..no_dupes.%d", bum_counter++);
funcname = ach;
}
diff --git a/gcc/cobol/genmath.cc b/gcc/cobol/genmath.cc
index 0a1c12d..e74aebd 100644
--- a/gcc/cobol/genmath.cc
+++ b/gcc/cobol/genmath.cc
@@ -52,7 +52,8 @@ set_up_on_exception_label(cbl_label_t *arithmetic_label)
if( !arithmetic_label->structs.arith_error )
{
arithmetic_label->structs.arith_error
- = (cbl_arith_error_t *)xmalloc(sizeof(struct cbl_arith_error_t) );
+ = static_cast<cbl_arith_error_t *>
+ (xmalloc(sizeof(struct cbl_arith_error_t)));
// Set up the address pairs for this clause
gg_create_goto_pair(&arithmetic_label->structs.arith_error->over.go_to,
&arithmetic_label->structs.arith_error->over.label);
@@ -72,8 +73,8 @@ set_up_compute_error_label(cbl_label_t *compute_label)
if( !compute_label->structs.compute_error )
{
compute_label->structs.compute_error
- = (cbl_compute_error_t *)
- xmalloc(sizeof(struct cbl_compute_error_t) );
+ = static_cast<cbl_compute_error_t *>
+ (xmalloc(sizeof(struct cbl_compute_error_t)));
compute_label->structs.compute_error->compute_error_code
= gg_define_int(0);
}
@@ -112,7 +113,6 @@ arithmetic_operation(size_t nC, cbl_num_result_t *C,
{
TRACE1_HEADER
TRACE1_TEXT_ABC("calling ", operation, "")
- TRACE1_END
for(size_t ii=0; ii<nA; ii++)
{
TRACE1_INDENT
@@ -129,7 +129,6 @@ arithmetic_operation(size_t nC, cbl_num_result_t *C,
build_int_cst_type(SIZE_T, ii));
TRACE1_REFER("", B[ii], "");
}
- TRACE1_END
}
// We need to split up cbl_num_result_t into two arrays, one for the refer_t
@@ -223,7 +222,6 @@ arithmetic_operation(size_t nC, cbl_num_result_t *C,
{
for(size_t ii=0; ii<nC; ii++)
{
- break; // Breaks on ADD 1 SUB2 GIVING SUB4 both PIC S9(3) COMP
TRACE1_INDENT
gg_fprintf( trace_handle,
1, "result: C[%ld]: ",
@@ -663,8 +661,10 @@ fast_divide(size_t nC, cbl_num_result_t *C,
// We now either divide into C[n] or assign dividend/divisor to C[n]:
for(size_t i=0; i<nC; i++ )
{
- tree dest_type = tree_type_from_size(C[i].refer.field->data.capacity, 0);
- tree dest_addr = gg_add(member(C[i].refer.field->var_decl_node, "data"),
+ tree dest_type =
+ tree_type_from_size(C[i].refer.field->data.capacity, 0);
+ tree dest_addr = gg_add(member( C[i].refer.field->var_decl_node,
+ "data"),
refer_offset(C[i].refer));
tree ptr = gg_cast(build_pointer_type(dest_type), dest_addr);
if( nB )
@@ -680,16 +680,15 @@ fast_divide(size_t nC, cbl_num_result_t *C,
}
// This is where we handle any remainder, keeping in mind that for
- // nB != 0, the actual dividend is in the value we have named "divisor".
- //
- // And, yes, I hate comments like that, too.
+ // nB != 0, the actual dividend is in the value we have named
+ // "divisor".
// We calculate the remainder by calculating
// dividend minus quotient * divisor
if( remainder.field )
{
- tree dest_addr = gg_add(member(remainder.field->var_decl_node, "data"),
- refer_offset(remainder));
+ dest_addr = gg_add( member(remainder.field->var_decl_node, "data"),
+ refer_offset(remainder));
dest_type = tree_type_from_size(remainder.field->data.capacity, 0);
ptr = gg_cast(build_pointer_type(dest_type), dest_addr);
diff --git a/gcc/cobol/genutil.cc b/gcc/cobol/genutil.cc
index e09b1bf..20b47ab 100644
--- a/gcc/cobol/genutil.cc
+++ b/gcc/cobol/genutil.cc
@@ -307,7 +307,8 @@ get_and_check_refstart_and_reflen( tree refstart,// LONG returned value
tree reflen, // LONG returned value
cbl_refer_t &refer)
{
- cbl_enabled_exceptions_t& enabled_exceptions( cdf_enabled_exceptions() );
+ const cbl_enabled_exceptions_t&
+ enabled_exceptions( cdf_enabled_exceptions() );
if( !enabled_exceptions.match(ec_bound_ref_mod_e) )
{
@@ -460,7 +461,8 @@ get_depending_on_value_from_odo(tree retval, cbl_field_t *odo)
declarative with a RESUME NEXT STATEMENT, or before the default_condition
processing can do a controlled exit.
*/
- cbl_enabled_exceptions_t& enabled_exceptions( cdf_enabled_exceptions() );
+ const cbl_enabled_exceptions_t&
+ enabled_exceptions( cdf_enabled_exceptions() );
cbl_field_t *depending_on;
depending_on = cbl_field_of(symbol_at(odo->occurs.depending_on));
@@ -474,8 +476,8 @@ get_depending_on_value_from_odo(tree retval, cbl_field_t *odo)
return;
}
- // Bounds checking is enabled, so we test the DEPENDING ON value to be between
- // the lower and upper OCCURS limits:
+ // Bounds checking is enabled, so we test the DEPENDING ON value to be
+ // between the lower and upper OCCURS limits:
get_integer_value(retval,
depending_on,
NULL,
@@ -485,23 +487,28 @@ get_depending_on_value_from_odo(tree retval, cbl_field_t *odo)
{
// This needs to evaluate to an integer
set_exception_code(ec_bound_odo_e);
- gg_assign(retval, build_int_cst_type(TREE_TYPE(retval), odo->occurs.bounds.lower));
+ gg_assign(retval, build_int_cst_type( TREE_TYPE(retval),
+ odo->occurs.bounds.lower));
gg_assign(var_decl_rdigits, integer_zero_node);
}
ELSE
ENDIF
- IF( retval, gt_op, build_int_cst_type(TREE_TYPE(retval), odo->occurs.bounds.upper) )
+ IF( retval, gt_op, build_int_cst_type(TREE_TYPE(retval),
+ odo->occurs.bounds.upper) )
{
set_exception_code(ec_bound_odo_e);
- gg_assign(retval, build_int_cst_type(TREE_TYPE(retval), odo->occurs.bounds.lower));
+ gg_assign(retval, build_int_cst_type( TREE_TYPE(retval),
+ odo->occurs.bounds.lower));
}
ELSE
{
- IF( retval, lt_op, build_int_cst_type(TREE_TYPE(retval), odo->occurs.bounds.lower) )
+ IF( retval, lt_op, build_int_cst_type(TREE_TYPE(retval),
+ odo->occurs.bounds.lower) )
{
set_exception_code(ec_bound_odo_e);
- gg_assign(retval, build_int_cst_type(TREE_TYPE(retval), odo->occurs.bounds.lower));
+ gg_assign(retval, build_int_cst_type( TREE_TYPE(retval),
+ odo->occurs.bounds.lower));
}
ELSE
ENDIF
@@ -551,7 +558,6 @@ get_data_offset(cbl_refer_t &refer,
// We have a refer.
// At the very least, we have an constant offset
int all_flags = 0;
- int all_flag_bit = 1;
if( refer.nsubscript() )
{
@@ -571,6 +577,7 @@ get_data_offset(cbl_refer_t &refer,
// Establish the field_t pointer for walking up through our ancestors:
cbl_field_t *parent = refer.field;
+ int all_flag_bit = 1;
// Note the backwards test, because refer->nsubscript is an unsigned value
for(size_t i=refer.nsubscript()-1; i<refer.nsubscript(); i-- )
{
@@ -604,7 +611,8 @@ get_data_offset(cbl_refer_t &refer,
}
else
{
- cbl_enabled_exceptions_t& enabled_exceptions( cdf_enabled_exceptions() );
+ const cbl_enabled_exceptions_t&
+ enabled_exceptions( cdf_enabled_exceptions() );
if( !enabled_exceptions.match(ec_bound_subscript_e) )
{
// With no exception testing, just pick up the value
@@ -629,21 +637,25 @@ get_data_offset(cbl_refer_t &refer,
}
ELSE
{
- IF( subscript, lt_op, gg_cast(TREE_TYPE(subscript), integer_one_node) )
+ IF( subscript, lt_op, gg_cast(TREE_TYPE(subscript),
+ integer_one_node) )
{
// The subscript is too small
set_exception_code(ec_bound_subscript_e);
- gg_assign(subscript, build_int_cst_type(TREE_TYPE(subscript), 1));
+ gg_assign(subscript, build_int_cst_type(TREE_TYPE(subscript),
+ 1));
}
ELSE
{
IF( subscript,
ge_op,
- build_int_cst_type(TREE_TYPE(subscript), parent->occurs.ntimes()) )
+ build_int_cst_type( TREE_TYPE(subscript),
+ parent->occurs.ntimes()) )
{
// The subscript is too large
set_exception_code(ec_bound_subscript_e);
- gg_assign(subscript, build_int_cst_type(TREE_TYPE(subscript), 1));
+ gg_assign(subscript, build_int_cst_type(TREE_TYPE(subscript),
+ 1));
}
ELSE
{
@@ -658,16 +670,19 @@ get_data_offset(cbl_refer_t &refer,
all_flag_bit <<= 1;
- // Although we strictly don't need to look at the ODO value at this point,
- // we do want it checked for the purposes of ec-bound-odo
+ // Although we strictly don't need to look at the ODO value at this
+ // point, we do want it checked for the purposes of ec-bound-odo
- cbl_enabled_exceptions_t& enabled_exceptions( cdf_enabled_exceptions() );
+ const cbl_enabled_exceptions_t&
+ enabled_exceptions( cdf_enabled_exceptions() );
if( enabled_exceptions.match(ec_bound_odo_e) )
{
if( parent->occurs.depending_on )
{
- static tree value64 = gg_define_variable(LONG, ".._gdos_value64", vs_file_static);
+ static tree value64 = gg_define_variable( LONG,
+ ".._gdos_value64",
+ vs_file_static);
cbl_field_t *odo = symbol_find_odo(parent);
get_depending_on_value_from_odo(value64, odo);
}
@@ -1244,20 +1259,15 @@ get_binary_value( tree value,
break;
}
- case FldAlphanumeric:
- {
-
- }
-
-
default:
{
- fprintf(stderr, "%s(): We know not how to"
- " get a binary value from %s\n",
- __func__,
- cbl_field_type_str(field->type) );
+ char *err = xasprintf("%s(): We know not how to"
+ " get a binary value from %s\n",
+ __func__,
+ cbl_field_type_str(field->type) );
+ cbl_internal_error("%s", err);
abort();
- break;
+ // break; // break not needed after abort();
}
}
@@ -1673,9 +1683,9 @@ set_exception_code_func(ec_type_t ec, int /*line*/, int from_raise_statement)
}
bool
-process_this_exception(ec_type_t ec)
+process_this_exception(const ec_type_t ec)
{
- cbl_enabled_exceptions_t& enabled_exceptions( cdf_enabled_exceptions() );
+ const cbl_enabled_exceptions_t& enabled_exceptions( cdf_enabled_exceptions() );
bool retval;
if( enabled_exceptions.match(ec) || !skip_exception_processing )
{
@@ -1707,7 +1717,7 @@ copy_little_endian_into_place(cbl_field_t *dest,
tree value,
int rhs_rdigits,
bool check_for_error,
- tree &size_error)
+ const tree &size_error)
{
if( check_for_error )
{
@@ -1933,7 +1943,7 @@ get_literal_string(cbl_field_t *field)
}
bool
-refer_is_clean(cbl_refer_t &refer)
+refer_is_clean(const cbl_refer_t &refer)
{
if( !refer.field || refer.field->type == FldLiteralN )
{
@@ -1980,7 +1990,7 @@ refer_refmod_length(cbl_refer_t &refer)
static
tree // size_t
-refer_fill_depends(cbl_refer_t &refer)
+refer_fill_depends(const cbl_refer_t &refer)
{
REFER("");
// This returns a positive number which is the amount a depends-limited
diff --git a/gcc/cobol/genutil.h b/gcc/cobol/genutil.h
index 0d9028e..20783e1 100644
--- a/gcc/cobol/genutil.h
+++ b/gcc/cobol/genutil.h
@@ -118,7 +118,7 @@ void set_exception_code_func(ec_type_t ec,
int line,
int from_raise_statement=0);
#define set_exception_code(ec) set_exception_code_func(ec, __LINE__)
-bool process_this_exception(ec_type_t ec);
+bool process_this_exception(const ec_type_t ec);
#define CHECK_FOR_FRACTIONAL_DIGITS true
void get_integer_value(tree value, // This is always a LONG
cbl_field_t *field,
@@ -130,7 +130,7 @@ void copy_little_endian_into_place(cbl_field_t *dest,
tree value,
int rhs_rdigits,
bool check_for_error,
- tree &size_error);
+ const tree &size_error);
tree build_array_of_size_t( size_t N,
const size_t *values);
void parser_display_internal_field(tree file_descriptor,
@@ -138,7 +138,7 @@ void parser_display_internal_field(tree file_descriptor,
bool advance=DISPLAY_NO_ADVANCE);
char *get_literal_string(cbl_field_t *field);
-bool refer_is_clean(cbl_refer_t &refer);
+bool refer_is_clean(const cbl_refer_t &refer);
tree refer_offset(cbl_refer_t &refer,
int *pflags=NULL);
diff --git a/gcc/cobol/lexio.cc b/gcc/cobol/lexio.cc
index dc632c2..52d1aff 100644
--- a/gcc/cobol/lexio.cc
+++ b/gcc/cobol/lexio.cc
@@ -344,7 +344,7 @@ check_push_pop_directive( filespan_t& mfile ) {
std::swap(*mfile.eol, eol); // see implementation for excuses
bool ok = regex_search(p, const_cast<const char *>(mfile.eol), cm, re);
std::swap(*mfile.eol, eol);
-
+
if( ok ) {
gcc_assert(cm.size() > 1);
bool push = TOUPPER(cm[1].first[1]) == 'U';
@@ -400,7 +400,7 @@ check_source_format_directive( filespan_t& mfile ) {
std::swap(*mfile.eol, eol); // see implementation for excuses
bool ok = regex_search(p, const_cast<const char *>(mfile.eol), cm, re);
std::swap(*mfile.eol, eol);
-
+
if( ok ) {
gcc_assert(cm.size() > 1);
switch( cm[3].length() ) {
@@ -417,7 +417,7 @@ check_source_format_directive( filespan_t& mfile ) {
dbgmsg( "%s:%d: %s format set, on line " HOST_SIZE_T_PRINT_UNSIGNED,
__func__, __LINE__,
- cdf_source_format().description(),
+ cdf_source_format().description(),
(fmt_size_t)mfile.lineno() );
char *bol = cdf_source_format().is_fixed()? mfile.cur : const_cast<char*>(cm[0].first);
gcc_assert(cm[0].second <= mfile.eol);
@@ -941,7 +941,7 @@ location_in( const filespan_t& mfile, const csub_match& cm ) {
gcc_assert(mfile.cur <= cm.first && cm.second <= mfile.eodata);
auto nline = std::count(cm.first, cm.second, '\n');
if( nline ) {
- gcc_assert(loc.first_line < nline);
+ gcc_assert(nline < loc.first_line);
loc.first_line -= nline;
auto p = static_cast<const char*>(memrchr(cm.first, '\n', cm.length()));
loc.last_column = (cm.second) - p;
@@ -1379,13 +1379,13 @@ lexer_input( char buf[], int max_size, FILE *input ) {
for( auto p = mfile.cur; p < next; *output.pos++ = *p++ ) {
static bool at_bol = false;
if( at_bol ) {
- auto nonblank = std::find_if( p, next,
+ auto nonblank_l = std::find_if( p, next,
[]( char ch ) {
return !isblank(ch); } );
- if( nonblank + 1 < next ) {
- if( *nonblank == '\r' ) nonblank++; // Windows
- if( *nonblank == '\n' ) {
- p = nonblank;
+ if( nonblank_l + 1 < next ) {
+ if( *nonblank_l == '\r' ) nonblank_l++; // Windows
+ if( *nonblank_l == '\n' ) {
+ p = nonblank_l;
continue;
}
}
@@ -1513,7 +1513,6 @@ cdftext::lex_open( const char filename[] ) {
// Process any files supplied by the -include command-line option.
for( auto name : included_files ) {
- int input;
if( -1 == (input = open(name, O_RDONLY)) ) {
yyerrorvl(1, "", "cannot open -include file %s", name);
continue;
@@ -1686,7 +1685,7 @@ bool lexio_dialect_mf();
*/
static const char *
valid_sequence_area( const char *data, const char *eodata ) {
-
+
for( const char *p = data;
(p = std::find_if(p, eodata, is_p)) != eodata;
p++ )
@@ -1709,7 +1708,7 @@ valid_sequence_area( const char *data, const char *eodata ) {
}
}
}
- return nullptr;
+ return nullptr;
}
/*
@@ -1745,7 +1744,7 @@ cdftext::free_form_reference_format( int input ) {
} current( mfile.data );
/*
- * Infer source code format.
+ * Infer source code format.
*/
if( cdf_source_format().inference_pending() ) {
const char *bol = valid_sequence_area(mfile.data, mfile.eodata);
@@ -1983,15 +1982,15 @@ cdftext::segment_line( filespan_t& mfile ) {
struct { unsigned long ante, post; } lineno = {
gb4(mfile.lineno()), gb4(mfile.lineno() + segment.after.nlines())
};
- char *directive = lineno.ante == lineno.post?
+ const char *directive = lineno.ante == lineno.post?
nullptr : xasprintf("\n#line %lu \"%s\"\n",
lineno.ante, cobol_filename());
- if( directive )
+ if( directive )
output.push_back( span_t(strlen(directive), directive) );
output.push_back( span_t(mfile.cur, segment.before.p) );
output.push_back( span_t(segment.after.p, segment.after.pend ) );
- if( directive )
+ if( directive )
output.push_back( span_t(strlen(directive), directive) );
mfile.cur = const_cast<char*>(segment.before.pend);
diff --git a/gcc/cobol/lexio.h b/gcc/cobol/lexio.h
index eb41068..ba4ef0a 100644
--- a/gcc/cobol/lexio.h
+++ b/gcc/cobol/lexio.h
@@ -244,8 +244,8 @@ struct span_t {
return span_t(output, eout);
}
const char * has_nul() const {
- auto p = std::find(this->p, pend, '\0');
- return p != pend? p : NULL;
+ auto p_l = std::find(this->p, pend, '\0');
+ return p_l != pend? p_l : NULL;
}
bool at_eol() const {
diff --git a/gcc/cobol/scan_ante.h b/gcc/cobol/scan_ante.h
index 88a8e8c..6128a3f 100644
--- a/gcc/cobol/scan_ante.h
+++ b/gcc/cobol/scan_ante.h
@@ -490,7 +490,8 @@ trim_location( int nkeep) {
(fmt_size_t)nline, (fmt_size_t)rescan.size());
if( nline ) {
gcc_assert( yylloc.first_line + nline <= yylloc.last_line );
- yylloc.last_line =- int(nline);
+ yylloc.last_line -= int(nline);
+ gcc_assert( yylloc.first_line <= yylloc.last_line );
char *p = static_cast<char*>(memrchr(rescan.p, '\n', rescan.size()));
yylloc.last_column = rescan.pend - ++p;
return;
diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc
index 4b34729..aaaa6f3 100644
--- a/gcc/cobol/symbols.cc
+++ b/gcc/cobol/symbols.cc
@@ -500,13 +500,13 @@ symbol_elem_cmp( const void *K, const void *E )
}
return strcasecmp(key.name, elem.name);
}
- break;
+ // break; // This break not needed if all options do a return.
case SymSpecial:
return special_pair_cmp(k->elem.special, e->elem.special)? 0 : 1;
- break;
+ // break; // This break not needed after return.
case SymAlphabet:
return strcasecmp(k->elem.alphabet.name, e->elem.alphabet.name);
- break;
+ // break; // This break not needed after return.
case SymFile:
// If the key is global, so must be the found element.
if( (cbl_file_of(k)->attr & global_e) == global_e &&
@@ -514,7 +514,7 @@ symbol_elem_cmp( const void *K, const void *E )
return 1;
}
return strcasecmp(k->elem.file.name, e->elem.file.name);
- break;
+ // break; // This break not needed after return.
}
assert(k->type == SymField);
@@ -672,7 +672,7 @@ symbol_special( size_t program, const char name[] )
struct symbol_elem_t *
symbol_alphabet( size_t program, const char name[] )
{
- cbl_alphabet_t alphabet(YYLTYPE(), custom_encoding_e);
+ cbl_alphabet_t alphabet(YYLTYPE(), custom_encoding_e); // cppcheck-suppress syntaxError
assert(strlen(name) < sizeof alphabet.name);
strcpy(alphabet.name, name);
@@ -931,7 +931,7 @@ end_of_group( size_t igroup ) {
if( e->program != group->program ) return isym;
if( e->type == SymLabel ) return isym; // end of data division
if( e->type == SymField ) {
- const auto f = cbl_field_of(e);
+ const cbl_field_t * f = cbl_field_of(e);
if( f->level == LEVEL77 || f->level == 66 ) return isym;
if( f->level == 1 && f->parent != igroup ) {
return isym;
@@ -1174,7 +1174,7 @@ static struct symbol_elem_t *
// If an 01 record exists for the FD/SD, use its capacity as the
// default_record capacity.
if( p != symbols_end() ) {
- const auto record = cbl_field_of(p);
+ const cbl_field_t * record = cbl_field_of(p);
assert(record->level == 1);
e = calculate_capacity(p);
auto record_size = std::max(record->data.memsize,
@@ -1262,7 +1262,7 @@ static struct symbol_elem_t *
// If group has a parent that is a record area, expand it, too.
if( 0 < group->parent ) {
- auto redefined = symbol_redefines(group);
+ redefined = symbol_redefines(group);
if( redefined && is_record_area(redefined) ) {
if( redefined->data.capacity < group->data.memsize ) {
redefined->data.capacity = group->data.memsize;
@@ -1434,11 +1434,11 @@ cbl_field_t::attr_str( const std::vector<cbl_field_attr_t>& attrs ) const
const char *sep = "";
char *out = NULL;
- for( auto attr : attrs ) {
+ for( auto attr_l : attrs ) {
char *part = out;
- if( has_attr(attr) ) {
+ if( has_attr(attr_l) ) {
int erc = asprintf(&out, "%s%s%s",
- part? part : "", sep, cbl_field_attr_str(attr));
+ part? part : "", sep, cbl_field_attr_str(attr_l));
if( -1 == erc ) return part;
free(part);
sep = ", ";
@@ -1745,7 +1745,7 @@ symbols_update( size_t first, bool parsed_ok ) {
bool size_invalid = field->data.memsize > 0 && symbol_redefines(field);
if( size_invalid ) { // redefine of record area is ok
- const auto redefined = symbol_redefines(field);
+ const cbl_field_t * redefined = symbol_redefines(field);
size_invalid = ! is_record_area(redefined);
}
if( !field->is_valid() || size_invalid )
@@ -1828,7 +1828,7 @@ symbols_update( size_t first, bool parsed_ok ) {
}
// Verify REDEFINing field has no ODO components
- const auto parent = symbol_redefines(field);
+ const cbl_field_t * parent = symbol_redefines(field);
if( parent && !is_record_area(parent) && is_variable_length(field) ) {
ERROR_FIELD(field, "line %d: REDEFINES field %s cannot be variable length",
field->line, field->name);
@@ -2470,7 +2470,7 @@ symbol_typedef_add( size_t program, struct cbl_field_t *field ) {
auto e = symbols_end() - 1;
assert( symbols_begin() < e );
if( e->type == SymField ) {
- const auto f = cbl_field_of(e);
+ const cbl_field_t * f = cbl_field_of(e);
if( f == field ) return e;
}
@@ -2520,7 +2520,8 @@ symbol_field_add( size_t program, struct cbl_field_t *field )
if( is_numeric(parent->usage) && parent->data.capacity > 0 ) {
field->type = parent->usage;
field->data = parent->data;
- field->data = 0;
+ field->data = 0; // cppcheck-suppress redundantAssignment
+ // // cppcheck doesn't understand multiple overloaded operator=
field->data.initial = NULL;
}
}
@@ -3144,7 +3145,6 @@ static cbl_field_t *
new_temporary_impl( enum cbl_field_type_t type, const cbl_name_t name = nullptr )
{
extern int yylineno;
- static int nstack, nliteral;
static const struct cbl_field_t empty_alpha = {
0, FldAlphanumeric, FldInvalid,
intermediate_e, 0, 0, 0, nonarray, 0, "",
@@ -3213,8 +3213,10 @@ new_temporary_impl( enum cbl_field_type_t type, const cbl_name_t name = nullptr
f->line = yylineno;
if( is_literal(type) ) {
+ static int nliteral = 0;
snprintf(f->name, sizeof(f->name), "_literal%d",++nliteral);
} else {
+ static int nstack = 0;
snprintf(f->name, sizeof(f->name), "_stack%d",++nstack);
}
@@ -3728,6 +3730,12 @@ symbol_label_add( size_t program, cbl_label_t *input )
bool
symbol_label_section_exists( size_t eval_label_index ) {
auto eval = symbols_begin(eval_label_index);
+ /* cppcheck warns that the following statement depends on the order of
+ evaluation of side effects. Since this isn't my code, and since I don't
+ think the warning can be eliminated without rewriting it, I am just
+ supprressing it.
+ -- Bob Dubner, 2025-07-14 */
+ // cppcheck-suppress unknownEvaluationOrder
bool has_section = std::any_of( ++eval, symbols_end(),
[program = eval->program]( const auto& sym ) {
if( program == sym.program && sym.type == SymLabel ) {
@@ -4187,7 +4195,7 @@ symbol_program_callables( size_t program ) {
if( e->type != SymLabel ) continue;
if( e->elem.label.type != LblProgram ) continue;
- const auto prog = cbl_label_of(e);
+ const cbl_label_t * prog = cbl_label_of(e);
if( program == symbol_index(e) && !prog->recursive ) continue;
if( (self->parent == prog->parent && prog->common) ||
@@ -4658,9 +4666,11 @@ file_status_status_of( file_status_t status ) {
size_t n = COUNT_OF(file_status_fields);
const file_status_field_t *fs, key { status };
- fs = (file_status_field_t*)lfind( &key, file_status_fields,
- &n, sizeof(*fs), cbl_file_status_cmp );
-
+ fs = static_cast<file_status_field_t*>(lfind( &key,
+ file_status_fields,
+ &n,
+ sizeof(*fs),
+ cbl_file_status_cmp ));
return fs? (long)fs->status : -1;
}
diff --git a/gcc/cobol/symfind.cc b/gcc/cobol/symfind.cc
index c04bb0f..8141b22 100644
--- a/gcc/cobol/symfind.cc
+++ b/gcc/cobol/symfind.cc
@@ -48,7 +48,7 @@ extern int yydebug;
static bool
is_data_field( symbol_elem_t& e ) {
if( e.type != SymField ) return false;
- const auto f = cbl_field_of(&e);
+ const cbl_field_t *f = cbl_field_of(&e);
if( f->name[0] == '\0' ) return false;
if( is_filler(f) ) return false;
@@ -129,7 +129,7 @@ finalize_symbol_map2() {
for( auto& elem : symbol_map2 ) {
auto& fields( elem.second );
fields.remove_if( []( auto isym ) {
- const auto f = cbl_field_of(symbol_at(isym));
+ const cbl_field_t *f = cbl_field_of(symbol_at(isym));
return f->type == FldInvalid;
} );
if( fields.empty() ) empties.insert(elem.first);
@@ -316,9 +316,9 @@ public:
if( p != item.second.end() ) {
// Preserve symbol's index at front of ancestor list.
symbol_map_t::mapped_type shorter(1 + ancestors->size());
- auto p = shorter.begin();
- *p = item.second.front();
- shorter.insert( ++p, ancestors->begin(), ancestors->end() );
+ auto p_l = shorter.begin();
+ *p_l = item.second.front();
+ shorter.insert( ++p_l, ancestors->begin(), ancestors->end() );
return make_pair(item.first, shorter);
}
}
@@ -341,7 +341,7 @@ class in_scope {
size_t program;
static size_t prog_of( size_t program ) {
- const auto L = cbl_label_of(symbol_at(program));
+ const cbl_label_t *L = cbl_label_of(symbol_at(program));
return L->parent;
}
@@ -430,7 +430,7 @@ symbol_match2( size_t program,
auto plist = symbol_map2.find(key);
if( plist != symbol_map2.end() ) {
for( auto candidate : plist->second ) {
- const auto e = symbol_at(candidate);
+ const symbol_elem_t *e = symbol_at(candidate);
if( name_has_names( e, names, local ) ) {
fields.push_back( symbol_index(e) );
}
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index afa1597..6439f23 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -93,7 +93,7 @@ static inline char *
get_current_dir_name ()
{
/* Use libiberty's allocator here. */
- char *buf = (char *) xmalloc (PATH_MAX);
+ char *buf = static_cast<char *>(xmalloc (PATH_MAX));
return getcwd (buf, PATH_MAX);
}
#endif
@@ -101,7 +101,7 @@ get_current_dir_name ()
/*
* For printing messages, usually the size of the thing is some kind of string
* length, and doesn't really need a size_t. For message formatting, use a
- * simple unsigned long, and warn if that's no good. "gb4" here stands for
+ * simple unsigned long, and warn if that's no good. "gb4" here stands for
* "4 Gigabytes".
*/
unsigned long
@@ -113,7 +113,7 @@ gb4( size_t input ) {
}
return input;
}
-
+
/*
* Most CDF Directives -- those that have state -- can be pushed and popped.
* This class maintains stacks of them, with each stack having a "default
@@ -140,20 +140,20 @@ gb4( size_t input ) {
* PAGE
* PROPAGATE
* REF-MOD-ZERO-LENGTH
- *
- * >>PUSH ALL calls the class's push() method.
- * >>POP ALL calls the class's pop() method.
+ *
+ * >>PUSH ALL calls the class's push() method.
+ * >>POP ALL calls the class's pop() method.
*/
class cdf_directives_t
{
template <typename T>
- class cdf_stack_t : private std::stack<T> {
+ class cdf_stack_t : private std::stack<T> { // cppcheck-suppress noConstructor
T default_value;
const T& top() const { return std::stack<T>::top(); }
bool empty() const { return std::stack<T>::empty(); }
public:
void value( const T& value ) {
- T& output( empty()? default_value : std::stack<T>::top() );
+ T& output( empty()? default_value : std::stack<T>::top() ); // cppcheck-suppress constVariableReference
output = value;
dbgmsg("cdf_directives_t::%s: %s", __func__, str(output).c_str());
}
@@ -166,7 +166,7 @@ class cdf_directives_t
}
void pop() {
if( empty() ) {
- error_msg(YYLTYPE(), "CDF stack empty");
+ error_msg(YYLTYPE(), "CDF stack empty"); // cppcheck-suppress syntaxError
return;
}
default_value = top();
@@ -190,7 +190,6 @@ class cdf_directives_t
static std::string str(cbl_enabled_exceptions_t) {
return "<enabled_exceptions>";
}
-
};
public:
@@ -203,7 +202,7 @@ class cdf_directives_t
cdf_directives_t() {
call_convention.value() = cbl_call_cobol_e;
}
-
+
void push() {
call_convention.push();
cobol_words.push();
@@ -995,7 +994,7 @@ cbl_field_t::report_invalid_initial_value(const YYLTYPE& loc) const {
// 8 or more, we need do no further testing because we assume
// everything fits.
if( data.capacity < 8 ) {
- const auto p = strchr(data.initial, symbol_decimal_point());
+ const char *p = strchr(data.initial, symbol_decimal_point());
if( p && atoll(p+1) != 0 ) {
error_msg(loc, "integer type %s VALUE '%s' "
"requires integer VALUE",
@@ -1141,7 +1140,7 @@ literal_subscript_oob( const cbl_refer_t& r, size_t& isub /* output */) {
pdim++;
return ! occurs.subscript_ok(r.field);
} );
- isub = psub - r.subscripts.begin();
+ isub = psub - r.subscripts.begin();
return psub == r.subscripts.end()? NULL : dims[isub];
}
@@ -1154,12 +1153,12 @@ cbl_refer_t::subscripts_set( const std::list<cbl_refer_t>& subs ) {
const char *
cbl_refer_t::str() const {
- static char subscripts[64];
- sprintf(subscripts, "(%u of " HOST_SIZE_T_PRINT_UNSIGNED " dimensions)",
+ static char subscripts_l[64];
+ sprintf(subscripts_l, "(%u of " HOST_SIZE_T_PRINT_UNSIGNED " dimensions)",
nsubscript(), (fmt_size_t)dimensions(field));
char *output = xasprintf("%s %s %s",
field? field_str(field) : "(none)",
- 0 < dimensions(field)? subscripts : "",
+ 0 < dimensions(field)? subscripts_l : "",
is_refmod_reference()? "(refmod)" : "" );
return output;
}
@@ -1861,12 +1860,13 @@ date_time_fmt( const char input[] ) {
{ regex_t(), 'd', "^(" DATE_FMT_B "|" DATE_FMT_E ")$" },
{ regex_t(), 't', "^(" TIME_FMT_B "|" TIME_FMT_E ")$" },
};
- int erc, cflags = REG_EXTENDED | REG_ICASE, eflags=0;
+ int cflags = REG_EXTENDED | REG_ICASE, eflags=0;
regmatch_t m[5];
char result = 0;
if( ! compiled ) {
for( auto& fmt : fmts ) {
+ int erc;
if( (erc = regcomp(&fmt.reg, fmt.pattern, cflags)) != 0 ) {
char msg[80];
regerror(erc, &fmt.reg, msg, sizeof(msg));
@@ -1924,7 +1924,7 @@ class unique_stack : public std::stack<input_file_t>
friend void cobol_set_pp_option(int opt);
bool option_m;
std::set<std::string> all_names;
-
+
const char *
no_wd( const char *wd, const char *name ) {
int i;
@@ -1935,7 +1935,7 @@ class unique_stack : public std::stack<input_file_t>
public:
unique_stack() : option_m(false) {}
-
+
bool push( const value_type& value ) {
auto ok = std::none_of( c.cbegin(), c.cend(),
[value]( const auto& that ) {
@@ -1969,8 +1969,8 @@ class unique_stack : public std::stack<input_file_t>
const input_file_t& peek( size_t n ) const {
gcc_assert( n < size() );
return c.at(size() - ++n);
- }
-
+ }
+
void option( int opt ) { // capture other preprocessor options eventually
assert(opt == 'M');
option_m = true;
@@ -1983,7 +1983,7 @@ class unique_stack : public std::stack<input_file_t>
std::string input( top().name );
printf( "%s: ", input.c_str() );
for( const auto& name : all_names ) {
- if( name != input )
+ if( name != input )
printf( "\\\n\t%s ", name.c_str() );
}
printf("\n");
@@ -2000,7 +2000,7 @@ void cobol_set_pp_option(int opt) {
assert(opt == 'M');
input_filenames.option_m = true;
}
-
+
/*
* Maintain a stack of input filenames. Ensure the files are unique (by
* inode), to prevent copybook cycles. Before pushing a new name, Record the
@@ -2011,7 +2011,7 @@ void cobol_set_pp_option(int opt) {
* to enforce uniqueness, and the scanner to maintain line numbers.
*/
bool cobol_filename( const char *name, ino_t inode ) {
- const line_map *lines = NULL;
+ //const line_map *lines = NULL;
if( inode == 0 ) {
auto p = old_filenames.find(name);
if( p == old_filenames.end() ) {
@@ -2021,8 +2021,10 @@ bool cobol_filename( const char *name, ino_t inode ) {
}
cbl_errx( "logic error: missing inode for %s", name);
}
- inode = p->second;
- assert(inode != 0);
+ else {
+ inode = p->second;
+ assert(inode != 0);
+ }
}
linemap_add(line_table, LC_ENTER, sysp, name, 1);
input_filename_vestige = name;
@@ -2071,7 +2073,7 @@ cobol_filename_restore() {
input_filenames.pop();
if( input_filenames.empty() ) return;
- auto& input = input_filenames.top();
+ const auto& input = input_filenames.top();
linemap_add(line_table, LC_LEAVE, sysp, NULL, 0);
}
@@ -2083,7 +2085,7 @@ location_t location_from_lineno() { return token_location; }
template <typename LOC>
static void
gcc_location_set_impl( const LOC& loc ) {
- // Set the position to the first line & column in the location.
+ // Set the position to the first line & column in the location.
token_location = linemap_line_start( line_table, loc.first_line, 80 );
token_location = linemap_position_for_column( line_table, loc.first_column);
location_dump(__func__, __LINE__, "parser", loc);
@@ -2144,8 +2146,8 @@ ydferror( const char gmsgid[], ... ) {
va_list ap;
va_start (ap, gmsgid);
rich_location richloc (line_table, token_location);
- bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_zero,
- gmsgid, &ap, DK_ERROR);
+ /*bool ret =*/ global_dc->diagnostic_impl (&richloc, nullptr, option_zero,
+ gmsgid, &ap, DK_ERROR);
va_end (ap);
}
@@ -2222,8 +2224,8 @@ void error_msg_direct( const char gmsgid[], ... ) {
auto_diagnostic_group d;
va_list ap;
va_start (ap, gmsgid);
- auto ret = emit_diagnostic_valist( DK_ERROR, token_location,
- option_zero, gmsgid, &ap );
+ /*auto ret = */emit_diagnostic_valist( DK_ERROR, token_location,
+ option_zero, gmsgid, &ap );
va_end (ap);
}
@@ -2236,8 +2238,11 @@ yyerror( const char gmsgid[], ... ) {
va_list ap;
va_start (ap, gmsgid);
rich_location richloc (line_table, token_location);
- bool ret = global_dc->diagnostic_impl (&richloc, nullptr, option_zero,
- gmsgid, &ap, DK_ERROR);
+ /*bool ret =*/ global_dc->diagnostic_impl ( &richloc,
+ nullptr,
+ option_zero,
+ gmsgid,
+ &ap, DK_ERROR);
va_end (ap);
global_dc->end_group();
}
@@ -2483,8 +2488,8 @@ cbl_unimplemented_at( const YYLTYPE& loc, const char *gmsgid, ... ) {
va_end(ap);
}
-/*
- * analogs to err(3) and errx(3).
+/*
+ * analogs to err(3) and errx(3).
*/
#pragma GCC diagnostic push
@@ -2619,7 +2624,7 @@ static const std::set<std::string> reserved_words = {
"VOLATILE",
"XML",
"END-START",
-
+
// ISO 2023 keywords
"ACCEPT",
"ACCESS",
diff --git a/gcc/common.opt b/gcc/common.opt
index 3d65656..d68d7d8 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -851,11 +851,17 @@ Common Var(warn_unused) Init(0) Warning
Enable all -Wunused- warnings.
Wunused-but-set-parameter
-Common Var(warn_unused_but_set_parameter) Warning EnabledBy(Wunused && Wextra)
+Common Alias(Wunused-but-set-parameter=,3,0) Warning
+
+Wunused-but-set-parameter=
+Common Var(warn_unused_but_set_parameter) RejectNegative Joined UInteger Warning IntegerRange(0, 3) EnabledBy(Wunused && Wextra)
Warn when a function parameter is only set, otherwise unused.
Wunused-but-set-variable
-Common Var(warn_unused_but_set_variable) Warning EnabledBy(Wunused)
+Common Alias(Wunused-but-set-variable=,3,0) Warning
+
+Wunused-but-set-variable=
+Common Var(warn_unused_but_set_variable) RejectNegative Joined UInteger Warning IntegerRange(0, 3) EnabledBy(Wunused)
Warn when a variable is only set, otherwise unused.
Wunused-function
diff --git a/gcc/common.opt.urls b/gcc/common.opt.urls
index a507168..38dd9d3 100644
--- a/gcc/common.opt.urls
+++ b/gcc/common.opt.urls
@@ -272,9 +272,15 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-unused)
Wunused-but-set-parameter
UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-parameter)
+Wunused-but-set-parameter=
+UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-parameter)
+
Wunused-but-set-variable
UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-variable)
+Wunused-but-set-variable=
+UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-variable)
+
Wunused-function
UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-function)
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 75192dd..270cb2f 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -9191,31 +9191,6 @@
[(set_attr "type" "crypto_sha3")]
)
-(define_insn_and_split "*eor3qdi4"
- [(set (match_operand:DI 0 "register_operand")
- (xor:DI
- (xor:DI
- (match_operand:DI 2 "register_operand")
- (match_operand:DI 3 "register_operand"))
- (match_operand:DI 1 "register_operand")))]
- "TARGET_SHA3"
- {@ [ cons: =0, 1, 2 , 3 ; attrs: type ]
- [ w , w, w , w ; crypto_sha3 ] eor3\t%0.16b, %1.16b, %2.16b, %3.16b
- [ &r , r, r0, r0 ; multiple ] #
- }
- "&& REG_P (operands[0]) && GP_REGNUM_P (REGNO (operands[0]))"
- [(set (match_dup 4) (xor:DI (match_dup 2) (match_dup 3)))
- (set (match_dup 0) (xor:DI (match_dup 4) (match_dup 1)))]
- {
- if (reload_completed)
- operands[4] = operands[0];
- else if (can_create_pseudo_p ())
- operands[4] = gen_reg_rtx (DImode);
- else
- FAIL;
- }
-)
-
(define_insn "aarch64_rax1qv2di"
[(set (match_operand:V2DI 0 "register_operand" "=w")
(xor:V2DI
diff --git a/gcc/config/aarch64/aarch64-sme.md b/gcc/config/aarch64/aarch64-sme.md
index bfe368e..6b3f439 100644
--- a/gcc/config/aarch64/aarch64-sme.md
+++ b/gcc/config/aarch64/aarch64-sme.md
@@ -1269,8 +1269,8 @@
;; ---- Absolute minimum/maximum
;; -------------------------------------------------------------------------
;; Includes:
-;; - svamin (SME2+faminmax)
-;; - svamin (SME2+faminmax)
+;; - FAMIN (SME2+FAMINMAX)
+;; - FAMAX (SME2+FAMINMAX)
;; -------------------------------------------------------------------------
(define_insn "@aarch64_sme_<faminmax_uns_op><mode>"
@@ -1278,7 +1278,7 @@
(unspec:SVE_Fx24 [(match_operand:SVE_Fx24 1 "register_operand" "%0")
(match_operand:SVE_Fx24 2 "register_operand" "Uw<vector_count>")]
FAMINMAX_UNS))]
- "TARGET_SME2 && TARGET_FAMINMAX"
+ "TARGET_STREAMING_SME2 && TARGET_FAMINMAX"
"<faminmax_uns_op>\t%0, %1, %2"
)
diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md
index 6b5113e..10aecf1 100644
--- a/gcc/config/aarch64/aarch64-sve.md
+++ b/gcc/config/aarch64/aarch64-sve.md
@@ -8690,8 +8690,8 @@
(unspec:<VPRED>
[(match_operand:<VPRED> 1)
(const_int SVE_KNOWN_PTRUE)
- (match_operand:SVE_FULL_F 2 "register_operand" "w, w")
- (match_operand:SVE_FULL_F 3 "aarch64_simd_reg_or_zero" "Dz, w")]
+ (match_operand:SVE_F 2 "register_operand" "w, w")
+ (match_operand:SVE_F 3 "aarch64_simd_reg_or_zero" "Dz, w")]
SVE_COND_FP_CMP_I0)
(match_operand:<VPRED> 4 "register_operand" "Upl, Upl")))]
"TARGET_SVE"
@@ -8713,8 +8713,8 @@
(unspec:<VPRED>
[(match_operand:<VPRED> 1)
(const_int SVE_KNOWN_PTRUE)
- (match_operand:SVE_FULL_F 2 "register_operand" "w")
- (match_operand:SVE_FULL_F 3 "register_operand" "w")]
+ (match_operand:SVE_F 2 "register_operand" "w")
+ (match_operand:SVE_F 3 "register_operand" "w")]
UNSPEC_COND_FCMUO)
(match_operand:<VPRED> 4 "register_operand" "Upl")))]
"TARGET_SVE"
@@ -8740,8 +8740,8 @@
(unspec:<VPRED>
[(match_operand:<VPRED> 1)
(const_int SVE_KNOWN_PTRUE)
- (match_operand:SVE_FULL_F 2 "register_operand" "w")
- (match_operand:SVE_FULL_F 3 "aarch64_simd_reg_or_zero" "wDz")]
+ (match_operand:SVE_F 2 "register_operand" "w")
+ (match_operand:SVE_F 3 "aarch64_simd_reg_or_zero" "wDz")]
SVE_COND_FP_CMP_I0))
(match_operand:<VPRED> 4 "register_operand" "Upa"))
(match_dup:<VPRED> 1)))
@@ -8777,8 +8777,8 @@
(unspec:<VPRED>
[(match_operand:<VPRED> 1)
(const_int SVE_KNOWN_PTRUE)
- (match_operand:SVE_FULL_F 2 "register_operand" "w")
- (match_operand:SVE_FULL_F 3 "aarch64_simd_reg_or_zero" "wDz")]
+ (match_operand:SVE_F 2 "register_operand" "w")
+ (match_operand:SVE_F 3 "aarch64_simd_reg_or_zero" "wDz")]
SVE_COND_FP_CMP_I0))
(not:<VPRED>
(match_operand:<VPRED> 4 "register_operand" "Upa")))
@@ -8808,6 +8808,7 @@
}
)
+;; Same for unordered comparisons.
(define_insn_and_split "*fcmuo<mode>_bic_combine"
[(set (match_operand:<VPRED> 0 "register_operand" "=Upa")
(and:<VPRED>
@@ -8816,8 +8817,8 @@
(unspec:<VPRED>
[(match_operand:<VPRED> 1)
(const_int SVE_KNOWN_PTRUE)
- (match_operand:SVE_FULL_F 2 "register_operand" "w")
- (match_operand:SVE_FULL_F 3 "register_operand" "w")]
+ (match_operand:SVE_F 2 "register_operand" "w")
+ (match_operand:SVE_F 3 "register_operand" "w")]
UNSPEC_COND_FCMUO))
(match_operand:<VPRED> 4 "register_operand" "Upa"))
(match_dup:<VPRED> 1)))
@@ -8843,7 +8844,6 @@
}
)
-;; Same for unordered comparisons.
(define_insn_and_split "*fcmuo<mode>_nor_combine"
[(set (match_operand:<VPRED> 0 "register_operand" "=Upa")
(and:<VPRED>
@@ -8852,8 +8852,8 @@
(unspec:<VPRED>
[(match_operand:<VPRED> 1)
(const_int SVE_KNOWN_PTRUE)
- (match_operand:SVE_FULL_F 2 "register_operand" "w")
- (match_operand:SVE_FULL_F 3 "register_operand" "w")]
+ (match_operand:SVE_F 2 "register_operand" "w")
+ (match_operand:SVE_F 3 "register_operand" "w")]
UNSPEC_COND_FCMUO))
(not:<VPRED>
(match_operand:<VPRED> 4 "register_operand" "Upa")))
diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def
index f2c916e..dd91324 100644
--- a/gcc/config/aarch64/aarch64-tuning-flags.def
+++ b/gcc/config/aarch64/aarch64-tuning-flags.def
@@ -44,6 +44,8 @@ AARCH64_EXTRA_TUNING_OPTION ("avoid_cross_loop_fma", AVOID_CROSS_LOOP_FMA)
AARCH64_EXTRA_TUNING_OPTION ("fully_pipelined_fma", FULLY_PIPELINED_FMA)
+AARCH64_EXTRA_TUNING_OPTION ("avoid_ldapur", AVOID_LDAPUR)
+
/* Enable is the target prefers to use a fresh register for predicate outputs
rather than re-use an input predicate register. */
AARCH64_EXTRA_TUNING_OPTION ("avoid_pred_rmw", AVOID_PRED_RMW)
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 6e16763..0485f69 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -18793,6 +18793,8 @@ aarch64_adjust_generic_arch_tuning (struct tune_params &current_tune)
if (TARGET_SVE2)
current_tune.extra_tuning_flags
&= ~AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS;
+ if (!AARCH64_HAVE_ISA(V8_8A))
+ aarch64_tune_params.extra_tuning_flags |= AARCH64_EXTRA_TUNE_AVOID_LDAPUR;
}
static void
@@ -18857,7 +18859,10 @@ aarch64_override_options_internal (struct gcc_options *opts)
/* Make a copy of the tuning parameters attached to the core, which
we may later overwrite. */
aarch64_tune_params = *(tune->tune);
- if (tune->tune == &generic_tunings)
+
+ if (tune->tune == &generic_tunings
+ || tune->tune == &generic_armv8_a_tunings
+ || tune->tune == &generic_armv9_a_tunings)
aarch64_adjust_generic_arch_tuning (aarch64_tune_params);
if (opts->x_aarch64_override_tune_string)
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index d5c4a42..096c853 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -493,6 +493,11 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE ATTRIBUTE_UNUSED
(bool (aarch64_tune_params.extra_tuning_flags \
& AARCH64_EXTRA_TUNE_CHEAP_FPMR_WRITE))
+/* Enable folding address computation into LDAPUR when RCPC2 is available. */
+#define TARGET_ENABLE_LDAPUR (TARGET_RCPC2 \
+ && !(aarch64_tune_params.extra_tuning_flags \
+ & AARCH64_EXTRA_TUNE_AVOID_LDAPUR))
+
/* Combinatorial tests. */
#define TARGET_SVE2_OR_SME2 \
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 27efc91..a4ae685 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -482,6 +482,8 @@
;; clobber for SVE predicates.
(define_attr "pred_clobber" "any,no,yes" (const_string "any"))
+(define_attr "enable_ldapur" "any,no,yes" (const_string "any"))
+
;; [For compatibility with Arm in pipeline models]
;; Attribute that specifies whether or not the instruction touches fp
;; registers.
@@ -506,7 +508,14 @@
(eq_attr "pred_clobber" "yes")
(match_test "TARGET_SVE_PRED_CLOBBER"))
(eq_attr "pred_clobber" "any"))
-
+ (ior
+ (and
+ (eq_attr "enable_ldapur" "yes")
+ (match_test "TARGET_ENABLE_LDAPUR"))
+ (and
+ (eq_attr "enable_ldapur" "no")
+ (match_test "!TARGET_ENABLE_LDAPUR"))
+ (eq_attr "enable_ldapur" "any"))
(ior
(eq_attr "arch" "any")
diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md
index 36b0dbd..ea4a936 100644
--- a/gcc/config/aarch64/atomics.md
+++ b/gcc/config/aarch64/atomics.md
@@ -679,13 +679,16 @@
)
(define_insn "aarch64_atomic_load<mode>_rcpc"
- [(set (match_operand:ALLI 0 "register_operand" "=r")
+ [(set (match_operand:ALLI 0 "register_operand")
(unspec_volatile:ALLI
- [(match_operand:ALLI 1 "aarch64_sync_memory_operand" "Q")
+ [(match_operand:ALLI 1 "aarch64_rcpc_memory_operand")
(match_operand:SI 2 "const_int_operand")] ;; model
UNSPECV_LDAP))]
"TARGET_RCPC"
- "ldapr<atomic_sfx>\t%<w>0, %1"
+ {@ [ cons: =0 , 1 ; attrs: enable_ldapur ]
+ [ r , Q ; any ] ldapr<atomic_sfx>\t%<w>0, %1
+ [ r , Ust ; yes ] ldapur<atomic_sfx>\t%<w>0, %1
+ }
)
(define_insn "aarch64_atomic_load<mode>"
@@ -705,21 +708,24 @@
)
(define_insn "*aarch64_atomic_load<ALLX:mode>_rcpc_zext"
- [(set (match_operand:SD_HSDI 0 "register_operand" "=r")
+ [(set (match_operand:SD_HSDI 0 "register_operand")
(zero_extend:SD_HSDI
(unspec_volatile:ALLX
- [(match_operand:ALLX 1 "aarch64_sync_memory_operand" "Q")
+ [(match_operand:ALLX 1 "aarch64_rcpc_memory_operand")
(match_operand:SI 2 "const_int_operand")] ;; model
UNSPECV_LDAP)))]
"TARGET_RCPC && (<SD_HSDI:sizen> > <ALLX:sizen>)"
- "ldapr<ALLX:atomic_sfx>\t%w0, %1"
+ {@ [ cons: =0 , 1 ; attrs: enable_ldapur ]
+ [ r , Q ; any ] ldapr<ALLX:atomic_sfx>\t%w0, %1
+ [ r , Ust ; yes ] ldapur<ALLX:atomic_sfx>\t%w0, %1
+ }
)
(define_insn "*aarch64_atomic_load<ALLX:mode>_rcpc_sext"
[(set (match_operand:GPI 0 "register_operand" "=r")
(sign_extend:GPI
(unspec_volatile:ALLX
- [(match_operand:ALLX 1 "aarch64_sync_memory_operand" "Q")
+ [(match_operand:ALLX 1 "aarch64_rcpc_memory_operand" "Ust")
(match_operand:SI 2 "const_int_operand")] ;; model
UNSPECV_LDAP)))]
"TARGET_RCPC2 && (<GPI:sizen> > <ALLX:sizen>)"
diff --git a/gcc/config/aarch64/tuning_models/cortexx925.h b/gcc/config/aarch64/tuning_models/cortexx925.h
index 7d0162e..f448493 100644
--- a/gcc/config/aarch64/tuning_models/cortexx925.h
+++ b/gcc/config/aarch64/tuning_models/cortexx925.h
@@ -222,7 +222,8 @@ static const struct tune_params cortexx925_tunings =
(AARCH64_EXTRA_TUNE_BASE
| AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS
| AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT
- | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW), /* tune_flags. */
+ | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW
+ | AARCH64_EXTRA_TUNE_AVOID_LDAPUR), /* tune_flags. */
&generic_armv9a_prefetch_tune,
AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */
AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */
diff --git a/gcc/config/aarch64/tuning_models/neoversev2.h b/gcc/config/aarch64/tuning_models/neoversev2.h
index b000fb4..266d8f1 100644
--- a/gcc/config/aarch64/tuning_models/neoversev2.h
+++ b/gcc/config/aarch64/tuning_models/neoversev2.h
@@ -220,7 +220,8 @@ static const struct tune_params neoversev2_tunings =
(AARCH64_EXTRA_TUNE_BASE
| AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS
| AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT
- | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW), /* tune_flags. */
+ | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW
+ | AARCH64_EXTRA_TUNE_AVOID_LDAPUR), /* tune_flags. */
&generic_armv9a_prefetch_tune,
AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */
AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */
diff --git a/gcc/config/aarch64/tuning_models/neoversev3.h b/gcc/config/aarch64/tuning_models/neoversev3.h
index ad3cd22..f5566d2 100644
--- a/gcc/config/aarch64/tuning_models/neoversev3.h
+++ b/gcc/config/aarch64/tuning_models/neoversev3.h
@@ -220,7 +220,8 @@ static const struct tune_params neoversev3_tunings =
(AARCH64_EXTRA_TUNE_BASE
| AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS
| AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT
- | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW), /* tune_flags. */
+ | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW
+ | AARCH64_EXTRA_TUNE_AVOID_LDAPUR), /* tune_flags. */
&generic_armv9a_prefetch_tune,
AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */
AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */
diff --git a/gcc/config/aarch64/tuning_models/neoversev3ae.h b/gcc/config/aarch64/tuning_models/neoversev3ae.h
index a0adef0..5796e52 100644
--- a/gcc/config/aarch64/tuning_models/neoversev3ae.h
+++ b/gcc/config/aarch64/tuning_models/neoversev3ae.h
@@ -220,7 +220,8 @@ static const struct tune_params neoversev3ae_tunings =
(AARCH64_EXTRA_TUNE_BASE
| AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS
| AARCH64_EXTRA_TUNE_MATCHED_VECTOR_THROUGHPUT
- | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW), /* tune_flags. */
+ | AARCH64_EXTRA_TUNE_AVOID_PRED_RMW
+ | AARCH64_EXTRA_TUNE_AVOID_LDAPUR), /* tune_flags. */
&generic_armv9a_prefetch_tune,
AARCH64_LDP_STP_POLICY_ALWAYS, /* ldp_policy_model. */
AARCH64_LDP_STP_POLICY_ALWAYS /* stp_policy_model. */
diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md
index f49c1ed..71a3916 100644
--- a/gcc/config/gcn/gcn-valu.md
+++ b/gcc/config/gcn/gcn-valu.md
@@ -3792,9 +3792,9 @@
/* Unsigned comparisons use the same patterns as signed comparisons,
except that they use unsigned operators (e.g. LTU vs LT).
The '%E1' directive then does the Right Thing. */
- emit_insn (gen_vec_cmpu<mode>di_exec (operands[0], operands[1],
- operands[2], operands[3],
- operands[4]));
+ emit_insn (gen_vec_cmp<mode>di_exec (operands[0], operands[1],
+ operands[2], operands[3],
+ operands[4]));
DONE;
})
diff --git a/gcc/config/riscv/mips-insn.md b/gcc/config/riscv/mips-insn.md
new file mode 100644
index 0000000..ad46026
--- /dev/null
+++ b/gcc/config/riscv/mips-insn.md
@@ -0,0 +1,35 @@
+;; Machine description for MIPS custom instructions.
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; This file is part of GCC.
+
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+(define_insn "*mov<GPR:mode><X:mode>cc_bitmanip"
+ [(set (match_operand:GPR 0 "register_operand" "=r")
+ (if_then_else:GPR (any_eq:X (match_operand:X 1 "register_operand" "r")
+ (match_operand:X 2 "const_0_operand" "J"))
+ (match_operand:GPR 3 "reg_or_0_operand" "rJ")
+ (match_operand:GPR 4 "reg_or_0_operand" "rJ")))]
+ "TARGET_XMIPSCMOV"
+{
+ enum rtx_code code = <CODE>;
+ if (code == NE)
+ return "mips.ccmov\t%0,%1,%z3,%z4";
+ else
+ return "mips.ccmov\t%0,%1,%z4,%z3";
+}
+[(set_attr "type" "condmove")
+ (set_attr "mode" "<GPR:MODE>")])
diff --git a/gcc/config/riscv/riscv-cores.def b/gcc/config/riscv/riscv-cores.def
index 2096c00..98f3470 100644
--- a/gcc/config/riscv/riscv-cores.def
+++ b/gcc/config/riscv/riscv-cores.def
@@ -169,7 +169,6 @@ RISCV_CORE("xiangshan-kunminghu", "rv64imafdcbvh_sdtrig_sha_shcounterenw_"
"zvfhmin_zvkt_zvl128b_zvl32b_zvl64b",
"xiangshan-kunminghu")
-RISCV_CORE("mips-p8700", "rv64imafd_zicsr_zmmul_"
- "zaamo_zalrsc_zba_zbb",
+RISCV_CORE("mips-p8700", "rv64imfd_zicsr_zifencei_zalrsc_zba_zbb",
"mips-p8700")
#undef RISCV_CORE
diff --git a/gcc/config/riscv/riscv-ext-mips.def b/gcc/config/riscv/riscv-ext-mips.def
new file mode 100644
index 0000000..5d7836d
--- /dev/null
+++ b/gcc/config/riscv/riscv-ext-mips.def
@@ -0,0 +1,35 @@
+/* MIPS extension definition file for RISC-V.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>.
+
+Please run `make riscv-regen` in build folder to make sure updated anything.
+
+Format of DEFINE_RISCV_EXT, please refer to riscv-ext.def. */
+
+DEFINE_RISCV_EXT (
+ /* NAME. */ xmipscmov,
+ /* UPPERCASE_NAME. */ XMIPSCMOV,
+ /* FULL_NAME. */ "Mips conditional move extension",
+ /* DESC. */ "",
+ /* URL. */ ,
+ /* DEP_EXTS. */ ({}),
+ /* SUPPORTED_VERSIONS. */ ({{1, 0}}),
+ /* FLAG_GROUP. */ xmips,
+ /* BITMASK_GROUP_ID. */ BITMASK_NOT_YET_ALLOCATED,
+ /* BITMASK_BIT_POSITION. */ BITMASK_NOT_YET_ALLOCATED,
+ /* EXTRA_EXTENSION_FLAGS. */ 0)
diff --git a/gcc/config/riscv/riscv-ext.def b/gcc/config/riscv/riscv-ext.def
index 816acaa..6fc6d38 100644
--- a/gcc/config/riscv/riscv-ext.def
+++ b/gcc/config/riscv/riscv-ext.def
@@ -2082,3 +2082,4 @@ DEFINE_RISCV_EXT(
#include "riscv-ext-sifive.def"
#include "riscv-ext-thead.def"
#include "riscv-ext-ventana.def"
+#include "riscv-ext-mips.def"
diff --git a/gcc/config/riscv/riscv-ext.opt b/gcc/config/riscv/riscv-ext.opt
index 9f8c545..26d6e68 100644
--- a/gcc/config/riscv/riscv-ext.opt
+++ b/gcc/config/riscv/riscv-ext.opt
@@ -47,6 +47,9 @@ TargetVariable
int riscv_xcv_subext
TargetVariable
+int riscv_xmips_subext
+
+TargetVariable
int riscv_xsf_subext
TargetVariable
@@ -445,3 +448,4 @@ Mask(XTHEADVECTOR) Var(riscv_xthead_subext)
Mask(XVENTANACONDOPS) Var(riscv_xventana_subext)
+Mask(XMIPSCMOV) Var(riscv_xmips_subext)
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index a4428f0..1275b03 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -87,6 +87,10 @@ along with GCC; see the file COPYING3. If not see
#include "riscv-vector-costs.h"
#include "riscv-subset.h"
+/* Target variants that support full conditional move. */
+#define TARGET_COND_MOV \
+ (TARGET_SFB_ALU || TARGET_XTHEADCONDMOV || TARGET_XMIPSCMOV)
+
/* True if X is an UNSPEC wrapper around a SYMBOL_REF or LABEL_REF. */
#define UNSPEC_ADDRESS_P(X) \
(GET_CODE (X) == UNSPEC \
@@ -4169,7 +4173,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
return false;
case IF_THEN_ELSE:
- if ((TARGET_SFB_ALU || TARGET_XTHEADCONDMOV)
+ if (TARGET_COND_MOV
&& reg_or_0_operand (XEXP (x, 1), mode)
&& sfb_alu_operand (XEXP (x, 2), mode)
&& comparison_operator (XEXP (x, 0), VOIDmode))
@@ -5487,6 +5491,68 @@ riscv_expand_conditional_branch (rtx label, rtx_code code, rtx op0, rtx op1)
emit_jump_insn (gen_condjump (condition, label));
}
+/* canonicalization of the comparands. */
+void
+canonicalize_comparands (rtx_code code, rtx *op0, rtx *op1)
+{
+ /* An integer comparison must be comparing WORD_MODE objects.
+ Extend the comparison arguments as necessary. */
+ if ((INTEGRAL_MODE_P (GET_MODE (*op0)) && GET_MODE (*op0) != word_mode)
+ || (INTEGRAL_MODE_P (GET_MODE (*op1)) && GET_MODE (*op1) != word_mode))
+ riscv_extend_comparands (code, op0, op1);
+
+ /* We might have been handed back a SUBREG. Just to make things
+ easy, force it into a REG. */
+ if (!REG_P (*op0) && !CONST_INT_P (*op0))
+ *op0 = force_reg (word_mode, *op0);
+ if (!REG_P (*op1) && !CONST_INT_P (*op1))
+ *op1 = force_reg (word_mode, *op1);
+}
+
+/* Emit target specific conditional move like TARGET_XMIPSCMOV etc. */
+bool
+riscv_target_conditional_move (rtx dest, rtx op0, rtx op1, rtx_code code,
+ rtx cons, rtx alt)
+{
+ machine_mode dst_mode = GET_MODE (dest);
+ rtx target;
+
+ /* force the operands to the register. */
+ cons = force_reg (dst_mode, cons);
+ alt = force_reg (dst_mode, alt);
+
+ if (TARGET_XMIPSCMOV)
+ {
+ if (code == EQ || code == NE)
+ {
+ op0 = riscv_zero_if_equal (op0, op1);
+ op1 = const0_rtx;
+ }
+ else
+ {
+ target = gen_reg_rtx (GET_MODE (op0));
+ riscv_emit_int_order_test (code, 0, target, op0, op1);
+ op0 = target;
+ op1 = const0_rtx;
+ code = NE;
+ }
+ riscv_emit_int_compare (&code, &op0, &op1);
+ rtx cond = gen_rtx_fmt_ee (code, GET_MODE (op0), op0, op1);
+ emit_insn (gen_rtx_SET (dest, gen_rtx_IF_THEN_ELSE (dst_mode,
+ cond, cons, alt)));
+ return true;
+ }
+ /* TARGET_SFB_ALU || TARGET_XTHEADCONDMOV. */
+ else
+ {
+ riscv_emit_int_compare (&code, &op0, &op1, !TARGET_SFB_ALU);
+ rtx cond = gen_rtx_fmt_ee (code, GET_MODE (op0), op0, op1);
+ emit_insn (gen_rtx_SET (dest, gen_rtx_IF_THEN_ELSE (dst_mode, cond,
+ cons, alt)));
+ return true;
+ }
+}
+
/* Emit a cond move: If OP holds, move CONS to DEST; else move ALT to DEST.
Return 0 if expansion failed. */
@@ -5539,34 +5605,22 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
/* If we need more special cases, add them here. */
}
+
if (((TARGET_ZICOND_LIKE
|| (arith_operand (cons, dst_mode) && arith_operand (alt, dst_mode)))
&& GET_MODE_CLASS (dst_mode) == MODE_INT
&& GET_MODE_CLASS (cond_mode) == MODE_INT)
- || TARGET_SFB_ALU || TARGET_XTHEADCONDMOV)
+ || TARGET_COND_MOV)
{
machine_mode mode0 = GET_MODE (op0);
- machine_mode mode1 = GET_MODE (op1);
- /* An integer comparison must be comparing WORD_MODE objects.
- Extend the comparison arguments as necessary. */
- if ((INTEGRAL_MODE_P (mode0) && mode0 != word_mode)
- || (INTEGRAL_MODE_P (mode1) && mode1 != word_mode))
- riscv_extend_comparands (code, &op0, &op1);
-
- /* We might have been handed back a SUBREG. Just to make things
- easy, force it into a REG. */
- if (!REG_P (op0) && !CONST_INT_P (op0))
- op0 = force_reg (word_mode, op0);
- if (!REG_P (op1) && !CONST_INT_P (op1))
- op1 = force_reg (word_mode, op1);
+ canonicalize_comparands (code,&op0,&op1);
/* In the fallback generic case use DST_MODE rather than WORD_MODE
for the output of the SCC instruction, to match the mode of the NEG
operation below. The output of SCC is 0 or 1 boolean, so it is
valid for input in any scalar integer mode. */
- rtx tmp = gen_reg_rtx ((TARGET_ZICOND_LIKE
- || TARGET_SFB_ALU || TARGET_XTHEADCONDMOV)
+ rtx tmp = gen_reg_rtx ((TARGET_ZICOND_LIKE || TARGET_COND_MOV)
? word_mode : dst_mode);
bool invert = false;
@@ -5603,25 +5657,12 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt)
op0 = XEXP (op, 0);
op1 = XEXP (op, 1);
}
- else if (!TARGET_ZICOND_LIKE && !TARGET_SFB_ALU && !TARGET_XTHEADCONDMOV)
+ else if (!TARGET_ZICOND_LIKE && !TARGET_COND_MOV)
riscv_expand_int_scc (tmp, code, op0, op1, &invert);
- if (TARGET_SFB_ALU || TARGET_XTHEADCONDMOV)
- {
- riscv_emit_int_compare (&code, &op0, &op1, !TARGET_SFB_ALU);
- rtx cond = gen_rtx_fmt_ee (code, GET_MODE (op0), op0, op1);
+ if (TARGET_COND_MOV)
+ return riscv_target_conditional_move (dest, op0, op1, code, cons, alt);
- /* The expander is a bit loose in its specification of the true
- arm of the conditional move. That allows us to support more
- cases for extensions which are more general than SFB. But
- does mean we need to force CONS into a register at this point. */
- cons = force_reg (dst_mode, cons);
- /* With XTheadCondMov we need to force ALT into a register too. */
- alt = force_reg (dst_mode, alt);
- emit_insn (gen_rtx_SET (dest, gen_rtx_IF_THEN_ELSE (dst_mode, cond,
- cons, alt)));
- return true;
- }
else if (!TARGET_ZICOND_LIKE)
{
if (invert)
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
index c6661f5..c3b504d 100644
--- a/gcc/config/riscv/riscv.md
+++ b/gcc/config/riscv/riscv.md
@@ -3298,7 +3298,7 @@
(match_operand:GPR 2 "movcc_operand")
(match_operand:GPR 3 "movcc_operand")))]
"TARGET_SFB_ALU || TARGET_XTHEADCONDMOV || TARGET_ZICOND_LIKE
- || TARGET_MOVCC"
+ || TARGET_MOVCC || TARGET_XMIPSCMOV"
{
if (riscv_expand_conditional_move (operands[0], operands[1],
operands[2], operands[3]))
@@ -4883,6 +4883,7 @@
(include "vector-crypto.md")
(include "vector-bfloat16.md")
(include "zicond.md")
+(include "mips-insn.md")
(include "sfb.md")
(include "zc.md")
;; Vendor extensions
diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv
index 32092d8..7aac56a 100644
--- a/gcc/config/riscv/t-riscv
+++ b/gcc/config/riscv/t-riscv
@@ -194,7 +194,8 @@ RISCV_EXT_DEFS = \
$(srcdir)/config/riscv/riscv-ext.def \
$(srcdir)/config/riscv/riscv-ext-sifive.def \
$(srcdir)/config/riscv/riscv-ext-thead.def \
- $(srcdir)/config/riscv/riscv-ext-ventana.def
+ $(srcdir)/config/riscv/riscv-ext-ventana.def \
+ $(srcdir)/config/riscv/riscv-ext-mips.def
$(srcdir)/config/riscv/riscv-ext.opt: $(RISCV_EXT_DEFS)
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index eb19784..ee06858 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -4201,10 +4201,10 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
&& TREE_CODE (new_obj) == COMPONENT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (new_obj, 0))) == UNION_TYPE)
{
+ tree ctor = build_constructor (TREE_TYPE (new_obj), NULL);
+ CONSTRUCTOR_NO_CLEARING (ctor) = true;
tree activate = build2 (INIT_EXPR, TREE_TYPE (new_obj),
- new_obj,
- build_constructor (TREE_TYPE (new_obj),
- NULL));
+ new_obj, ctor);
cxx_eval_constant_expression (ctx, activate,
lval, non_constant_p, overflow_p,
jump_target);
@@ -5793,6 +5793,18 @@ cxx_eval_component_reference (const constexpr_ctx *ctx, tree t,
}
/* If there's no explicit init for this field, it's value-initialized. */
+
+ if (AGGREGATE_TYPE_P (TREE_TYPE (t)))
+ {
+ /* As in cxx_eval_store_expression, insert an empty CONSTRUCTOR
+ and copy the flags. */
+ constructor_elt *e = get_or_insert_ctor_field (whole, part);
+ e->value = value = build_constructor (TREE_TYPE (part), NULL);
+ CONSTRUCTOR_ZERO_PADDING_BITS (value)
+ = CONSTRUCTOR_ZERO_PADDING_BITS (whole);
+ return value;
+ }
+
value = build_value_init (TREE_TYPE (t), tf_warning_or_error);
return cxx_eval_constant_expression (ctx, value,
lval,
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 882a943..d54fe34 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -3028,7 +3028,7 @@ cp_fold (tree x, fold_flags_t flags)
case CLEANUP_POINT_EXPR:
/* Strip CLEANUP_POINT_EXPR if the expression doesn't have side
effects. */
- r = cp_fold_rvalue (TREE_OPERAND (x, 0), flags);
+ r = cp_fold (TREE_OPERAND (x, 0), flags);
if (!TREE_SIDE_EFFECTS (r))
x = r;
break;
@@ -3217,7 +3217,16 @@ cp_fold (tree x, fold_flags_t flags)
loc = EXPR_LOCATION (x);
op0 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 0), rval_ops, flags);
- op1 = cp_fold_rvalue (TREE_OPERAND (x, 1), flags);
+ bool clear_decl_read;
+ clear_decl_read = false;
+ if (code == MODIFY_EXPR
+ && (VAR_P (op0) || TREE_CODE (op0) == PARM_DECL)
+ && !DECL_READ_P (op0))
+ clear_decl_read = true;
+ op1 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 1),
+ code != COMPOUND_EXPR, flags);
+ if (clear_decl_read)
+ DECL_READ_P (op0) = 0;
/* decltype(nullptr) has only one value, so optimize away all comparisons
with that type right away, keeping them in the IL causes troubles for
diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc
index f663a6d..55be12d 100644
--- a/gcc/cp/cvt.cc
+++ b/gcc/cp/cvt.cc
@@ -1186,13 +1186,6 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
expr = maybe_undo_parenthesized_ref (expr);
- expr = mark_discarded_use (expr);
- if (implicit == ICV_CAST)
- /* An explicit cast to void avoids all -Wunused-but-set* warnings. */
- mark_exp_read (expr);
-
- if (!TREE_TYPE (expr))
- return expr;
if (invalid_nonstatic_memfn_p (loc, expr, complain))
return error_mark_node;
if (TREE_CODE (expr) == PSEUDO_DTOR_EXPR)
@@ -1209,6 +1202,12 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
if (VOID_TYPE_P (TREE_TYPE (expr)))
return expr;
+
+ expr = mark_discarded_use (expr);
+ if (implicit == ICV_CAST)
+ /* An explicit cast to void avoids all -Wunused-but-set* warnings. */
+ mark_exp_read (expr);
+
switch (TREE_CODE (expr))
{
case COND_EXPR:
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 843f0e4..4752874 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -747,11 +747,11 @@ poplevel (int keep, int reverse, int functionbody)
{
if (!DECL_NAME (decl) && DECL_DECOMPOSITION_P (decl))
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_variable, "structured "
+ OPT_Wunused_but_set_variable_, "structured "
"binding declaration set but not used");
else
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_variable,
+ OPT_Wunused_but_set_variable_,
"variable %qD set but not used", decl);
unused_but_set_errorcount = errorcount;
}
@@ -19496,14 +19496,14 @@ finish_function (bool inline_p)
&& !DECL_READ_P (decl)
&& DECL_NAME (decl)
&& !DECL_ARTIFICIAL (decl)
- && !warning_suppressed_p (decl,OPT_Wunused_but_set_parameter)
+ && !warning_suppressed_p (decl, OPT_Wunused_but_set_parameter_)
&& !DECL_IN_SYSTEM_HEADER (decl)
&& TREE_TYPE (decl) != error_mark_node
&& !TYPE_REF_P (TREE_TYPE (decl))
&& (!CLASS_TYPE_P (TREE_TYPE (decl))
|| !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl))))
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_parameter,
+ OPT_Wunused_but_set_parameter_,
"parameter %qD set but not used", decl);
unused_but_set_errorcount = errorcount;
}
diff --git a/gcc/cp/expr.cc b/gcc/cp/expr.cc
index 2157cfb..32dc3ee 100644
--- a/gcc/cp/expr.cc
+++ b/gcc/cp/expr.cc
@@ -102,6 +102,9 @@ mark_use (tree expr, bool rvalue_p, bool read_p,
if (reject_builtin && reject_gcc_builtin (expr, loc))
return error_mark_node;
+ if (TREE_TYPE (expr) && VOID_TYPE_P (TREE_TYPE (expr)))
+ read_p = false;
+
if (read_p)
mark_exp_read (expr);
@@ -211,7 +214,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p,
}
return expr;
}
- gcc_fallthrough();
+ gcc_fallthrough ();
CASE_CONVERT:
recurse_op[0] = true;
break;
@@ -352,6 +355,9 @@ mark_exp_read (tree exp)
if (exp == NULL)
return;
+ if (TREE_TYPE (exp) && VOID_TYPE_P (TREE_TYPE (exp)))
+ return;
+
switch (TREE_CODE (exp))
{
case VAR_DECL:
@@ -361,16 +367,20 @@ mark_exp_read (tree exp)
case PARM_DECL:
DECL_READ_P (exp) = 1;
break;
+ CASE_CONVERT:
case ARRAY_REF:
case COMPONENT_REF:
case MODIFY_EXPR:
case REALPART_EXPR:
case IMAGPART_EXPR:
- CASE_CONVERT:
case ADDR_EXPR:
case INDIRECT_REF:
case FLOAT_EXPR:
case VIEW_CONVERT_EXPR:
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
mark_exp_read (TREE_OPERAND (exp, 0));
break;
case COMPOUND_EXPR:
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 689319a..e3c1a68 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -11124,8 +11124,7 @@ trees_in::fn_parms_fini (int tag, tree fn, tree existing, bool is_defn)
{
tree existing_parm = existing ? DECL_ARGUMENTS (existing) : NULL_TREE;
tree parms = DECL_ARGUMENTS (fn);
- unsigned ix = 0;
- for (tree parm = parms; parm; parm = DECL_CHAIN (parm), ix++)
+ for (tree parm = parms; parm; parm = DECL_CHAIN (parm))
{
if (existing_parm)
{
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 77fac45..640e1ea 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -3741,6 +3741,11 @@ finish_unary_op_expr (location_t op_loc, enum tree_code code, cp_expr expr,
if (!(complain & tf_warning))
return result;
+ /* These will never fold into a constant, so no need to check for
+ overflow for them. */
+ if (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR)
+ return result;
+
tree result_ovl = result;
tree expr_ovl = expr;
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 0bf5ae4..a604511 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -7680,7 +7680,18 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
if (val != 0)
goto return_build_unary_op;
- arg = mark_lvalue_use (arg);
+ tree stripped_arg;
+ stripped_arg = tree_strip_any_location_wrapper (arg);
+ if ((VAR_P (stripped_arg) || TREE_CODE (stripped_arg) == PARM_DECL)
+ && !DECL_READ_P (stripped_arg)
+ && (VAR_P (stripped_arg) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1)
+ {
+ arg = mark_lvalue_use (arg);
+ DECL_READ_P (stripped_arg) = 0;
+ }
+ else
+ arg = mark_lvalue_use (arg);
/* Increment or decrement the real part of the value,
and don't change the imaginary part. */
@@ -9796,7 +9807,22 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
{
auto_diagnostic_group d;
rhs = stabilize_expr (rhs, &init);
+ bool clear_decl_read = false;
+ tree stripped_lhs = tree_strip_any_location_wrapper (lhs);
+ if ((VAR_P (stripped_lhs) || TREE_CODE (stripped_lhs) == PARM_DECL)
+ && !DECL_READ_P (stripped_lhs)
+ && (VAR_P (stripped_lhs) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 2
+ && !CLASS_TYPE_P (TREE_TYPE (lhs))
+ && !CLASS_TYPE_P (TREE_TYPE (rhs)))
+ {
+ mark_exp_read (rhs);
+ if (!DECL_READ_P (stripped_lhs))
+ clear_decl_read = true;
+ }
newrhs = cp_build_binary_op (loc, modifycode, lhs, rhs, complain);
+ if (clear_decl_read)
+ DECL_READ_P (stripped_lhs) = 0;
if (newrhs == error_mark_node)
{
if (complain & tf_error)
diff --git a/gcc/diagnostic-spec.cc b/gcc/diagnostic-spec.cc
index df78579..b43ae63 100644
--- a/gcc/diagnostic-spec.cc
+++ b/gcc/diagnostic-spec.cc
@@ -72,9 +72,9 @@ nowarn_spec_t::nowarn_spec_t (opt_code opt)
case OPT_Wstrict_aliasing:
case OPT_Wunused:
case OPT_Wunused_function:
- case OPT_Wunused_but_set_variable:
+ case OPT_Wunused_but_set_variable_:
case OPT_Wunused_variable:
- case OPT_Wunused_but_set_parameter:
+ case OPT_Wunused_but_set_parameter_:
m_bits = NW_LEXICAL;
break;
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f60865b..0980230 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -433,7 +433,8 @@ Objective-C and Objective-C++ Dialects}.
-Wunsuffixed-float-constants
-Wunterminated-string-initialization
-Wunused
--Wunused-but-set-parameter -Wunused-but-set-variable
+-Wunused-but-set-parameter -Wunused-but-set-parameter=@var{n}
+-Wunused-but-set-variable -Wunused-but-set-variable=@var{n}
-Wunused-const-variable -Wunused-const-variable=@var{n}
-Wunused-function -Wunused-label -Wunused-local-typedefs
-Wunused-macros
@@ -7921,27 +7922,89 @@ statement.
@opindex Wunused-but-set-parameter
@opindex Wno-unused-but-set-parameter
@item -Wunused-but-set-parameter
+@option{-Wunused-but-set-parameter} is the same as
+@option{-Wunused-but-set-parameter=3} and
+@option{-Wno-unused-but-set-parameter} is the same as
+@option{-Wunused-but-set-parameter=0}.
+
+@opindex Wunused-but-set-parameter=
+@item -Wunused-but-set-parameter=@var{n}
Warn whenever a function parameter is assigned to, but otherwise unused
(aside from its declaration).
To suppress this warning use the @code{unused} attribute
(@pxref{Variable Attributes}).
-This warning is also enabled by @option{-Wunused} together with
-@option{-Wextra}.
+@option{-Wunused-but-set-parameter=0} disables the warning.
+With @option{-Wunused-but-set-parameter=1} all uses except initialization
+and left hand side of assignment which is not further used disable the
+warning.
+With @option{-Wunused-but-set-parameter=2} additionally uses of parameter
+in @code{++} and @code{--} operators don't count as uses.
+And finally with @option{-Wunused-but-set-parameter=3} additionally
+uses in @var{parm} @code{@var{@@}=} @var{rhs} outside of @var{rhs} don't
+count as uses. See @option{-Wunused-but-set-variable=@var{n}} option for
+examples.
+
+This @option{-Wunused-but-set-parameter=3} warning is also enabled by
+@option{-Wunused} together with @option{-Wextra}.
@opindex Wunused-but-set-variable
@opindex Wno-unused-but-set-variable
@item -Wunused-but-set-variable
+@option{-Wunused-but-set-variable} is the same as
+@option{-Wunused-but-set-variable=3} and
+@option{-Wno-unused-but-set-variable} is the same as
+@option{-Wunused-but-set-variable=0}.
+
+@opindex Wunused-but-set-variable=
+@item -Wunused-but-set-variable=@var{n}
Warn whenever a local variable is assigned to, but otherwise unused
(aside from its declaration).
-This warning is enabled by @option{-Wall}.
+This @option{-Wunused-but-set-variable=3} warning is enabled by @option{-Wall}.
To suppress this warning use the @code{unused} attribute
(@pxref{Variable Attributes}).
-This warning is also enabled by @option{-Wunused}, which is enabled
-by @option{-Wall}.
+@option{-Wunused-but-set-variable=0} disables the warning.
+With @option{-Wunused-but-set-variable=1} all uses except initialization
+and left hand side of assignment which is not further used disable the
+warning.
+With @option{-Wunused-but-set-variable=2} additionally uses of variable
+in @code{++} and @code{--} operators don't count as uses.
+And finally with @option{-Wunused-but-set-variable=3} additionally
+uses in @var{parm} @code{@var{@@}=} @var{rhs} outside of @var{rhs} don't
+count as uses.
+
+This @option{-Wunused-but-set-variable=3} warning is also enabled by
+@option{-Wunused}, which is enabled by @option{-Wall}.
+
+@smallexample
+void foo (void)
+@{
+ int a = 1; // @option{-Wunused-variable} warning
+ int b = 0; // Warning for @var{n} >= 1
+ b = 1; b = 2;
+ int c = 0; // Warning for @var{n} >= 2
+ ++c; c--; --c; c++;
+ int d = 0; // Warning for @var{n} >= 3
+ d += 4;
+ int e = 0; // No warning, cast to void
+ (void) e;
+ int f = 0; // No warning, f used
+ int g = f = 5;
+ (void) g;
+ int h = 0; // No warning, preincrement used
+ int i = ++h;
+ (void) i;
+ int j = 0; // No warning, postdecrement used
+ int k = j--;
+ (void) k;
+ int l = 0; // No warning, l used
+ int m = l |= 2;
+ (void) m;
+@}
+@end smallexample
@opindex Wunused-function
@opindex Wno-unused-function
diff --git a/gcc/doc/riscv-ext.texi b/gcc/doc/riscv-ext.texi
index c3ed1bf..572b70e 100644
--- a/gcc/doc/riscv-ext.texi
+++ b/gcc/doc/riscv-ext.texi
@@ -714,4 +714,8 @@
@tab 1.0
@tab Ventana integer conditional operations extension
+@item xmipscmov
+@tab 1.0
+@tab Mips conditional move extension
+
@end multitable
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 4c85548..d85095c 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2028,10 +2028,6 @@ typedef struct gfc_symbol
/* Set if this should be passed by value, but is not a VALUE argument
according to the Fortran standard. */
unsigned pass_as_value:1;
- /* Set if an allocatable array variable has been allocated in the current
- scope. Used in the suppression of uninitialized warnings in reallocation
- on assignment. */
- unsigned allocated_in_scope:1;
/* Set if an external dummy argument is called with different argument lists.
This is legal in Fortran, but can cause problems with autogenerated
C prototypes for C23. */
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 93df5d0..c33bd17 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -11014,16 +11014,16 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
that does precisely this here (instead of using the
'global' one). */
- /* First check the derived type import status. */
- if (gfc_current_ns->import_state != IMPORT_NOT_SET
- && (c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS))
- {
- st = gfc_find_symtree (gfc_current_ns->sym_root,
- c->ts.u.derived->name);
- if (!check_sym_import_status (c->ts.u.derived, st, NULL, old_code,
- gfc_current_ns))
- error++;
- }
+ /* First check the derived type import status. */
+ if (gfc_current_ns->import_state != IMPORT_NOT_SET
+ && (c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS))
+ {
+ st = gfc_find_symtree (gfc_current_ns->sym_root,
+ c->ts.u.derived->name);
+ if (!check_sym_import_status (c->ts.u.derived, st, NULL, old_code,
+ gfc_current_ns))
+ error++;
+ }
const char * var_name = gfc_var_name_for_select_type_temp (orig_expr1);
if (c->ts.type == BT_CLASS)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 7be2d7b..1561936 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3420,6 +3420,23 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
}
+/* Given an array descriptor expression DESCR and its data pointer DATA, decide
+ whether to either save the data pointer to a variable and use the variable or
+ use the data pointer expression directly without any intermediary variable.
+ */
+
+static bool
+save_descriptor_data (tree descr, tree data)
+{
+ return !(DECL_P (data)
+ || (TREE_CODE (data) == ADDR_EXPR
+ && DECL_P (TREE_OPERAND (data, 0)))
+ || (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (descr))
+ && TREE_CODE (descr) == COMPONENT_REF
+ && GFC_CLASS_TYPE_P (TREE_TYPE (TREE_OPERAND (descr, 0)))));
+}
+
+
/* Translate expressions for the descriptor and data pointer of a SS. */
/*GCC ARRAYS*/
@@ -3466,17 +3483,14 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base)
Otherwise we must evaluate it now to avoid breaking dependency
analysis by pulling the expressions for elemental array indices
inside the loop. */
- if (!(DECL_P (tmp)
- || (TREE_CODE (tmp) == ADDR_EXPR
- && DECL_P (TREE_OPERAND (tmp, 0)))
- || (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se.expr))
- && TREE_CODE (se.expr) == COMPONENT_REF
- && GFC_CLASS_TYPE_P (TREE_TYPE (TREE_OPERAND (se.expr, 0))))))
+ if (save_descriptor_data (se.expr, tmp) && !ss->is_alloc_lhs)
tmp = gfc_evaluate_now (tmp, block);
info->data = tmp;
tmp = gfc_conv_array_offset (se.expr);
- info->offset = gfc_evaluate_now (tmp, block);
+ if (!ss->is_alloc_lhs)
+ tmp = gfc_evaluate_now (tmp, block);
+ info->offset = tmp;
/* Make absolutely sure that the saved_offset is indeed saved
so that the variable is still accessible after the loops
@@ -4769,13 +4783,12 @@ gfc_trans_scalarized_loop_boundary (gfc_loopinfo * loop, stmtblock_t * body)
static void
evaluate_bound (stmtblock_t *block, tree *bounds, gfc_expr ** values,
- tree desc, int dim, bool lbound, bool deferred)
+ tree desc, int dim, bool lbound, bool deferred, bool save_value)
{
gfc_se se;
gfc_expr * input_val = values[dim];
tree *output = &bounds[dim];
-
if (input_val)
{
/* Specified section bound. */
@@ -4801,7 +4814,8 @@ evaluate_bound (stmtblock_t *block, tree *bounds, gfc_expr ** values,
*output = lbound ? gfc_conv_array_lbound (desc, dim) :
gfc_conv_array_ubound (desc, dim);
}
- *output = gfc_evaluate_now (*output, block);
+ if (save_value)
+ *output = gfc_evaluate_now (*output, block);
}
@@ -4834,18 +4848,18 @@ gfc_conv_section_startstride (stmtblock_t * block, gfc_ss * ss, int dim)
|| ar->dimen_type[dim] == DIMEN_THIS_IMAGE);
desc = info->descriptor;
stride = ar->stride[dim];
-
+ bool save_value = !ss->is_alloc_lhs;
/* Calculate the start of the range. For vector subscripts this will
be the range of the vector. */
evaluate_bound (block, info->start, ar->start, desc, dim, true,
- ar->as->type == AS_DEFERRED);
+ ar->as->type == AS_DEFERRED, save_value);
/* Similarly calculate the end. Although this is not used in the
scalarizer, it is needed when checking bounds and where the end
is an expression with side-effects. */
evaluate_bound (block, info->end, ar->end, desc, dim, false,
- ar->as->type == AS_DEFERRED);
+ ar->as->type == AS_DEFERRED, save_value);
/* Calculate the stride. */
@@ -4856,7 +4870,11 @@ gfc_conv_section_startstride (stmtblock_t * block, gfc_ss * ss, int dim)
gfc_init_se (&se, NULL);
gfc_conv_expr_type (&se, stride, gfc_array_index_type);
gfc_add_block_to_block (block, &se.pre);
- info->stride[dim] = gfc_evaluate_now (se.expr, block);
+ tree value = se.expr;
+ if (save_value)
+ info->stride[dim] = gfc_evaluate_now (value, block);
+ else
+ info->stride[dim] = value;
}
}
@@ -5991,7 +6009,10 @@ gfc_set_delta (gfc_loopinfo *loop)
gfc_array_index_type,
info->start[dim], tmp);
- info->delta[dim] = gfc_evaluate_now (tmp, &outer_loop->pre);
+ if (ss->is_alloc_lhs)
+ info->delta[dim] = tmp;
+ else
+ info->delta[dim] = gfc_evaluate_now (tmp, &outer_loop->pre);
}
}
}
@@ -6779,8 +6800,6 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
else
gfc_add_expr_to_block (&se->pre, set_descriptor);
- expr->symtree->n.sym->allocated_in_scope = 1;
-
return true;
}
@@ -8470,7 +8489,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
gcc_assert (n == codim - 1);
evaluate_bound (&loop.pre, info->start, ar->start,
info->descriptor, n + ndim, true,
- ar->as->type == AS_DEFERRED);
+ ar->as->type == AS_DEFERRED, true);
loop.from[n + loop.dimen] = info->start[n + ndim];
}
else
@@ -11206,6 +11225,9 @@ gfc_is_reallocatable_lhs (gfc_expr *expr)
gfc_ref * ref;
gfc_symbol *sym;
+ if (!flag_realloc_lhs)
+ return false;
+
if (!expr->ref)
return false;
@@ -11330,6 +11352,55 @@ concat_str_length (gfc_expr* expr)
}
+/* Among the scalarization chain of LOOP, find the element associated with an
+ allocatable array on the lhs of an assignment and evaluate its fields
+ (bounds, offset, etc) to new variables, putting the new code in BLOCK. This
+ function is to be called after putting the reallocation code in BLOCK and
+ before the beginning of the scalarization loop body.
+
+ The fields to be saved are expected to hold on entry to the function
+ expressions referencing the array descriptor. Especially the expressions
+ shouldn't be already temporary variable references as the value saved before
+ reallocation would be incorrect after reallocation.
+ At the end of the function, the expressions have been replaced with variable
+ references. */
+
+static void
+update_reallocated_descriptor (stmtblock_t *block, gfc_loopinfo *loop)
+{
+ for (gfc_ss *s = loop->ss; s != gfc_ss_terminator; s = s->loop_chain)
+ {
+ if (!s->is_alloc_lhs)
+ continue;
+
+ gcc_assert (s->info->type == GFC_SS_SECTION);
+ gfc_array_info *info = &s->info->data.array;
+
+#define SAVE_VALUE(value) \
+ do \
+ { \
+ value = gfc_evaluate_now (value, block); \
+ } \
+ while (0)
+
+ if (save_descriptor_data (info->descriptor, info->data))
+ SAVE_VALUE (info->data);
+ SAVE_VALUE (info->offset);
+ info->saved_offset = info->offset;
+ for (int i = 0; i < s->dimen; i++)
+ {
+ int dim = s->dim[i];
+ SAVE_VALUE (info->start[dim]);
+ SAVE_VALUE (info->end[dim]);
+ SAVE_VALUE (info->stride[dim]);
+ SAVE_VALUE (info->delta[dim]);
+ }
+
+#undef SAVE_VALUE
+ }
+}
+
+
/* Allocate the lhs of an assignment to an allocatable array, otherwise
reallocate it. */
@@ -11368,7 +11439,6 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
tree lbd;
tree class_expr2 = NULL_TREE;
int n;
- int dim;
gfc_array_spec * as;
bool coarray = (flag_coarray == GFC_FCOARRAY_LIB
&& gfc_caf_attr (expr1, true).codimension);
@@ -11423,14 +11493,61 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
&& !expr2->value.function.isym)
expr2->ts.u.cl->backend_decl = rss->info->string_length;
- gfc_start_block (&fblock);
-
/* Since the lhs is allocatable, this must be a descriptor type.
Get the data and array size. */
desc = linfo->descriptor;
gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)));
array1 = gfc_conv_descriptor_data_get (desc);
+ /* If the data is null, set the descriptor bounds and offset. This suppresses
+ the maybe used uninitialized warning. Note that the always false variable
+ prevents this block from ever being executed, and makes sure that the
+ optimizers are able to remove it. Component references are not subject to
+ the warnings, so we don't uselessly complicate the generated code for them.
+ */
+ for (ref = expr1->ref; ref; ref = ref->next)
+ if (ref->type == REF_COMPONENT)
+ break;
+
+ if (!ref)
+ {
+ stmtblock_t unalloc_init_block;
+ gfc_init_block (&unalloc_init_block);
+ tree guard = gfc_create_var (logical_type_node, "unallocated_init_guard");
+ gfc_add_modify (&unalloc_init_block, guard, logical_false_node);
+
+ gfc_start_block (&loop_pre_block);
+ for (n = 0; n < expr1->rank; n++)
+ {
+ gfc_conv_descriptor_lbound_set (&loop_pre_block, desc,
+ gfc_rank_cst[n],
+ gfc_index_one_node);
+ gfc_conv_descriptor_ubound_set (&loop_pre_block, desc,
+ gfc_rank_cst[n],
+ gfc_index_zero_node);
+ gfc_conv_descriptor_stride_set (&loop_pre_block, desc,
+ gfc_rank_cst[n],
+ gfc_index_zero_node);
+ }
+
+ tmp = gfc_conv_descriptor_offset (desc);
+ gfc_add_modify (&loop_pre_block, tmp, gfc_index_zero_node);
+
+ tmp = fold_build2_loc (input_location, EQ_EXPR,
+ logical_type_node, array1,
+ build_int_cst (TREE_TYPE (array1), 0));
+ tmp = fold_build2_loc (input_location, TRUTH_ANDIF_EXPR,
+ logical_type_node, tmp, guard);
+ tmp = build3_v (COND_EXPR, tmp,
+ gfc_finish_block (&loop_pre_block),
+ build_empty_stmt (input_location));
+ gfc_prepend_expr_to_block (&loop->pre, tmp);
+ gfc_prepend_expr_to_block (&loop->pre,
+ gfc_finish_block (&unalloc_init_block));
+ }
+
+ gfc_start_block (&fblock);
+
if (expr2)
desc2 = rss->info->data.array.descriptor;
else
@@ -11543,45 +11660,6 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
array1, build_int_cst (TREE_TYPE (array1), 0));
cond_null= gfc_evaluate_now (cond_null, &fblock);
- /* If the data is null, set the descriptor bounds and offset. This suppresses
- the maybe used uninitialized warning and forces the use of malloc because
- the size is zero in all dimensions. Note that this block is only executed
- if the lhs is unallocated and is only applied once in any namespace.
- Component references are not subject to the warnings. */
- for (ref = expr1->ref; ref; ref = ref->next)
- if (ref->type == REF_COMPONENT)
- break;
-
- if (!expr1->symtree->n.sym->allocated_in_scope && !ref)
- {
- gfc_start_block (&loop_pre_block);
- for (n = 0; n < expr1->rank; n++)
- {
- gfc_conv_descriptor_lbound_set (&loop_pre_block, desc,
- gfc_rank_cst[n],
- gfc_index_one_node);
- gfc_conv_descriptor_ubound_set (&loop_pre_block, desc,
- gfc_rank_cst[n],
- gfc_index_zero_node);
- gfc_conv_descriptor_stride_set (&loop_pre_block, desc,
- gfc_rank_cst[n],
- gfc_index_zero_node);
- }
-
- tmp = gfc_conv_descriptor_offset (desc);
- gfc_add_modify (&loop_pre_block, tmp, gfc_index_zero_node);
-
- tmp = fold_build2_loc (input_location, EQ_EXPR,
- logical_type_node, array1,
- build_int_cst (TREE_TYPE (array1), 0));
- tmp = build3_v (COND_EXPR, tmp,
- gfc_finish_block (&loop_pre_block),
- build_empty_stmt (input_location));
- gfc_prepend_expr_to_block (&loop->pre, tmp);
-
- expr1->symtree->n.sym->allocated_in_scope = 1;
- }
-
tmp = build3_v (COND_EXPR, cond_null,
build1_v (GOTO_EXPR, jump_label1),
build_empty_stmt (input_location));
@@ -11736,21 +11814,6 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
running offset. Use the saved_offset instead. */
tmp = gfc_conv_descriptor_offset (desc);
gfc_add_modify (&fblock, tmp, offset);
- if (linfo->saved_offset
- && VAR_P (linfo->saved_offset))
- gfc_add_modify (&fblock, linfo->saved_offset, tmp);
-
- /* Now set the deltas for the lhs. */
- for (n = 0; n < expr1->rank; n++)
- {
- tmp = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[n]);
- dim = lss->dim[n];
- tmp = fold_build2_loc (input_location, MINUS_EXPR,
- gfc_array_index_type, tmp,
- loop->from[dim]);
- if (linfo->delta[dim] && VAR_P (linfo->delta[dim]))
- gfc_add_modify (&fblock, linfo->delta[dim], tmp);
- }
/* Take into account _len of unlimited polymorphic entities, so that span
for array descriptors and allocation sizes are computed correctly. */
@@ -11972,18 +12035,18 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
tmp = build3_v (COND_EXPR, cond_null, alloc_expr, realloc_expr);
gfc_add_expr_to_block (&fblock, tmp);
- /* Make sure that the scalarizer data pointer is updated. */
- if (linfo->data && VAR_P (linfo->data))
- {
- tmp = gfc_conv_descriptor_data_get (desc);
- gfc_add_modify (&fblock, linfo->data, tmp);
- }
-
/* Add the label for same shape lhs and rhs. */
tmp = build1_v (LABEL_EXPR, jump_label2);
gfc_add_expr_to_block (&fblock, tmp);
- return gfc_finish_block (&fblock);
+ tree realloc_code = gfc_finish_block (&fblock);
+
+ stmtblock_t result_block;
+ gfc_init_block (&result_block);
+ gfc_add_expr_to_block (&result_block, realloc_code);
+ update_reallocated_descriptor (&result_block, loop);
+
+ return gfc_finish_block (&result_block);
}
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 3e0d763..082987f 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -12875,11 +12875,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
if (gfc_is_reallocatable_lhs (expr1))
{
lss->no_bounds_check = 1;
- if (!(expr2->expr_type == EXPR_FUNCTION
- && expr2->value.function.isym != NULL
- && !(expr2->value.function.isym->elemental
- || expr2->value.function.isym->conversion)))
- lss->is_alloc_lhs = 1;
+ lss->is_alloc_lhs = 1;
}
else
lss->no_bounds_check = expr1->no_bounds_check;
@@ -12943,6 +12939,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
rhs_caf_attr = gfc_caf_attr (expr2, false, &rhs_refs_comp);
}
+ tree reallocation = NULL_TREE;
if (lss != gfc_ss_terminator)
{
/* The assignment needs scalarization. */
@@ -12961,8 +12958,12 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
/* Walk the rhs. */
rss = gfc_walk_expr (expr2);
if (rss == gfc_ss_terminator)
- /* The rhs is scalar. Add a ss for the expression. */
- rss = gfc_get_scalar_ss (gfc_ss_terminator, expr2);
+ {
+ /* The rhs is scalar. Add a ss for the expression. */
+ rss = gfc_get_scalar_ss (gfc_ss_terminator, expr2);
+ lss->is_alloc_lhs = 0;
+ }
+
/* When doing a class assign, then the handle to the rhs needs to be a
pointer to allow for polymorphism. */
if (is_poly_assign && expr2->rank == 0 && !UNLIMITED_POLY (expr2))
@@ -13011,6 +13012,15 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
ompws_flags |= OMPWS_SCALARIZER_WS | OMPWS_SCALARIZER_BODY;
}
+ /* F2003: Allocate or reallocate lhs of allocatable array. */
+ if (realloc_flag)
+ {
+ realloc_lhs_warning (expr1->ts.type, true, &expr1->where);
+ ompws_flags &= ~OMPWS_SCALARIZER_WS;
+ reallocation = gfc_alloc_allocatable_for_assignment (&loop, expr1,
+ expr2);
+ }
+
/* Start the scalarized loop body. */
gfc_start_scalarized_body (&loop, &body);
}
@@ -13319,15 +13329,8 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
gfc_add_expr_to_block (&body, tmp);
}
- /* F2003: Allocate or reallocate lhs of allocatable array. */
- if (realloc_flag)
- {
- realloc_lhs_warning (expr1->ts.type, true, &expr1->where);
- ompws_flags &= ~OMPWS_SCALARIZER_WS;
- tmp = gfc_alloc_allocatable_for_assignment (&loop, expr1, expr2);
- if (tmp != NULL_TREE)
- gfc_add_expr_to_block (&loop.code[expr1->rank - 1], tmp);
- }
+ if (reallocation != NULL_TREE)
+ gfc_add_expr_to_block (&loop.code[loop.dimen - 1], reallocation);
if (maybe_workshare)
ompws_flags &= ~OMPWS_SCALARIZER_BODY;
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index f3d7cd4..278e91c 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -9714,11 +9714,12 @@ gfc_trans_omp_declare_variant (gfc_namespace *ns, gfc_namespace *parent_ns)
{
gfc_symtree *proc_st;
gfc_find_sym_tree (variant_proc_name, gfc_current_ns, 1, &proc_st);
- variant_proc_sym = proc_st->n.sym;
+ variant_proc_sym = proc_st ? proc_st->n.sym : NULL;
}
if (variant_proc_sym == NULL)
{
- gfc_error ("Cannot find symbol %qs", variant_proc_name);
+ gfc_error ("Cannot find symbol %qs at %L", variant_proc_name,
+ &odv->where);
continue;
}
set_selectors = omp_check_context_selector
diff --git a/gcc/gimple-ssa-store-merging.cc b/gcc/gimple-ssa-store-merging.cc
index 90f449c..ce56d97 100644
--- a/gcc/gimple-ssa-store-merging.cc
+++ b/gcc/gimple-ssa-store-merging.cc
@@ -644,9 +644,7 @@ find_bswap_or_nop_1 (gimple *stmt, struct symbolic_number *n, int limit)
/* Mask. */
uint64_t mask = 0;
- uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
- for (unsigned i = 0; i < bitsize / BITS_PER_UNIT;
- i++, tmp <<= BITS_PER_UNIT)
+ for (unsigned i = 0; i < bitsize / BITS_PER_UNIT; i++)
mask |= (uint64_t) MARKER_MASK << (i * BITS_PER_MARKER);
n->n &= mask;
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 3aad419..566eca8 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -5987,12 +5987,11 @@ Function::export_func_with_type(Export* exp, const Named_object* no,
const Typed_identifier_list* parameters = fntype->parameters();
if (parameters != NULL)
{
- size_t i = 0;
bool is_varargs = fntype->is_varargs();
bool first = true;
for (Typed_identifier_list::const_iterator p = parameters->begin();
p != parameters->end();
- ++p, ++i)
+ ++p)
{
if (first)
first = false;
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index d7c0a92..86270af 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -3059,6 +3059,8 @@ pass_ipa_strub::execute (function *)
TYPE_ATTRIBUTES (TREE_TYPE (nnode->decl)));
}
}
+#else
+ (void) named_args;
#endif
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 49f7f91..f132b84 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,169 @@
+2025-07-14 Richard Biener <rguenther@suse.de>
+
+ Revert:
+ 2025-07-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121059
+ * gcc.dg/vect/pr121059.c: New testcase.
+
+2025-07-14 Juergen Christ <jchrist@linux.ibm.com>
+
+ * lib/target-supports.exp: Add s390 to vect_logical_reduc targets.
+ * gcc.target/s390/vector/reduc-binops-1.c: New test.
+ * gcc.target/s390/vector/reduc-minmax-1.c: New test.
+ * gcc.target/s390/vector/reduc-plus-1.c: New test.
+
+2025-07-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/121059
+ * gcc.dg/vect/pr121059.c: New testcase.
+
+2025-07-14 Pan Li <pan2.li@intel.com>
+
+ * gcc.target/riscv/sat/sat_u_mul-1-u16-from-u64.c: New test.
+ * gcc.target/riscv/sat/sat_u_mul-1-u32-from-u64.c: New test.
+ * gcc.target/riscv/sat/sat_u_mul-1-u8-from-u64.c: New test.
+ * gcc.target/riscv/sat/sat_u_mul-run-1-u16-from-u64.c: New test.
+ * gcc.target/riscv/sat/sat_u_mul-run-1-u32-from-u64.c: New test.
+ * gcc.target/riscv/sat/sat_u_mul-run-1-u8-from-u64.c: New test.
+
+2025-07-14 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/121015
+ * gcc.target/i386/pr121015.c: New test.
+
+2025-07-14 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/120881
+ * gcc.dg/20021014-1.c: Add additional -mfentry -fno-pic options
+ for x86.
+ * gcc.dg/aru-2.c: Likewise.
+ * gcc.dg/nest.c: Likewise.
+ * gcc.dg/pr32450.c: Likewise.
+ * gcc.dg/pr43643.c: Likewise.
+ * gcc.target/i386/pr104447.c: Likewise.
+ * gcc.target/i386/pr113122-3.c: Likewise.
+ * gcc.target/i386/pr119386-1.c: Add additional -mfentry if not
+ ia32.
+ * gcc.target/i386/pr119386-2.c: Likewise.
+ * gcc.target/i386/pr120881-1a.c: New test.
+ * gcc.target/i386/pr120881-1b.c: Likewise.
+ * gcc.target/i386/pr120881-1c.c: Likewise.
+ * gcc.target/i386/pr120881-1d.c: Likewise.
+ * gcc.target/i386/pr120881-2a.c: Likewise.
+ * gcc.target/i386/pr120881-2b.c: Likewise.
+ * gcc.target/i386/pr82699-1.c: Add additional -mfentry.
+ * lib/target-supports.exp (check_effective_target_fentry): New.
+
+2025-07-14 François-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gcc.dg/darwin-minversion-link.c: Account for macOS 26.
+
+2025-07-14 Paul-Antoine Arras <parras@baylibre.com>
+
+ PR target/119100
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfwmacc and
+ vfwmsac.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise. Also check
+ for fcvt and vfmv.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Add vfwmacc and
+ vfwmsac.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise. Also check
+ for fcvt and vfmv.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h: Add support for
+ widening variants.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop_widen_run.h: New test
+ helper.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwmacc-run-1-f16.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwmacc-run-1-f32.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwmsac-run-1-f16.c: New test.
+ * gcc.target/riscv/rvv/autovec/vx_vf/vf_vfwmsac-run-1-f32.c: New test.
+
+2025-07-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/deref4.adb: New test.
+ * gnat.dg/deref4_pkg.ads: New helper.
+
+2025-07-14 Alfie Richards <alfie.richards@arm.com>
+
+ * gcc.target/aarch64/sme2/acle-asm/amax_f16_x2.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amax_f16_x4.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amax_f32_x2.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amax_f32_x4.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amax_f64_x2.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amax_f64_x4.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amin_f16_x2.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amin_f16_x4.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amin_f32_x2.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amin_f32_x4.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amin_f64_x2.c: New test.
+ * gcc.target/aarch64/sme2/acle-asm/amin_f64_x4.c: New test.
+
+2025-07-14 panciyan <panciyan@eswincomputing.com>
+
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_arith.h: Unsigned vector SAT_SUB form11 form12.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_data.h: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-1-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-1-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-1-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-1-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-10-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-10-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-10-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-10-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-2-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-2-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-2-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-2-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-3-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-3-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-3-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-3-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-4-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-4-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-4-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-4-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-5-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-5-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-5-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-5-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-6-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-6-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-6-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-6-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-7-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-7-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-7-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-7-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-8-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-8-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-8-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-8-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-9-u16.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-9-u32.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-9-u64.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-9-u8.c: Use ussub instead of usub.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-11-u16.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-11-u32.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-11-u64.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-11-u8.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-12-u16.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-12-u32.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-12-u64.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-12-u8.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-11-u16.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-11-u32.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-11-u64.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-11-u8.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-12-u16.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-12-u32.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-12-u64.c: New test.
+ * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub-run-12-u8.c: New test.
+
2025-07-12 Xi Ruoyao <xry111@xry111.site>
PR rtl-optimization/87600
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-1.c b/gcc/testsuite/c-c++-common/Wunused-parm-1.c
new file mode 100644
index 0000000..355fa4a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-1.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-2.c b/gcc/testsuite/c-c++-common/Wunused-parm-2.c
new file mode 100644
index 0000000..2caea94
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-2.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused -Wextra" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-3.c b/gcc/testsuite/c-c++-common/Wunused-parm-3.c
new file mode 100644
index 0000000..2978cd4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-3.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=3" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-4.c b/gcc/testsuite/c-c++-common/Wunused-parm-4.c
new file mode 100644
index 0000000..063b40f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-4.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=2" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-5.c b/gcc/testsuite/c-c++-common/Wunused-parm-5.c
new file mode 100644
index 0000000..1c80a82
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-5.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=1" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b,
+ int c,
+ int d,
+ int e,
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m)
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-parm-6.c b/gcc/testsuite/c-c++-common/Wunused-parm-6.c
new file mode 100644
index 0000000..ee328bd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-parm-6.c
@@ -0,0 +1,50 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=0" } */
+
+void baz (int);
+
+void
+foo (int a,
+ int b,
+ int c,
+ int d,
+ int e,
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m)
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-19.c b/gcc/testsuite/c-c++-common/Wunused-var-19.c
new file mode 100644
index 0000000..32c47e6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-19.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-20.c b/gcc/testsuite/c-c++-common/Wunused-var-20.c
new file mode 100644
index 0000000..e25b26b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-20.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-21.c b/gcc/testsuite/c-c++-common/Wunused-var-21.c
new file mode 100644
index 0000000..0732d98
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-21.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=3" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-22.c b/gcc/testsuite/c-c++-common/Wunused-var-22.c
new file mode 100644
index 0000000..84f57c5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-22.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=2" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-23.c b/gcc/testsuite/c-c++-common/Wunused-var-23.c
new file mode 100644
index 0000000..b74c3f4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-23.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=1" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0;
+ ++b;
+ int c = 0;
+ c++;
+ int d = 0;
+ --d;
+ int e = 0;
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-24.c b/gcc/testsuite/c-c++-common/Wunused-var-24.c
new file mode 100644
index 0000000..a59f50a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-24.c
@@ -0,0 +1,60 @@
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=0" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0;
+ a = 1;
+ int b = 0;
+ ++b;
+ int c = 0;
+ c++;
+ int d = 0;
+ --d;
+ int e = 0;
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-7.c b/gcc/testsuite/c-c++-common/Wunused-var-7.c
index 7419643..ea6babd 100644
--- a/gcc/testsuite/c-c++-common/Wunused-var-7.c
+++ b/gcc/testsuite/c-c++-common/Wunused-var-7.c
@@ -24,7 +24,7 @@ foo (void)
void
bar (void)
{
- int a;
+ int a; /* { dg-warning "set but not used" } */
int b;
int c; /* { dg-warning "set but not used" } */
a = 1;
@@ -36,7 +36,7 @@ bar (void)
void
baz (void)
{
- int a;
+ int a; /* { dg-warning "set but not used" } */
int b;
int c;
int d;
diff --git a/gcc/testsuite/g++.dg/cpp26/decomp25.C b/gcc/testsuite/g++.dg/cpp26/decomp25.C
index 55559f0..f395685 100644
--- a/gcc/testsuite/g++.dg/cpp26/decomp25.C
+++ b/gcc/testsuite/g++.dg/cpp26/decomp25.C
@@ -1,6 +1,6 @@
// C++26 P2686R4 - constexpr structured bindings
// { dg-do compile { target c++11 } }
-// { dg-options "" }
+// { dg-options "-fno-implicit-constexpr" }
namespace std {
template <typename T> struct tuple_size;
diff --git a/gcc/testsuite/g++.dg/cpp26/name-independent-decl1.C b/gcc/testsuite/g++.dg/cpp26/name-independent-decl1.C
index 0830ce8..9b56e84 100644
--- a/gcc/testsuite/g++.dg/cpp26/name-independent-decl1.C
+++ b/gcc/testsuite/g++.dg/cpp26/name-independent-decl1.C
@@ -70,7 +70,7 @@ foo ()
++_;
}
{
- static int _ = 3;
+ static int _ = 3; // { dg-warning "variable '_' set but not used" }
++_;
}
{
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-union9.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-union9.C
new file mode 100644
index 0000000..7db1030
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-union9.C
@@ -0,0 +1,33 @@
+// PR c++/120577
+// { dg-do compile { target c++20 } }
+
+template <class _Tp> struct optional {
+ union {
+ _Tp __val_;
+ };
+ template <class... _Args>
+ constexpr optional(_Args... __args)
+ : __val_(__args...) {}
+};
+template <class _Tp, class... _Args>
+constexpr optional<_Tp> make_optional(_Args... __args) {
+ return optional<_Tp>(__args...);
+}
+
+struct __non_trivial_if {
+ constexpr __non_trivial_if() {}
+};
+struct allocator : __non_trivial_if {};
+struct __padding {};
+struct __short {
+ [[__no_unique_address__]] __padding __padding_;
+ int __data_;
+};
+struct basic_string {
+ union {
+ __short __s;
+ };
+ [[__no_unique_address__]] allocator __alloc_;
+ constexpr basic_string(int, int) {}
+};
+auto opt = make_optional<basic_string>(4, 'X');
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-parm-12.C b/gcc/testsuite/g++.dg/warn/Wunused-parm-12.C
new file mode 100644
index 0000000..03029f9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-parm-12.C
@@ -0,0 +1,59 @@
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-parameter" }
+
+void baz (int);
+
+template <int N>
+void
+foo (int a, // { dg-warning "parameter 'a' set but not used" }
+ int b, // { dg-warning "parameter 'b' set but not used" }
+ int c, // { dg-warning "parameter 'c' set but not used" }
+ int d, // { dg-warning "parameter 'd' set but not used" }
+ int e, // { dg-warning "parameter 'e' set but not used" }
+ int f, // { dg-warning "parameter 'f' set but not used" }
+ int g, // { dg-warning "parameter 'g' set but not used" }
+ int h, // { dg-warning "parameter 'h' set but not used" }
+ int i, // { dg-warning "parameter 'i' set but not used" }
+ int j, // { dg-warning "parameter 'j' set but not used" }
+ int k, // { dg-warning "parameter 'k' set but not used" }
+ int l, // { dg-warning "parameter 'l' set but not used" }
+ int m) // { dg-warning "parameter 'm' set but not used" }
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <int N>
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <0> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ bar <0> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-parm-13.C b/gcc/testsuite/g++.dg/warn/Wunused-parm-13.C
new file mode 100644
index 0000000..f2d357f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-parm-13.C
@@ -0,0 +1,59 @@
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-parameter" }
+
+void baz (int);
+
+template <typename T>
+void
+foo (T a, // { dg-warning "parameter 'a' set but not used" }
+ T b, // { dg-warning "parameter 'b' set but not used" }
+ T c, // { dg-warning "parameter 'c' set but not used" }
+ T d, // { dg-warning "parameter 'd' set but not used" }
+ T e, // { dg-warning "parameter 'e' set but not used" }
+ T f, // { dg-warning "parameter 'f' set but not used" }
+ T g, // { dg-warning "parameter 'g' set but not used" }
+ T h, // { dg-warning "parameter 'h' set but not used" }
+ T i, // { dg-warning "parameter 'i' set but not used" }
+ T j, // { dg-warning "parameter 'j' set but not used" }
+ T k, // { dg-warning "parameter 'k' set but not used" }
+ T l, // { dg-warning "parameter 'l' set but not used" }
+ T m) // { dg-warning "parameter 'm' set but not used" }
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (T n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <typename T>
+T
+bar (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j,
+ T k, T l, T m, T n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <int> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ bar <int> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-2.C b/gcc/testsuite/g++.dg/warn/Wunused-var-2.C
index 0b21ef1..869065f 100644
--- a/gcc/testsuite/g++.dg/warn/Wunused-var-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-2.C
@@ -18,9 +18,9 @@ f1 ()
}
void
-f2 (int x)
+f2 (int x) // { dg-warning "parameter 'x' set but not used" }
{
- int a = 0;
+ int a = 0; // { dg-warning "variable 'a' set but not used" }
x++;
++a;
}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-40.C b/gcc/testsuite/g++.dg/warn/Wunused-var-40.C
new file mode 100644
index 0000000..9351367
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-40.C
@@ -0,0 +1,69 @@
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-variable" }
+
+void baz (int);
+
+template <int N>
+void
+foo (void)
+{
+ int a = 0; // { dg-warning "variable 'a' set but not used" }
+ a = 1;
+ int b = 0; // { dg-warning "variable 'b' set but not used" }
+ ++b;
+ int c = 0; // { dg-warning "variable 'c' set but not used" }
+ c++;
+ int d = 0; // { dg-warning "variable 'd' set but not used" }
+ --d;
+ int e = 0; // { dg-warning "variable 'e' set but not used" }
+ e--;
+ int f = 0; // { dg-warning "variable 'f' set but not used" }
+ f += 2;
+ int g = 0; // { dg-warning "variable 'g' set but not used" }
+ g |= 2;
+ int h = 0; // { dg-warning "variable 'h' set but not used" }
+ h -= 2;
+ int i = 0; // { dg-warning "variable 'i' set but not used" }
+ i &= 2;
+ int j = 0; // { dg-warning "variable 'j' set but not used" }
+ j ^= 2;
+ int k = 0; // { dg-warning "variable 'k' set but not used" }
+ k *= 2;
+ int l = 0; // { dg-warning "variable 'l' set but not used" }
+ l %= 2;
+ int m = 0; // { dg-warning "variable 'm' set but not used" }
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <int N>
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <0> ();
+ bar <0> ();
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-41.C b/gcc/testsuite/g++.dg/warn/Wunused-var-41.C
new file mode 100644
index 0000000..ff981ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-41.C
@@ -0,0 +1,69 @@
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-variable" }
+
+void baz (int);
+
+template <typename T>
+void
+foo (void)
+{
+ T a = 0; // { dg-warning "variable 'a' set but not used" }
+ a = 1;
+ T b = 0; // { dg-warning "variable 'b' set but not used" }
+ ++b;
+ T c = 0; // { dg-warning "variable 'c' set but not used" }
+ c++;
+ T d = 0; // { dg-warning "variable 'd' set but not used" }
+ --d;
+ T e = 0; // { dg-warning "variable 'e' set but not used" }
+ e--;
+ T f = 0; // { dg-warning "variable 'f' set but not used" }
+ f += 2;
+ T g = 0; // { dg-warning "variable 'g' set but not used" }
+ g |= 2;
+ T h = 0; // { dg-warning "variable 'h' set but not used" }
+ h -= 2;
+ T i = 0; // { dg-warning "variable 'i' set but not used" }
+ i &= 2;
+ T j = 0; // { dg-warning "variable 'j' set but not used" }
+ j ^= 2;
+ T k = 0; // { dg-warning "variable 'k' set but not used" }
+ k *= 2;
+ T l = 0; // { dg-warning "variable 'l' set but not used" }
+ l %= 2;
+ T m = 0; // { dg-warning "variable 'm' set but not used" }
+ for (T n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <typename T>
+T
+bar (void)
+{
+ T a = 0;
+ T b = ++a;
+ T c = 0;
+ T d = --c;
+ T e = 0;
+ T f = e--;
+ T g = 0;
+ T h = g++;
+ T i = 0;
+ T j;
+ j = i += 42;
+ T k = 0;
+ T l;
+ l = k *= 4;
+ T m = 0;
+ T n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <int> ();
+ bar <int> ();
+}
diff --git a/gcc/testsuite/gcc.dg/memchr-3.c b/gcc/testsuite/gcc.dg/memchr-3.c
index 9a35735..9caa2ac 100644
--- a/gcc/testsuite/gcc.dg/memchr-3.c
+++ b/gcc/testsuite/gcc.dg/memchr-3.c
@@ -17,9 +17,10 @@ struct SX
const struct SX sx = { 0x1221 };
const char sx_rep[] = { };
-void test_find (void)
+int test_find (void)
{
int n = 0, nb = (const char*)&sx.a - (const char*)&sx;
const char *p = (const char*)&sx, *q = sx_rep;
n += p + 1 == memchr (p, q[1], nb);
+ return n;
}
diff --git a/gcc/testsuite/gcc.dg/unused-9.c b/gcc/testsuite/gcc.dg/unused-9.c
index bdf36e1..ad1ad0e 100644
--- a/gcc/testsuite/gcc.dg/unused-9.c
+++ b/gcc/testsuite/gcc.dg/unused-9.c
@@ -2,12 +2,9 @@
/* { dg-do compile } */
/* { dg-options "-Wunused" } */
-
void g(void)
{
- int i = 0;
- volatile int x;
- (x, i++); /* { dg-bogus "set but not used" } */
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ volatile int x; /* { dg-bogus "variable 'x' set but not used" } */
+ (x, i++);
}
-
-
diff --git a/gcc/testsuite/gcc.dg/vect/pr121059.c b/gcc/testsuite/gcc.dg/vect/pr121059.c
new file mode 100644
index 0000000..2bbfcea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr121059.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3 --param vect-partial-vector-usage=1" } */
+/* { dg-additional-options "-march=x86-64-v4" { target avx512f } } */
+
+typedef struct {
+ long left, right, top, bottom;
+} MngBox;
+typedef struct {
+ MngBox object_clip[6];
+ char exists[256], frozen[];
+} MngReadInfo;
+MngReadInfo mng_info;
+
+long ReadMNGImage_i;
+
+void ReadMNGImage(int ReadMNGImage_i)
+{
+ for (; ReadMNGImage_i < 256; ReadMNGImage_i++)
+ if (mng_info.exists[ReadMNGImage_i] && mng_info.frozen[ReadMNGImage_i])
+ mng_info.object_clip[ReadMNGImage_i].left =
+ mng_info.object_clip[ReadMNGImage_i].right =
+ mng_info.object_clip[ReadMNGImage_i].top =
+ mng_info.object_clip[ReadMNGImage_i].bottom = 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/avoid-store-forwarding-be.c b/gcc/testsuite/gcc.target/aarch64/avoid-store-forwarding-be.c
new file mode 100644
index 0000000..2e8946b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/avoid-store-forwarding-be.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-require-effective-target aarch64_big_endian } */
+/* { dg-options "-O2 -favoid-store-forwarding" } */
+
+typedef union {
+ char arr[2];
+ short value;
+} DataUnion;
+
+short __attribute__ ((noinline))
+ssll (DataUnion *data, char x, char y)
+{
+ data->arr[0] = x;
+ data->arr[1] = y;
+ return data->value;
+}
+
+int main () {
+ DataUnion data = {};
+ short value = ssll (&data, 0, 1);
+ if (value != 1)
+ __builtin_abort ();
+} \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/aarch64/ldapr-sext.c b/gcc/testsuite/gcc.target/aarch64/ldapr-sext.c
index f57c09d..e8a545a 100644
--- a/gcc/testsuite/gcc.target/aarch64/ldapr-sext.c
+++ b/gcc/testsuite/gcc.target/aarch64/ldapr-sext.c
@@ -33,7 +33,7 @@ TEST(s8_s64, s8, long long)
/*
**test_s16_s64:
**...
-** ldapursh x0, \[x[0-9]+\]
+** ldapursh x0, \[x[0-9]+, [0-9]+\]
** ret
*/
@@ -42,7 +42,7 @@ TEST(s16_s64, s16, long long)
/*
**test_s32_s64:
**...
-** ldapursw x0, \[x[0-9]+\]
+** ldapursw x0, \[x[0-9]+, [0-9]+\]
** ret
*/
@@ -60,7 +60,7 @@ TEST(s8_s32, s8, int)
/*
**test_s16_s32:
**...
-** ldapursh w0, \[x[0-9]+\]
+** ldapursh w0, \[x[0-9]+, [0-9]+\]
** ret
*/
diff --git a/gcc/testsuite/gcc.target/aarch64/ldapur.c b/gcc/testsuite/gcc.target/aarch64/ldapur.c
new file mode 100644
index 0000000..5c68bdd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ldapur.c
@@ -0,0 +1,77 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=c99" } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+#include <stdatomic.h>
+#include <stdint.h>
+
+#pragma GCC target "arch=armv8.8-a"
+
+atomic_ullong u64;
+atomic_uint u32;
+atomic_ushort u16;
+atomic_uchar u8[2]; /* Force an offset for u8 */
+
+#define TEST(name, ldsize, rettype) \
+rettype \
+test_##name (void) \
+{ \
+ return atomic_load_explicit (&ldsize, memory_order_acquire); \
+} \
+
+
+/*
+** test_u8_u64:
+** ...
+** ldapurb w[0-9]+, \[x[0-9]+, [0-9]+\]
+** ret
+*/
+TEST(u8_u64, u8[1], uint64_t)
+
+/*
+** test_u16_u64:
+** ...
+** ldapurh w[0-9]+, \[x[0-9]+, [0-9]+\]
+** ret
+*/
+TEST(u16_u64, u16, uint64_t)
+
+/*
+**test_u32_u64:
+** ...
+** ldapur w[0-9]+, \[x[0-9]+, [0-9]+\]
+** ret
+*/
+TEST(u32_u64, u32, uint64_t)
+
+/*
+**test_u64_u64:
+** ...
+** ldapur x[0-9]+, \[x[0-9]+, [0-9]+\]
+** ret
+*/
+TEST(u64_u64, u64, uint64_t)
+
+/*
+**test_u8_u32:
+** ...
+** ldapurb w[0-9]+, \[x[0-9]+, [0-9]+\]
+** ret
+*/
+TEST(u8_u32, u8[1], uint32_t)
+
+/*
+**test_u16_u32:
+** ...
+** ldapurh w[0-9]+, \[x[0-9]+, [0-9]+\]
+** ret
+*/
+TEST(u16_u32, u16, uint32_t)
+
+/*
+**test_u32_u32:
+** ...
+** ldapur w[0-9]+, \[x[0-9]+, [0-9]+\]
+** ret
+*/
+TEST(u32_u32, u32, uint32_t) \ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/aarch64/ldapur_avoid.c b/gcc/testsuite/gcc.target/aarch64/ldapur_avoid.c
new file mode 100644
index 0000000..ad87a30
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/ldapur_avoid.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -std=c99 -moverride=tune=avoid_ldapur" } */
+
+#include <stdatomic.h>
+#include <stdint.h>
+
+#pragma GCC target "arch=armv8.8-a"
+/* LDAPUR is only avoided for armv8.4 to armv8.7. This checks for the working
+of avoid_ldapur flag. */
+
+/* { dg-final { scan-assembler-not "ldapur\t" } } */
+
+atomic_ullong u64;
+atomic_uint u32;
+atomic_ushort u16;
+atomic_uchar u8[2]; /* Force an offset for u8 */
+
+#define TEST(name, ldsize, rettype) \
+rettype \
+test_##name (void) \
+{ \
+ return atomic_load_explicit (&ldsize, memory_order_acquire); \
+} \
+
+TEST(u8_u64, u8[1], uint64_t)
+TEST(u16_u64, u16, uint64_t)
+TEST(u32_u64, u32, uint64_t)
+TEST(u64_u64, u64, uint64_t)
+TEST(u8_u32, u8[1], uint32_t)
+TEST(u16_u32, u16, uint32_t)
+TEST(u32_u32, u32, uint32_t)
+
+/* { dg-final { scan-assembler-times "ldapr\t" 3 } } */
+/* { dg-final { scan-assembler-times "ldaprh\t" 2 } } */
+/* { dg-final { scan-assembler-times "ldaprb\t" 2 } } */
+
+
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/eor3_d.c b/gcc/testsuite/gcc.target/aarch64/simd/eor3_d.c
index 6c9595b..7f2b2b4 100644
--- a/gcc/testsuite/gcc.target/aarch64/simd/eor3_d.c
+++ b/gcc/testsuite/gcc.target/aarch64/simd/eor3_d.c
@@ -7,13 +7,9 @@
#define EOR3(x,y,z) ((x) ^ (y) ^ (z))
-/* Should not use EOR3 when inputs come from GP regs. */
-uint64_t eor3_d_gp (uint64_t a, uint64_t b, uint64_t c) { return EOR3 (a, b, c); }
-
-uint64x1_t eor3_d (uint64x1_t a, uint64x1_t b, uint64x1_t c) { return EOR3 (a, b, c); }
uint32x2_t bcax_s (uint32x2_t a, uint32x2_t b, uint32x2_t c) { return EOR3 (a, b, c); }
uint16x4_t bcax_h (uint16x4_t a, uint16x4_t b, uint16x4_t c) { return EOR3 (a, b, c); }
uint8x8_t bcax_b (uint8x8_t a, uint8x8_t b, uint8x8_t c) { return EOR3 (a, b, c); }
-/* { dg-final { scan-assembler-times {eor3\tv0.16b, v[0-9]+.16b, v[0-9]+.16b, v[0-9]+.16b} 4 } } */
+/* { dg-final { scan-assembler-times {eor3\tv0.16b, v[0-9]+.16b, v[0-9]+.16b, v[0-9]+.16b} 3 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_1.c b/gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_1.c
new file mode 100644
index 0000000..d793a6c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -moverride=sve_width=2048 --param=aarch64-autovec-preference=sve-only -fno-trapping-math" } */
+
+#include "unpacked_fcm_1.c"
+
+/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 32 } } */
+/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 32 } } */
+/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d} 32 } } */
+
+/* Drop a PTRUE predicated AND with the loop mask and comparison result in
+ favour of predicating the comparison with the loop mask. */
+/* { dg-final { scan-assembler-not {\tand\t} } } */
+
+/* Similarly, for codes that are implemented via an inversion, prefer
+ NOT (predicated with the loop mask) over BIC+PTRUE. */
+/* { dg-final { scan-assembler-not {\tbic\t} } } */
+/* { dg-final { scan-assembler-times {\tnot\t} 15 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_2.c b/gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_2.c
new file mode 100644
index 0000000..b85391b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/unpacked_fcm_combines_2.c
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -moverride=sve_width=2048 --param=aarch64-autovec-preference=sve-only -fno-trapping-math" } */
+
+#include <stdint.h>
+
+/* Ensure that we still emit NOR here, rather than two NOTs. */
+
+#define TEST_FCM_NOR(TYPE0, TYPE1, CMP, COUNT) \
+ void \
+ f_##TYPE0##_##TYPE1##_##CMP (TYPE0 *__restrict out, \
+ TYPE1 *__restrict a, \
+ TYPE1 *__restrict b, \
+ TYPE1 *__restrict c) \
+ { \
+ for (unsigned int i = 0; i < COUNT; i++) \
+ out[i] = !(CMP (a[i], c[i]) | CMP (b[i], c[i])) ? 3 : out[i]; \
+ }
+
+#define GT(A, B) ((A) > (B))
+
+TEST_FCM_NOR (uint64_t, float, GT, 32)
+TEST_FCM_NOR (uint64_t, _Float16, GT, 32)
+TEST_FCM_NOR (uint32_t, _Float16, GT, 64)
+
+TEST_FCM_NOR (uint64_t, float, __builtin_isunordered, 32)
+TEST_FCM_NOR (uint64_t, _Float16, __builtin_isunordered, 32)
+TEST_FCM_NOR (uint32_t, _Float16, __builtin_isunordered, 64)
+
+/* { dg-final { scan-assembler-times {\tld1w\tz[0-9]+\.d} 6 } } */
+/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.s} 6 } } */
+/* { dg-final { scan-assembler-times {\tld1h\tz[0-9]+\.d} 6 } } */
+
+/* { dg-final { scan-assembler-not {\tbic\t} } } */
+/* { dg-final { scan-assembler-not {\tnot\t} } } */
+/* { dg-final { scan-assembler-times {\tnor\tp[0-9]+\.b, p[0-9]+/z, p[0-9]+\.b, p[0-9]+\.b\n} 6 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/mipscondmov.c b/gcc/testsuite/gcc.target/riscv/mipscondmov.c
new file mode 100644
index 0000000..5485133
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mipscondmov.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32imafd_xmipscmov" { target { rv32 } } } */
+/* { dg-options "-march=rv64imafd_xmipscmov -mabi=lp64d" { target { rv64 } } } */
+/* { dg-skip-if "" { *-*-* } { "-O0" "-Og" } } */
+
+#define MYTEST(name, mytype) \
+mytype test1_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a == b) ? c : d; } \
+mytype test2_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a != b) ? c : d; } \
+mytype test3_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a > b) ? c : d; } \
+mytype test4_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a >= b) ? c : d; } \
+mytype test5_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a < b) ? c : d; } \
+mytype test6_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a <= b) ? c : d; } \
+mytype test7_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a == 1) ? c : d; } \
+mytype test8_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a != 1) ? c : d; } \
+mytype test9_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a > 1) ? c : d; } \
+mytype test10_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a >= 1) ? c : d; } \
+mytype test11_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a < 1) ? c : d; } \
+mytype test12_ ## name (mytype a, mytype b, mytype c, mytype d) { return (a <= 1) ? c : d; }
+
+MYTEST(1, long)
+MYTEST(2, unsigned long)
+MYTEST(3, int)
+MYTEST(4, unsigned int)
+MYTEST(5, short)
+MYTEST(6, unsigned short)
+MYTEST(7, signed char)
+MYTEST(8, unsigned char)
+
+/* { dg-final { scan-assembler-times "mips.ccmov" 96 } } */
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr104428.f90 b/gcc/testsuite/gfortran.dg/gomp/pr104428.f90
new file mode 100644
index 0000000..639b331
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr104428.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+
+program p
+ interface
+ subroutine x
+ end subroutine x
+ end interface
+contains
+ subroutine foo
+ !$omp declare variant(x) match(construct={do})
+ end
+ subroutine bar
+ !$omp declare variant(y) match(construct={do}) ! { dg-error "Cannot find symbol 'y'" }
+ end
+end
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 4aa69da..e2dcfaa 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -6705,7 +6705,6 @@ vectorizable_operation (vec_info *vinfo,
poly_uint64 nunits_in;
poly_uint64 nunits_out;
tree vectype_out;
- int vec_num;
int i;
vec<tree> vec_oprnds0 = vNULL;
vec<tree> vec_oprnds1 = vNULL;
@@ -6877,7 +6876,7 @@ vectorizable_operation (vec_info *vinfo,
/* Multiple types in SLP are handled by creating the appropriate number of
vectorized stmts for each SLP node. */
- vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
+ auto vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
/* Reject attempts to combine mask types with nonmask types, e.g. if
we have an AND between a (nonmask) boolean loaded from memory and
@@ -7229,7 +7228,7 @@ vectorizable_operation (vec_info *vinfo,
&& code == BIT_AND_EXPR
&& VECTOR_BOOLEAN_TYPE_P (vectype))
{
- if (loop_vinfo->scalar_cond_masked_set.contains ({ op0, 1 }))
+ if (loop_vinfo->scalar_cond_masked_set.contains ({ op0, vec_num }))
{
mask = vect_get_loop_mask (loop_vinfo, gsi, masks,
vec_num, vectype, i);
@@ -7238,7 +7237,7 @@ vectorizable_operation (vec_info *vinfo,
vop0, gsi);
}
- if (loop_vinfo->scalar_cond_masked_set.contains ({ op1, 1 }))
+ if (loop_vinfo->scalar_cond_masked_set.contains ({ op1, vec_num }))
{
mask = vect_get_loop_mask (loop_vinfo, gsi, masks,
vec_num, vectype, i);
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 9d3d0ec..9bc6228 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "backend.h"
#include "target.h"
+#include "memmodel.h"
#include "tm_p.h"
#include "tree.h"
#include "gimple.h"
diff --git a/libgcc/config/libbid/bid_binarydecimal.c b/libgcc/config/libbid/bid_binarydecimal.c
index daca2ff..12e32b9 100644
--- a/libgcc/config/libbid/bid_binarydecimal.c
+++ b/libgcc/config/libbid/bid_binarydecimal.c
@@ -132,6 +132,7 @@ UINT64 CY; \
__mul_10x64(p1,c1,a1,c0); \
__mul_10x64(p2,c2,a2,c1); \
__mul_10x64(p3,c3,a3,c2); \
+ (void)c3; \
}
// Set up indices for low and high parts, depending on the endian-ness.
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 716a516..0a1eea7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,51 @@
+2025-07-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/stl_pair.h (swap): Add comment to deleted
+ overload.
+ * include/bits/unique_ptr.h (swap): Likewise.
+ * include/std/array (swap): Likewise.
+ * include/std/optional (swap): Likewise.
+ * include/std/tuple (swap): Likewise.
+ * include/std/variant (swap): Likewise.
+ * testsuite/23_containers/array/tuple_interface/get_neg.cc:
+ Adjust dg-error line numbers.
+
+2025-07-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/pstl/algorithm_impl.h (__for_each_n_it_serial):
+ Protect against overloaded comma operator.
+ (__brick_walk2): Likewise.
+ (__brick_walk2_n): Likewise.
+ (__brick_walk3): Likewise.
+ (__brick_move_destroy::operator()): Likewise.
+ (__brick_calc_mask_1): Likewise.
+ (__brick_copy_by_mask): Likewise.
+ (__brick_partition_by_mask): Likewise.
+ (__brick_calc_mask_2): Likewise.
+ (__brick_reverse): Likewise.
+ (__pattern_partial_sort_copy): Likewise.
+ * include/pstl/memory_impl.h (__brick_uninitialized_move):
+ Likewise.
+ (__brick_uninitialized_copy): Likewise.
+ * include/pstl/numeric_impl.h (__brick_transform_scan):
+ Likewise.
+
+2025-07-14 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/117785
+ * include/bits/version.def (constexpr_exceptions): Define
+ correct value.
+ * include/bits/version.h: Regenerate.
+ * libsupc++/exception: Check correct value.
+ * testsuite/18_support/exception/version.cc: New test.
+
+2025-07-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * libsupc++/exception_ptr.h (make_exception_ptr): Return null
+ for consteval when -fno-exceptions is used.
+ (exception_ptr_cast): Likewise. Allow consteval path to work
+ with -fno-rtti.
+
2025-07-11 Jakub Jelinek <jakub@redhat.com>
* libsupc++/exception_ptr.h: Implement C++26 P3748R0 - Inspecting
diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index 75ee7e8..fe3c912 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -881,16 +881,32 @@ namespace __format
_S_empty_fs()
{ return _Runtime_format_string<_CharT>(_S_empty_spec); }
- // Return the formatting locale.
- template<typename _FormatContext>
- std::locale
- _M_locale(_FormatContext& __fc) const
- {
- if (!_M_spec._M_localized)
- return std::locale::classic();
- else
- return __fc.locale();
- }
+ static constexpr const _CharT* _S_weekdays[]
+ {
+ _GLIBCXX_WIDEN("Sunday"),
+ _GLIBCXX_WIDEN("Monday"),
+ _GLIBCXX_WIDEN("Tuesday"),
+ _GLIBCXX_WIDEN("Wednesday"),
+ _GLIBCXX_WIDEN("Thursday"),
+ _GLIBCXX_WIDEN("Friday"),
+ _GLIBCXX_WIDEN("Saturday"),
+ };
+
+ static constexpr const _CharT* _S_months[]
+ {
+ _GLIBCXX_WIDEN("January"),
+ _GLIBCXX_WIDEN("February"),
+ _GLIBCXX_WIDEN("March"),
+ _GLIBCXX_WIDEN("April"),
+ _GLIBCXX_WIDEN("May"),
+ _GLIBCXX_WIDEN("June"),
+ _GLIBCXX_WIDEN("July"),
+ _GLIBCXX_WIDEN("August"),
+ _GLIBCXX_WIDEN("September"),
+ _GLIBCXX_WIDEN("October"),
+ _GLIBCXX_WIDEN("November"),
+ _GLIBCXX_WIDEN("December"),
+ };
private:
template<typename _OutIter>
@@ -1051,15 +1067,15 @@ namespace __format
break;
case 'a':
case 'A':
- __out = _M_a_A(__t._M_weekday, std::move(__out), __fc, __c == 'A');
+ __out = _M_a_A(__t._M_weekday, std::move(__out), __c == 'A');
break;
case 'b':
case 'h':
case 'B':
- __out = _M_b_B(__t._M_month, std::move(__out), __fc, __c == 'B');
+ __out = _M_b_B(__t._M_month, std::move(__out), __c == 'B');
break;
case 'c':
- __out = _M_c(__t, std::move(__out), __fc);
+ __out = _M_c(__t, std::move(__out));
break;
case 'C':
case 'y':
@@ -1095,7 +1111,7 @@ namespace __format
__out = _M_M(__t._M_minutes, __print_sign());
break;
case 'p':
- __out = _M_p(__t._M_hours, std::move(__out), __fc);
+ __out = _M_p(__t._M_hours, std::move(__out));
break;
case 'q':
__out = _M_q(__t._M_unit_suffix, std::move(__out));
@@ -1104,7 +1120,7 @@ namespace __format
__out = _M_Q(__t, __print_sign(), __fc);
break;
case 'r':
- __out = _M_r(__t, __print_sign(), __fc);
+ __out = _M_r(__t, __print_sign());
break;
case 'R':
case 'X':
@@ -1183,10 +1199,9 @@ namespace __format
return std::move(__out);
}
- template<typename _OutIter, typename _FormatContext>
+ template<typename _OutIter>
_OutIter
- _M_a_A(chrono::weekday __wd, _OutIter __out,
- _FormatContext& __ctx, bool __full) const
+ _M_a_A(chrono::weekday __wd, _OutIter __out, bool __full) const
{
// %a Locale's abbreviated weekday name.
// %A Locale's full weekday name.
@@ -1199,21 +1214,15 @@ namespace __format
__string_view(_GLIBCXX_WIDEN(" is not a valid weekday")));
}
- locale __loc = _M_locale(__ctx);
- const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
- const _CharT* __days[7];
- if (__full)
- __tp._M_days(__days);
- else
- __tp._M_days_abbreviated(__days);
- __string_view __str(__days[__wd.c_encoding()]);
- return _M_write(std::move(__out), __loc, __str);
+ __string_view __str = _S_weekdays[__wd.c_encoding()];
+ if (!__full)
+ __str = __str.substr(0, 3);
+ return __format::__write(std::move(__out), __str);
}
- template<typename _OutIter, typename _FormatContext>
+ template<typename _OutIter>
_OutIter
- _M_b_B(chrono::month __m, _OutIter __out,
- _FormatContext& __ctx, bool __full) const
+ _M_b_B(chrono::month __m, _OutIter __out, bool __full) const
{
// %b Locale's abbreviated month name.
// %B Locale's full month name.
@@ -1226,28 +1235,22 @@ namespace __format
__string_view(_GLIBCXX_WIDEN(" is not a valid month")));
}
- locale __loc = _M_locale(__ctx);
- const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
- const _CharT* __months[12];
- if (__full)
- __tp._M_months(__months);
- else
- __tp._M_months_abbreviated(__months);
- __string_view __str(__months[(unsigned)__m - 1]);
- return _M_write(std::move(__out), __loc, __str);
+ __string_view __str = _S_months[(unsigned)__m - 1];
+ if (!__full)
+ __str = __str.substr(0, 3);
+ return __format::__write(std::move(__out), __str);
}
- template<typename _OutIter, typename _FormatContext>
+ template<typename _OutIter>
_OutIter
- _M_c(const _ChronoData<_CharT>& __t, _OutIter __out,
- _FormatContext& __ctx) const
+ _M_c(const _ChronoData<_CharT>& __t, _OutIter __out) const
{
// %c Locale's date and time representation, for C-locale: %a %b %e %T %Y
// %Ec Locale's alternate date and time representation, for C-locale same as above
- __out = _M_a_A(__t._M_weekday, std::move(__out), __ctx, false);
+ __out = _M_a_A(__t._M_weekday, std::move(__out), false);
*__out = _S_space;
- __out = _M_b_B(__t._M_month, std::move(++__out), __ctx, false);
+ __out = _M_b_B(__t._M_month, std::move(++__out), false);
*__out = _S_space;
__out = _M_d_e(__t._M_day, std::move(++__out), 'e');
*__out = _S_space;
@@ -1489,20 +1492,15 @@ namespace __format
return __format::__write(std::move(__out), _S_two_digits(__i));
}
- template<typename _OutIter, typename _FormatContext>
+ template<typename _OutIter>
_OutIter
- _M_p(chrono::hours __h, _OutIter __out, _FormatContext& __ctx) const
+ _M_p(chrono::hours __h, _OutIter __out) const
{
// %p The locale's equivalent of the AM/PM designations.
- auto __hi = __h.count();
- if (__hi >= 24) [[unlikely]]
- __hi %= 24;
-
- locale __loc = _M_locale(__ctx);
- const auto& __tp = use_facet<__timepunct<_CharT>>(__loc);
- const _CharT* __ampm[2];
- __tp._M_am_pm(__ampm);
- return _M_write(std::move(__out), __loc, __ampm[__hi >= 12]);
+
+ _CharT __buf[2];
+ _S_fill_ampm(__buf, __h);
+ return __format::__write(std::move(__out), __string_view(__buf, 2));
}
template<typename _OutIter>
@@ -1522,27 +1520,25 @@ namespace __format
return std::vformat_to(std::move(__out), _S_empty_spec, __t._M_ereps);
}
- template<typename _OutIter, typename _FormatContext>
+ template<typename _OutIter>
_OutIter
- _M_r(const _ChronoData<_CharT>& __t, _OutIter __out,
- _FormatContext& __ctx) const
+ _M_r(const _ChronoData<_CharT>& __t, _OutIter __out) const
{
// %r Locale's 12-hour clock time, for C-locale: %I:%M:%S %p
auto __hi = __t._M_hours.count() % 12;
if (__hi == 0)
__hi = 12;
- _CharT __buf[9];
+ _CharT __buf[11];
__buf[2] = _S_colon;
__buf[5] = _S_colon;
__buf[8] = _S_space;
_S_fill_two_digits(__buf, __hi);
_S_fill_two_digits(__buf + 3, __t._M_minutes.count());
_S_fill_two_digits(__buf + 6, __t._M_seconds.count());
+ _S_fill_ampm(__buf + 9, __t._M_hours);
- __string_view __sv(__buf, 9);
- __out = __format::__write(std::move(__out), __sv);
- return _M_p(__t._M_hours, std::move(__out), __ctx);
+ return __format::__write(std::move(__out), __string_view(__buf, 11));
}
template<typename _OutIter>
@@ -1606,9 +1602,9 @@ namespace __format
return __out;
_CharT __dot = _S_dot;
- if (_M_spec._M_localized)
- if (auto __loc = __ctx.locale(); __loc != locale::classic())
+ if (_M_spec._M_localized) [[unlikely]]
{
+ auto __loc = __ctx.locale();
const auto& __np = use_facet<numpunct<_CharT>>(__loc);
__dot = __np.decimal_point();
}
@@ -1618,8 +1614,8 @@ namespace __format
if (_M_spec._M_floating_point_rep)
{
_Str_sink<_CharT> __sink;
- if (_M_spec._M_localized && _M_spec._M_custom_rep)
- std::vformat_to(__sink.out(), _M_locale(__ctx),
+ if (_M_spec._M_localized && _M_spec._M_custom_rep) [[unlikely]]
+ std::vformat_to(__sink.out(), __ctx.locale(),
_GLIBCXX_WIDEN("{1:0.{2}Lf}"), __t._M_ereps);
else
std::vformat_to(__sink.out(),
@@ -1778,6 +1774,20 @@ namespace __format
__buf[1] = __sv[1];
}
+ // Fills __buf[0] and __buf[1] with "AM", "PM" depending on __h.
+ [[__gnu__::__always_inline__]]
+ static void
+ _S_fill_ampm(_CharT* __buf, chrono::hours __h)
+ {
+ auto __hi = __h.count();
+ if (__hi >= 24) [[unlikely]]
+ __hi %= 24;
+
+ constexpr const _CharT* __apm = _GLIBCXX_WIDEN("APM");
+ __buf[0] = __apm[__hi >= 12];
+ __buf[1] = __apm[2];
+ }
+
// Returns decimal representation of __n.
// Returned string_view may point to __buf.
[[__gnu__::__always_inline__]]
@@ -1879,7 +1889,6 @@ namespace __format
};
using __formatter_chrono<_CharT>::__formatter_chrono;
- using __formatter_chrono<_CharT>::_M_locale;
using __formatter_chrono<_CharT>::_M_spec;
template<typename _Duration, typename _ParseContext>
@@ -1909,6 +1918,17 @@ namespace __format
return __res;
}
+ // Return the formatting locale.
+ template<typename _FormatContext>
+ std::locale
+ _M_locale(_FormatContext& __fc) const
+ {
+ if (!_M_spec._M_localized)
+ return std::locale::classic();
+ else
+ return __fc.locale();
+ }
+
// Format duration for empty chrono-specs, e.g. "{}" (C++20 [time.format] p6).
template<typename _Rep, typename _Period, typename _FormatContext>
typename _FormatContext::iterator
diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h
index e84c9ee..8456089 100644
--- a/libstdc++-v3/include/bits/functional_hash.h
+++ b/libstdc++-v3/include/bits/functional_hash.h
@@ -199,6 +199,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_3 unsigned)
#endif
+#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
+ // In strict modes __GLIBCXX_TYPE_INT_N_0 is not defined for __int128,
+ // but we want to always treat signed/unsigned __int128 as integral types.
+ __extension__
+ _Cxx_hashtable_define_trivial_hash(__int128)
+ __extension__
+ _Cxx_hashtable_define_trivial_hash(__int128 unsigned)
+#endif
+
#undef _Cxx_hashtable_define_trivial_hash
struct _Hash_impl
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 085ca07..061e6b4 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -215,14 +215,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @return Nothing.
*/
template<typename _Tp>
- _GLIBCXX20_CONSTEXPR
- inline
-#if __cplusplus >= 201103L
- typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
- is_move_constructible<_Tp>,
- is_move_assignable<_Tp>>::value>::type
+#if __glibcxx_concepts // >= C++20
+ requires (! __is_tuple_like<_Tp>::value)
+ && is_move_constructible_v<_Tp>
+ && is_move_assignable_v<_Tp>
+ constexpr void
+#elif __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR inline
+ __enable_if_t<__and_<__not_<__is_tuple_like<_Tp>>,
+ is_move_constructible<_Tp>,
+ is_move_assignable<_Tp>>::value>
#else
- void
+ inline void
#endif
swap(_Tp& __a, _Tp& __b)
_GLIBCXX_NOEXCEPT_IF(__and_<is_nothrow_move_constructible<_Tp>,
@@ -241,12 +245,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// DR 809. std::swap should be overloaded for array types.
/// Swap the contents of two arrays.
template<typename _Tp, size_t _Nm>
- _GLIBCXX20_CONSTEXPR
- inline
-#if __cplusplus >= 201103L
- typename enable_if<__is_swappable<_Tp>::value>::type
+#if __glibcxx_concepts // >= C++20
+ requires is_swappable_v<_Tp>
+ constexpr void
+#elif __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR inline
+ __enable_if_t<__is_swappable<_Tp>::value>
#else
- void
+ inline void
#endif
swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
_GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Tp>::value)
diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h
index 0251e5d..7df638d 100644
--- a/libstdc++-v3/include/bits/ranges_base.h
+++ b/libstdc++-v3/include/bits/ranges_base.h
@@ -879,10 +879,17 @@ namespace ranges
{
if constexpr (sized_sentinel_for<_Sent, _It>)
{
- const auto __diff = __bound - __it;
+ const iter_difference_t<_It> __diff = __bound - __it;
if (__diff == 0)
- return __n;
+ {
+ // inline any possible side effects of advance(it, bound)
+ if constexpr (assignable_from<_It&, _Sent>)
+ __it = std::move(__bound);
+ else if constexpr (random_access_iterator<_It>)
+ __it += 0;
+ return __n;
+ }
else if (__diff > 0 ? __n >= __diff : __n <= __diff)
{
(*this)(__it, __bound);
@@ -897,9 +904,14 @@ namespace ranges
return 0;
}
else
- return 0;
+ {
+ // inline any possible side effects of advance(it, n)
+ if constexpr (random_access_iterator<_It>)
+ __it += 0;
+ return 0;
+ }
}
- else if (__it == __bound || __n == 0)
+ else if (__n == 0 || __it == __bound)
return __n;
else if (__n > 0)
{
diff --git a/libstdc++-v3/include/bits/ranges_uninitialized.h b/libstdc++-v3/include/bits/ranges_uninitialized.h
index 12a714b..3f9a07f 100644
--- a/libstdc++-v3/include/bits/ranges_uninitialized.h
+++ b/libstdc++-v3/include/bits/ranges_uninitialized.h
@@ -556,13 +556,12 @@ namespace ranges
__destroy_fn::operator()(_Iter __first, _Sent __last) const noexcept
{
if constexpr (is_trivially_destructible_v<iter_value_t<_Iter>>)
- return ranges::next(std::move(__first), __last);
- else
- {
- for (; __first != __last; ++__first)
- ranges::destroy_at(std::__addressof(*__first));
- return __first;
- }
+ if (!is_constant_evaluated())
+ return ranges::next(std::move(__first), __last);
+
+ for (; __first != __last; ++__first)
+ ranges::destroy_at(std::__addressof(*__first));
+ return __first;
}
template<__detail::__nothrow_input_range _Range>
@@ -581,13 +580,12 @@ namespace ranges
operator()(_Iter __first, iter_difference_t<_Iter> __n) const noexcept
{
if constexpr (is_trivially_destructible_v<iter_value_t<_Iter>>)
- return ranges::next(std::move(__first), __n);
- else
- {
- for (; __n > 0; ++__first, (void)--__n)
- ranges::destroy_at(std::__addressof(*__first));
- return __first;
- }
+ if (!is_constant_evaluated())
+ return ranges::next(std::move(__first), __n);
+
+ for (; __n > 0; ++__first, (void)--__n)
+ ranges::destroy_at(std::__addressof(*__first));
+ return __first;
}
};
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 8c57712..393f6a0 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -1132,6 +1132,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif // C++23
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2766. Swapping non-swappable types
template<typename _T1, typename _T2>
typename enable_if<!__and_<__is_swappable<_T1>,
__is_swappable<_T2>>::value>::type
diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h
index 6ae46a9..d76ad63 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -832,6 +832,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __x.swap(__y); }
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2766. Swapping non-swappable types
template<typename _Tp, typename _Dp>
typename enable_if<!__is_swappable<_Dp>::value>::type
swap(unique_ptr<_Tp, _Dp>&,
diff --git a/libstdc++-v3/include/experimental/memory b/libstdc++-v3/include/experimental/memory
index 131e5ac..1b01462 100644
--- a/libstdc++-v3/include/experimental/memory
+++ b/libstdc++-v3/include/experimental/memory
@@ -148,42 +148,42 @@ inline namespace fundamentals_v2
}; // observer_ptr<>
template<typename _Tp>
- void
+ constexpr void
swap(observer_ptr<_Tp>& __p1, observer_ptr<_Tp>& __p2) noexcept
{
__p1.swap(__p2);
}
template<typename _Tp>
- observer_ptr<_Tp>
+ constexpr observer_ptr<_Tp>
make_observer(_Tp* __p) noexcept
{
return observer_ptr<_Tp>(__p);
}
template<typename _Tp, typename _Up>
- bool
+ constexpr bool
operator==(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return __p1.get() == __p2.get();
}
template<typename _Tp, typename _Up>
- bool
+ constexpr bool
operator!=(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return !(__p1 == __p2);
}
template<typename _Tp>
- bool
+ constexpr bool
operator==(observer_ptr<_Tp> __p, nullptr_t) noexcept
{
return !__p;
}
template<typename _Tp>
- bool
+ constexpr bool
operator==(nullptr_t, observer_ptr<_Tp> __p) noexcept
{
return !__p;
@@ -197,14 +197,14 @@ inline namespace fundamentals_v2
}
template<typename _Tp>
- bool
+ constexpr bool
operator!=(nullptr_t, observer_ptr<_Tp> __p) noexcept
{
return bool(__p);
}
template<typename _Tp, typename _Up>
- bool
+ constexpr bool
operator<(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return std::less<typename common_type<typename add_pointer<_Tp>::type,
@@ -214,21 +214,21 @@ inline namespace fundamentals_v2
}
template<typename _Tp, typename _Up>
- bool
+ constexpr bool
operator>(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return __p2 < __p1;
}
template<typename _Tp, typename _Up>
- bool
+ constexpr bool
operator<=(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return !(__p2 < __p1);
}
template<typename _Tp, typename _Up>
- bool
+ constexpr bool
operator>=(observer_ptr<_Tp> __p1, observer_ptr<_Up> __p2)
{
return !(__p1 < __p2);
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index fdcf0b0..12f0109 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -381,6 +381,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __one.swap(__two); }
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2766. Swapping non-swappable types
template<typename _Tp, std::size_t _Nm>
__enable_if_t<!__array_traits<_Tp, _Nm>::_Is_swappable::value>
swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete;
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index cc7af5b..e5051d7 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -1740,6 +1740,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
noexcept(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2766. Swapping non-swappable types
template<typename _Tp>
enable_if_t<!(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>)>
swap(optional<_Tp>&, optional<_Tp>&) = delete;
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 3a6710b..efe6296 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -3022,7 +3022,8 @@ namespace views::__adaptor
{ _M_satisfy(); }
[[no_unique_address]]
- __detail::__maybe_present_t<forward_range<_Base>, _Outer_iter> _M_outer;
+ __detail::__maybe_present_t<forward_range<_Base>, _Outer_iter> _M_outer
+ = decltype(_M_outer)();
optional<_Inner_iter> _M_inner;
_Parent* _M_parent = nullptr;
@@ -3376,7 +3377,8 @@ namespace views::__adaptor
[[no_unique_address]]
__detail::__maybe_present_t<forward_range<_Vp>,
- iterator_t<_Base>> _M_current;
+ iterator_t<_Base>> _M_current
+ = decltype(_M_current)();
bool _M_trailing_empty = false;
public:
@@ -7400,7 +7402,8 @@ namespace views::__adaptor
_Parent* _M_parent = nullptr;
[[no_unique_address]]
- __detail::__maybe_present_t<forward_range<_Base>, _OuterIter> _M_outer_it;
+ __detail::__maybe_present_t<forward_range<_Base>, _OuterIter> _M_outer_it
+ = decltype(_M_outer_it)();
variant<_PatternIter, _InnerIter> _M_inner_it;
constexpr _OuterIter&
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index b39ce71..2e6499e 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -2835,6 +2835,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __x.swap(__y); }
#if __cpp_lib_ranges_zip // >= C++23
+ /// Exchange the values of two const tuples (if const elements can be swapped)
template<typename... _Elements>
requires (is_swappable_v<const _Elements> && ...)
constexpr void
@@ -2844,7 +2845,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif // C++23
#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
- /// Exchange the values of two const tuples (if const elements can be swapped)
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2766. Swapping non-swappable types
template<typename... _Elements>
_GLIBCXX20_CONSTEXPR
typename enable_if<!__and_<__is_swappable<_Elements>...>::value>::type
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 78a5ee8..ff23544 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1992,8 +1992,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: __make_unsigned_selector_base
{
// With -fshort-enums, an enum may be as small as a char.
+ __extension__
using _UInts = _List<unsigned char, unsigned short, unsigned int,
- unsigned long, unsigned long long>;
+ unsigned long, unsigned long long
+#ifdef __SIZEOF_INT128__
+ , unsigned __int128
+#endif
+ >;
using __unsigned_type = typename __select<sizeof(_Tp), _UInts>::__type;
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index ec46ff1..2f44f97 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -1387,6 +1387,8 @@ namespace __detail::__variant
noexcept(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 2766. Swapping non-swappable types
template<typename... _Types>
enable_if_t<!((is_move_constructible_v<_Types> && ...)
&& (is_swappable_v<_Types> && ...))>
diff --git a/libstdc++-v3/scripts/gen_windows_zones_map.py b/libstdc++-v3/scripts/gen_windows_zones_map.py
new file mode 100755
index 0000000..7f547a7
--- /dev/null
+++ b/libstdc++-v3/scripts/gen_windows_zones_map.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python3
+#
+# Script to generate the map for libstdc++ std::chrono::current_zone under Windows.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# To update the Libstdc++ static data in src/c++20/windows_zones-map.h download the latest:
+# https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml
+# Then run this script and save the output to
+# src/c++20/windows_zones-map.h
+
+import os
+import sys
+import xml.etree.ElementTree as et
+
+if len(sys.argv) != 2:
+ print("Usage: %s <windows zones xml>" % sys.argv[0], file=sys.stderr)
+ sys.exit(1)
+
+self = os.path.basename(__file__)
+print("// Generated by scripts/{}, do not edit.".format(self))
+print("""
+// Copyright The GNU Toolchain Authors.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+""")
+
+class WindowsZoneMapEntry:
+ def __init__(self, windows, territory, iana):
+ self.windows = windows
+ self.territory = territory
+ self.iana = iana
+
+ def __lt__(self, other):
+ return (self.windows, self.territory) < (other.windows, other.territory)
+
+windows_zone_map = []
+
+tree = et.parse(sys.argv[1])
+xml_zone_map = tree.getroot().find("windowsZones").find("mapTimezones")
+
+for entry in xml_zone_map.iter("mapZone"):
+ iana = entry.attrib["type"]
+ space = iana.find(" ")
+ if space != -1:
+ iana = iana[0:space]
+ windows_zone_map.append(WindowsZoneMapEntry(entry.attrib["other"], entry.attrib["territory"], iana))
+
+# Sort so we can use binary search on the array.
+windows_zone_map.sort()
+
+# Skip territories which have the same IANA zone as 001, so we can reduce the data.
+last_windows_zone = ""
+for entry in windows_zone_map[:]:
+ if entry.windows != last_windows_zone:
+ if entry.territory != "001":
+ raise ValueError('Territory "001" not the first one, this breaks assumptions in tzdb.cc!')
+ last_windows_zone = entry.windows
+ fallback_iana = entry.iana
+ else:
+ if entry.iana == fallback_iana:
+ windows_zone_map.remove(entry)
+
+print("""struct windows_zone_map_entry
+{{
+ wstring_view windows_name;
+ wstring_view territory;
+ string_view iana_name;
+}};
+
+static constexpr array<windows_zone_map_entry, {}> windows_zone_map{{
+ {{""".format(len(windows_zone_map)))
+
+for entry in windows_zone_map:
+ print(' {{L"{}", L"{}", "{}"}},'.format(entry.windows, entry.territory, entry.iana))
+
+print(""" }
+};""")
+
+# src/c++20/tzdb.cc gives an error if this macro is not defined.
+# Do this last, so that the generated output is not usable unless we reach here.
+print("\n#define _GLIBCXX_WINDOWS_ZONES_MAP_COMPLETE")
diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc
index 6e244dc..d79b61a 100644
--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -44,6 +44,14 @@
# include <cstdlib> // getenv
#endif
+#if _GLIBCXX_HAVE_WINDOWS_H
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include <psapi.h>
+
+# include <array>
+#endif
+
#if defined __GTHREADS && ATOMIC_POINTER_LOCK_FREE == 2
# define USE_ATOMIC_LIST_HEAD 1
// TODO benchmark atomic<shared_ptr<>> vs mutex.
@@ -1145,6 +1153,34 @@ namespace std::chrono
else
path = _GLIBCXX_ZONEINFO_DIR;
#endif
+#ifdef _GLIBCXX_HAVE_WINDOWS_H
+ if (path.empty())
+ {
+ HMODULE dll_module;
+ if (GetModuleHandleExA(
+ GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
+ | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+ reinterpret_cast<const char *>(&zoneinfo_file), &dll_module))
+ {
+ char dll_path[MAX_PATH];
+ if (GetModuleFileNameA(dll_module, dll_path, MAX_PATH) != 0)
+ {
+ string_view dll_path_view = dll_path;
+ auto pos = dll_path_view.find_last_of('\\');
+ dll_path_view = dll_path_view.substr(0, pos);
+ if (dll_path_view.ends_with("\\bin"))
+ {
+ constexpr string_view remaining_path = "share\\zoneinfo";
+ dll_path_view.remove_suffix(3); // Remove bin
+ path.reserve(dll_path_view.size()
+ + remaining_path.size());
+ path = dll_path_view;
+ path += remaining_path;
+ }
+ }
+ }
+ }
+#endif
if (!path.empty())
path.append(filename);
return path;
@@ -1734,6 +1770,98 @@ namespace std::chrono
return nullptr; // not found
}
+
+#ifdef _GLIBCXX_HAVE_WINDOWS_H
+ string_view
+ detect_windows_zone() noexcept
+ {
+ DYNAMIC_TIME_ZONE_INFORMATION information{};
+ if (GetDynamicTimeZoneInformation(&information) == TIME_ZONE_ID_INVALID)
+ return {};
+
+ constexpr SYSTEMTIME all_zero_time{};
+ const wstring_view zone_name{ information.TimeZoneKeyName };
+ auto equal = [](const SYSTEMTIME &lhs, const SYSTEMTIME &rhs) noexcept
+ { return memcmp(&lhs, &rhs, sizeof(SYSTEMTIME)) == 0; };
+ // The logic is copied from icu, couldn't find the source.
+ // Detect if DST is disabled.
+ if (information.DynamicDaylightTimeDisabled
+ && equal(information.StandardDate, information.DaylightDate)
+ && ((!zone_name.empty()
+ && equal(information.StandardDate, all_zero_time))
+ || (zone_name.empty()
+ && !equal(information.StandardDate, all_zero_time))))
+ {
+ if (information.Bias == 0)
+ return "Etc/UTC";
+
+ if (information.Bias % 60 != 0)
+ // If the offset is not in full hours, we can't do anything really.
+ return {};
+
+ const auto raw_index = information.Bias / 60;
+
+ // The bias added to the local time equals UTC. And GMT+X corresponds
+ // to UTC-X, the sign is negated. Thus we can use the hourly bias as
+ // an index into an array.
+ if (raw_index < 0 && raw_index >= -14)
+ {
+ static constexpr array<string_view, 14> table{
+ "Etc/GMT-1", "Etc/GMT-2", "Etc/GMT-3", "Etc/GMT-4",
+ "Etc/GMT-5", "Etc/GMT-6", "Etc/GMT-7", "Etc/GMT-8",
+ "Etc/GMT-9", "Etc/GMT-10", "Etc/GMT-11", "Etc/GMT-12",
+ "Etc/GMT-13", "Etc/GMT-14"
+ };
+ return table[-raw_index - 1];
+ }
+ else if (raw_index > 0 && raw_index <= 12)
+ {
+ static constexpr array<string_view, 12> table{
+ "Etc/GMT+1", "Etc/GMT+2", "Etc/GMT+3", "Etc/GMT+4",
+ "Etc/GMT+5", "Etc/GMT+6", "Etc/GMT+7", "Etc/GMT+8",
+ "Etc/GMT+9", "Etc/GMT+10", "Etc/GMT+11", "Etc/GMT+12"
+ };
+ return table[raw_index - 1];
+ }
+ return {};
+ }
+
+#include "windows_zones-map.h"
+#ifndef _GLIBCXX_WINDOWS_ZONES_MAP_COMPLETE
+# error "Invalid windows_zones map"
+#endif
+
+ const auto zone_range
+ = ranges::equal_range(windows_zone_map, zone_name, {},
+ &windows_zone_map_entry::windows_name);
+
+ const auto size = ranges::size(zone_range);
+ if (size == 0)
+ // Unknown zone, we can't detect anything.
+ return {};
+
+ if (size == 1)
+ // Some zones have only one territory, use the quick path.
+ return zone_range.front().iana_name;
+
+ const auto geo_id = GetUserGeoID(GEOCLASS_NATION);
+ // We ask for a 2-letter country code plus the zero terminator. "001" is
+ // only contained in the zone map, not returned by GetGeoInfoW.
+ wchar_t territory[3] = {};
+ if (GetGeoInfoW(geo_id, GEO_ISO2, territory, 3, 0) == 0)
+ // Couldn't detect the territory, fallback to "001", which is the first
+ // entry.
+ return zone_range.front().iana_name;
+
+ const auto iter = ranges::lower_bound(
+ zone_range, territory, {}, &windows_zone_map_entry::territory);
+ if (iter == zone_range.end() || iter->territory != territory)
+ // Territory not within the the map, use "001".
+ return zone_range.front().iana_name;
+
+ return iter->iana_name;
+ }
+#endif
} // namespace
// Implementation of std::chrono::tzdb::locate_zone(string_view).
@@ -1756,7 +1884,7 @@ namespace std::chrono
{
// TODO cache this function's result?
-#ifndef _AIX
+#if !defined(_AIX) && !defined(_GLIBCXX_HAVE_WINDOWS_H)
// Repeat the preprocessor condition used by filesystem::read_symlink,
// to avoid a dependency on src/c++17/fs_ops.o if it won't work anyway.
#if defined(_GLIBCXX_HAVE_READLINK) && defined(_GLIBCXX_HAVE_SYS_STAT_H)
@@ -1813,7 +1941,11 @@ namespace std::chrono
return tz;
}
}
-#else
+#elif defined(_GLIBCXX_HAVE_WINDOWS_H)
+ if (auto tz
+ = do_locate_zone(this->zones, this->links, detect_windows_zone()))
+ return tz;
+#else // defined(_AIX)
// AIX stores current zone in $TZ in /etc/environment but the value
// is typically a POSIX time zone name, not IANA zone.
// https://developer.ibm.com/articles/au-aix-posix/
diff --git a/libstdc++-v3/src/c++20/windows_zones-map.h b/libstdc++-v3/src/c++20/windows_zones-map.h
new file mode 100644
index 0000000..0f63a17
--- /dev/null
+++ b/libstdc++-v3/src/c++20/windows_zones-map.h
@@ -0,0 +1,399 @@
+// Generated by scripts/gen_windows_zones_map.py, do not edit.
+
+// Copyright The GNU Toolchain Authors.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+
+struct windows_zone_map_entry
+{
+ wstring_view windows_name;
+ wstring_view territory;
+ string_view iana_name;
+};
+
+static constexpr array<windows_zone_map_entry, 361> windows_zone_map{
+ {
+ {L"AUS Central Standard Time", L"001", "Australia/Darwin"},
+ {L"AUS Eastern Standard Time", L"001", "Australia/Sydney"},
+ {L"Afghanistan Standard Time", L"001", "Asia/Kabul"},
+ {L"Alaskan Standard Time", L"001", "America/Anchorage"},
+ {L"Aleutian Standard Time", L"001", "America/Adak"},
+ {L"Altai Standard Time", L"001", "Asia/Barnaul"},
+ {L"Arab Standard Time", L"001", "Asia/Riyadh"},
+ {L"Arab Standard Time", L"BH", "Asia/Bahrain"},
+ {L"Arab Standard Time", L"KW", "Asia/Kuwait"},
+ {L"Arab Standard Time", L"QA", "Asia/Qatar"},
+ {L"Arab Standard Time", L"YE", "Asia/Aden"},
+ {L"Arabian Standard Time", L"001", "Asia/Dubai"},
+ {L"Arabian Standard Time", L"OM", "Asia/Muscat"},
+ {L"Arabian Standard Time", L"ZZ", "Etc/GMT-4"},
+ {L"Arabic Standard Time", L"001", "Asia/Baghdad"},
+ {L"Argentina Standard Time", L"001", "America/Buenos_Aires"},
+ {L"Astrakhan Standard Time", L"001", "Europe/Astrakhan"},
+ {L"Atlantic Standard Time", L"001", "America/Halifax"},
+ {L"Atlantic Standard Time", L"BM", "Atlantic/Bermuda"},
+ {L"Atlantic Standard Time", L"GL", "America/Thule"},
+ {L"Aus Central W. Standard Time", L"001", "Australia/Eucla"},
+ {L"Azerbaijan Standard Time", L"001", "Asia/Baku"},
+ {L"Azores Standard Time", L"001", "Atlantic/Azores"},
+ {L"Azores Standard Time", L"GL", "America/Scoresbysund"},
+ {L"Bahia Standard Time", L"001", "America/Bahia"},
+ {L"Bangladesh Standard Time", L"001", "Asia/Dhaka"},
+ {L"Bangladesh Standard Time", L"BT", "Asia/Thimphu"},
+ {L"Belarus Standard Time", L"001", "Europe/Minsk"},
+ {L"Bougainville Standard Time", L"001", "Pacific/Bougainville"},
+ {L"Canada Central Standard Time", L"001", "America/Regina"},
+ {L"Cape Verde Standard Time", L"001", "Atlantic/Cape_Verde"},
+ {L"Cape Verde Standard Time", L"ZZ", "Etc/GMT+1"},
+ {L"Caucasus Standard Time", L"001", "Asia/Yerevan"},
+ {L"Cen. Australia Standard Time", L"001", "Australia/Adelaide"},
+ {L"Central America Standard Time", L"001", "America/Guatemala"},
+ {L"Central America Standard Time", L"BZ", "America/Belize"},
+ {L"Central America Standard Time", L"CR", "America/Costa_Rica"},
+ {L"Central America Standard Time", L"EC", "Pacific/Galapagos"},
+ {L"Central America Standard Time", L"HN", "America/Tegucigalpa"},
+ {L"Central America Standard Time", L"NI", "America/Managua"},
+ {L"Central America Standard Time", L"SV", "America/El_Salvador"},
+ {L"Central America Standard Time", L"ZZ", "Etc/GMT+6"},
+ {L"Central Asia Standard Time", L"001", "Asia/Bishkek"},
+ {L"Central Asia Standard Time", L"AQ", "Antarctica/Vostok"},
+ {L"Central Asia Standard Time", L"CN", "Asia/Urumqi"},
+ {L"Central Asia Standard Time", L"IO", "Indian/Chagos"},
+ {L"Central Asia Standard Time", L"ZZ", "Etc/GMT-6"},
+ {L"Central Brazilian Standard Time", L"001", "America/Cuiaba"},
+ {L"Central Europe Standard Time", L"001", "Europe/Budapest"},
+ {L"Central Europe Standard Time", L"AL", "Europe/Tirane"},
+ {L"Central Europe Standard Time", L"CZ", "Europe/Prague"},
+ {L"Central Europe Standard Time", L"ME", "Europe/Podgorica"},
+ {L"Central Europe Standard Time", L"RS", "Europe/Belgrade"},
+ {L"Central Europe Standard Time", L"SI", "Europe/Ljubljana"},
+ {L"Central Europe Standard Time", L"SK", "Europe/Bratislava"},
+ {L"Central European Standard Time", L"001", "Europe/Warsaw"},
+ {L"Central European Standard Time", L"BA", "Europe/Sarajevo"},
+ {L"Central European Standard Time", L"HR", "Europe/Zagreb"},
+ {L"Central European Standard Time", L"MK", "Europe/Skopje"},
+ {L"Central Pacific Standard Time", L"001", "Pacific/Guadalcanal"},
+ {L"Central Pacific Standard Time", L"AQ", "Antarctica/Casey"},
+ {L"Central Pacific Standard Time", L"FM", "Pacific/Ponape"},
+ {L"Central Pacific Standard Time", L"NC", "Pacific/Noumea"},
+ {L"Central Pacific Standard Time", L"VU", "Pacific/Efate"},
+ {L"Central Pacific Standard Time", L"ZZ", "Etc/GMT-11"},
+ {L"Central Standard Time", L"001", "America/Chicago"},
+ {L"Central Standard Time", L"CA", "America/Winnipeg"},
+ {L"Central Standard Time", L"MX", "America/Matamoros"},
+ {L"Central Standard Time (Mexico)", L"001", "America/Mexico_City"},
+ {L"Chatham Islands Standard Time", L"001", "Pacific/Chatham"},
+ {L"China Standard Time", L"001", "Asia/Shanghai"},
+ {L"China Standard Time", L"HK", "Asia/Hong_Kong"},
+ {L"China Standard Time", L"MO", "Asia/Macau"},
+ {L"Cuba Standard Time", L"001", "America/Havana"},
+ {L"Dateline Standard Time", L"001", "Etc/GMT+12"},
+ {L"E. Africa Standard Time", L"001", "Africa/Nairobi"},
+ {L"E. Africa Standard Time", L"AQ", "Antarctica/Syowa"},
+ {L"E. Africa Standard Time", L"DJ", "Africa/Djibouti"},
+ {L"E. Africa Standard Time", L"ER", "Africa/Asmera"},
+ {L"E. Africa Standard Time", L"ET", "Africa/Addis_Ababa"},
+ {L"E. Africa Standard Time", L"KM", "Indian/Comoro"},
+ {L"E. Africa Standard Time", L"MG", "Indian/Antananarivo"},
+ {L"E. Africa Standard Time", L"SO", "Africa/Mogadishu"},
+ {L"E. Africa Standard Time", L"TZ", "Africa/Dar_es_Salaam"},
+ {L"E. Africa Standard Time", L"UG", "Africa/Kampala"},
+ {L"E. Africa Standard Time", L"YT", "Indian/Mayotte"},
+ {L"E. Africa Standard Time", L"ZZ", "Etc/GMT-3"},
+ {L"E. Australia Standard Time", L"001", "Australia/Brisbane"},
+ {L"E. Europe Standard Time", L"001", "Europe/Chisinau"},
+ {L"E. South America Standard Time", L"001", "America/Sao_Paulo"},
+ {L"Easter Island Standard Time", L"001", "Pacific/Easter"},
+ {L"Eastern Standard Time", L"001", "America/New_York"},
+ {L"Eastern Standard Time", L"BS", "America/Nassau"},
+ {L"Eastern Standard Time", L"CA", "America/Toronto"},
+ {L"Eastern Standard Time (Mexico)", L"001", "America/Cancun"},
+ {L"Egypt Standard Time", L"001", "Africa/Cairo"},
+ {L"Ekaterinburg Standard Time", L"001", "Asia/Yekaterinburg"},
+ {L"FLE Standard Time", L"001", "Europe/Kiev"},
+ {L"FLE Standard Time", L"AX", "Europe/Mariehamn"},
+ {L"FLE Standard Time", L"BG", "Europe/Sofia"},
+ {L"FLE Standard Time", L"EE", "Europe/Tallinn"},
+ {L"FLE Standard Time", L"FI", "Europe/Helsinki"},
+ {L"FLE Standard Time", L"LT", "Europe/Vilnius"},
+ {L"FLE Standard Time", L"LV", "Europe/Riga"},
+ {L"Fiji Standard Time", L"001", "Pacific/Fiji"},
+ {L"GMT Standard Time", L"001", "Europe/London"},
+ {L"GMT Standard Time", L"ES", "Atlantic/Canary"},
+ {L"GMT Standard Time", L"FO", "Atlantic/Faeroe"},
+ {L"GMT Standard Time", L"GG", "Europe/Guernsey"},
+ {L"GMT Standard Time", L"IE", "Europe/Dublin"},
+ {L"GMT Standard Time", L"IM", "Europe/Isle_of_Man"},
+ {L"GMT Standard Time", L"JE", "Europe/Jersey"},
+ {L"GMT Standard Time", L"PT", "Europe/Lisbon"},
+ {L"GTB Standard Time", L"001", "Europe/Bucharest"},
+ {L"GTB Standard Time", L"CY", "Asia/Nicosia"},
+ {L"GTB Standard Time", L"GR", "Europe/Athens"},
+ {L"Georgian Standard Time", L"001", "Asia/Tbilisi"},
+ {L"Greenland Standard Time", L"001", "America/Godthab"},
+ {L"Greenwich Standard Time", L"001", "Atlantic/Reykjavik"},
+ {L"Greenwich Standard Time", L"BF", "Africa/Ouagadougou"},
+ {L"Greenwich Standard Time", L"CI", "Africa/Abidjan"},
+ {L"Greenwich Standard Time", L"GH", "Africa/Accra"},
+ {L"Greenwich Standard Time", L"GL", "America/Danmarkshavn"},
+ {L"Greenwich Standard Time", L"GM", "Africa/Banjul"},
+ {L"Greenwich Standard Time", L"GN", "Africa/Conakry"},
+ {L"Greenwich Standard Time", L"GW", "Africa/Bissau"},
+ {L"Greenwich Standard Time", L"LR", "Africa/Monrovia"},
+ {L"Greenwich Standard Time", L"ML", "Africa/Bamako"},
+ {L"Greenwich Standard Time", L"MR", "Africa/Nouakchott"},
+ {L"Greenwich Standard Time", L"SH", "Atlantic/St_Helena"},
+ {L"Greenwich Standard Time", L"SL", "Africa/Freetown"},
+ {L"Greenwich Standard Time", L"SN", "Africa/Dakar"},
+ {L"Greenwich Standard Time", L"TG", "Africa/Lome"},
+ {L"Haiti Standard Time", L"001", "America/Port-au-Prince"},
+ {L"Hawaiian Standard Time", L"001", "Pacific/Honolulu"},
+ {L"Hawaiian Standard Time", L"CK", "Pacific/Rarotonga"},
+ {L"Hawaiian Standard Time", L"PF", "Pacific/Tahiti"},
+ {L"Hawaiian Standard Time", L"ZZ", "Etc/GMT+10"},
+ {L"India Standard Time", L"001", "Asia/Calcutta"},
+ {L"Iran Standard Time", L"001", "Asia/Tehran"},
+ {L"Israel Standard Time", L"001", "Asia/Jerusalem"},
+ {L"Jordan Standard Time", L"001", "Asia/Amman"},
+ {L"Kaliningrad Standard Time", L"001", "Europe/Kaliningrad"},
+ {L"Korea Standard Time", L"001", "Asia/Seoul"},
+ {L"Libya Standard Time", L"001", "Africa/Tripoli"},
+ {L"Line Islands Standard Time", L"001", "Pacific/Kiritimati"},
+ {L"Line Islands Standard Time", L"ZZ", "Etc/GMT-14"},
+ {L"Lord Howe Standard Time", L"001", "Australia/Lord_Howe"},
+ {L"Magadan Standard Time", L"001", "Asia/Magadan"},
+ {L"Magallanes Standard Time", L"001", "America/Punta_Arenas"},
+ {L"Marquesas Standard Time", L"001", "Pacific/Marquesas"},
+ {L"Mauritius Standard Time", L"001", "Indian/Mauritius"},
+ {L"Mauritius Standard Time", L"RE", "Indian/Reunion"},
+ {L"Mauritius Standard Time", L"SC", "Indian/Mahe"},
+ {L"Middle East Standard Time", L"001", "Asia/Beirut"},
+ {L"Montevideo Standard Time", L"001", "America/Montevideo"},
+ {L"Morocco Standard Time", L"001", "Africa/Casablanca"},
+ {L"Morocco Standard Time", L"EH", "Africa/El_Aaiun"},
+ {L"Mountain Standard Time", L"001", "America/Denver"},
+ {L"Mountain Standard Time", L"CA", "America/Edmonton"},
+ {L"Mountain Standard Time", L"MX", "America/Ciudad_Juarez"},
+ {L"Mountain Standard Time (Mexico)", L"001", "America/Mazatlan"},
+ {L"Myanmar Standard Time", L"001", "Asia/Rangoon"},
+ {L"Myanmar Standard Time", L"CC", "Indian/Cocos"},
+ {L"N. Central Asia Standard Time", L"001", "Asia/Novosibirsk"},
+ {L"Namibia Standard Time", L"001", "Africa/Windhoek"},
+ {L"Nepal Standard Time", L"001", "Asia/Katmandu"},
+ {L"New Zealand Standard Time", L"001", "Pacific/Auckland"},
+ {L"New Zealand Standard Time", L"AQ", "Antarctica/McMurdo"},
+ {L"Newfoundland Standard Time", L"001", "America/St_Johns"},
+ {L"Norfolk Standard Time", L"001", "Pacific/Norfolk"},
+ {L"North Asia East Standard Time", L"001", "Asia/Irkutsk"},
+ {L"North Asia Standard Time", L"001", "Asia/Krasnoyarsk"},
+ {L"North Korea Standard Time", L"001", "Asia/Pyongyang"},
+ {L"Omsk Standard Time", L"001", "Asia/Omsk"},
+ {L"Pacific SA Standard Time", L"001", "America/Santiago"},
+ {L"Pacific Standard Time", L"001", "America/Los_Angeles"},
+ {L"Pacific Standard Time", L"CA", "America/Vancouver"},
+ {L"Pacific Standard Time (Mexico)", L"001", "America/Tijuana"},
+ {L"Pakistan Standard Time", L"001", "Asia/Karachi"},
+ {L"Paraguay Standard Time", L"001", "America/Asuncion"},
+ {L"Qyzylorda Standard Time", L"001", "Asia/Qyzylorda"},
+ {L"Romance Standard Time", L"001", "Europe/Paris"},
+ {L"Romance Standard Time", L"BE", "Europe/Brussels"},
+ {L"Romance Standard Time", L"DK", "Europe/Copenhagen"},
+ {L"Romance Standard Time", L"ES", "Europe/Madrid"},
+ {L"Russia Time Zone 10", L"001", "Asia/Srednekolymsk"},
+ {L"Russia Time Zone 11", L"001", "Asia/Kamchatka"},
+ {L"Russia Time Zone 3", L"001", "Europe/Samara"},
+ {L"Russian Standard Time", L"001", "Europe/Moscow"},
+ {L"Russian Standard Time", L"UA", "Europe/Simferopol"},
+ {L"SA Eastern Standard Time", L"001", "America/Cayenne"},
+ {L"SA Eastern Standard Time", L"AQ", "Antarctica/Rothera"},
+ {L"SA Eastern Standard Time", L"BR", "America/Fortaleza"},
+ {L"SA Eastern Standard Time", L"FK", "Atlantic/Stanley"},
+ {L"SA Eastern Standard Time", L"SR", "America/Paramaribo"},
+ {L"SA Eastern Standard Time", L"ZZ", "Etc/GMT+3"},
+ {L"SA Pacific Standard Time", L"001", "America/Bogota"},
+ {L"SA Pacific Standard Time", L"BR", "America/Rio_Branco"},
+ {L"SA Pacific Standard Time", L"CA", "America/Coral_Harbour"},
+ {L"SA Pacific Standard Time", L"EC", "America/Guayaquil"},
+ {L"SA Pacific Standard Time", L"JM", "America/Jamaica"},
+ {L"SA Pacific Standard Time", L"KY", "America/Cayman"},
+ {L"SA Pacific Standard Time", L"PA", "America/Panama"},
+ {L"SA Pacific Standard Time", L"PE", "America/Lima"},
+ {L"SA Pacific Standard Time", L"ZZ", "Etc/GMT+5"},
+ {L"SA Western Standard Time", L"001", "America/La_Paz"},
+ {L"SA Western Standard Time", L"AG", "America/Antigua"},
+ {L"SA Western Standard Time", L"AI", "America/Anguilla"},
+ {L"SA Western Standard Time", L"AW", "America/Aruba"},
+ {L"SA Western Standard Time", L"BB", "America/Barbados"},
+ {L"SA Western Standard Time", L"BL", "America/St_Barthelemy"},
+ {L"SA Western Standard Time", L"BQ", "America/Kralendijk"},
+ {L"SA Western Standard Time", L"BR", "America/Manaus"},
+ {L"SA Western Standard Time", L"CA", "America/Blanc-Sablon"},
+ {L"SA Western Standard Time", L"CW", "America/Curacao"},
+ {L"SA Western Standard Time", L"DM", "America/Dominica"},
+ {L"SA Western Standard Time", L"DO", "America/Santo_Domingo"},
+ {L"SA Western Standard Time", L"GD", "America/Grenada"},
+ {L"SA Western Standard Time", L"GP", "America/Guadeloupe"},
+ {L"SA Western Standard Time", L"GY", "America/Guyana"},
+ {L"SA Western Standard Time", L"KN", "America/St_Kitts"},
+ {L"SA Western Standard Time", L"LC", "America/St_Lucia"},
+ {L"SA Western Standard Time", L"MF", "America/Marigot"},
+ {L"SA Western Standard Time", L"MQ", "America/Martinique"},
+ {L"SA Western Standard Time", L"MS", "America/Montserrat"},
+ {L"SA Western Standard Time", L"PR", "America/Puerto_Rico"},
+ {L"SA Western Standard Time", L"SX", "America/Lower_Princes"},
+ {L"SA Western Standard Time", L"TT", "America/Port_of_Spain"},
+ {L"SA Western Standard Time", L"VC", "America/St_Vincent"},
+ {L"SA Western Standard Time", L"VG", "America/Tortola"},
+ {L"SA Western Standard Time", L"VI", "America/St_Thomas"},
+ {L"SA Western Standard Time", L"ZZ", "Etc/GMT+4"},
+ {L"SE Asia Standard Time", L"001", "Asia/Bangkok"},
+ {L"SE Asia Standard Time", L"AQ", "Antarctica/Davis"},
+ {L"SE Asia Standard Time", L"CX", "Indian/Christmas"},
+ {L"SE Asia Standard Time", L"ID", "Asia/Jakarta"},
+ {L"SE Asia Standard Time", L"KH", "Asia/Phnom_Penh"},
+ {L"SE Asia Standard Time", L"LA", "Asia/Vientiane"},
+ {L"SE Asia Standard Time", L"VN", "Asia/Saigon"},
+ {L"SE Asia Standard Time", L"ZZ", "Etc/GMT-7"},
+ {L"Saint Pierre Standard Time", L"001", "America/Miquelon"},
+ {L"Sakhalin Standard Time", L"001", "Asia/Sakhalin"},
+ {L"Samoa Standard Time", L"001", "Pacific/Apia"},
+ {L"Sao Tome Standard Time", L"001", "Africa/Sao_Tome"},
+ {L"Saratov Standard Time", L"001", "Europe/Saratov"},
+ {L"Singapore Standard Time", L"001", "Asia/Singapore"},
+ {L"Singapore Standard Time", L"BN", "Asia/Brunei"},
+ {L"Singapore Standard Time", L"ID", "Asia/Makassar"},
+ {L"Singapore Standard Time", L"MY", "Asia/Kuala_Lumpur"},
+ {L"Singapore Standard Time", L"PH", "Asia/Manila"},
+ {L"Singapore Standard Time", L"ZZ", "Etc/GMT-8"},
+ {L"South Africa Standard Time", L"001", "Africa/Johannesburg"},
+ {L"South Africa Standard Time", L"BI", "Africa/Bujumbura"},
+ {L"South Africa Standard Time", L"BW", "Africa/Gaborone"},
+ {L"South Africa Standard Time", L"CD", "Africa/Lubumbashi"},
+ {L"South Africa Standard Time", L"LS", "Africa/Maseru"},
+ {L"South Africa Standard Time", L"MW", "Africa/Blantyre"},
+ {L"South Africa Standard Time", L"MZ", "Africa/Maputo"},
+ {L"South Africa Standard Time", L"RW", "Africa/Kigali"},
+ {L"South Africa Standard Time", L"SZ", "Africa/Mbabane"},
+ {L"South Africa Standard Time", L"ZM", "Africa/Lusaka"},
+ {L"South Africa Standard Time", L"ZW", "Africa/Harare"},
+ {L"South Africa Standard Time", L"ZZ", "Etc/GMT-2"},
+ {L"South Sudan Standard Time", L"001", "Africa/Juba"},
+ {L"Sri Lanka Standard Time", L"001", "Asia/Colombo"},
+ {L"Sudan Standard Time", L"001", "Africa/Khartoum"},
+ {L"Syria Standard Time", L"001", "Asia/Damascus"},
+ {L"Taipei Standard Time", L"001", "Asia/Taipei"},
+ {L"Tasmania Standard Time", L"001", "Australia/Hobart"},
+ {L"Tocantins Standard Time", L"001", "America/Araguaina"},
+ {L"Tokyo Standard Time", L"001", "Asia/Tokyo"},
+ {L"Tokyo Standard Time", L"ID", "Asia/Jayapura"},
+ {L"Tokyo Standard Time", L"PW", "Pacific/Palau"},
+ {L"Tokyo Standard Time", L"TL", "Asia/Dili"},
+ {L"Tokyo Standard Time", L"ZZ", "Etc/GMT-9"},
+ {L"Tomsk Standard Time", L"001", "Asia/Tomsk"},
+ {L"Tonga Standard Time", L"001", "Pacific/Tongatapu"},
+ {L"Transbaikal Standard Time", L"001", "Asia/Chita"},
+ {L"Turkey Standard Time", L"001", "Europe/Istanbul"},
+ {L"Turks And Caicos Standard Time", L"001", "America/Grand_Turk"},
+ {L"US Eastern Standard Time", L"001", "America/Indianapolis"},
+ {L"US Mountain Standard Time", L"001", "America/Phoenix"},
+ {L"US Mountain Standard Time", L"CA", "America/Creston"},
+ {L"US Mountain Standard Time", L"MX", "America/Hermosillo"},
+ {L"US Mountain Standard Time", L"ZZ", "Etc/GMT+7"},
+ {L"UTC", L"001", "Etc/UTC"},
+ {L"UTC+12", L"001", "Etc/GMT-12"},
+ {L"UTC+12", L"KI", "Pacific/Tarawa"},
+ {L"UTC+12", L"MH", "Pacific/Majuro"},
+ {L"UTC+12", L"NR", "Pacific/Nauru"},
+ {L"UTC+12", L"TV", "Pacific/Funafuti"},
+ {L"UTC+12", L"UM", "Pacific/Wake"},
+ {L"UTC+12", L"WF", "Pacific/Wallis"},
+ {L"UTC+13", L"001", "Etc/GMT-13"},
+ {L"UTC+13", L"KI", "Pacific/Enderbury"},
+ {L"UTC+13", L"TK", "Pacific/Fakaofo"},
+ {L"UTC-02", L"001", "Etc/GMT+2"},
+ {L"UTC-02", L"BR", "America/Noronha"},
+ {L"UTC-02", L"GS", "Atlantic/South_Georgia"},
+ {L"UTC-08", L"001", "Etc/GMT+8"},
+ {L"UTC-08", L"PN", "Pacific/Pitcairn"},
+ {L"UTC-09", L"001", "Etc/GMT+9"},
+ {L"UTC-09", L"PF", "Pacific/Gambier"},
+ {L"UTC-11", L"001", "Etc/GMT+11"},
+ {L"UTC-11", L"AS", "Pacific/Pago_Pago"},
+ {L"UTC-11", L"NU", "Pacific/Niue"},
+ {L"UTC-11", L"UM", "Pacific/Midway"},
+ {L"Ulaanbaatar Standard Time", L"001", "Asia/Ulaanbaatar"},
+ {L"Venezuela Standard Time", L"001", "America/Caracas"},
+ {L"Vladivostok Standard Time", L"001", "Asia/Vladivostok"},
+ {L"Volgograd Standard Time", L"001", "Europe/Volgograd"},
+ {L"W. Australia Standard Time", L"001", "Australia/Perth"},
+ {L"W. Central Africa Standard Time", L"001", "Africa/Lagos"},
+ {L"W. Central Africa Standard Time", L"AO", "Africa/Luanda"},
+ {L"W. Central Africa Standard Time", L"BJ", "Africa/Porto-Novo"},
+ {L"W. Central Africa Standard Time", L"CD", "Africa/Kinshasa"},
+ {L"W. Central Africa Standard Time", L"CF", "Africa/Bangui"},
+ {L"W. Central Africa Standard Time", L"CG", "Africa/Brazzaville"},
+ {L"W. Central Africa Standard Time", L"CM", "Africa/Douala"},
+ {L"W. Central Africa Standard Time", L"DZ", "Africa/Algiers"},
+ {L"W. Central Africa Standard Time", L"GA", "Africa/Libreville"},
+ {L"W. Central Africa Standard Time", L"GQ", "Africa/Malabo"},
+ {L"W. Central Africa Standard Time", L"NE", "Africa/Niamey"},
+ {L"W. Central Africa Standard Time", L"TD", "Africa/Ndjamena"},
+ {L"W. Central Africa Standard Time", L"TN", "Africa/Tunis"},
+ {L"W. Central Africa Standard Time", L"ZZ", "Etc/GMT-1"},
+ {L"W. Europe Standard Time", L"001", "Europe/Berlin"},
+ {L"W. Europe Standard Time", L"AD", "Europe/Andorra"},
+ {L"W. Europe Standard Time", L"AT", "Europe/Vienna"},
+ {L"W. Europe Standard Time", L"CH", "Europe/Zurich"},
+ {L"W. Europe Standard Time", L"GI", "Europe/Gibraltar"},
+ {L"W. Europe Standard Time", L"IT", "Europe/Rome"},
+ {L"W. Europe Standard Time", L"LI", "Europe/Vaduz"},
+ {L"W. Europe Standard Time", L"LU", "Europe/Luxembourg"},
+ {L"W. Europe Standard Time", L"MC", "Europe/Monaco"},
+ {L"W. Europe Standard Time", L"MT", "Europe/Malta"},
+ {L"W. Europe Standard Time", L"NL", "Europe/Amsterdam"},
+ {L"W. Europe Standard Time", L"NO", "Europe/Oslo"},
+ {L"W. Europe Standard Time", L"SE", "Europe/Stockholm"},
+ {L"W. Europe Standard Time", L"SJ", "Arctic/Longyearbyen"},
+ {L"W. Europe Standard Time", L"SM", "Europe/San_Marino"},
+ {L"W. Europe Standard Time", L"VA", "Europe/Vatican"},
+ {L"W. Mongolia Standard Time", L"001", "Asia/Hovd"},
+ {L"West Asia Standard Time", L"001", "Asia/Tashkent"},
+ {L"West Asia Standard Time", L"AQ", "Antarctica/Mawson"},
+ {L"West Asia Standard Time", L"KZ", "Asia/Oral"},
+ {L"West Asia Standard Time", L"MV", "Indian/Maldives"},
+ {L"West Asia Standard Time", L"TF", "Indian/Kerguelen"},
+ {L"West Asia Standard Time", L"TJ", "Asia/Dushanbe"},
+ {L"West Asia Standard Time", L"TM", "Asia/Ashgabat"},
+ {L"West Asia Standard Time", L"ZZ", "Etc/GMT-5"},
+ {L"West Bank Standard Time", L"001", "Asia/Hebron"},
+ {L"West Pacific Standard Time", L"001", "Pacific/Port_Moresby"},
+ {L"West Pacific Standard Time", L"AQ", "Antarctica/DumontDUrville"},
+ {L"West Pacific Standard Time", L"FM", "Pacific/Truk"},
+ {L"West Pacific Standard Time", L"GU", "Pacific/Guam"},
+ {L"West Pacific Standard Time", L"MP", "Pacific/Saipan"},
+ {L"West Pacific Standard Time", L"ZZ", "Etc/GMT-10"},
+ {L"Yakutsk Standard Time", L"001", "Asia/Yakutsk"},
+ {L"Yukon Standard Time", L"001", "America/Whitehorse"},
+ }
+};
+
+#define _GLIBCXX_WINDOWS_ZONES_MAP_COMPLETE
diff --git a/libstdc++-v3/testsuite/20_util/hash/int128.cc b/libstdc++-v3/testsuite/20_util/hash/int128.cc
new file mode 100644
index 0000000..7c3a1ba
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/hash/int128.cc
@@ -0,0 +1,20 @@
+// { dg-do run { target c++11 } }
+// { dg-add-options strict_std }
+
+#include <functional>
+#include <testsuite_hooks.h>
+
+int main()
+{
+#ifdef __SIZEOF_INT128__
+ std::hash<__int128> h;
+ __int128 i = (__int128)0x123456789;
+ VERIFY( h(i) == i );
+ VERIFY( h(-i) == (std::size_t)-i );
+ VERIFY( h(~i) == (std::size_t)~i );
+ std::hash<unsigned __int128> hu;
+ unsigned __int128 u = i;
+ VERIFY( hu(u) == u );
+ VERIFY( hu(~u) == (std::size_t)~u );
+#endif
+}
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/int128.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/int128.cc
new file mode 100644
index 0000000..46c07b7
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/int128.cc
@@ -0,0 +1,14 @@
+// { dg-do compile { target c++11 } }
+// { dg-add-options strict_std }
+
+#include <type_traits>
+
+#ifdef __SIZEOF_INT128__
+enum E : __int128 { };
+using U = std::make_unsigned<E>::type;
+static_assert( std::is_integral<U>::value, "type is an integer" );
+static_assert( sizeof(U) == sizeof(E), "width of type is 128 bits" );
+using I = std::make_signed<E>::type;
+static_assert( std::is_integral<I>::value, "type is an integer" );
+static_assert( sizeof(I) == sizeof(E), "width of type is 128 bits" );
+#endif
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/121024.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/121024.cc
new file mode 100644
index 0000000..781dd40
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/destroy/121024.cc
@@ -0,0 +1,77 @@
+// { dg-do compile { target c++26 } }
+
+// Bug 121024
+// ranges::destroy and ranges::destroy_n do not end lifetime of trivial types
+
+#include <memory>
+
+consteval bool is_within_lifetime(const auto* p) noexcept
+{
+ return __builtin_constant_p(*p);
+}
+
+template<typename T>
+struct Buf
+{
+ constexpr Buf() : p(std::allocator<T>().allocate(2)) { }
+ constexpr ~Buf() { std::allocator<T>().deallocate(p, 2); }
+ T* p;
+};
+
+template<typename T>
+consteval bool
+test_destroy()
+{
+ Buf<T> buf;
+ std::uninitialized_value_construct(buf.p, buf.p + 2);
+ std::destroy(buf.p, buf.p + 2);
+ return not is_within_lifetime(buf.p) && not is_within_lifetime(buf.p + 1);
+}
+
+template<typename T>
+consteval bool
+test_destroy_n()
+{
+ Buf<T> buf;
+ std::uninitialized_value_construct_n(buf.p, 2);
+ std::destroy_n(buf.p, 2);
+ return not is_within_lifetime(buf.p) && not is_within_lifetime(buf.p + 1);
+}
+
+template<typename T>
+consteval bool
+test_ranges_destroy()
+{
+ Buf<T> buf;
+ std::uninitialized_value_construct(buf.p, buf.p + 2);
+ std::ranges::destroy(buf.p, buf.p + 2);
+ return not is_within_lifetime(buf.p) && not is_within_lifetime(buf.p + 1);
+}
+
+template<typename T>
+consteval bool
+test_ranges_destroy_n()
+{
+ Buf<T> buf;
+ std::uninitialized_value_construct_n(buf.p, 2);
+ std::ranges::destroy_n(buf.p, 2);
+ return not is_within_lifetime(buf.p) && not is_within_lifetime(buf.p + 1);
+}
+
+struct O
+{
+ constexpr O() { }
+ constexpr ~O() { }
+};
+
+// These all fail for GCC because is_within_lifetime still returns true
+// after the lifetime has been ended.
+// { dg-xfail-if "PR c++/102284" { *-*-* } }
+static_assert( test_destroy<int>() );
+static_assert( test_destroy<O>() );
+static_assert( test_destroy_n<int>() );
+static_assert( test_destroy_n<O>() );
+static_assert( test_ranges_destroy<int>() );
+static_assert( test_ranges_destroy<O>() );
+static_assert( test_ranges_destroy_n<int>() );
+static_assert( test_ranges_destroy_n<O>() );
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
index 25511e7..e1e9ce9b 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
@@ -26,6 +26,6 @@ int n1 = std::get<1>(a);
int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca);
-// { dg-error "static assertion failed" "" { target *-*-* } 394 }
-// { dg-error "static assertion failed" "" { target *-*-* } 403 }
-// { dg-error "static assertion failed" "" { target *-*-* } 412 }
+// { dg-error "static assertion failed" "" { target *-*-* } 396 }
+// { dg-error "static assertion failed" "" { target *-*-* } 405 }
+// { dg-error "static assertion failed" "" { target *-*-* } 414 }
diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/debug/constexpr_neg.cc b/libstdc++-v3/testsuite/25_algorithms/copy/debug/constexpr_neg.cc
index 0e80977..3840524 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy/debug/constexpr_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy/debug/constexpr_neg.cc
@@ -33,7 +33,7 @@ test1()
}
static_assert(test1()); // { dg-error "non-constant condition" }
-// { dg-error "_Error_formatter::_M_error()" "" { target *-*-* } 0 }
+// { dg-error "_Error_formatter::(_M_error|_S_at)" "" { target *-*-* } 0 }
constexpr bool
test2()
diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc b/libstdc++-v3/testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc
index 410c235..d5d84b1 100644
--- a/libstdc++-v3/testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/copy_backward/debug/constexpr_neg.cc
@@ -35,4 +35,4 @@ test()
static_assert(test()); // { dg-error "non-constant condition" }
-// { dg-prune-output "_Error_formatter::_M_error()" }
+// { dg-prune-output "_Error_formatter::(_M_error|_S_at)" }
diff --git a/libstdc++-v3/testsuite/25_algorithms/equal/debug/constexpr_neg.cc b/libstdc++-v3/testsuite/25_algorithms/equal/debug/constexpr_neg.cc
index cbc7509..6c1531d 100644
--- a/libstdc++-v3/testsuite/25_algorithms/equal/debug/constexpr_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/equal/debug/constexpr_neg.cc
@@ -32,7 +32,7 @@ test01()
}
static_assert(test01()); // { dg-error "non-constant condition" }
-// { dg-error "_Error_formatter::_M_error()" "" { target *-*-* } 0 }
+// { dg-error "_Error_formatter::(_M_error|_S_at)" "" { target *-*-* } 0 }
constexpr bool
test02()
diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc
index c07145c..b44cb4b 100644
--- a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_neg.cc
@@ -43,5 +43,5 @@ test()
static_assert(test()); // { dg-error "" }
-// { dg-prune-output "_Error_formatter::_M_error()" }
+// { dg-prune-output "_Error_formatter::(_M_error|_S_at)" }
// { dg-prune-output "in 'constexpr'" }
diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc
index 09ae26f..7835b30 100644
--- a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_partitioned_pred_neg.cc
@@ -33,4 +33,4 @@ test()
static_assert(test()); // { dg-error "" }
-// { dg-prune-output "_Error_formatter::_M_error()" }
+// { dg-prune-output "_Error_formatter::(_M_error|_S_at)" }
diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc
index 20eb026..911880b 100644
--- a/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/debug/constexpr_valid_range_neg.cc
@@ -46,5 +46,5 @@ test2()
static_assert(test2()); // { dg-error "" }
-// { dg-prune-output "_Error_formatter::_M_error()" }
+// { dg-prune-output "_Error_formatter::(_M_error|_S_at)" }
diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc
index ffe5d77..950d432 100644
--- a/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_neg.cc
@@ -43,4 +43,4 @@ test()
static_assert(test()); // { dg-error "" }
-// { dg-prune-output "_Error_formatter::_M_error()" }
+// { dg-prune-output "_Error_formatter::(_M_error|_S_at)" }
diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc
index a1c2ce6..41eb00c 100644
--- a/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_partitioned_pred_neg.cc
@@ -33,4 +33,4 @@ test()
static_assert(test()); // { dg-error "" }
-// { dg-prune-output "_Error_formatter::_M_error()" }
+// { dg-prune-output "_Error_formatter::(_M_error|_S_at)" }
diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc
index c7c9e3b..032c8d3 100644
--- a/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/debug/constexpr_valid_range_neg.cc
@@ -46,4 +46,4 @@ test2()
static_assert(test2()); // { dg-error "" }
-// { dg-prune-output "_Error_formatter::_M_error()" }
+// { dg-prune-output "_Error_formatter::(_M_error|_S_at)" }
diff --git a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/make_observer.cc b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/make_observer.cc
index 048735f..1de9cf0 100644
--- a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/make_observer.cc
+++ b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/make_observer.cc
@@ -20,12 +20,19 @@
#include <experimental/memory>
#include <testsuite_hooks.h>
-int main()
+constexpr bool test()
{
const int i = 42;
auto o = std::experimental::make_observer(&i);
static_assert( std::is_same<decltype(o),
- std::experimental::observer_ptr<const int>>(), "" );
+ std::experimental::observer_ptr<const int>>(), "" );
VERIFY( o && *o == 42 );
VERIFY( o.get() == &i );
+ return true;
+}
+
+int main()
+{
+ test();
+ static_assert( test(), "LWG 4295 - make_observer should be constexpr" );
}
diff --git a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/relops/relops.cc b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/relops/relops.cc
index 3e23e0b..d03dd5d 100644
--- a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/relops/relops.cc
+++ b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/relops/relops.cc
@@ -22,13 +22,13 @@
using std::experimental::observer_ptr;
-void test01()
+constexpr void test01()
{
observer_ptr<int> a, b;
VERIFY(a == b);
}
-void test02()
+constexpr void test02()
{
int x[2]{};
observer_ptr<int> a{&x[0]};
@@ -40,7 +40,7 @@ void test02()
VERIFY(b > a);
}
-void test03()
+constexpr void test03()
{
int x{};
observer_ptr<int> a{&x};
@@ -48,9 +48,10 @@ void test03()
VERIFY(a == b);
}
-void test04()
+int x[2]{};
+
+constexpr void test04()
{
- static constexpr int x[2]{};
constexpr observer_ptr<const int> a{&x[0]};
constexpr observer_ptr<const int> b{&x[1]};
VERIFY(a != b);
@@ -60,20 +61,25 @@ void test04()
VERIFY(b > a);
}
-void test05()
+constexpr void test05()
{
- static constexpr int x{};
- constexpr observer_ptr<const int> a{&x};
- constexpr observer_ptr<const int> b{&x};
+ constexpr observer_ptr<const int> a{&x[0]};
+ constexpr observer_ptr<const int> b{&x[0]};
VERIFY(a == b);
}
-
-int main()
+constexpr bool all_tests()
{
test01();
test02();
test03();
test04();
test05();
+ return true;
+}
+
+int main()
+{
+ all_tests();
+ static_assert( all_tests(), "LWG 4295 - relops should be constexpr" );
}
diff --git a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/swap/swap.cc b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/swap/swap.cc
index 9e76788..84b8844 100644
--- a/libstdc++-v3/testsuite/experimental/memory/observer_ptr/swap/swap.cc
+++ b/libstdc++-v3/testsuite/experimental/memory/observer_ptr/swap/swap.cc
@@ -25,7 +25,7 @@ using std::experimental::observer_ptr;
struct B {};
struct D : B {};
-void test01()
+constexpr void test01()
{
observer_ptr<int> a, b;
VERIFY(a == b);
@@ -33,7 +33,7 @@ void test01()
VERIFY(a == b);
}
-void test02()
+constexpr void test02()
{
int x{};
observer_ptr<int> a;
@@ -45,7 +45,7 @@ void test02()
VERIFY(!b);
}
-void test03()
+constexpr void test03()
{
int x[2]{1,2};
observer_ptr<int> a{&x[0]};
@@ -57,10 +57,16 @@ void test03()
VERIFY(*b == 1);
}
-
int main()
{
- test01();
- test02();
- test03();
+ auto tests = [] {
+ test01();
+ test02();
+ test03();
+ return true;
+ };
+ tests();
+#if __cpp_lib_constexpr_algorithms >= 201806L // >= C++20
+ static_assert( tests(), "LWG 4295 - swap should be constexpr" );
+#endif
}
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc
index 2861115..a9395b4 100644
--- a/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc
+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc
@@ -233,6 +233,13 @@ test14()
VERIFY( ranges::equal(v | views::join, (int[]){1, 2, 3}) );
}
+void
+test15()
+{
+ // PR libstdc++/119962 - __maybe_present_t misses initialization
+ constexpr decltype(views::join(views::single(views::single(0))).begin()) it;
+}
+
int
main()
{
@@ -250,4 +257,5 @@ main()
test12();
test13();
test14();
+ test15();
}
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/join_with/1.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/join_with/1.cc
index 8ab30a5..4d55c9d 100644
--- a/libstdc++-v3/testsuite/std/ranges/adaptors/join_with/1.cc
+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/join_with/1.cc
@@ -94,6 +94,13 @@ test04()
return true;
}
+void
+test05()
+{
+ // PR libstdc++/119962 - __maybe_present_t misses initialization
+ constexpr decltype(views::join_with(views::single(views::single(0)), 0).begin()) it;
+}
+
int
main()
{
@@ -105,4 +112,5 @@ main()
#else
VERIFY(test04());
#endif
+ test05();
}
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc
index 81fc60b..321ae27 100644
--- a/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc
+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/lazy_split.cc
@@ -232,6 +232,13 @@ test12()
return true;
}
+void
+test13()
+{
+ // PR libstdc++/119962 - __maybe_present_t misses initialization
+ constexpr decltype(views::lazy_split(views::single(0), 0).begin()) it;
+}
+
int
main()
{
@@ -247,4 +254,5 @@ main()
test10();
test11();
static_assert(test12());
+ test13();
}