]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
21 months agolibstdc++: Remove redundant partial specialization in _Nth_type
Feng Jisen [Fri, 3 Nov 2023 16:33:44 +0000 (16:33 +0000)] 
libstdc++: Remove redundant partial specialization in _Nth_type

libstdc++-v3/ChangeLog:

* include/bits/utility.h (_Nth_type): Remove redundant partial
specialization.

(cherry picked from commit ada871cfadd3f4960b4435f6f7f07a5aca1887d3)

21 months agolibstdc++: Add assertion to std::string_view::remove_suffix [PR112314]
Jonathan Wakely [Wed, 1 Nov 2023 15:01:22 +0000 (15:01 +0000)] 
libstdc++: Add assertion to std::string_view::remove_suffix [PR112314]

libstdc++-v3/ChangeLog:

PR libstdc++/112314
* include/std/string_view (string_view::remove_suffix): Add
debug assertion.
* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/debug.cc:
New test.
* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/debug.cc:
New test.

(cherry picked from commit 6afa984f47e16e8bd958646d7407b74e61041f5d)

21 months agolibstdc++: Fix warning during configure
Jonathan Wakely [Wed, 1 Nov 2023 14:20:33 +0000 (14:20 +0000)] 
libstdc++: Fix warning during configure

The checks for snprintf give a -Wformat warning due to a missing
argument.

libstdc++-v3/ChangeLog:

* acinclude.m4 (GLIBCXX_ENABLE_C99): Fix snprintf checks.
* configure: Regenerate.

(cherry picked from commit 8a4cde6319b40802a842a8fe71267524dd8af828)

21 months agolibstdc++: Fix exception thrown by std::shared_lock::unlock() [PR112089]
Jonathan Wakely [Thu, 26 Oct 2023 15:51:30 +0000 (16:51 +0100)] 
libstdc++: Fix exception thrown by std::shared_lock::unlock() [PR112089]

The incorrect errc constant here looks like a copy&paste error.

libstdc++-v3/ChangeLog:

PR libstdc++/112089
* include/std/shared_mutex (shared_lock::unlock): Change errc
constant to operation_not_permitted.
* testsuite/30_threads/shared_lock/locking/112089.cc: New test.

(cherry picked from commit 0c305f3dec9a992dd775a3b9607b7b1e8c051859)

21 months agolibstdc++: Add dg-timeout-factor to <chrono> IO tests
Jonathan Wakely [Tue, 24 Oct 2023 20:50:17 +0000 (21:50 +0100)] 
libstdc++: Add dg-timeout-factor to <chrono> IO tests

This avoids failures due to compilation timeouts when testing with a low
tool_timeout value.

libstdc++-v3/ChangeLog:

* testsuite/20_util/duration/io.cc: Double timeout using
dg-timeout-factor.
* testsuite/std/time/day/io.cc: Likewise.
* testsuite/std/time/format.cc: Likewise.
* testsuite/std/time/hh_mm_ss/io.cc: Likewise.
* testsuite/std/time/month/io.cc: Likewise.
* testsuite/std/time/month_day/io.cc: Likewise.
* testsuite/std/time/month_day_last/io.cc: Likewise.
* testsuite/std/time/month_weekday/io.cc: Likewise.
* testsuite/std/time/month_weekday_last/io.cc: Likewise.
* testsuite/std/time/weekday/io.cc: Likewise.
* testsuite/std/time/weekday_indexed/io.cc: Likewise.
* testsuite/std/time/weekday_last/io.cc: Likewise.
* testsuite/std/time/year/io.cc: Likewise.
* testsuite/std/time/year_month/io.cc: Likewise.
* testsuite/std/time/year_month_day/io.cc: Likewise.
* testsuite/std/time/year_month_day_last/io.cc: Likewise.
* testsuite/std/time/year_month_weekday/io.cc: Likewise.
* testsuite/std/time/year_month_weekday_last/io.cc: Likewise.
* testsuite/std/time/zoned_time/io.cc: Likewise.

(cherry picked from commit 7d06b29f8145805f33a33fb54a7d69acf31cecd6)

21 months agolibstdc++: Split std::basic_string::_M_use_local_data into two functions
Jonathan Wakely [Fri, 29 Sep 2023 11:12:22 +0000 (12:12 +0100)] 
libstdc++: Split std::basic_string::_M_use_local_data into two functions

This splits out the activate-the-union-member-for-constexpr logic from
_M_use_local_data, so that it can be used separately in cases that don't
need to use std::pointer_traits<pointer>::pointer_to to obtain the
return value.

This leaves only three uses of _M_use_local_data() which are all of the
same form:

  __s._M_data(_M_use_local_data());
  __s._M_set_length(0);

We could remove _M_use_local_data() and change those three places to use
a new _M_reset() function that does:

  _M_init_local_buf();
  _M_data(_M_local_data());
  _M_set_length(0);

This is left for a future change.

libstdc++-v3/ChangeLog:

* include/bits/basic_string.h (_M_init_local_buf()): New
function.
(_M_use_local_data()): Use _M_init_local_buf.
(basic_string(), basic_string(const Alloc&))
(basic_string(basic_string&&))
(basic_string(basic_string&&, const Alloc&)): Use
_M_init_local_buf instead of _M_use_local_data().
* include/bits/basic_string.tcc (swap(basic_string&))
(_M_construct(InIter, InIter, input_iterator_tag))
(_M_construct(InIter, InIter, forward_iterator_tag))
(_M_construct(size_type, CharT), reserve()): Likewise.

(cherry picked from commit 405a4140fc30bce86b1ec885a98bb17704e0c8c6)

21 months agoDaily bump.
GCC Administrator [Wed, 8 Nov 2023 00:21:03 +0000 (00:21 +0000)] 
Daily bump.

21 months agolibphobos: Fix regression d21 loops in getCpuInfo0B in Solaris/x86 kernel zone
Iain Buclaw [Tue, 7 Nov 2023 13:04:07 +0000 (14:04 +0100)] 
libphobos: Fix regression d21 loops in getCpuInfo0B in Solaris/x86 kernel zone

This function assumes that cpuid would return "invalid domain" when a
sub-leaf index greater than what's supported is requested.  This turned
out not to always be the case when running on some virtual machines.

As the loop only does anything for levels 0 and 1, make that a hard
limit for number of times the loop is ran.

    PR d/112408

libphobos/ChangeLog:

* libdruntime/core/cpuid.d (getCpuInfo0B): Limit number of times loop
runs.

21 months agoDaily bump.
GCC Administrator [Tue, 7 Nov 2023 00:20:51 +0000 (00:20 +0000)] 
Daily bump.

21 months agolibstdc++: use -D_GNU_SOURCE when building libbacktrace
Ian Lance Taylor [Mon, 6 Nov 2023 23:12:05 +0000 (15:12 -0800)] 
libstdc++: use -D_GNU_SOURCE when building libbacktrace

PR libbacktrace/111315
PR libbacktrace/112263
* acinclude.m4: Set -D_GNU_SOURCE in BACKTRACE_CPPFLAGS and when
grepping link.h for dl_iterate_phdr.
* configure: Regenerate.

21 months agohppa: Fix typo in PA 2.0 trampoline template
John David Anglin [Mon, 6 Nov 2023 20:45:13 +0000 (20:45 +0000)] 
hppa: Fix typo in PA 2.0 trampoline template

2023-11-06  John David Anglin  <danglin@gcc.gnu.org>

* config/pa/pa.cc (pa_asm_trampoline_template): Fix typo.

21 months agoDaily bump.
GCC Administrator [Mon, 6 Nov 2023 00:24:16 +0000 (00:24 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sun, 5 Nov 2023 02:50:05 +0000 (02:50 +0000)] 
Daily bump.

21 months agoFortran: fix issue with multiple references of a procedure pointer [PR97245]
Harald Anlauf [Fri, 3 Nov 2023 18:41:54 +0000 (19:41 +0100)] 
Fortran: fix issue with multiple references of a procedure pointer [PR97245]

gcc/fortran/ChangeLog:

PR fortran/97245
* match.cc (gfc_match_call): If a procedure pointer has already been
resolved, do not create a new symbol in a procedure reference of
the same name shadowing the first one if it is host-associated.

gcc/testsuite/ChangeLog:

PR fortran/97245
* gfortran.dg/proc_ptr_53.f90: New test.

(cherry picked from commit 5340f48b7639fcc874f64aac214f9ef9ae43d43e)

21 months agoDaily bump.
GCC Administrator [Sat, 4 Nov 2023 01:34:33 +0000 (01:34 +0000)] 
Daily bump.

21 months agoFortran: Fix for regression in ASSOCIATE [PR112316]
Paul Thomas [Thu, 2 Nov 2023 22:23:05 +0000 (22:23 +0000)] 
Fortran: Fix for regression in ASSOCIATE [PR112316]

2023-11-02  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/112316
* parse.cc (parse_associate): Remove condition that caused this
regression.

gcc/testsuite/
PR fortran/112316
* gfortran.dg/pr112316.f90: New test.

(cherry picked from commit 7c1d011bc1f8b26dba4ebcbd4a429628dfb2698d)

21 months agoDaily bump.
GCC Administrator [Fri, 3 Nov 2023 00:21:12 +0000 (00:21 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Thu, 2 Nov 2023 00:21:20 +0000 (00:21 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Wed, 1 Nov 2023 00:22:10 +0000 (00:22 +0000)] 
Daily bump.

21 months agoRISC-V: Fix ICE of RVV vget/vset intrinsic[PR111935]
xuli [Tue, 24 Oct 2023 07:39:02 +0000 (07:39 +0000)] 
RISC-V: Fix ICE of RVV vget/vset intrinsic[PR111935]

Calling vget/vset intrinsic without receiving a return value will cause
a crash. Because in this case e.target is null.
This patch should be backported to releases/gcc-13.

PR target/111935

gcc/ChangeLog:

* config/riscv/riscv-vector-builtins-bases.cc: fix bug.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/pr111935.c: New test.

(cherry picked from commit b44d4ff7b43ff6a34d5c074c7ade03c4a38974fa)

21 months agoDaily bump.
GCC Administrator [Tue, 31 Oct 2023 00:21:12 +0000 (00:21 +0000)] 
Daily bump.

21 months agolibstdc++: [_GLIBCXX_INLINE_VERSION] Provide handle_contract_violation symbol
François Dumont [Tue, 19 Sep 2023 16:56:57 +0000 (18:56 +0200)] 
libstdc++: [_GLIBCXX_INLINE_VERSION] Provide handle_contract_violation symbol

libstdc++-v3/ChangeLog:

* src/experimental/contract.cc
[_GLIBCXX_INLINE_VERSION](handle_contract_violation): Provide symbol
without version namespace decoration for gcc.

21 months agoDaily bump.
GCC Administrator [Mon, 30 Oct 2023 00:21:09 +0000 (00:21 +0000)] 
Daily bump.

21 months agod: Fix ICE: verify_gimple_failed (conversion of register to a different size in ...
Iain Buclaw [Sun, 29 Oct 2023 19:13:14 +0000 (20:13 +0100)] 
d: Fix ICE: verify_gimple_failed (conversion of register to a different size in 'view_convert_expr')

Static arrays in D are passed around by value, rather than decaying to a
pointer.  On x86_64 __builtin_va_list is an exception to this rule, but
semantically it's still treated as a static array.

This makes certain assignment operations fail due a mismatch in types.
As all examples in the test program are rejected by C/C++ front-ends,
these are now errors in D too to be consistent.

PR d/110712

gcc/d/ChangeLog:

* d-codegen.cc (d_build_call): Update call to convert_for_argument.
* d-convert.cc (is_valist_parameter_type): New function.
(check_valist_conversion): New function.
(convert_for_assignment): Update signature.  Add check whether
assigning va_list is permissible.
(convert_for_argument): Likewise.
* d-tree.h (convert_for_assignment): Update signature.
(convert_for_argument): Likewise.
* expr.cc (ExprVisitor::visit (AssignExp *)): Update call to
convert_for_assignment.

gcc/testsuite/ChangeLog:

* gdc.dg/pr110712.d: New test.

(cherry picked from commit ea8ffdcadb388b531adf4772287e7987a82a84b7)

21 months agoDaily bump.
GCC Administrator [Sun, 29 Oct 2023 00:21:40 +0000 (00:21 +0000)] 
Daily bump.

21 months agod: Fix ICE: in verify_gimple_in_seq on powerpc-darwin9 [PR112270]
Iain Buclaw [Sat, 28 Oct 2023 22:27:49 +0000 (00:27 +0200)] 
d: Fix ICE: in verify_gimple_in_seq on powerpc-darwin9 [PR112270]

This ICE was seen during stage2 on powerpc-darwin9 only.  There were
still some uses of GCC's boolean_type_node in the D front-end, which
caused a type mismatch to trigger as D bool size is fixed to 1 byte on
all targets.

So two new nodes have been introduced - d_bool_false_node and
d_bool_true_node - which have replaced all remaining uses of
boolean_false_node and boolean_true_node respectively.

PR d/112270

gcc/d/ChangeLog:

* d-builtins.cc (d_build_d_type_nodes): Initialize d_bool_false_node,
d_bool_true_node.
* d-codegen.cc (build_array_struct_comparison): Use d_bool_false_node
instead of boolean_false_node.
* d-convert.cc (d_truthvalue_conversion): Use d_bool_false_node and
d_bool_true_node instead of boolean_false_node and boolean_true_node.
* d-tree.h (enum d_tree_index): Add DTI_BOOL_FALSE and DTI_BOOL_TRUE.
(d_bool_false_node): New macro.
(d_bool_true_node): New macro.
* modules.cc (build_dso_cdtor_fn): Use d_bool_false_node and
d_bool_true_node instead of boolean_false_node and boolean_true_node.
(register_moduleinfo): Use d_bool_type instead of boolean_type_node.

gcc/testsuite/ChangeLog:

* gdc.dg/pr112270.d: New test.

(cherry picked from commit 10f1489dcb3bd9adccc88898bc12f53398fa3583)

21 months agoDaily bump.
GCC Administrator [Sat, 28 Oct 2023 00:20:44 +0000 (00:20 +0000)] 
Daily bump.

21 months agoAvoid compile time hog on vect_peel_nonlinear_iv_init for nonlinear induction vec_ste...
liuhongt [Wed, 18 Oct 2023 02:08:24 +0000 (10:08 +0800)] 
Avoid compile time hog on vect_peel_nonlinear_iv_init for nonlinear induction vec_step_op_mul when iteration count is too big.

There's loop in vect_peel_nonlinear_iv_init to get init_expr *
pow (step_expr, skip_niters). When skipn_iters is too big, compile time
hogs. To avoid that, optimize init_expr * pow (step_expr, skip_niters) to
init_expr << (exact_log2 (step_expr) * skip_niters) when step_expr is
pow of 2, otherwise give up vectorization when skip_niters >=
TYPE_PRECISION (TREE_TYPE (init_expr)).

Also give up vectorization when niters_skip is negative which will be
used for fully masked loop.

gcc/ChangeLog:

PR tree-optimization/111820
PR tree-optimization/111833
* tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p): Give
up vectorization for nonlinear iv vect_step_op_mul when
step_expr is not exact_log2 and niters is greater than
TYPE_PRECISION (TREE_TYPE (step_expr)). Also don't vectorize
for nagative niters_skip which will be used by fully masked
loop.
(vect_can_advance_ivs_p): Pass whole phi_info to
vect_can_peel_nonlinear_iv_p.
* tree-vect-loop.cc (vect_peel_nonlinear_iv_init): Optimize
init_expr * pow (step_expr, skipn) to init_expr
<< (log2 (step_expr) * skipn) when step_expr is exact_log2.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr111820-1.c: New test.
* gcc.target/i386/pr111820-2.c: New test.
* gcc.target/i386/pr111820-3.c: New test.
* gcc.target/i386/pr103144-mul-1.c: Adjust testcase.
* gcc.target/i386/pr103144-mul-2.c: Adjust testcase.

21 months agoDaily bump.
GCC Administrator [Fri, 27 Oct 2023 00:21:28 +0000 (00:21 +0000)] 
Daily bump.

21 months agoFortran: Set hidden string length for pointer components [PR67740].
Paul Thomas [Thu, 12 Oct 2023 06:26:59 +0000 (07:26 +0100)] 
Fortran: Set hidden string length for pointer components [PR67740].

2023-10-11  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/67740
* trans-expr.cc (gfc_trans_pointer_assignment): Set the hidden
string length component for pointer assignment to character
pointer components.

gcc/testsuite/
PR fortran/67740
* gfortran.dg/pr67740.f90: New test

(cherry picked from commit 701363d827d45d3e3601735fa42f95644fda8b64)

21 months agoLoongArch: Define macro CLEAR_INSN_CACHE.
Lulu Cheng [Mon, 23 Oct 2023 01:07:32 +0000 (09:07 +0800)] 
LoongArch: Define macro CLEAR_INSN_CACHE.

LoongArch's microstructure ensures cache consistency by hardware.
Due to out-of-order execution, "ibar" is required to ensure the visibility of the
store (invalidated icache) executed by this CPU before "ibar" (to the instance).
"ibar" will not invalidate the icache, so the start and end parameters are not Affect
"ibar" performance.

gcc/ChangeLog:

* config/loongarch/loongarch.h (CLEAR_INSN_CACHE): New definition.

(cherry picked from commit 5697ed0327f23d2e2ec4f7beec3b3d02f463173c)

21 months agoLoongArch: Implement __builtin_thread_pointer for TLS.
chenxiaolong [Tue, 24 Oct 2023 06:40:14 +0000 (14:40 +0800)] 
LoongArch: Implement __builtin_thread_pointer for TLS.

gcc/ChangeLog:

* config/loongarch/loongarch.md (get_thread_pointer<mode>):Adds the
instruction template corresponding to the __builtin_thread_pointer
function.
* doc/extend.texi:Add the __builtin_thread_pointer function support
description to the documentation.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/builtin_thread_pointer.c: New test.

(cherry picked from commit 1b30ef7cea773e0af527dbf821e0be42b6a264f8)

21 months agoDaily bump.
GCC Administrator [Thu, 26 Oct 2023 00:20:46 +0000 (00:20 +0000)] 
Daily bump.

21 months agolibstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936]
Jonathan Wakely [Tue, 24 Oct 2023 15:56:30 +0000 (16:56 +0100)] 
libstdc++: Build libstdc++_libbacktrace.a as PIC [PR111936]

In order for std::stacktrace to be used in a shared library, the
libbacktrace symbols need to be built with -fPIC. Add the libtool
-prefer-pic flag to the commands in src/libbacktrace/Makefile so that
the archive contains PIC objects.

libstdc++-v3/ChangeLog:

PR libstdc++/111936
* src/libbacktrace/Makefile.am: Add -prefer-pic to libtool
compile commands.
* src/libbacktrace/Makefile.in: Regenerate.

(cherry picked from commit f32c1e1e96ffef6512ce025942b51f3967a3e7f2)

21 months agolibstdc++: Include cstdarg in freestanding
Paul M. Bendixen [Fri, 21 Jul 2023 21:35:25 +0000 (23:35 +0200)] 
libstdc++: Include cstdarg in freestanding

P1642 includes cstdarg in the full headers to include.
This commit includes it along with cstdalign and cstdbool that were
left out when updating in an earlier commit.

libstdc++/Changelog

* include/Makefile.am: Move cstdarg, cstdalign and cstdbool to
freestanding.
* include/Makefile.in: Regenerate.

Signed-off-by: Paul M. Bendixen <paulbendixen@gmail.com>
(cherry picked from commit c1eee808a93a94a18cffef59432e3422ed4e9b27)

21 months agoDaily bump.
GCC Administrator [Wed, 25 Oct 2023 00:24:37 +0000 (00:24 +0000)] 
Daily bump.

21 months agoRemove obsolete debugging formats from names list
Mark Harmstone [Tue, 24 Oct 2023 07:04:25 +0000 (09:04 +0200)] 
Remove obsolete debugging formats from names list

* opts.cc (debug_type_names): Remove stabs and xcoff.
(df_set_names): Adjust.

(cherry picked from commit 724badcadf889b5798321620aeed16b61e91fe72)

21 months agoDaily bump.
GCC Administrator [Tue, 24 Oct 2023 00:25:42 +0000 (00:25 +0000)] 
Daily bump.

21 months agolibstdc++: [_Hashtable] Do not reuse untrusted cached hash code
François Dumont [Wed, 18 Oct 2023 17:35:32 +0000 (19:35 +0200)] 
libstdc++: [_Hashtable] Do not reuse untrusted cached hash code

On merge, reuse a merged node's possibly cached hash code only if we are on the
same type of hash and this hash is stateless.

Usage of function pointers or std::function as hash functor will prevent reusing
cached hash code.

libstdc++-v3/ChangeLog

* include/bits/hashtable_policy.h
(_Hash_code_base::_M_hash_code(const _Hash&, const _Hash_node_value<>&)): Remove.
(_Hash_code_base::_M_hash_code<_H2>(const _H2&, const _Hash_node_value<>&)): Remove.
* include/bits/hashtable.h
(_M_src_hash_code<_H2>(const _H2&, const key_type&, const __node_value_type&)): New.
(_M_merge_unique<>, _M_merge_multi<>): Use latter.
* testsuite/23_containers/unordered_map/modifiers/merge.cc
(test04, test05, test06): New test cases.

21 months agoSH: Fix PR 111001
Oleg Endo [Mon, 23 Oct 2023 13:08:37 +0000 (22:08 +0900)] 
SH: Fix PR 111001

gcc/ChangeLog:

PR target/111001
* config/sh/sh_treg_combine.cc (sh_treg_combine::record_set_of_reg):
Skip over nop move insns.

21 months agors6000: Make 32 bit stack_protect support prefixed insn [PR111367]
Kewen Lin [Thu, 12 Oct 2023 05:05:03 +0000 (00:05 -0500)] 
rs6000: Make 32 bit stack_protect support prefixed insn [PR111367]

As PR111367 shows, with prefixed insn supported, some of
checkings consider it's able to leverage prefixed insn
for stack protect related load/store, but since we don't
actually change the emitted assembly for 32 bit, it can
cause the assembler error as exposed.

Mike's commit r10-4547-gce6a6c007e5a98 has already handled
the 64 bit case (DImode), this patch is to treat the 32
bit case (SImode) by making use of mode iterator P and
ptrload attribute iterator, also fixes the constraints
to match the emitted operand formats.

PR target/111367

gcc/ChangeLog:

* config/rs6000/rs6000.md (stack_protect_setsi): Support prefixed
instruction emission and incorporate to stack_protect_set<mode>.
(stack_protect_setdi): Rename to ...
(stack_protect_set<mode>): ... this, adjust constraint.
(stack_protect_testsi): Support prefixed instruction emission and
incorporate to stack_protect_test<mode>.
(stack_protect_testdi): Rename to ...
(stack_protect_test<mode>): ... this, adjust constraint.

gcc/testsuite/ChangeLog:

* g++.target/powerpc/pr111367.C: New test.

(cherry picked from commit 530babc2058be5f2b06b1541384e7b730c368b93)

21 months agoDaily bump.
GCC Administrator [Mon, 23 Oct 2023 00:21:10 +0000 (00:21 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sun, 22 Oct 2023 00:20:27 +0000 (00:20 +0000)] 
Daily bump.

21 months agoFortran: out of bounds access with nested implied-do IO [PR111837]
Harald Anlauf [Mon, 16 Oct 2023 19:02:20 +0000 (21:02 +0200)] 
Fortran: out of bounds access with nested implied-do IO [PR111837]

gcc/fortran/ChangeLog:

PR fortran/111837
* frontend-passes.cc (traverse_io_block): Dependency check of loop
nest shall be triangular, not banded.

gcc/testsuite/ChangeLog:

PR fortran/111837
* gfortran.dg/implied_do_io_8.f90: New test.

(cherry picked from commit 5ac63ec5da2e93226457bea4dbb3a4f78d5d82c2)

21 months agolibstdc++: Workaround for LLVM-61763 in <ranges>
Benjamin Brock [Fri, 20 Oct 2023 17:07:50 +0000 (18:07 +0100)] 
libstdc++: Workaround for LLVM-61763 in <ranges>

This patch adds a small workaround that avoids declaring constrained
friends when compiling with Clang, instead making some members public.
MSVC's standard library has implemented a similar workaround.

Signed-off-by: Benjamin Brock <brock@cs.berkeley.edu>
libstdc++-v3/ChangeLog:

* include/std/ranges (zip_view, adjacent_view): Implement
workaround for LLVM-61763.

(cherry picked from commit be34a8b538c0f04b11a428bd1a9340eb19dec13f)

21 months agolibstdc++: Fix formatting of filesystem directory iterators
Jonathan Wakely [Tue, 3 Oct 2023 16:35:38 +0000 (17:35 +0100)] 
libstdc++: Fix formatting of filesystem directory iterators

Fix indentation.

libstdc++-v3/ChangeLog:

* include/bits/fs_dir.h (operator==(default_sentinel_t)): Fix
indentation.

(cherry picked from commit 77209d43f1f38f153863a1845b64542cca79c2cb)

21 months agolibstdc++: Ensure active union member is correctly set
Nathaniel Shead [Fri, 29 Sep 2023 09:30:41 +0000 (10:30 +0100)] 
libstdc++: Ensure active union member is correctly set

This patch ensures that the union members for std::string and
std::variant are always properly set when a change occurs.

libstdc++-v3/ChangeLog:

* include/bits/basic_string.h: (basic_string(basic_string&&)):
Activate _M_local_buf when needed.
(basic_string(basic_string&&, const _Alloc&)): Likewise.
* include/bits/basic_string.tcc: (basic_string::swap): Likewise.
* include/std/variant: (__detail::__variant::__construct_n): New.
(__detail::__variant::__emplace): Use __construct_n.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
(cherry picked from commit 28adad7a32ed92a3c0906b38411c4ed686bbacc5)

21 months agoDaily bump.
GCC Administrator [Sat, 21 Oct 2023 00:21:04 +0000 (00:21 +0000)] 
Daily bump.

21 months agoc-family: char8_t and aliasing in C vs C++ [PR111884]
Marek Polacek [Thu, 19 Oct 2023 20:32:10 +0000 (16:32 -0400)] 
c-family: char8_t and aliasing in C vs C++ [PR111884]

In the PR, Joseph says that in C char8_t is not a distinct type.  So
we should behave as if it can alias anything, like ordinary char.
In C, unsigned_char_type_node == char8_type_node, so with this patch
we return 0 instead of -1.  And the following comment says:

  /* The C standard guarantees that any object may be accessed via an
     lvalue that has narrow character type (except char8_t).  */
  if (t == char_type_node
      || t == signed_char_type_node
      || t == unsigned_char_type_node)
    return 0;

Which appears to be wrong, so I'm adjusting that as well.

PR c/111884

gcc/c-family/ChangeLog:

* c-common.cc (c_common_get_alias_set): Return -1 for char8_t only
in C++.

gcc/testsuite/ChangeLog:

* c-c++-common/alias-1.c: New test.

(cherry picked from commit 281699fbff6262766674ab13087d37db751cd40a)

21 months agoSH: Fix PR 101177
Oleg Endo [Fri, 20 Oct 2023 09:48:34 +0000 (18:48 +0900)] 
SH: Fix PR 101177

Fix accidentally inverted comparison.

gcc/ChangeLog:

PR target/101177
* config/sh/sh.md (unnamed split pattern): Fix comparison of
find_regno_note result.

21 months agoDaily bump.
GCC Administrator [Fri, 20 Oct 2023 00:20:24 +0000 (00:20 +0000)] 
Daily bump.

21 months agoc++: Make -Wunknown-pragmas controllable by #pragma GCC diagnostic [PR89038]
Lewis Hyatt [Wed, 18 Oct 2023 16:37:08 +0000 (12:37 -0400)] 
c++: Make -Wunknown-pragmas controllable by #pragma GCC diagnostic [PR89038]

As noted on the PR, commit r13-1544, the fix for PR53431, did not handle
the specific case of -Wunknown-pragmas, because that warning is issued
during preprocessing, but not by libcpp directly (it comes from the
cb_def_pragma callback).  Address that by handling this pragma in
addition to libcpp pragmas during the early pragma handler.

gcc/c-family/ChangeLog:

PR c++/89038
* c-pragma.cc (handle_pragma_diagnostic_impl):  Handle
-Wunknown-pragmas during early processing.

gcc/testsuite/ChangeLog:

PR c++/89038
* c-c++-common/cpp/Wunknown-pragmas-1.c: New test.

21 months agoLibF7: Implement mul_mant for devices without MUL instruction.
Georg-Johann Lay [Wed, 18 Oct 2023 16:59:17 +0000 (18:59 +0200)] 
LibF7: Implement mul_mant for devices without MUL instruction.

libgcc/config/avr/libf7/
* libf7-asm.sx (mul_mant): Implement for devices without MUL.
* asm-defs.h (wmov) [!HAVE_MUL]: Fix regno computation.
* t-libf7 (F7_ASM_FLAGS): Add -g0.

21 months agoDaily bump.
GCC Administrator [Thu, 19 Oct 2023 00:21:56 +0000 (00:21 +0000)] 
Daily bump.

21 months agolra: Avoid unfolded plus-0
Richard Sandiford [Wed, 18 Oct 2023 17:44:57 +0000 (18:44 +0100)] 
lra: Avoid unfolded plus-0

While backporting another patch to an earlier release, I hit a
situation in which lra_eliminate_regs_1 would eliminate an address to:

    (plus (reg:P R) (const_int 0))

This address compared not-equal to plain:

    (reg:P R)

which caused an ICE in a later peephole2.  (The ICE showed up in
gfortran.fortran-torture/compile/pr80464.f90 on the branch but seems
to be latent on trunk.)

These unfolded PLUSes shouldn't occur in the insn stream, and later code
in the same function tried to avoid them.

gcc/
PR target/111528
* lra-eliminations.cc (lra_eliminate_regs_1): Use simplify_gen_binary
rather than gen_rtx_PLUS.

(cherry picked from commit 10d59b802a7db9ae908291fb20627c1493cfa26c)

21 months agoPR modula2/111756: Re-building all-gcc after source changes fails to link
Gaius Mulley [Wed, 18 Oct 2023 02:09:29 +0000 (03:09 +0100)] 
PR modula2/111756: Re-building all-gcc after source changes fails to link

When having modula-2 enabled in a development tree and there are any
changes that trigger rebuilds in m2/ doing a 'make all-gcc' in the
build directory might fail due to lack of dependency tracking.
This patch introduces build dependencies into gcc/m2/Make-lang.in using
-M* options.

gcc/m2/ChangeLog:

PR modula2/111756
* Make-lang.in (CM2DEP): New define conditionally set if
($(CXXDEPMODE),depmode=gcc3).
(m2/gm2-gcc/%.o): Ensure $(@D)/$(DEPDIR) is created.
Add $(CM2DEP) to the $(COMPILER) command and use $(POSTCOMPILE).
(m2/gm2-gcc/m2configure.o): Ditto.
(m2/gm2-lang.o): Ditto.
(m2/m2pp.o): Ditto.
(m2/gm2-gcc/rtegraph.o): Ditto.
(m2/mc-boot/$(SRC_PREFIX)%.o): Ditto.
(m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto.
(m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto.
(m2/mc-boot/main.o): Ditto.
(mcflex.o): Ditto.
(m2/gm2-libs-boot/M2RTS.o): Ditto.
(m2/gm2-libs-boot/%.o): Ditto.
(m2/gm2-libs-boot/%.o): Ditto.
(m2/gm2-libs-boot/RTcodummy.o): Ditto.
(m2/gm2-libs-boot/RTintdummy.o): Ditto.
(m2/gm2-libs-boot/wrapc.o): Ditto.
(m2/gm2-libs-boot/UnixArgs.o): Ditto.
(m2/gm2-libs-boot/choosetemp.o): Ditto.
(m2/gm2-libs-boot/errno.o): Ditto.
(m2/gm2-libs-boot/dtoa.o): Ditto.
(m2/gm2-libs-boot/ldtoa.o): Ditto.
(m2/gm2-libs-boot/termios.o): Ditto.
(m2/gm2-libs-boot/SysExceptions.o): Ditto.
(m2/gm2-libs-boot/SysStorage.o): Ditto.
(m2/gm2-compiler-boot/M2GCCDeclare.o): Ditto.
(m2/gm2-compiler-boot/M2Error.o): Ditto.
(m2/gm2-compiler-boot/%.o): Ditto.
(m2/gm2-compiler-boot/%.o): Ditto.
(m2/gm2-compiler-boot/m2flex.o): Ditto.
(m2/gm2-compiler/m2flex.o): Ditto.
(m2/gm2-libs/choosetemp.o): Ditto.
(m2/boot-bin/mklink$(exeext)): Ditto.
(m2/pge-boot/%.o): Ditto.
(m2/pge-boot/%.o): Ditto.
* README: Remove out of date info.
* gm2-compiler/M2Quads.mod (BuildStringAdrParam): Correct
procedure end name.
* gm2-compiler/SymbolTable.mod (GetVarPointerCheck): Add
default FALSE return value.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
21 months agoDaily bump.
GCC Administrator [Wed, 18 Oct 2023 00:21:03 +0000 (00:21 +0000)] 
Daily bump.

21 months agoLibF7: Re-generate f7-renames.h to pick up white-space from f7renames.sh.
Georg-Johann Lay [Tue, 17 Oct 2023 15:18:18 +0000 (17:18 +0200)] 
LibF7: Re-generate f7-renames.h to pick up white-space from f7renames.sh.

libgcc/config/avr/libf7/
* f7-renames.h: Re-renerate.

21 months agoLibF7: Implement fma / fmal.
Georg-Johann Lay [Tue, 17 Oct 2023 09:36:52 +0000 (11:36 +0200)] 
LibF7: Implement fma / fmal.

libgcc/config/avr/libf7/
* libf7.h (F7_SIZEOF): New macro.
* libf7-asm.sx: Use F7_SIZEOF instead of magic number "10".
(F7MOD_D_fma_, __fma): New module and function.
(fma) [-mdouble=64]: Define as alias for __fma.
(fmal) [-mlong-double=64]: Define as alias for __fma.
* libf7-common.mk (F7_ASM_PARTS): Add D_fma.

21 months agoDisparage slightly for the alternative which move DFmode between SSE_REGS and GENERAL...
liuhongt [Wed, 5 Jul 2023 05:45:11 +0000 (13:45 +0800)] 
Disparage slightly for the alternative which move DFmode between SSE_REGS and GENERAL_REGS.

For testcase

void __cond_swap(double* __x, double* __y) {
  bool __r = (*__x < *__y);
  auto __tmp = __r ? *__x : *__y;
  *__y = __r ? *__y : *__x;
  *__x = __tmp;
}

GCC-14 with -O2 and -march=x86-64 options generates the following code:

__cond_swap(double*, double*):
        movsd   xmm1, QWORD PTR [rdi]
        movsd   xmm0, QWORD PTR [rsi]
        comisd  xmm0, xmm1
        jbe     .L2
        movq    rax, xmm1
        movapd  xmm1, xmm0
        movq    xmm0, rax
.L2:
        movsd   QWORD PTR [rsi], xmm1
        movsd   QWORD PTR [rdi], xmm0
        ret

rax is used to save and restore DFmode value. In RA both GENERAL_REGS
and SSE_REGS cost zero since we didn't disparage the
alternative in movdf_internal pattern, according to register
allocation order, GENERAL_REGS is allocated. The patch add ? for
alternative (r,v) and (v,r) just like we did for movsf/hf/bf_internal
pattern, after that we get optimal RA.

__cond_swap:
.LFB0:
.cfi_startproc
movsd (%rdi), %xmm1
movsd (%rsi), %xmm0
comisd %xmm1, %xmm0
jbe .L2
movapd %xmm1, %xmm2
movapd %xmm0, %xmm1
movapd %xmm2, %xmm0
.L2:
movsd %xmm1, (%rsi)
movsd %xmm0, (%rdi)
ret

gcc/ChangeLog:

PR target/110170
* config/i386/i386.md (movdf_internal): Disparage slightly for
2 alternatives (r,v) and (v,r) by adding constraint modifier
'?'.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr110170-3.c: New test.

(cherry picked from commit 37a231cc7594d12ba0822077018aad751a6fb94e)

21 months agoDaily bump.
GCC Administrator [Tue, 17 Oct 2023 00:20:33 +0000 (00:20 +0000)] 
Daily bump.

21 months agors6000: Use default target option node for callee by default [PR111380]
Kewen Lin [Mon, 16 Oct 2023 02:05:47 +0000 (21:05 -0500)] 
rs6000: Use default target option node for callee by default [PR111380]

As PR111380 (and the discussion in related PRs) shows, for
now how function rs6000_can_inline_p treats the callee
without any target option node is wrong.  It considers it's
always safe to inline this kind of callee, but actually its
target flags are from the command line options
(target_option_default_node), it's possible that the flags
of callee don't satisfy the condition of inlining, but it
is still inlined, then result in unexpected consequence.

As the associated test case pr111380-1.c shows, the caller
main is attributed with power8, but the callee foo is
compiled with power9 from command line, it's unexpected to
make main inline foo since foo can contain something that
requires power9 capability.  Without this patch, for lto
(with -flto) we can get error message (as it forces the
callee to have a target option node), but for non-lto, it's
inlined unexpectedly.

This patch is to make callee adopt target_option_default_node
when it doesn't have a target option node, it can avoid wrong
inlining decision and fix the inconsistency between LTO and
non-LTO.  It also aligns with what the other ports do.

PR target/111380

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_can_inline_p): Adopt
target_option_default_node when the callee has no option
attributes, also simplify the existing code accordingly.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr111380-1.c: New test.
* gcc.target/powerpc/pr111380-2.c: New test.

(cherry picked from commit 266dfed68b881702e9660889f63408054b7fa9c0)

21 months agors6000: Skip empty inline asm in rs6000_update_ipa_fn_target_info [PR111366]
Kewen Lin [Mon, 16 Oct 2023 02:05:40 +0000 (21:05 -0500)] 
rs6000: Skip empty inline asm in rs6000_update_ipa_fn_target_info [PR111366]

PR111366 exposes one thing that can be improved in function
rs6000_update_ipa_fn_target_info is to skip the given empty
inline asm string, since it's impossible to adopt any
hardware features (so far HTM).

Since this rs6000_update_ipa_fn_target_info related approach
exists in GCC12 and later, the affected project highway has
updated its target pragma with ",htm", see the link:
https://github.com/google/highway/commit/15e63d61eb535f478bc
I'd not bother to consider an inline asm parser for now but
will file a separated PR for further enhancement.

PR target/111366

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_update_ipa_fn_target_info): Skip
empty inline asm.

gcc/testsuite/ChangeLog:

* g++.target/powerpc/pr111366.C: New test.

(cherry picked from commit a65b38e361320e0aa45adbc969c704385ab1f45b)

21 months agoDaily bump.
GCC Administrator [Mon, 16 Oct 2023 00:20:54 +0000 (00:20 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sun, 15 Oct 2023 00:20:24 +0000 (00:20 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sat, 14 Oct 2023 00:19:21 +0000 (00:19 +0000)] 
Daily bump.

21 months agoDo not add partial equivalences with no uses.
Andrew MacLeod [Thu, 12 Oct 2023 21:06:36 +0000 (17:06 -0400)] 
Do not add partial equivalences with no uses.

PR tree-optimization/111622
* value-relation.cc (equiv_oracle::add_partial_equiv): Do not
register a partial equivalence if an operand has no uses.

21 months agoDaily bump.
GCC Administrator [Fri, 13 Oct 2023 00:21:00 +0000 (00:21 +0000)] 
Daily bump.

21 months agoLibF7: Implement atan2.
Georg-Johann Lay [Thu, 12 Oct 2023 13:32:41 +0000 (15:32 +0200)] 
LibF7: Implement atan2.

libgcc/config/avr/libf7/
* libf7.c (F7MOD_atan2_, f7_atan2): New module and function.
* libf7.h: Adjust comments.
* libf7-common.mk (CALL_PROLOGUES): Add atan2.

21 months agoDaily bump.
GCC Administrator [Thu, 12 Oct 2023 00:20:56 +0000 (00:20 +0000)] 
Daily bump.

21 months agoEnsure float equivalences include + and - zero.
Andrew MacLeod [Mon, 9 Oct 2023 17:40:15 +0000 (13:40 -0400)] 
Ensure float equivalences include + and - zero.

A floating point equivalence may not properly reflect both signs of
zero, so be pessimsitic and ensure both signs are included.

PR tree-optimization/111694
gcc/
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Adjust
equivalence range.
* value-relation.cc (adjust_equivalence_range): New.
* value-relation.h (adjust_equivalence_range): New prototype.

gcc/testsuite/
* gcc.dg/pr111694.c: New.

21 months agotree-ssa-strlen: optimization skips clobbering store [PR111519]
Jakub Jelinek [Wed, 11 Oct 2023 06:58:29 +0000 (08:58 +0200)] 
tree-ssa-strlen: optimization skips clobbering store [PR111519]

The following testcase is miscompiled, because count_nonzero_bytes incorrectly
uses get_strinfo information on a pointer from which an earlier instruction
loads SSA_NAME stored at the current instruction.  get_strinfo shows a state
right before the current store though, so if there are some stores in between
the current store and the load, the string length information might have
changed.

The patch passes around gimple_vuse from the store and punts instead of using
strinfo on loads from MEM_REF which have different gimple_vuse from that.

2023-10-11  Richard Biener  <rguenther@suse.de>
    Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/111519
* tree-ssa-strlen.cc (strlen_pass::count_nonzero_bytes): Add vuse
argument and pass it through to recursive calls and
count_nonzero_bytes_addr calls.  Don't shadow the stmt argument, but
change stmt for gimple_assign_single_p statements for which we don't
immediately punt.
(strlen_pass::count_nonzero_bytes_addr): Add vuse argument and pass
it through to recursive calls and count_nonzero_bytes calls.  Don't
use get_strinfo if gimple_vuse (stmt) is different from vuse.  Don't
shadow the stmt argument.

* gcc.dg/torture/pr111519.c: New testcase.

(cherry picked from commit e75bf1985fdc9a5d3a307882a9251d8fd6e93def)

21 months agoDaily bump.
GCC Administrator [Wed, 11 Oct 2023 00:20:42 +0000 (00:20 +0000)] 
Daily bump.

22 months agoada: Fix infinite loop with multiple limited with clauses
Eric Botcazou [Tue, 26 Sep 2023 20:54:12 +0000 (22:54 +0200)] 
ada: Fix infinite loop with multiple limited with clauses

This occurs when one of the types has an incomplete declaration in addition
to its full declaration in its package. In this case AI05-129 says that the
incomplete type is not part of the limited view of the package, i.e. only
the full view is. Now, in the GNAT implementation, it's the opposite in the
regular view of the package, i.e. the incomplete type is the visible one.

That's why the implementation needs to also swap the types on the visibility
chain while it is swapping the views when the clauses are either installed
or removed. This works correctly for the installation, but does not for the
removal, so this change rewrites the code doing the latter.

gcc/ada/
PR ada/111434
* sem_ch10.adb (Replace): New procedure to replace an entity with
another on the homonym chain.
(Install_Limited_With_Clause): Rename Non_Lim_View to Typ for the
sake of consistency.  Call Replace to do the replacements and split
the code into the regular and the special cases.  Add debuggging
output controlled by -gnatdi.
(Install_With_Clause): Print the Parent_With and Implicit_With flags
in the debugging output controlled by -gnatdi.
(Remove_Limited_With_Unit.Restore_Chain_For_Shadow (Shadow)): Rewrite
using a direct replacement of E4 by E2.   Call Replace to do the
replacements.  Add debuggging output controlled by -gnatdi.

22 months agoDaily bump.
GCC Administrator [Tue, 10 Oct 2023 00:23:29 +0000 (00:23 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Mon, 9 Oct 2023 00:20:38 +0000 (00:20 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Sun, 8 Oct 2023 00:20:53 +0000 (00:20 +0000)] 
Daily bump.

22 months agoMATCH: Fix infinite loop between `vec_cond(vec_cond(a,b,0), c, d)` and `a & b`
Andrew Pinski [Thu, 5 Oct 2023 19:21:19 +0000 (12:21 -0700)] 
MATCH: Fix infinite loop between `vec_cond(vec_cond(a,b,0), c, d)` and `a & b`

Match has a pattern which converts `vec_cond(vec_cond(a,b,0), c, d)`
into `vec_cond(a & b, c, d)` but since in this case a is a comparison
fold will change `a & b` back into `vec_cond(a,b,0)` which causes an
infinite loop.
The best way to fix this is to enable the patterns for vec_cond(*,vec_cond,*)
only for GIMPLE so we don't get an infinite loop for fold any more.

Note this is a latent bug since these patterns were added in r11-2577-g229752afe3156a
and was exposed by r14-3350-g47b833a9abe1 where now able to remove a VIEW_CONVERT_EXPR.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR middle-end/111699

gcc/ChangeLog:

* match.pd ((c ? a : b) op d, (c ? a : b) op (c ? d : e),
(v ? w : 0) ? a : b, c1 ? c2 ? a : b : b): Enable only for GIMPLE.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr111699-1.c: New test.

(cherry picked from commit e77428a9a336f57e3efe3eff95f2b491d7e9be14)

22 months agoDaily bump.
GCC Administrator [Sat, 7 Oct 2023 00:20:44 +0000 (00:20 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Fri, 6 Oct 2023 00:20:32 +0000 (00:20 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Thu, 5 Oct 2023 00:21:56 +0000 (00:21 +0000)] 
Daily bump.

22 months agoFortran: Alloc comp of non-finalizable type not finalized [PR111674]
Paul Thomas [Wed, 4 Oct 2023 07:26:35 +0000 (08:26 +0100)] 
Fortran: Alloc comp of non-finalizable type not finalized [PR111674]

2023-10-04  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/37336
PR fortran/111674
* trans-expr.cc (gfc_trans_scalar_assign): Finalize components
on deallocation if derived type is not finalizable.

gcc/testsuite/
PR fortran/37336
PR fortran/111674
* gfortran.dg/allocate_with_source_25.f90: Final count in tree
dump reverts from 4 to original 6.
* gfortran.dg/finalize_38.f90: Add test for fix of PR111674.

(cherry picked from commit 84284e1c490e9235fca5cb85269ecfcb87eef4f1)

22 months agoDaily bump.
GCC Administrator [Wed, 4 Oct 2023 00:21:27 +0000 (00:21 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Tue, 3 Oct 2023 00:20:16 +0000 (00:20 +0000)] 
Daily bump.

22 months agolibstdc++: Force _Hash_node_value_base methods inline to fix abi (PR111050)
Tim Song [Wed, 6 Sep 2023 17:31:55 +0000 (19:31 +0200)] 
libstdc++: Force _Hash_node_value_base methods inline to fix abi (PR111050)

https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1b6f0476837205932613ddb2b3429a55c26c409d
changed _Hash_node_value_base to no longer derive from _Hash_node_base, which means
that its member functions expect _M_storage to be at a different offset. So explosions
result if an out-of-line definition is emitted for any of the member functions (say,
in a non-optimized build) and the resulting object file is then linked with code built
using older version of GCC/libstdc++.

libstdc++-v3/ChangeLog:

PR libstdc++/111050
* include/bits/hashtable_policy.h
(_Hash_node_value_base<>::_M_valptr(), _Hash_node_value_base<>::_M_v())
Add [[__gnu__::__always_inline__]].

(cherry picked from commit 2c1e3544a94c5d7354fad031e1f9731c3ce3af25)

22 months agoDisable generation of scalar modulo instructions.
Pat Haugen [Tue, 19 Sep 2023 18:19:59 +0000 (13:19 -0500)] 
Disable generation of scalar modulo instructions.

It was recently discovered that the scalar modulo instructions can suffer
noticeable performance issues for certain input values. This patch disables
their generation since the equivalent div/mul/sub sequence does not suffer
the same problem.

gcc/
* config/rs6000/rs6000.cc (rs6000_rtx_costs): Check whether the
modulo instruction is disabled.
* config/rs6000/rs6000.h (RS6000_DISABLE_SCALAR_MODULO): New.
* config/rs6000/rs6000.md (mod<mode>3, *mod<mode>3): Check it.
(define_expand umod<mode>3): New.
(define_insn umod<mode>3): Rename to *umod<mode>3 and check if the modulo
instruction is disabled.
(umodti3, modti3): Check if the modulo instruction is disabled.

gcc/testsuite/
* gcc.target/powerpc/clone1.c: Add xfails.
* gcc.target/powerpc/clone3.c: Likewise.
* gcc.target/powerpc/mod-1.c: Update scan strings and add xfails.
* gcc.target/powerpc/mod-2.c: Likewise.
* gcc.target/powerpc/p10-vdivq-vmodq.c: Add xfails.

(cherry picked from commit 58ab38213b979811d314f68e3f455c28a1d44140)

22 months agoDaily bump.
GCC Administrator [Mon, 2 Oct 2023 00:20:40 +0000 (00:20 +0000)] 
Daily bump.

22 months agoFix PR 111331: wrong code for `a > 28 ? MIN<a, 28> : 29`
Andrew Pinski [Fri, 8 Sep 2023 05:13:31 +0000 (22:13 -0700)] 
Fix PR 111331: wrong code for `a > 28 ? MIN<a, 28> : 29`

The problem here is after r6-7425-ga9fee7cdc3c62d0e51730,
the comparison to see if the transformation could be done was using the
wrong value. Instead of see if the inner was LE (for MIN and GE for MAX)
the outer value, it was comparing the inner to the value used in the comparison
which was wrong.

Committed to GCC 13 branch after bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

PR tree-optimization/111331
* tree-ssa-phiopt.cc (minmax_replacement):
Fix the LE/GE comparison for the
`(a CMP CST1) ? max<a,CST2> : a` optimization.

gcc/testsuite/ChangeLog:

PR tree-optimization/111331
* gcc.c-torture/execute/pr111331-1.c: New test.
* gcc.c-torture/execute/pr111331-2.c: New test.
* gcc.c-torture/execute/pr111331-3.c: New test.

(cherry picked from commit 30e6ee074588bacefd2dfe745b188bb20c81fe5e)

22 months agoFix PR 110386: backprop vs ABSU_EXPR
Andrew Pinski [Sun, 24 Sep 2023 04:53:09 +0000 (21:53 -0700)] 
Fix PR 110386: backprop vs ABSU_EXPR

The issue here is that when backprop tries to go
and strip sign ops, it skips over ABSU_EXPR but
ABSU_EXPR not only does an ABS, it also changes the
type to unsigned.
Since strip_sign_op_1 is only supposed to strip off
sign changing operands and not ones that change types,
removing ABSU_EXPR here is correct. We don't handle
nop conversions so this does cause any missed optimizations either.

Committed to the GCC 13 branch after bootstrapped and
tested on x86_64-linux-gnu with no regressions.

PR tree-optimization/110386

gcc/ChangeLog:

* gimple-ssa-backprop.cc (strip_sign_op_1): Remove ABSU_EXPR.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr110386-1.c: New test.
* gcc.c-torture/compile/pr110386-2.c: New test.

(cherry picked from commit 2bbac12ea7bd8a3eef5382e1b13f6019df4ec03f)

22 months agoDaily bump.
GCC Administrator [Sun, 1 Oct 2023 00:21:58 +0000 (00:21 +0000)] 
Daily bump.

22 months agoFixup d9b3269bdc.
Andre Vehreschild [Sat, 30 Sep 2023 13:10:38 +0000 (15:10 +0200)] 
Fixup d9b3269bdc.

Adapt to different parameter count in comparison to gcc-14.

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_trans_deferred_array): Use correct
position for statements to add to guarded block.

22 months agoDaily bump.
GCC Administrator [Sat, 30 Sep 2023 00:20:59 +0000 (00:20 +0000)] 
Daily bump.

22 months agoFortran: Free alloc. comp. in allocated coarrays only.
Andre Vehreschild [Thu, 28 Sep 2023 07:30:12 +0000 (09:30 +0200)] 
Fortran: Free alloc. comp. in allocated coarrays only.

When freeing allocatable components of an allocatable coarray, add
a check that the coarray is still allocated, before accessing the
components.

This patch adds to PR fortran/37336, but does not fix it completely.

gcc/fortran/ChangeLog:
PR fortran/37336
* trans-array.cc (structure_alloc_comps): Deref coarray.
(gfc_trans_deferred_array): Add freeing of components after
check for allocated coarray.

gcc/testsuite/ChangeLog:
PR fortran/37336
* gfortran.dg/coarray/alloc_comp_6.f90: New test.
* gfortran.dg/coarray/alloc_comp_7.f90: New test.

(cherry picked from commit 9a63a62dfd73e159f1956e9b04b555c445de4e78)

22 months agoAArch64: List official cores before codenames
Wilco Dijkstra [Wed, 13 Sep 2023 12:16:14 +0000 (13:16 +0100)] 
AArch64: List official cores before codenames

List official cores first so that -mcpu=native does not show a codename with
-v or in errors/warnings.

gcc/ChangeLog:
* config/aarch64/aarch64-cores.def (neoverse-n1): Place before ares.
(neoverse-v1): Place before zeus.
(neoverse-v2): Place before demeter.
* config/aarch64/aarch64-tune.md: Regenerate.

(cherry picked from commit 64d5bc35c8c2a66ac133a3e6ace820b0ad8a63fb)

22 months agoAArch64: Fix memmove operand corruption [PR111121]
Wilco Dijkstra [Tue, 26 Sep 2023 15:42:45 +0000 (16:42 +0100)] 
AArch64: Fix memmove operand corruption [PR111121]

A MOPS memmove may corrupt registers since there is no copy of the input
operands to temporary registers.  Fix this by calling
aarch64_expand_cpymem_mops.

Reviewed-by: Richard Sandiford <richard.sandiford@arm.com>
gcc/ChangeLog/
PR target/111121
* config/aarch64/aarch64.md (aarch64_movmemdi): Add new expander.
(movmemdi): Call aarch64_expand_cpymem_mops for correct expansion.
* config/aarch64/aarch64.cc (aarch64_expand_cpymem_mops): Add support
for memmove.
* config/aarch64/aarch64-protos.h (aarch64_expand_cpymem_mops): Add new
function.

gcc/testsuite/ChangeLog/
PR target/111121
* gcc.target/aarch64/mops_4.c: Add memmove testcases.

(cherry picked from commit d8b56c95782aeeee79ec40932ca88d00fd9f2ee2)

22 months agoDaily bump.
GCC Administrator [Fri, 29 Sep 2023 00:21:32 +0000 (00:21 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Thu, 28 Sep 2023 09:54:02 +0000 (09:54 +0000)] 
Daily bump.

22 months agolibstdc++: Add test for illegal pointer arithmetic in format [PR111102]
Paul Dreik [Thu, 24 Aug 2023 10:43:43 +0000 (11:43 +0100)] 
libstdc++: Add test for illegal pointer arithmetic in format [PR111102]

libstdc++-v3/ChangeLog:

PR libstdc++/111102
* testsuite/std/format/string.cc: Check wide character format
strings with out-of-range widths.

(cherry picked from commit 7564fe98657ad5ede34bd08f5279778fa8698865)

22 months agolibstdc++: [_GLIBCXX_INLINE_VERSION] Fix <format> friend declaration
François Dumont [Wed, 23 Aug 2023 17:15:43 +0000 (19:15 +0200)] 
libstdc++: [_GLIBCXX_INLINE_VERSION] Fix <format> friend declaration

GCC do not consider the inline namespace in friend function declarations.
This is PR c++/59526, we need to explicit this namespace.

libstdc++-v3/ChangeLog:

* include/std/format (std::__format::_Arg_store): Explicit version
namespace on make_format_args friend declaration.

(cherry picked from commit 92456291849fe88303bbcab366f41dcd4a885ad5)

22 months agolibstdc++: fix illegal pointer arithmetic in format [PR111102]
Paul Dreik [Thu, 24 Aug 2023 10:43:43 +0000 (11:43 +0100)] 
libstdc++: fix illegal pointer arithmetic in format [PR111102]

When parsing a format string, the width is parsed into an unsigned short
but the result is not checked in the case the format string is not a
char string (such as a wide string). In case the parse fails, a null
pointer is returned which is used for pointer arithmetic which is
undefined behaviour.

Signed-off-by: Paul Dreik <gccpatches@pauldreik.se>
libstdc++-v3/ChangeLog:

PR libstdc++/111102
* include/std/format (__format::__parse_integer): Check for
non-null pointer.

(cherry picked from commit dd4bdb9eea436bf06f175d8dbfc2190377455be4)