]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
20 months agolibstdc++: Reformat Python code
Jonathan Wakely [Thu, 28 Sep 2023 13:54:59 +0000 (14:54 +0100)] 
libstdc++: Reformat Python code

Some of these changes were suggested by autopep8's --aggressive
option, others are for readability.

Break long lines by splitting strings across multiple lines, or
introducing local variables to hold results.

Use raw strings for regular expressions, so that backslashes don't need
to be escaped.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py: Break long lines. Use raw
strings for regular expressions. Add whitespace around
operators.
(is_member_of_namespace): Use isinstance to check type.
(is_specialization_of): Likewise. Adjust template_name
for versioned namespace instead of duplicating the re.match
call.
(StdExpAnyPrinter._string_types): New static method.
(StdExpAnyPrinter.to_string): Use _string_types.

(cherry picked from commit 6b5c3f9b8139d9eee358b354b35da0b757a0270d)

20 months agolibstdc++: Format Python docstrings according to PEP 357
Jonathan Wakely [Thu, 28 Sep 2023 10:06:02 +0000 (11:06 +0100)] 
libstdc++: Format Python docstrings according to PEP 357

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py: Format docstrings according
to PEP 257.
* python/libstdcxx/v6/xmethods.py: Likewise.

(cherry picked from commit 0ef4cc8225f8669463bca501f36b6951967a692a)

20 months agolibstdc++: Format Python code according to PEP8
Jonathan Wakely [Mon, 11 Sep 2023 20:47:00 +0000 (21:47 +0100)] 
libstdc++: Format Python code according to PEP8

These files were filtered through autopep8 to reformat them more
conventionally.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py: Reformat.
* python/libstdcxx/v6/xmethods.py: Likewise.

(cherry picked from commit e08559271b2d797f658579ac8610dbf5e58bcfd8)

21 months agoFix wrong code due to vec_merge + pcmp to blendvb splitter.
liuhongt [Thu, 9 Nov 2023 05:20:05 +0000 (13:20 +0800)] 
Fix wrong code due to vec_merge + pcmp to blendvb splitter.

gcc/ChangeLog:

PR target/112443
* config/i386/sse.md (*avx2_pcmp<mode>3_4): Fix swap condition
from LT to GT since there's not in the pattern.
(*avx2_pcmp<mode>3_5): Ditto.

gcc/testsuite/ChangeLog:

* g++.target/i386/pr112443.C: New test.

(cherry picked from commit 9a0cc04b9c9b02426762892b88efc5c44ba546bd)

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

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

21 months agoDaily bump.
GCC Administrator [Wed, 8 Nov 2023 00:19:32 +0000 (00:19 +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.

(cherry picked from commit 0b25c1295d4e84af681f4b1f4af2ad37cd270da3)

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

21 months agolibstdc++: use -D_GNU_SOURCE when building libbacktrace
Ian Lance Taylor [Mon, 6 Nov 2023 23:12:41 +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:22:16 +0000 (00:22 +0000)] 
Daily bump.

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

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

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

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

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

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

21 months agoDaily bump.
GCC Administrator [Mon, 30 Oct 2023 00:19:44 +0000 (00:19 +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:19:47 +0000 (00:19 +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:19:06 +0000 (00:19 +0000)] 
Daily bump.

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

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 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 [Thu, 26 Oct 2023 00:20:11 +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 agoDaily bump.
GCC Administrator [Wed, 25 Oct 2023 00:23:17 +0000 (00:23 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Tue, 24 Oct 2023 00:24:43 +0000 (00:24 +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:19:50 +0000 (00:19 +0000)] 
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sun, 22 Oct 2023 00:19:21 +0000 (00:19 +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 agoDaily bump.
GCC Administrator [Sat, 21 Oct 2023 00:19:48 +0000 (00:19 +0000)] 
Daily bump.

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:19:10 +0000 (00:19 +0000)] 
Daily bump.

21 months agolra: Avoid unfolded plus-0
Richard Sandiford [Thu, 19 Oct 2023 09:49:19 +0000 (10:49 +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 agoDaily bump.
GCC Administrator [Thu, 19 Oct 2023 00:20:16 +0000 (00:20 +0000)] 
Daily bump.

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

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

21 months agors6000: Use default target option node for callee by default [PR111380]
Kewen Lin [Mon, 16 Oct 2023 02:08:29 +0000 (21:08 -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:08:26 +0000 (21:08 -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:19:30 +0000 (00:19 +0000)] 
Daily bump.

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

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

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

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

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

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

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

22 months agoDaily bump.
GCC Administrator [Sun, 8 Oct 2023 00:20:12 +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:19:33 +0000 (00:19 +0000)] 
Daily bump.

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

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

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

22 months agolibstdc++: Fix linker errors for directory iterator comparisons
Jonathan Wakely [Tue, 3 Oct 2023 16:41:14 +0000 (17:41 +0100)] 
libstdc++: Fix linker errors for directory iterator comparisons

These new comparison operators for std::default_sentinel_t require some
new symbol exports, which were added with r13-5662-gdb8d6fc572ec31 for
trunk, but that isn't suitable for the gcc-12 branch.

Define them as specified in the standard instead, which doesn't require
any new symbols.

libstdc++-v3/ChangeLog:

* include/bits/fs_dir.h (directory_iterator::operator==):
Define without using a non-exported shared_ptr symbol.
(recursive_directory_iterator::operator==): Likewise.

22 months agolibstdc++: Use dg-require-filesystem-ts in link test
Jonathan Wakely [Thu, 31 Aug 2023 17:35:12 +0000 (18:35 +0100)] 
libstdc++: Use dg-require-filesystem-ts in link test

This test expects to be able to link, which fails if there are undefined
references to chdir, mkdir etc. in fs_ops.o in the libstdc++.a archive.

libstdc++-v3/ChangeLog:

* testsuite/27_io/filesystem/path/108636.cc: Add dg-require for
filesystem support.

(cherry picked from commit c07d82c12f2f17427a89188abad69af195590309)

22 months agolibstdc++: Make std::filesystem::copy_file work for procfs [PR108178]
Jonathan Wakely [Tue, 21 Mar 2023 12:29:08 +0000 (12:29 +0000)] 
libstdc++: Make std::filesystem::copy_file work for procfs [PR108178]

The size reported by stat is always zero for some special files such as
those under /proc, which means the current copy_file implementation
thinks there is nothing to copy. Instead of trusting the stat value, try
to read a character from a streambuf and check for EOF.

For the backport, we also need to avoid trying to use sendfile when stat
reports a zero size, so that we use streambufs to copy the file.

libstdc++-v3/ChangeLog:

PR libstdc++/108178
* src/filesystem/ops-common.h (do_copy_file): Check for empty
files by trying to read a character.
* testsuite/27_io/filesystem/operations/copy_file_108178.cc:
New test.

(cherry picked from commit 07a0e108247f23fcb919c61595adae143f1ea02a)

22 months agolibstdc++: Use close-on-exec for file descriptors in filesystem::copy_file
Jonathan Wakely [Mon, 5 Jun 2023 16:45:37 +0000 (17:45 +0100)] 
libstdc++: Use close-on-exec for file descriptors in filesystem::copy_file

libstdc++-v3/ChangeLog:

* src/filesystem/ops-common.h (do_copy_file) [O_CLOEXEC]: Set
close-on-exec flag on file descriptors.

(cherry picked from commit 7e8e071c4b64f1b6ea5ddf528724fc793a0f0e36)

22 months agolibstdc++: Fix formatting in std::filesystem helper function
Jonathan Wakely [Mon, 20 Mar 2023 13:40:59 +0000 (13:40 +0000)] 
libstdc++: Fix formatting in std::filesystem helper function

libstdc++-v3/ChangeLog:

* src/filesystem/ops-common.h (get_temp_directory_from_env): Fix
formatting.

(cherry picked from commit ccfca55536f87a1332f844efcc66b8383030d149)

22 months agolibstdc++: Use ENOSYS for unsupported filesystem ops on AVR
Jonathan Wakely [Thu, 2 Feb 2023 16:00:21 +0000 (16:00 +0000)] 
libstdc++: Use ENOSYS for unsupported filesystem ops on AVR

Because avr-libc <errno.h> defines most error numbers with duplicate
values it's not sufficient to check #ifdef ENOTSUP when deciding which
std::errc constant to use for the filesystem library's __unsupported()
helper. Add a special case for AVR to always use the ENOSYS value.

libstdc++-v3/ChangeLog:

* src/filesystem/ops-common.h [AVR] (__unsupported): Always use
errc::function_not_supported instead of errc::not_supported.

(cherry picked from commit 5c43f06c228d169c370e99fa009154344fa305b8)

22 months agoDaily bump.
GCC Administrator [Tue, 3 Oct 2023 00:19:15 +0000 (00:19 +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:19:31 +0000 (00:19 +0000)] 
Daily bump.

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

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

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:19:48 +0000 (00:19 +0000)] 
Daily bump.

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

22 months agolibstdc++: Fix constexpr functions to conform to older standards
Jonathan Wakely [Wed, 9 Aug 2023 10:11:31 +0000 (11:11 +0100)] 
libstdc++: Fix constexpr functions to conform to older standards

Some constexpr functions were inadvertently relying on relaxed constexpr
rules from later standards.

libstdc++-v3/ChangeLog:

* include/experimental/bits/fs_path.h (path::string): Use
_GLIBCXX17_CONSTEXPR not _GLIBCXX_CONSTEXPR for 'if constexpr'.
* include/std/charconv (__to_chars_8): Initialize variable for
C++17 constexpr rules.

(cherry picked from commit b3a2b307b9deea719fb725a86df43b82176fe459)

22 months agolibstdc++: Prevent unwanted ADL in std::to_array [PR111512]
Jonathan Wakely [Thu, 21 Sep 2023 08:14:57 +0000 (09:14 +0100)] 
libstdc++: Prevent unwanted ADL in std::to_array [PR111512]

Qualify the calls to the __to_array helper to prevent ADL, so we don't
try to complete associated classes.

libstdc++-v3/ChangeLog:

PR libstdc++/111511
PR c++/111512
* include/std/array (to_array): Qualify calls to __to_array.
* testsuite/23_containers/array/creation/111512.cc: New test.

(cherry picked from commit 77cf3773021b0a20d89623e09d620747a05588ec)

22 months agoAdd missing return in gori_compute::logical_combine
Eric Botcazou [Mon, 25 Sep 2023 18:48:53 +0000 (20:48 +0200)] 
Add missing return in gori_compute::logical_combine

The varying case currently falls through to the 1/true case.

gcc/
* gimple-range-gori.cc (gori_compute::logical_combine): Add missing
return statement in the varying case.

gcc/testsuite/
* gnat.dg/opt102.adb:New test.
* gnat.dg/opt102_pkg.adb, gnat.dg/opt102_pkg.ads: New helper.

22 months agoDaily bump.
GCC Administrator [Tue, 26 Sep 2023 00:20:24 +0000 (00:20 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Mon, 25 Sep 2023 00:19:48 +0000 (00:19 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Sun, 24 Sep 2023 00:19:45 +0000 (00:19 +0000)] 
Daily bump.

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

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

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

22 months agoaarch64: Fix loose ldpstp check [PR111411]
Richard Sandiford [Wed, 20 Sep 2023 10:13:20 +0000 (11:13 +0100)] 
aarch64: Fix loose ldpstp check [PR111411]

aarch64_operands_ok_for_ldpstp contained the code:

  /* One of the memory accesses must be a mempair operand.
     If it is not the first one, they need to be swapped by the
     peephole.  */
  if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1))
       && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2)))
    return false;

But the requirement isn't just that one of the accesses must be a
valid mempair operand.  It's that the lower access must be, since
that's the access that will be used for the instruction operand.

gcc/
PR target/111411
* config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp): Require
the lower memory access to a mem-pair operand.

gcc/testsuite/
PR target/111411
* gcc.dg/rtl/aarch64/pr111411.c: New test.

(cherry picked from commit 2d38f45bcca62ca0c7afef4b579f82c5c2a01610)

22 months agoaarch64: Fix return register handling in untyped_call
Richard Sandiford [Wed, 20 Sep 2023 10:13:19 +0000 (11:13 +0100)] 
aarch64: Fix return register handling in untyped_call

While working on another patch, I hit a problem with the aarch64
expansion of untyped_call.  The expander emits the usual:

  (set (mem ...) (reg resN))

instructions to store the result registers to memory, but it didn't
say in RTL where those resN results came from.  This eventually led
to a failure of gcc.dg/torture/stackalign/builtin-return-2.c,
via regrename.

This patch turns the untyped call from a plain call to a call_value,
to represent that the call returns (or might return) a useful value.
The patch also uses a PARALLEL return rtx to represent all the possible
return registers.

gcc/
* config/aarch64/aarch64.md (untyped_call): Emit a call_value
rather than a call.  List each possible destination register
in the call pattern.

(cherry picked from commit 629efe27744d13c3b83bbe8338b84c37c83dbe4f)

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

22 months agoDaily bump.
GCC Administrator [Tue, 19 Sep 2023 00:19:43 +0000 (00:19 +0000)] 
Daily bump.

22 months agolibstdc++: Update C++20 status docs
Jonathan Wakely [Mon, 18 Sep 2023 14:30:05 +0000 (15:30 +0100)] 
libstdc++: Update C++20 status docs

libstdc++-v3/ChangeLog:

* doc/xml/manual/configure.xml: Use conventional option name.
* doc/xml/manual/status_cxx2020.xml: Update.
* doc/html/*: Regenerate.

(cherry picked from commit c8e9a75085f9725c5b5f32a27867c106fed3b5fb)

22 months agoDaily bump.
GCC Administrator [Mon, 18 Sep 2023 00:19:26 +0000 (00:19 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Sun, 17 Sep 2023 00:20:43 +0000 (00:20 +0000)] 
Daily bump.

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

22 months agoDaily bump.
GCC Administrator [Fri, 15 Sep 2023 00:20:19 +0000 (00:20 +0000)] 
Daily bump.

22 months agolibstdc++: Add workaround for std::make_integer_sequence bug [PR111357]
Jonathan Wakely [Thu, 14 Sep 2023 08:18:34 +0000 (09:18 +0100)] 
libstdc++: Add workaround for std::make_integer_sequence bug [PR111357]

The compiler bug has been fixed on trunk, but we need this workaround on
the branches.

libstdc++-v3/ChangeLog:

PR c++/111357
* include/bits/utility.h (make_integer_sequence): Add cast.
* testsuite/20_util/integer_sequence/pr111357.cc: New test.

(cherry picked from commit 7b0abd4a8ee9d2057febe443de67009dcdfe7574)

22 months agoDaily bump.
GCC Administrator [Thu, 14 Sep 2023 00:24:04 +0000 (00:24 +0000)] 
Daily bump.

22 months agoDaily bump.
GCC Administrator [Wed, 13 Sep 2023 00:24:38 +0000 (00:24 +0000)] 
Daily bump.

22 months agoi386: Handle CONST_WIDE_INT in output_pic_addr_const [PR111340]
Uros Bizjak [Mon, 11 Sep 2023 18:56:42 +0000 (20:56 +0200)] 
i386: Handle CONST_WIDE_INT in output_pic_addr_const [PR111340]

PR target/111340

gcc/ChangeLog:

* config/i386/i386.cc (output_pic_addr_const): Handle CONST_WIDE_INT.
Call output_addr_const for CASE_CONST_SCALAR_INT.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr111340.c: New test.

22 months agoaarch64: Make stack smash canary protect saved registers
Richard Sandiford [Tue, 12 Sep 2023 15:08:57 +0000 (16:08 +0100)] 
aarch64: Make stack smash canary protect saved registers

AArch64 normally puts the saved registers near the bottom of the frame,
immediately above any dynamic allocations.  But this means that a
stack-smash attack on those dynamic allocations could overwrite the
saved registers without needing to reach as far as the stack smash
canary.

The same thing could also happen for variable-sized arguments that are
passed by value, since those are allocated before a call and popped on
return.

This patch avoids that by putting the locals (and thus the canary) below
the saved registers when stack smash protection is active.

The patch fixes CVE-2023-4039.

gcc/
* config/aarch64/aarch64.cc (aarch64_save_regs_above_locals_p):
New function.
(aarch64_layout_frame): Use it to decide whether locals should
go above or below the saved registers.
(aarch64_expand_prologue): Update stack layout comment.
Emit a stack tie after the final adjustment.

gcc/testsuite/
* gcc.target/aarch64/stack-protector-8.c: New test.
* gcc.target/aarch64/stack-protector-9.c: Likewise.

22 months agoaarch64: Remove below_hard_fp_saved_regs_size
Richard Sandiford [Tue, 12 Sep 2023 15:08:56 +0000 (16:08 +0100)] 
aarch64: Remove below_hard_fp_saved_regs_size

After previous patches, it's no longer necessary to store
saved_regs_size and below_hard_fp_saved_regs_size in the frame info.
All measurements instead use the top or bottom of the frame as
reference points.

gcc/
* config/aarch64/aarch64.h (aarch64_frame::saved_regs_size)
(aarch64_frame::below_hard_fp_saved_regs_size): Delete.
* config/aarch64/aarch64.cc (aarch64_layout_frame): Update accordingly.

22 months agoaarch64: Explicitly record probe registers in frame info
Richard Sandiford [Tue, 12 Sep 2023 15:08:56 +0000 (16:08 +0100)] 
aarch64: Explicitly record probe registers in frame info

The stack frame is currently divided into three areas:

A: the area above the hard frame pointer
B: the SVE saves below the hard frame pointer
C: the outgoing arguments

If the stack frame is allocated in one chunk, the allocation needs a
probe if the frame size is >= guard_size - 1KiB.  In addition, if the
function is not a leaf function, it must probe an address no more than
1KiB above the outgoing SP.  We ensured the second condition by

(1) using single-chunk allocations for non-leaf functions only if
    the link register save slot is within 512 bytes of the bottom
    of the frame; and

(2) using the link register save as a probe (meaning, for instance,
    that it can't be individually shrink wrapped)

If instead the stack is allocated in multiple chunks, then:

* an allocation involving only the outgoing arguments (C above) requires
  a probe if the allocation size is > 1KiB

* any other allocation requires a probe if the allocation size
  is >= guard_size - 1KiB

* second and subsequent allocations require the previous allocation
  to probe at the bottom of the allocated area, regardless of the size
  of that previous allocation

The final point means that, unlike for single allocations,
it can be necessary to have both a non-SVE register probe and
an SVE register probe.  For example:

* allocate A, probe using a non-SVE register save
* allocate B, probe using an SVE register save
* allocate C

The non-SVE register used in this case was again the link register.
It was previously used even if the link register save slot was some
bytes above the bottom of the non-SVE register saves, but an earlier
patch avoided that by putting the link register save slot first.

As a belt-and-braces fix, this patch explicitly records which
probe registers we're using and allows the non-SVE probe to be
whichever register comes first (as for SVE).

The patch also avoids unnecessary probes in sve/pcs/stack_clash_3.c.

gcc/
* config/aarch64/aarch64.h (aarch64_frame::sve_save_and_probe)
(aarch64_frame::hard_fp_save_and_probe): New fields.
* config/aarch64/aarch64.cc (aarch64_layout_frame): Initialize them.
Rather than asserting that a leaf function saves LR, instead assert
that a leaf function saves something.
(aarch64_get_separate_components): Prevent the chosen probe
registers from being individually shrink-wrapped.
(aarch64_allocate_and_probe_stack_space): Remove workaround for
probe registers that aren't at the bottom of the previous allocation.

gcc/testsuite/
* gcc.target/aarch64/sve/pcs/stack_clash_3.c: Avoid redundant probes.