]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
2 years agoDaily bump.
GCC Administrator [Wed, 28 Dec 2022 00:20:23 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Tue, 27 Dec 2022 00:20:21 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Mon, 26 Dec 2022 00:20:39 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 25 Dec 2022 00:20:15 +0000 (00:20 +0000)] 
Daily bump.

2 years agoSkip guality tests on hppa-hpux.
John David Anglin [Sun, 13 Nov 2022 17:04:44 +0000 (17:04 +0000)] 
Skip guality tests on hppa-hpux.

The guality check command hangs. This causes TCL errors in
other tests and slows testsuite execution.

2022-11-13  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

* g++.dg/guality/guality.exp: Skip on hppa*-*-hpux*.
* gcc.dg/guality/guality.exp: Likewise.
* gfortran.dg/guality/guality.exp: Likewise.

2 years agoDaily bump.
GCC Administrator [Sat, 24 Dec 2022 00:20:55 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 23 Dec 2022 00:23:19 +0000 (00:23 +0000)] 
Daily bump.

2 years agobootstrap/106482 - document minimal GCC version
Richard Biener [Thu, 22 Dec 2022 14:51:46 +0000 (15:51 +0100)] 
bootstrap/106482 - document minimal GCC version

There's no explicit mention of what GCC compiler supports C++11
and the cross compiler build requirement mentions GCC 4.8 but not
GCC 4.8.3 which is the earliest known version to not run into
C++11 implementation bugs.  The following adds explicit wording.

PR bootstrap/106482
* doc/install.texi (ISO C++11 Compiler): Document GCC version
known to work.

(cherry picked from commit b97c33fbd28e74a206c81c96a9b0b9fa3c8545d6)

2 years agolto: support --jobserver-style=fifo for recent GNU make
Martin Liska [Tue, 9 Aug 2022 11:59:36 +0000 (13:59 +0200)] 
lto: support --jobserver-style=fifo for recent GNU make

gcc/ChangeLog:

* opts-jobserver.h: Add one member.
* opts-common.cc (jobserver_info::jobserver_info): Parse FIFO
format of --jobserver-auth.

(cherry picked from commit 53e3b2bf16a486c15c20991c6095f7be09012b55)

2 years agoFactor out jobserver_active_p.
Martin Liska [Tue, 9 Aug 2022 11:59:32 +0000 (13:59 +0200)] 
Factor out jobserver_active_p.

gcc/ChangeLog:

* gcc.cc (driver::detect_jobserver): Remove and move to
jobserver.h.
* lto-wrapper.cc (jobserver_active_p): Likewise.
(run_gcc): Likewise.
* opts-jobserver.h: New file.
* opts-common.cc (jobserver_info::jobserver_info): New function.

(cherry picked from commit 1270ccda70ca09f7d4fe76b5156dca8992bd77a6)

2 years agoDaily bump.
GCC Administrator [Thu, 22 Dec 2022 00:20:54 +0000 (00:20 +0000)] 
Daily bump.

2 years agolibstdc++: Fix unsafe use of dirent::d_name [PR107814]
Jonathan Wakely [Tue, 22 Nov 2022 19:15:53 +0000 (19:15 +0000)] 
libstdc++: Fix unsafe use of dirent::d_name [PR107814]

Copy the fix for PR 104731 to the equivalent experimental::filesystem
test.

libstdc++-v3/ChangeLog:

PR libstdc++/107814
* testsuite/experimental/filesystem/iterators/error_reporting.cc:
Use a static buffer with space after it.

(cherry picked from commit 1cac00d013856fea4cee0f13c4959c8e21afd2d9)

2 years agolibstdc++: Fixes for std::expected
Jonathan Wakely [Fri, 16 Dec 2022 16:07:29 +0000 (16:07 +0000)] 
libstdc++: Fixes for std::expected

This fixes some bugs in the swap functions for std::expected.

It also disables the noexcept-specifiers for equality operators, because
those are problematic when querying whether a std::expected is equality
comparable. The operator==(const expected<T,E>&, const U&) function is
not constrained, so is viable for comparing expected<T,E> with
expected<void,G>, but then we get an error from the noexcept-specifier.

libstdc++-v3/ChangeLog:

* include/std/expected (expected::_M_swap_val_unex): Guard the
correct object.
(expected::swap): Move is_swappable
requirement from static_assert to constraint.
(swap): Likewise.
(operator==): Remove noexcept-specifier.
* testsuite/20_util/expected/swap.cc: Check swapping of
types without non-throwing move constructor. Check constraints
on swap.
* testsuite/20_util/expected/unexpected.cc: Check constraints on
swap.
* testsuite/20_util/expected/equality.cc: New test.

(cherry picked from commit 59822c39207c9e8be576e9d6c3370bd85ddaf886)

2 years agolibgfortran's ISO_Fortran_binding.c: Use GCC11 version for backward-only code [PR108056]
Tobias Burnus [Wed, 21 Dec 2022 06:55:22 +0000 (07:55 +0100)] 
libgfortran's ISO_Fortran_binding.c: Use GCC11 version for backward-only code [PR108056]

Since GCC 12, the conversion between the array descriptors formats - the
internal (GFC) and the C binding one (CFI) - moved to the compiler itself
such that the cfi_desc_to_gfc_desc/gfc_desc_to_cfi_desc functions are only
used with older code (GCC 9 to 11).  The newly added checks caused asserts
as older code did not pass the proper values (e.g. real(4) as effective
argument arrived as BT_ASSUME type as the effective type got lost inbetween).

As proposed in the PR, revert to the GCC 11 version - known bugs is better
than some fixes and new issues. Still, GCC 12 is much better in terms of
TS29113 support and should really be used.

This patch uses the current libgomp version of the GCC 11 branch, except
it fixes the GFC version number (which is 0), uses calloc instead of malloc,
and sets the lower bound to 1 instead of keeping it as is for
CFI_attribute_other.

(cherry picked from commit e205ec03f0794aeac3e8a89e947c12624d5a274e)

(This cherry pick excludes an accidentally committed file, which was
removed in follow-up commit 18af26fc375398f0a7cd7bae5aabebd447f8c899.)

libgfortran/ChangeLog:

PR libfortran/108056
* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc,
gfc_desc_to_cfi_desc): Mostly revert to GCC 11 version for
those backward-compatiblity-only functions.

2 years agoDaily bump.
GCC Administrator [Wed, 21 Dec 2022 00:20:23 +0000 (00:20 +0000)] 
Daily bump.

2 years agod/104749 - document host GDC version requirement
Richard Biener [Tue, 20 Dec 2022 13:34:01 +0000 (14:34 +0100)] 
d/104749 - document host GDC version requirement

This documents that GDC 9.4 or later is required to build the D
language rather than GDC 9.1 which suffers from PR94240.

PR d/104749
* doc/install.texi (GDC): Document GDC 9.4 or later is required
to build the D language frontend.

(cherry picked from commit 05b7cf52e1b640271900894a894da2d27ef90092)

2 years agoi386: Avoid fma_chain for -march=alderlake and sapphirerapids.
Hongyu Wang [Tue, 6 Dec 2022 01:53:35 +0000 (09:53 +0800)] 
i386: Avoid fma_chain for -march=alderlake and sapphirerapids.

For Alderlake there is similar issue like PR81616, enable
avoid_fma256_chain will also benefit on Intel latest platforms
Alderlake and Sapphire Rapids.

gcc/ChangeLog:

* config/i386/x86-tune.def (X86_TUNE_AVOID_256FMA_CHAINS): Add
m_SAPPHIRERAPIDS, m_ALDERLAKE.

2 years agoDaily bump.
GCC Administrator [Tue, 20 Dec 2022 00:20:39 +0000 (00:20 +0000)] 
Daily bump.

2 years agoc++: extract_local_specs and unevaluated contexts [PR100295]
Patrick Palka [Thu, 15 Dec 2022 21:02:05 +0000 (16:02 -0500)] 
c++: extract_local_specs and unevaluated contexts [PR100295]

Here during partial instantiation of the constexpr if, extra_local_specs
walks the statement looking for local specializations within to capture.
However, we're thwarted by the fact that 'ts' first appears inside an
unevaluated context, and so the calls to process_outer_var_ref for its
local specializations are a no-op.  And since we walk each tree exactly
once, we end up not capturing the local specializations despite 'ts'
later occurring in an evaluated context.

This patch fixes this by making extract_local_specs walk evaluated
contexts first before walking unevaluated contexts.  We could probably
get away with not walking unevaluated contexts at all, but this approach
seems more clearly safe.

PR c++/100295
PR c++/107579

gcc/cp/ChangeLog:

* pt.cc (el_data::skip_unevaluated_operands): New data member.
(extract_locals_r): If skip_unevaluated_operands is true,
don't walk into unevaluated contexts.
(extract_local_specs): Walk the pattern twice, first with
skip_unevaluated_operands true followed by it set to false.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/constexpr-if-lambda5.C: New test.

(cherry picked from commit 18499b9f848707aee42d810e99ac0a4c9788433c)

2 years agoc++: partial ordering with memfn ptr cst [PR108104]
Patrick Palka [Thu, 15 Dec 2022 20:38:47 +0000 (15:38 -0500)] 
c++: partial ordering with memfn ptr cst [PR108104]

Here we're triggering an overzealous assert in unify during partial
ordering since the member function pointer constants are represented as
ordinary CONSTRUCTORs (with TYPE_PTRMEMFUNC_P TREE_TYPE) but the assert
expects COMPOUND_LITERAL_P constructors.

PR c++/108104

gcc/cp/ChangeLog:

* pt.cc (unify) <default>: Relax assert to accept any
CONSTRUCTOR parm, not just COMPOUND_LITERAL_P one.

gcc/testsuite/ChangeLog:

* g++.dg/template/ptrmem33.C: New test.

(cherry picked from commit 38304846d18d6bb14b0fd6c627c5c6d43a814d01)

2 years agoc++: pack in requires-expr parm list [PR107417]
Patrick Palka [Sun, 4 Dec 2022 15:47:24 +0000 (10:47 -0500)] 
c++: pack in requires-expr parm list [PR107417]

Here find_parameter_packs_r isn't detecting the pack T inside the
requires-expr's parameter list ultimately because cp_walk_trees
deliberately avoids walking the list so as to avoid false positives in
the unexpanded pack checker.

But it should still be fine to walk the TREE_TYPE of each parameter,
which we already need to do from for_each_template_parm_r, and is
sufficient to fix the testcase.

PR c++/107417

gcc/cp/ChangeLog:

* pt.cc (for_each_template_parm_r) <case REQUIRES_EXPR>: Move
walking of the TREE_TYPE of each parameter to ...
* tree.cc (cp_walk_subtrees) <case REQUIRES_EXPR>: ... here.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-requires33.C: New test.

(cherry picked from commit 079add3ad39d6620d34665dd9c26c21951eb657c)

2 years agoc++: substituting CONST_DECL_USING_P enumerators [PR103081]
Patrick Palka [Sat, 3 Dec 2022 15:28:25 +0000 (10:28 -0500)] 
c++: substituting CONST_DECL_USING_P enumerators [PR103081]

We implement class-scope using enum by injecting clones of the enum's
CONST_DECLs as fields of the class, for which CONST_DECL_USING_P is
true, so that qualified lookup naturally finds the enumerators.
Substitution into such a CONST_DECL currently ICEs however, because we
assume the DECL_CONTEXT is always the ENUMERAL_TYPE (which has
TYPE_VALUES) but in this case it's the RECORD_TYPE for the class scope
(which has TYPE_FIELDS).

Since these CONST_DECLs appear to always be non-dependent, this patch
fixes this by shortcutting substitution for CONST_DECLs that have
non-dependent DECL_CONTEXT.  This subsumes the existing (and seemingly
dead) DECL_NAMESPACE_SCOPE_P early exit test and also benefits
substitution into ordinary non-dependent CONST_DECLs.

PR c++/103081

gcc/cp/ChangeLog:

* pt.cc (tsubst_copy) <case CONST_DECL>: Generalize
early exit test for namespace-scope decls to check dependence of
the enclosing scope instead.  Remove dead early exit test.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/using-enum-10.C: New test.
* g++.dg/cpp2a/using-enum-10a.C: New test.

(cherry picked from commit b3912122c9dfaba6c8229e8f095885f69782ceda)

2 years agoc++: ICE with <=> of incompatible pointers [PR107542]
Patrick Palka [Wed, 30 Nov 2022 00:25:37 +0000 (19:25 -0500)] 
c++: ICE with <=> of incompatible pointers [PR107542]

In a SFINAE context composite_pointer_type returns error_mark_node if
the given pointer types are incompatible.  But the SPACESHIP_EXPR case
of cp_build_binary_op wasn't prepared for this error_mark_node result,
which led to an ICE (from spaceship_comp_cat) for the below testcase.
(In a non-SFINAE context composite_pointer_type issues a permerror and
returns cv void* in this case, so this ICE seems specific to SFINAE.)

PR c++/107542

gcc/cp/ChangeLog:

* typeck.cc (cp_build_binary_op): In the SPACESHIP_EXPR case,
handle an error_mark_node result type.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/spaceship-sfinae2.C: New test.

(cherry picked from commit 000e9863120cbc75a0f8d497264519974c97669f)

2 years agoc-family: Fix ICE with -Wsuggest-attribute [PR98487]
Marek Polacek [Fri, 16 Dec 2022 17:28:43 +0000 (12:28 -0500)] 
c-family: Fix ICE with -Wsuggest-attribute [PR98487]

Here we crash because check_function_format was using TREE_PURPOSE
directly rather than using get_attribute_name.

PR c/98487

gcc/c-family/ChangeLog:

* c-format.cc (check_function_format): Use get_attribute_name.

gcc/testsuite/ChangeLog:

* c-c++-common/Wsuggest-attribute-1.c: New test.

(cherry picked from commit 68e51bd0a85794cd437d3e740357dfef84dc560d)

2 years agoDaily bump.
GCC Administrator [Mon, 19 Dec 2022 00:21:58 +0000 (00:21 +0000)] 
Daily bump.

2 years agoFortran: ICE on recursive derived types with allocatable components [PR107872]
Paul Thomas [Fri, 9 Dec 2022 21:13:45 +0000 (22:13 +0100)] 
Fortran: ICE on recursive derived types with allocatable components [PR107872]

gcc/fortran/ChangeLog:

PR fortran/107872
* resolve.cc (derived_inaccessible): Skip over allocatable components
to prevent an infinite loop.

gcc/testsuite/ChangeLog:

PR fortran/107872
* gfortran.dg/pr107872.f90: New test.

(cherry picked from commit 01254aa2eb766c7584fd047568d7277d4d65d067)

2 years agoDaily bump.
GCC Administrator [Sun, 18 Dec 2022 00:20:41 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 17 Dec 2022 00:21:28 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 16 Dec 2022 00:21:18 +0000 (00:21 +0000)] 
Daily bump.

2 years agoAArch64: Add UNSPECV_PATCHABLE_AREA [PR98776]
Sebastian Pop [Wed, 30 Nov 2022 19:45:24 +0000 (19:45 +0000)] 
AArch64: Add UNSPECV_PATCHABLE_AREA [PR98776]

Currently patchable area is at the wrong place on AArch64.  It is placed
immediately after function label, before .cfi_startproc.  This patch
adds UNSPECV_PATCHABLE_AREA for pseudo patchable area instruction and
modifies aarch64_print_patchable_function_entry to avoid placing
patchable area before .cfi_startproc.

gcc/
PR target/98776
* config/aarch64/aarch64-protos.h (aarch64_output_patchable_area):
Declared.
* config/aarch64/aarch64.cc (aarch64_print_patchable_function_entry):
Emit an UNSPECV_PATCHABLE_AREA pseudo instruction.
(aarch64_output_patchable_area): New.
* config/aarch64/aarch64.md (UNSPECV_PATCHABLE_AREA): New.
(patchable_area): Define.

gcc/testsuite/
PR target/98776
* gcc.target/aarch64/pr98776.c: New.
* gcc.target/aarch64/pr92424-2.c: Adjust pattern.
* gcc.target/aarch64/pr92424-3.c: Adjust pattern.

2 years agoDaily bump.
GCC Administrator [Thu, 15 Dec 2022 00:20:50 +0000 (00:20 +0000)] 
Daily bump.

2 years agolibstdc++: Fix size passed to operator delete [PR108097]
Jonathan Wakely [Wed, 14 Dec 2022 11:58:05 +0000 (11:58 +0000)] 
libstdc++: Fix size passed to operator delete [PR108097]

The number of elements gets stored in _M_capacity so use a separate
variable for the number of bytes to allocate.

libstdc++-v3/ChangeLog:

PR libstdc++/108097
* include/std/stacktrace (basic_stracktrace::_Impl): Do not
multiply N by sizeof(value_type) when allocating.

(cherry picked from commit 881c6cabce5d0b27285ed41bd6dabdf48848cce7)

2 years agoDaily bump.
GCC Administrator [Wed, 14 Dec 2022 00:22:41 +0000 (00:22 +0000)] 
Daily bump.

2 years agolibphobos: Backport library and bindings fixes from mainline
Iain Buclaw [Tue, 13 Dec 2022 21:34:57 +0000 (22:34 +0100)] 
libphobos: Backport library and bindings fixes from mainline

D Runtime changes:

- Fix MIPS64 bindings for CRuntime_UClibc.

Phobos changes:

- Fix std.path.expandTilde erroneously raising onOutOfMemory
  after failed call to getpwnam_r().
- Fix std.random unittest failures on ILP32 targets.
- Use GENERIC_IO on CRuntime_UClibc port of std.stdio.

libphobos/ChangeLog:

* libdruntime/core/stdc/fenv.d: Compile in MIPS uClibc bindings on
MIPS_Any targets.
* libdruntime/core/stdc/math.d: Likewise.
* libdruntime/core/sys/posix/dlfcn.d: Likewise.
* libdruntime/core/sys/posix/setjmp.d: Add MIPS64 definitions for
CRuntime_UClibc.
* libdruntime/core/sys/posix/sys/types.d: Likewise.
* src/std/path.d (expandTilde): Handle more errno codes that could be
left set by getpwnam_r.
* src/std/random.d: Use D_LP64 in unittests.
* src/std/stdio.d: Set CRuntime_UClibc as GENERIC_IO target.

2 years agovarasm: Fix type confusion bug
Alex Coplan [Thu, 1 Dec 2022 17:36:02 +0000 (17:36 +0000)] 
varasm: Fix type confusion bug

This patch fixes a type confusion bug in varasm.cc:assemble_variable.
The problem is that the current code calls:

  sect = get_variable_section (decl, false);

and then accesses sect->named.name without checking whether the section
is in fact a named section. In the surrounding else clause, we only know
that SECTION_STYLE (sect) != SECTION_NOSWITCH, so it is possible that
the section is an unnamed section.

In practice, this means that we end up doing a wild string compare
between a function pointer and the string literal ".vtable_map_vars".
This is because sect->named.name aliases sect->unnamed.callback in the
section union.

This can be seen in GDB with a simple testcase such as "int x;".

This patch fixes the issue by checking the SECTION_STYLE of the section
is in fact SECTION_NAMED before trying to do the string comparison.

We drop the existing check of whether sect->named.name is non-NULL
because this should presumably always be the case for a named section.

gcc/ChangeLog:

* varasm.cc (assemble_variable): Fix type confusion bug when
checking for ".vtable_map_vars" section.

(cherry picked from commit de144fdab17dbbb64ccb540056ab78b4ffb3fbbc)

2 years agoDaily bump.
GCC Administrator [Tue, 13 Dec 2022 00:21:48 +0000 (00:21 +0000)] 
Daily bump.

2 years agod: Fix undefined reference to nested lambda in template (PR108055)
Iain Buclaw [Sat, 10 Dec 2022 21:11:41 +0000 (22:11 +0100)] 
d: Fix undefined reference to nested lambda in template (PR108055)

Sometimes, nested lambdas of templated functions get no code generation
due to them being marked as instantianted outside of all modules being
compiled in the current compilation unit.  This despite enclosing
template instances being marked as instantiated inside the current
compilation unit.  To fix, all enclosing templates are now checked in
`function_defined_in_root_p'.

Because of this change, `function_needs_inline_definition_p' has also
been fixed up to only check whether the regular function definition
itself is to be emitted in the current compilation unit.

PR d/108055

gcc/d/ChangeLog:

* decl.cc (function_defined_in_root_p): Check all enclosing template
instances for definition in a root module.
(function_needs_inline_definition_p): Replace call to
function_defined_in_root_p with test for outer module `isRoot'.

gcc/testsuite/ChangeLog:

* gdc.dg/torture/imports/pr108055conv.d: New.
* gdc.dg/torture/imports/pr108055spec.d: New.
* gdc.dg/torture/imports/pr108055write.d: New.
* gdc.dg/torture/pr108055.d: New test.

(cherry picked from commit 9fe7d3debbf60ed9fef8053123ad542a99d62100)

2 years agotree-optimization/107898 - ICE with -Walloca-larger-than
Richard Biener [Tue, 29 Nov 2022 08:03:46 +0000 (09:03 +0100)] 
tree-optimization/107898 - ICE with -Walloca-larger-than

The following avoids ICEing with a mismatched prototype for alloca
and -Walloca-larger-than using irange for checks which doesn't
like mismatched types.

PR tree-optimization/107898
* gimple-ssa-warn-alloca.cc (alloca_call_type): Check
the type of the alloca argument is compatible with size_t
before querying ranges.

(cherry picked from commit 9948daa4fd0f0ea0a9d56c2fefe1bca478554d27)

2 years agotree-optimization/107865 - ICE with outlining of loops
Richard Biener [Fri, 25 Nov 2022 07:27:42 +0000 (08:27 +0100)] 
tree-optimization/107865 - ICE with outlining of loops

The following makes sure to clear loops number of iterations when
outlining them as part of a SESE region as can happen with
auto-parallelization.  The referenced SSA names become stale otherwise.

PR tree-optimization/107865
* tree-cfg.cc (move_sese_region_to_fn): Free the number of
iterations of moved loops.

* gfortran.dg/graphite/pr107865.f90: New testcase.

(cherry picked from commit bcc2449384f2092cbdf5d6ac2357aeabe3212b2e)

2 years agotree-optimization/107833 - invariant motion of uninit uses
Richard Biener [Fri, 2 Dec 2022 13:52:20 +0000 (14:52 +0100)] 
tree-optimization/107833 - invariant motion of uninit uses

The following fixes a wrong-code bug caused by loop invariant motion
hoisting an expression using an uninitialized value outside of its
controlling condition causing IVOPTs to use that to rewrite a defined
value.  PR107839 is a similar case involving a bogus uninit diagnostic.

PR tree-optimization/107833
PR tree-optimization/107839
* cfghooks.cc: Include tree.h.
* tree-ssa-loop-im.cc (movement_possibility): Wrap and
make stmts using any ssa_name_maybe_undef_p operand
to preserve execution.
(loop_invariant_motion_in_fun): Call mark_ssa_maybe_undefs
to init maybe-undefined status.
* tree-ssa-loop-ivopts.cc (ssa_name_maybe_undef_p,
ssa_name_set_maybe_undef, ssa_name_any_use_dominates_bb_p,
mark_ssa_maybe_undefs): Move ...
* tree-ssa.cc: ... here.
* tree-ssa.h (ssa_name_any_use_dominates_bb_p,
mark_ssa_maybe_undefs): Declare.
(ssa_name_maybe_undef_p, ssa_name_set_maybe_undef): Define.

* gcc.dg/torture/pr107833.c: New testcase.
* gcc.dg/uninit-pr107839.c: Likewise.

(cherry picked from commit 44c8402d35160515b3c09fd2bc239587e0c32a2b)

2 years agotree-optimization/107686 - fix bitfield ref through vec_unpack optimization
Richard Biener [Wed, 16 Nov 2022 14:27:13 +0000 (15:27 +0100)] 
tree-optimization/107686 - fix bitfield ref through vec_unpack optimization

The following propely restricts the bitfield access to integral types
when we look through VEC_UNPACK with the intent to emit a widening
conversion.

PR tree-optimization/107686
* tree-ssa-forwprop.cc (optimize_vector_load): Restrict
VEC_UNPACK support to integral typed bitfield refs.

* gcc.dg/pr107686.c: New testcase.

(cherry picked from commit 246bbdaa5f536b7a199dda9860c473137f40d622)

2 years agotree-optimization/107766 - ICE with recent -ffp-contract=off fix
Richard Biener [Mon, 21 Nov 2022 06:56:06 +0000 (07:56 +0100)] 
tree-optimization/107766 - ICE with recent -ffp-contract=off fix

The following uses *node to check for FP types rather than the
child nodes which could be constant leafs and thus without a
vector type.

PR tree-optimization/107766
* tree-vect-slp-patterns.cc (complex_mul_pattern::matches):
Use *node to check for FP vector types.

* g++.dg/vect/pr107766.cc: New testcase.

(cherry picked from commit 1a06ae6f2f4f292fd05a900bcf433cb4282da1e3)

2 years agotree-optimization/107647 - avoid FMA from SLP with -ffp-contract=off
Richard Biener [Thu, 17 Nov 2022 08:43:31 +0000 (09:43 +0100)] 
tree-optimization/107647 - avoid FMA from SLP with -ffp-contract=off

Only with -ffp-contract=fast we can synthesize FMA operations like
vfmaddsub231ps, so properly guard the transform in SLP pattern
detection.

PR tree-optimization/107647
* tree-vect-slp-patterns.cc (addsub_pattern::recognize): Only
allow FMA generation with -ffp-contract=fast for FP types.
(complex_mul_pattern::matches): Likewise.

* gcc.target/i386/pr107647.c: New testcase.

(cherry picked from commit c5df8392c5848c0462558f41cdf6eab31db301cf)

2 years agotree-optimization/107407 - wrong code with DSE
Richard Biener [Fri, 28 Oct 2022 13:03:49 +0000 (15:03 +0200)] 
tree-optimization/107407 - wrong code with DSE

So what happens is that we elide processing of this check with

          /* In addition to kills we can remove defs whose only use
             is another def in defs.  That can only ever be PHIs of which
             we track two for simplicity reasons, the first and last in
             {first,last}_phi_def (we fail for multiple PHIs anyways).
             We can also ignore defs that feed only into
             already visited PHIs.  */
          else if (single_imm_use (vdef, &use_p, &use_stmt)
                   && (use_stmt == first_phi_def
                       || use_stmt == last_phi_def
                       || (gimple_code (use_stmt) == GIMPLE_PHI
                           && bitmap_bit_p (visited,
                                            SSA_NAME_VERSION
                                              (PHI_RESULT (use_stmt))))))

where we have the last PHI being the outer loop virtual PHI and the first
PHI being the loop exit PHI of the outer loop and we've already processed
the single immediate use of the outer loop PHI, the inner loop PHI.  But
we still have to perform the above check!

It's easiest to perform the check when we visit the PHI node instead of
delaying it to the actual processing loop.

PR tree-optimization/107407
* tree-ssa-dse.cc (dse_classify_store): Perform backedge
varying index check when collecting PHI uses rather than
after optimizing processing of the candidate defs.

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

(cherry picked from commit 031a400e49d8db156c43f9ec0b21ab0c2aee8c6d)

2 years agotree-optimization/106868 - bogus -Wdangling-pointer diagnostic
Richard Biener [Mon, 5 Dec 2022 09:13:13 +0000 (10:13 +0100)] 
tree-optimization/106868 - bogus -Wdangling-pointer diagnostic

The testcase shows we mishandle the case where there's a pass-through
of a pointer through a function like memcpy.  The following adjusts
handling of this copy case to require a taken address and adjust
the PHI case similarly.

PR tree-optimization/106868
* gimple-ssa-warn-access.cc (pass_waccess::gimple_call_return_arg_ref):
Inline into single user ...
(pass_waccess::check_dangling_uses): ... here and adjust the
call and the PHI case to require that ref.aref is the address
of the decl.

* gcc.dg/Wdangling-pointer-pr106868.c: New testcase.

(cherry picked from commit d492d50f644811327c5976e2c918ab6d906ed40c)

2 years agoDaily bump.
GCC Administrator [Mon, 12 Dec 2022 00:27:09 +0000 (00:27 +0000)] 
Daily bump.

2 years agod: Remove "final" and "override" from visitor method.
Iain Buclaw [Sun, 11 Dec 2022 18:08:01 +0000 (19:08 +0100)] 
d: Remove "final" and "override" from visitor method.

This was added by the backport of an ICE in r12-8969.  While harmless,
it was not until r13-758 that "final" and "override" were introduced to
all visitor methods in the D front-end.  Removing it from the release
branch just for consistency with the rest of the file.

gcc/d/ChangeLog:

* imports.cc (ImportVisitor::visit (OverloadSet *)): Remove "final"
and "override" from visitor method.

2 years agod: Fix internal compiler error: in visit, at d/imports.cc:72 (PR108050)
Iain Buclaw [Sat, 10 Dec 2022 18:12:43 +0000 (19:12 +0100)] 
d: Fix internal compiler error: in visit, at d/imports.cc:72 (PR108050)

The visitor for lowering IMPORTED_DECLs did not have an override for
dealing with importing OverloadSet symbols.  This has now been
implemented in the code generator.

PR d/108050

gcc/d/ChangeLog:

* decl.cc (DeclVisitor::visit (Import *)): Handle build_import_decl
returning a TREE_LIST.
* imports.cc (ImportVisitor::visit (OverloadSet *)): New override.

gcc/testsuite/ChangeLog:

* gdc.dg/imports/pr108050/mod1.d: New.
* gdc.dg/imports/pr108050/mod2.d: New.
* gdc.dg/imports/pr108050/package.d: New.
* gdc.dg/pr108050.d: New test.

(cherry picked from commit d9d8c9674ad3ad3aa38419d24b1aaaffe31f5d3f)

2 years agoDaily bump.
GCC Administrator [Sun, 11 Dec 2022 00:21:50 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 10 Dec 2022 00:22:21 +0000 (00:22 +0000)] 
Daily bump.

2 years agoi386: fix assert (__builtin_cpu_supports ("x86-64") >= 0)
Martin Liska [Fri, 25 Nov 2022 12:05:56 +0000 (13:05 +0100)] 
i386: fix assert (__builtin_cpu_supports ("x86-64") >= 0)

Similar story as PR103661, we again return a negative number
for __builtin_cpu_supports:

Documentation says:

int __builtin_cpu_supports(const char *feature)
This function returns a positive integer if the run-time CPU supports feature and returns 0 otherwise.
while we return -2147483648.

Moreover, I noticed "x86-64" is not a valid option for __builtin_cpu_is,
but for __builtin_cpu_supports.

PR target/107551

gcc/ChangeLog:

* config/i386/i386-builtins.cc (fold_builtin_cpu): Use same path
as for PR103661.
* doc/extend.texi: Fix "x86-64" use.

gcc/testsuite/ChangeLog:

* gcc.target/i386/builtin_target.c: Add more checks.

(cherry picked from commit d71b20fc30965ba8326ad9363d0aca9d61eb4ed3)

2 years agoi386: simplify cpu_feature handling
Martin Liska [Wed, 15 Dec 2021 09:54:23 +0000 (10:54 +0100)] 
i386: simplify cpu_feature handling

The patch removes unneeded loops for cpu_features2 and CONVERT_EXPR
that can be simplified with NOP_EXPR.

gcc/ChangeLog:

* common/config/i386/cpuinfo.h (has_cpu_feature): Directly
compute index in cpu_features2.
(set_cpu_feature): Likewise.
* config/i386/i386-builtins.cc (fold_builtin_cpu): Also remove
loop for cpu_features2 and use NOP_EXPRs.

(cherry picked from commit ef14bba0a6f3836d41d75863e6516d21aef0e936)

2 years agoDaily bump.
GCC Administrator [Fri, 9 Dec 2022 00:22:54 +0000 (00:22 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Thu, 8 Dec 2022 00:21:47 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Wed, 7 Dec 2022 00:22:28 +0000 (00:22 +0000)] 
Daily bump.

2 years agoaarch64: Specify that FEAT_MOPS sequences clobber CC
Kyrylo Tkachov [Wed, 30 Nov 2022 17:38:16 +0000 (17:38 +0000)] 
aarch64: Specify that FEAT_MOPS sequences clobber CC

According to the architecture pseudocode the FEAT_MOPS sequences overwrite the NZCV flags
as par of their operation, so GCC needs to model that in the relevant RTL patterns.
For the testcase:
void g();
void foo (int a, size_t N, char *__restrict__ in,
         char *__restrict__ out)
{
  if (a != 3)
    __builtin_memcpy (out, in, N);
  if (a > 3)
    g ();
}

we will currently generate:
foo:
        cmp     w0, 3
        bne     .L6
.L1:
        ret
.L6:
        cpyfp   [x3]!, [x2]!, x1!
        cpyfm   [x3]!, [x2]!, x1!
        cpyfe   [x3]!, [x2]!, x1!
        ble     .L1 // Flags reused after CPYF* sequence
        b       g

This is wrong as the result of cmp needs to be recalculated after the MOPS sequence.
With this patch we'll insert a "cmp w0, 3" before the ble, similar to what clang does.

Bootstrapped and tested on aarch64-none-linux-gnu.
Pushing to trunk and to the GCC 12 branch after some baking time.

gcc/ChangeLog:

* config/aarch64/aarch64.md (aarch64_cpymemdi): Specify clobber of CC reg.
(*aarch64_cpymemdi): Likewise.
(aarch64_movmemdi): Likewise.
(aarch64_setmemdi): Likewise.
(*aarch64_setmemdi): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/mops_5.c: New test.
* gcc.target/aarch64/mops_6.c: Likewise.
* gcc.target/aarch64/mops_7.c: Likewise.

(cherry picked from commit cbdffae5745327b0e5eb887afc512daf34b049b1)

2 years agoDaily bump.
GCC Administrator [Tue, 6 Dec 2022 00:21:48 +0000 (00:21 +0000)] 
Daily bump.

2 years agotree-optimization/107956 - ICE with NULL call LHS
Andrew Pinski [Mon, 5 Dec 2022 08:09:52 +0000 (09:09 +0100)] 
tree-optimization/107956 - ICE with NULL call LHS

The following adds a missing check for a NULL call LHS in the
vector pattern recognizer.

PR tree-optimization/107956
* tree-vect-patterns.cc (vect_recog_mask_conversion_pattern):
Check for NULL LHS on masked loads.

(cherry picked from commit 5c11d748564c7ce3b096e87ad350fcddd493e45e)

2 years agoDaily bump.
GCC Administrator [Mon, 5 Dec 2022 00:21:42 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 4 Dec 2022 00:20:51 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 3 Dec 2022 00:21:32 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Fri, 2 Dec 2022 00:21:49 +0000 (00:21 +0000)] 
Daily bump.

2 years agoFix unrecognizable insn due to illegal immediate_operand (const_int 255) of QImode.
liuhongt [Mon, 28 Nov 2022 01:59:47 +0000 (09:59 +0800)] 
Fix unrecognizable insn due to illegal immediate_operand (const_int 255) of QImode.

For __builtin_ia32_vec_set_v16qi (a, -1, 2) with
!flag_signed_char. it's transformed to
__builtin_ia32_vec_set_v16qi (_4, 255, 2) in the gimple,
and expanded to (const_int 255) in the rtl. But for immediate_operand,
it expects (const_int 255) to be signed extended to
(const_int -1). The mismatch caused an unrecognizable insn error.

The patch converts (const_int 255) to (const_int -1) in the backend
expander.

gcc/ChangeLog:

PR target/107863
* config/i386/i386-expand.cc (ix86_expand_vec_set_builtin):
Convert op1 to target mode whenever mode mismatch.

gcc/testsuite/ChangeLog:

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

2 years agoDaily bump.
GCC Administrator [Thu, 1 Dec 2022 00:21:29 +0000 (00:21 +0000)] 
Daily bump.

2 years agod: Include tm.h in all D target platform sources, remove memmodel.h
Iain Buclaw [Thu, 8 Sep 2022 10:29:32 +0000 (12:29 +0200)] 
d: Include tm.h in all D target platform sources, remove memmodel.h

The tm.h header would pull in config/elfos.h, which defines
TARGET_D_MINFO_SECTION needed for the D module support in the front-end
to emit data to the correct section for the run-time library to pick up.

The removal of it in r13-2385 caused a stage2 bootstrap failure on all
Solaris targets.

The memmodel header has also been removed as it is no longer required
now tm_p.h is no longer used by these sources.

gcc/ChangeLog:

* config/darwin-d.cc: Include tm.h.
* config/dragonfly-d.cc: Likewise.
* config/freebsd-d.cc: Remove memmodel.h.
* config/glibc-d.cc: Likewise.
* config/netbsd-d.cc: Include tm.h.
* config/openbsd-d.cc: Likewise.
* config/sol2-d.cc: Likewise.

(cherry picked from commit a7852bd30a19d29ff7986869453786d460d17877)

2 years agod: Fix ICE on named continue label in an unrolled loop [PR107592]
Iain Buclaw [Fri, 11 Nov 2022 23:54:47 +0000 (00:54 +0100)] 
d: Fix ICE on named continue label in an unrolled loop [PR107592]

Continue labels in an unrolled loop require a unique label per
iteration.  Previously this used the Statement body node for each
unrolled iteration to generate a new entry in the label hash table.
This does not work when the continue label has an identifier, as said
named label is pointing to the outer UnrolledLoopStatement node.

What would happen is that during the lowering of `continue label', an
automatic label associated with the unrolled loop would be generated,
and a jump to that label inserted, but because it was never pushed by
the visitor for the loop itself, it subsequently never gets emitted.

To fix, correctly use the UnrolledLoopStatement as the key to look up
and store the break/continue label pair, but remove the continue label
from the value entry after every loop to force a new label to be
generated by the next call to `push_continue_label'

PR d/107592

gcc/d/ChangeLog:

* toir.cc (IRVisitor::push_unrolled_continue_label): New method.
(IRVisitor::pop_unrolled_continue_label): New method.
(IRVisitor::visit (UnrolledLoopStatement *)): Use them instead of
push_continue_label and pop_continue_label.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 031d3f095520f0e1ee03e29b7ad5067c2a3f96e0)

2 years agod: Fix #error You must define PREFERRED_DEBUGGING_TYPE if DWARF is not supported
Iain Buclaw [Tue, 16 Aug 2022 14:18:02 +0000 (16:18 +0200)] 
d: Fix #error You must define PREFERRED_DEBUGGING_TYPE if DWARF is not supported

This moves all D front-end specific target definitions out of the main
target headers, and into its own header that is included by tm_d.h
instead of pulling in the same headers as tm_p.h.

This fixes the build on target configurations that pull in the default D
language target hooks, and subsequently trigger an error because the
definition of PREFERRED_DEBUGGING_TYPE is behind tm.h, the one header
that is avoided from being included in default-d.cc.

PR d/105659

gcc/ChangeLog:

* config.gcc: Set tm_d_file to ${cpu_type}/${cpu_type}-d.h.
* config/aarch64/aarch64-d.cc: Include tm_d.h.
* config/aarch64/aarch64-protos.h (aarch64_d_target_versions): Move to
config/aarch64/aarch64-d.h.
(aarch64_d_register_target_info): Likewise.
* config/aarch64/aarch64.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
* config/arm/arm-d.cc: Include tm_d.h and arm-protos.h instead of
tm_p.h.
* config/arm/arm-protos.h (arm_d_target_versions): Move to
config/arm/arm-d.h.
(arm_d_register_target_info): Likewise.
* config/arm/arm.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
* config/default-d.cc: Remove memmodel.h include.
* config/freebsd-d.cc: Include tm_d.h instead of tm_p.h.
* config/glibc-d.cc: Likewise.
* config/i386/i386-d.cc: Include tm_d.h.
* config/i386/i386-protos.h (ix86_d_target_versions): Move to
config/i386/i386-d.h.
(ix86_d_register_target_info): Likewise.
(ix86_d_has_stdcall_convention): Likewise.
* config/i386/i386.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
(TARGET_D_HAS_STDCALL_CONVENTION): Likewise.
* config/i386/winnt-d.cc: Include tm_d.h instead of tm_p.h.
* config/mips/mips-d.cc: Include tm_d.h.
* config/mips/mips-protos.h (mips_d_target_versions): Move to
config/mips/mips-d.h.
(mips_d_register_target_info): Likewise.
* config/mips/mips.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
* config/netbsd-d.cc: Include tm_d.h instead of tm.h and memmodel.h.
* config/openbsd-d.cc: Likewise.
* config/pa/pa-d.cc: Include tm_d.h.
* config/pa/pa-protos.h (pa_d_target_versions): Move to
config/pa/pa-d.h.
(pa_d_register_target_info): Likewise.
* config/pa/pa.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
* config/riscv/riscv-d.cc: Include tm_d.h.
* config/riscv/riscv-protos.h (riscv_d_target_versions): Move to
config/riscv/riscv-d.h.
(riscv_d_register_target_info): Likewise.
* config/riscv/riscv.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
* config/rs6000/rs6000-d.cc: Include tm_d.h.
* config/rs6000/rs6000-protos.h (rs6000_d_target_versions): Move to
config/rs6000/rs6000-d.h.
(rs6000_d_register_target_info): Likewise.
* config/rs6000/rs6000.h (TARGET_D_CPU_VERSIONS) Likewise.:
(TARGET_D_REGISTER_CPU_TARGET_INFO) Likewise.:
* config/s390/s390-d.cc: Include tm_d.h.
* config/s390/s390-protos.h (s390_d_target_versions): Move to
config/s390/s390-d.h.
(s390_d_register_target_info): Likewise.
* config/s390/s390.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
* config/sol2-d.cc: Include tm_d.h instead of tm.h and memmodel.h.
* config/sparc/sparc-d.cc: Include tm_d.h.
* config/sparc/sparc-protos.h (sparc_d_target_versions): Move to
config/sparc/sparc-d.h.
(sparc_d_register_target_info): Likewise.
* config/sparc/sparc.h (TARGET_D_CPU_VERSIONS): Likewise.
(TARGET_D_REGISTER_CPU_TARGET_INFO): Likewise.
* configure: Regenerate.
* configure.ac (tm_d_file): Remove defaults.h.
(tm_d_include_list): Remove options.h and insn-constants.h.
* config/aarch64/aarch64-d.h: New file.
* config/arm/arm-d.h: New file.
* config/i386/i386-d.h: New file.
* config/mips/mips-d.h: New file.
* config/pa/pa-d.h: New file.
* config/riscv/riscv-d.h: New file.
* config/rs6000/rs6000-d.h: New file.
* config/s390/s390-d.h: New file.
* config/sparc/sparc-d.h: New file.

(cherry picked from commit d5ad6f8415171798adaff5787400505ce9882144)

2 years agoFix addvdi3 and subvdi3 patterns
John David Anglin [Wed, 30 Nov 2022 18:40:10 +0000 (18:40 +0000)] 
Fix addvdi3 and subvdi3 patterns

While most PA 2.0 instructions support both 32 and 64-bit traps
and conditions, the addi and subi instructions only support 32-bit
traps and conditions. Thus, we need to force immediate operands
to register operands on the 64-bit target and use the add/sub
instructions which can trap on 64-bit signed overflow.

2022-11-30  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.md (addvdi3): Force operand 2 to a register.
Remove "addi,tsv,*" instruction from unamed pattern.
(subvdi3): Force operand 1 to a register.
Remove "subi,tsv" instruction from from unamed pattern.

2 years agoDaily bump.
GCC Administrator [Wed, 30 Nov 2022 00:21:50 +0000 (00:21 +0000)] 
Daily bump.

2 years agogcc: fix PR rtl-optimization/107482
Max Filippov [Mon, 7 Nov 2022 21:58:49 +0000 (13:58 -0800)] 
gcc: fix PR rtl-optimization/107482

gcc/
PR rtl-optimization/107482
* ira-color.cc (assign_hard_reg): Only call
update_costs_from_copies when retry_p is false.

(cherry picked from commit e581490f0cfa80c58d2b648d71a44a597fbe3008)

2 years agoDaily bump.
GCC Administrator [Tue, 29 Nov 2022 00:22:20 +0000 (00:22 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Mon, 28 Nov 2022 00:20:30 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sun, 27 Nov 2022 00:20:27 +0000 (00:20 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Sat, 26 Nov 2022 00:20:51 +0000 (00:20 +0000)] 
Daily bump.

2 years agoFortran: reject NULL actual argument without explicit interface [PR107576]
Harald Anlauf [Thu, 17 Nov 2022 20:36:49 +0000 (21:36 +0100)] 
Fortran: reject NULL actual argument without explicit interface [PR107576]

gcc/fortran/ChangeLog:

PR fortran/107576
* interface.cc (gfc_procedure_use): Reject NULL as actual argument
when there is no explicit procedure interface.

gcc/testsuite/ChangeLog:

PR fortran/107576
* gfortran.dg/null_actual_3.f90: New test.

(cherry picked from commit 820c25c83561085f54268bd536f9d216d03c3e18)

2 years agoDaily bump.
GCC Administrator [Fri, 25 Nov 2022 10:07:49 +0000 (10:07 +0000)] 
Daily bump.

2 years agoFix thinko in operator_bitwise_xor::op1_range
Eric Botcazou [Fri, 25 Nov 2022 09:49:20 +0000 (10:49 +0100)] 
Fix thinko in operator_bitwise_xor::op1_range

There is a thinko in the op1_range method of ranger's operator_bitwise_xor
class in a boolean context: if the result is known to be true, it may infer
that a specific operand is false without any basis.

gcc/
* range-op.cc (operator_bitwise_xor::op1_range): Fix thinko.

gcc/testsuite/
* gnat.dg/opt100.adb: New test.
* gnat.dg/opt100_pkg.adb, gnat.dg/opt100_pkg.ads: New helper.

2 years agoFix wrong array type conversion with different storage orde
Eric Botcazou [Tue, 22 Nov 2022 18:03:49 +0000 (19:03 +0100)] 
Fix wrong array type conversion with different storage orde

When two arrays of scalars have a different storage order in Ada, the
front-end makes sure that the conversion is performed component-wise
so that each component can be reversed.  So it's a little bit counter
productive that the ldist pass performs the opposite transformation
and synthesizes a memcpy/memmove in this case.

gcc/
* tree-loop-distribution.cc (loop_distribution::classify_builtin_ldst):
Bail out if source and destination do not have the same storage order.

gcc/testsuite/
* gnat.dg/sso18.adb: New test.

2 years agolibstdc++: Remove unnecessary header from <memory>
Jonathan Wakely [Thu, 15 Sep 2022 17:21:32 +0000 (18:21 +0100)] 
libstdc++: Remove unnecessary header from <memory>

Previously <memory> included <bits/stl_algobase.h> so that std::copy,
std::fill etc. could be used by <bits/stl_uninitialized.h>. But that
includes it explicitly now, so that it can be compiled as a header unit.
There's no need to include it in <memory>, where its purpose isn't
obvious.

libstdc++-v3/ChangeLog:

* include/std/memory: Do not include <bits/stl_algobase.h>.

(cherry picked from commit d6ccad7641da10d9c5f1f6cfc676d5f5b9d2d126)

2 years agolibstdc++: Fix tests with non-const operator==
Jonathan Wakely [Thu, 10 Nov 2022 14:11:27 +0000 (14:11 +0000)] 
libstdc++: Fix tests with non-const operator==

These tests fail in strict -std=c++20 mode but their equality ops don't
need to be non-const, it looks like an accident.

This fixes two FAILs with -std=c++20:
FAIL: 20_util/tuple/swap.cc (test for excess errors)
FAIL: 26_numerics/valarray/87641.cc (test for excess errors)

libstdc++-v3/ChangeLog:

* testsuite/20_util/tuple/swap.cc (MoveOnly::operator==): Add
const qualifier.
* testsuite/26_numerics/valarray/87641.cc (X::operator==):
Likewise.

(cherry picked from commit fbad7a74aaaddea3d7b39045a09dd3860603658e)

2 years agolibstdc++: Remove unnecessary variant member in std::expected
Jonathan Wakely [Tue, 1 Nov 2022 13:47:24 +0000 (13:47 +0000)] 
libstdc++: Remove unnecessary variant member in std::expected

Hui Xie pointed out that we don't need a dummy member in the union,
because all constructors always initialize either _M_val or _M_unex.

We still need the _M_void member of the expected<void, E>
specialization, because the constructor has to initialize something when
not using the _M_unex member.

libstdc++-v3/ChangeLog:

* include/std/expected (expected::_M_invalid): Remove.

(cherry picked from commit f4874691812bc20e3d8e3302db439c27f30c472c)

2 years agolibstdc++: Check static assertions earlier in chrono::duration
Jonathan Wakely [Mon, 21 Nov 2022 11:52:34 +0000 (11:52 +0000)] 
libstdc++: Check static assertions earlier in chrono::duration

This ensures that we fail a static assertion before giving any other
errors. Instantiating chrono::duration<int, chrono::seconds> will now
print this before the other errors caused by it:

error: static assertion failed: period must be a specialization of ratio

libstdc++-v3/ChangeLog:

* include/bits/chrono.h (duration): Check preconditions on
template arguments before using them.

(cherry picked from commit ed77dcb9be76e592b62449c75a5e751485514afd)

2 years agolibstdc++: Fix dangling reference in filesystem::path::filename()
Jonathan Wakely [Fri, 28 Oct 2022 14:28:09 +0000 (15:28 +0100)] 
libstdc++: Fix dangling reference in filesystem::path::filename()

The new -Wdangling-reference warning noticed this.

libstdc++-v3/ChangeLog:

* include/bits/fs_path.h (path::filename()): Fix dangling
reference.

(cherry picked from commit 49237fe6ef677a81eae701f937546210c90b5914)

2 years agolibstdc++: Document LWG 1203 API change in manual
Jonathan Wakely [Wed, 14 Sep 2022 12:48:25 +0000 (13:48 +0100)] 
libstdc++: Document LWG 1203 API change in manual

libstdc++-v3/ChangeLog:

* doc/xml/manual/intro.xml: Document LWG 1203.
* doc/html/*: Regenerate.

(cherry picked from commit 8b1bc3051bd68ce193a8612fa3b1a65c0353b5b0)

2 years agolibstdc++: Add missing runtime exception to licence notice
Jonathan Wakely [Tue, 6 Sep 2022 10:58:21 +0000 (11:58 +0100)] 
libstdc++: Add missing runtime exception to licence notice

This file is missing the GCC Runtime Library Exception text in the
licence header. That is unintentional, and it should have been present.

libstdc++-v3/ChangeLog:

* include/std/barrier: Add missing runtime exception.

(cherry picked from commit d7f282c4243e24f567b11a5cb6048a27a3df733d)

2 years agolibstdc++: Add comparisons to std::default_sentinel_t (LWG 3719)
Jonathan Wakely [Thu, 4 Aug 2022 11:48:22 +0000 (12:48 +0100)] 
libstdc++: Add comparisons to std::default_sentinel_t (LWG 3719)

This library defect was recently approved for C++23.

libstdc++-v3/ChangeLog:

* include/bits/fs_dir.h (directory_iterator): Add comparison
with std::default_sentinel_t. Remove redundant operator!= for
C++20.
* (recursive_directory_iterator): Likewise.
* include/bits/iterator_concepts.h [!__cpp_lib_concepts]
(default_sentinel_t, default_sentinel): Define even if concepts
are not supported.
* include/bits/regex.h (regex_iterator): Add comparison with
std::default_sentinel_t. Remove redundant operator!= for C++20.
(regex_token_iterator): Likewise.
(regex_token_iterator::_M_end_of_seq()): Add noexcept.
* testsuite/27_io/filesystem/iterators/lwg3719.cc: New test.
* testsuite/28_regex/iterators/regex_iterator/lwg3719.cc:
New test.
* testsuite/28_regex/iterators/regex_token_iterator/lwg3719.cc:
New test.

(cherry picked from commit db33daa4677997399485176303406794dc900987)

2 years agolibstdc++: Fix std::is_nothrow_invocable_r for uncopyable prvalues [PR91456]
Jonathan Wakely [Fri, 23 Sep 2022 12:28:37 +0000 (13:28 +0100)] 
libstdc++: Fix std::is_nothrow_invocable_r for uncopyable prvalues [PR91456]

This is the last missing piece of PR 91456.

This also removes the only use of the C++11 version of
std::is_nothrow_invocable.

libstdc++-v3/ChangeLog:

PR libstdc++/91456
* include/std/type_traits (__is_nothrow_invocable): Remove.
(__is_invocable_impl::__nothrow_type): New member type which
checks if the conversion can throw.
(__is_nt_invocable_impl): Replace class template with alias
template to __is_nt_invocable_impl::__nothrow_type.
* testsuite/20_util/is_nothrow_invocable/91456.cc: New test.
* testsuite/20_util/is_nothrow_convertible/value.cc: Remove
macro used by value_ext.cc test.
* testsuite/20_util/is_nothrow_convertible/value_ext.cc: Remove
test for non-standard __is_nothrow_invocable trait.

(cherry picked from commit 71c828f84572d933979468baf2cf744180258ee4)

2 years agoDaily bump.
GCC Administrator [Thu, 24 Nov 2022 00:21:33 +0000 (00:21 +0000)] 
Daily bump.

2 years agoDaily bump.
GCC Administrator [Wed, 23 Nov 2022 00:21:13 +0000 (00:21 +0000)] 
Daily bump.

2 years agolibstdc++: Add workaround for fs::path constraint recursion [PR106201]
Jonathan Wakely [Tue, 22 Nov 2022 18:15:56 +0000 (18:15 +0000)] 
libstdc++: Add workaround for fs::path constraint recursion [PR106201]

This works around a compiler bug where overload resolution attempts
implicit conversion to path in order to call a function with a path&
parameter. Such conversion would produce a prvalue, which would not be
able to bind to the lvalue reference anyway. Attempting to check the
conversion causes a constraint recursion because the arguments to the
path constructor are checked to see if they're iterators, which checks
if they're swappable, which tries to use the swap function that
triggered the conversion in the first place.

This replaces the swap function with an abbreviated function template
that is constrained with same_as<path> auto& so that the invalid
conversion is never considered.

libstdc++-v3/ChangeLog:

PR libstdc++/106201
* include/bits/fs_path.h (filesystem::swap(path&, path&)):
Replace with abbreviated function template.
* include/experimental/bits/fs_path.h (filesystem::swap):
Likewise.
* testsuite/27_io/filesystem/iterators/106201.cc: New test.
* testsuite/experimental/filesystem/iterators/106201.cc: New test.

2 years agolibstdc++: Fix pool resource build errors for H8 [PR107801]
Jonathan Wakely [Tue, 22 Nov 2022 09:53:36 +0000 (09:53 +0000)] 
libstdc++: Fix pool resource build errors for H8 [PR107801]

The array of pool sizes was previously adjusted to work for msp430-elf
which has 16-bit int and either 16-bit size_t or 20-bit size_t. The
largest pool sizes were disabled unless size_t has more than 20 bits.

The H8 family has 16-bit int but 32-bit size_t, which means that the
largest sizes are enabled, but 1<<15 produces a negative number that
then cannot be narrowed to size_t.

Replace the test for 32-bit size_t with a test for 32-bit int, which
means we won't use the 4kiB to 4MiB pools for targets with 16-bit int
even if they have a wider size_t.

libstdc++-v3/ChangeLog:

PR libstdc++/107801
* src/c++17/memory_resource.cc (pool_sizes): Disable large pools
for targets with 16-bit int.

(cherry picked from commit 0f9659e770304d3c44cfa0e793833a461bc487aa)

2 years agoDaily bump.
GCC Administrator [Tue, 22 Nov 2022 00:21:37 +0000 (00:21 +0000)] 
Daily bump.

2 years agoi386: Uglify some local identifiers in *intrin.h [PR107748]
Jakub Jelinek [Mon, 21 Nov 2022 09:28:27 +0000 (10:28 +0100)] 
i386: Uglify some local identifiers in *intrin.h [PR107748]

While reporting PR107748 (where is a problem with non-uglified names,
but I've left it out because it needs fixing anyway), I've noticed
various spots where identifiers in *intrin.h headers weren't uglified.
The following patch fixed those that are related to unions (I've grepped
for [a-zA-Z]\.[a-zA-Z] spots).
The reason we need those to be uglified is the same as why the arguments
of the inlines are __ prefixed and most of automatic vars in the inlines
- say a, v or u aren't part of implementation namespace and so users could
 #define u whatever->something
 #include <x86intrin.h>
and it should still work, as long as u is not e.g. one of the names
of the functions/macros the header provides (_mm* etc.).

2022-11-21  Jakub Jelinek  <jakub@redhat.com>

PR target/107748
* config/i386/avx512fp16intrin.h (_mm512_castph512_ph128,
_mm512_castph512_ph256, _mm512_castph128_ph512,
_mm512_castph256_ph512, _mm512_set1_pch): Uglify names of local
variables and union members.
* config/i386/avx512fp16vlintrin.h (_mm256_castph256_ph128,
_mm256_castph128_ph256, _mm256_set1_pch, _mm_set1_pch): Likewise.
* config/i386/smmintrin.h (_mm_extract_ps): Likewise.
* config/i386/avx512bf16intrin.h (_mm_cvtsbh_ss): Likewise.

(cherry picked from commit ec8ec09f9414be871e322fecf4ebf53e3687bd22)

2 years agoDaily bump.
GCC Administrator [Mon, 21 Nov 2022 00:21:29 +0000 (00:21 +0000)] 
Daily bump.

2 years agoreg-stack: Fix a -fcompare-debug bug in reg-stack [PR107183]
Jakub Jelinek [Sun, 20 Nov 2022 16:42:42 +0000 (17:42 +0100)] 
reg-stack: Fix a -fcompare-debug bug in reg-stack [PR107183]

As the following testcase shows, the swap_rtx_condition function
in reg-stack can result in different code generation between -g and -g0.
The function is doing the changes as it goes, so does analysis and
changes together, which makes it harder to deal with DEBUG_INSNs,
where normally analysis phase ignores them and the later phase
doesn't.
swap_rtx_condition walks instructions two different ways, one is
using next_flags_user function which stops on non-call instructions
that mention the flags register, and the other is a loop on fnstsw
where it stops on instructions mentioning it and tries to find
sahf instruction that uses it (in both cases calls stop it and so
does end of basic block).
Now both of these currently stop on DEBUG_INSNs that mention
the flags register resp. the fnstsw result register.
On success the function recurses on next flags user instruction
if still live and if the recursion failed, reverts the changes
it did too and fails.
If it were just for the next_flags_user case, the fix could be
just not doing
      INSN_CODE (insn) = -1;
      if (recog_memoized (insn) == -1)
        fail = 1;
on DEBUG_INSNs (assuming all changes to those are fine),
swap_rtx_condition_1 just changes one comparison to a different
one.  But due to the possibility of fnstsw result being used
in theory before sahf in some DEBUG_INSNs, this patch takes
a different approach.  swap_rtx_condition has now a new argument
and two modes.  The first mode is when debug_seen is >= 0, in this
case both next_flags_user and the loop for fnstsw -> sahf will
ignore but note DEBUG_INSNs (that mention flags register or fnstsw
result).  If no such DEBUG_INSN is found during the whole call
including recursive invocations (so e.g. for -g0 but probably most
often for -g as well), it behaves as before, if it returns true
all the changes are done and nothing further needs to be done later.
If any DEBUG_INSNs are seen along the way, even when returning success
all the changes are reverted, so it just reports that the function
would be successful if DEBUG_INSNs were ignored.
In this case, compare_for_stack_reg needs to call it again in
debug_seen = -1 mode, which tells the function to update everything
including DEBUG_INSNs.  For the fnstsw -> sahf case which I hope
will be very rare I just reset the DEBUG_INSNs, I don't really
know how to express it easily otherwise.  For the rest
swap_rtx_condition_1 is done even on the DEBUG_INSNs.

2022-11-20  Jakub Jelinek  <jakub@redhat.com>

PR target/107183
* reg-stack.cc (next_flags_user): Add DEBUG_SEEN argument.
If >= 0 and a DEBUG_INSN would be otherwise returned, set
DEBUG_SEEN to 1 and ignore it.
(swap_rtx_condition): Add DEBUG_SEEN argument.  In >= 0
mode only set DEBUG_SEEN to 1 if problematic DEBUG_ISNSs
were seen and revert all changes on success in that case.
Don't try to recog_memoized DEBUG_INSNs.
(compare_for_stack_reg): Adjust swap_rtx_condition caller.
If it returns true and debug_seen is 1, call swap_rtx_condition
again with debug_seen -1.

* gcc.dg/ubsan/pr107183.c: New test.

(cherry picked from commit 6b5c98c1c0003bd470a4428bede6c862637a94b8)

2 years agoc++: Fix a typo in function name
Jakub Jelinek [Tue, 15 Nov 2022 07:17:11 +0000 (08:17 +0100)] 
c++: Fix a typo in function name

I've noticed I've made a typo in the name of the function.
Fixed thusly.

2022-11-15  Jakub Jelinek  <jakub@redhat.com>

* cp-tree.h (next_common_initial_seqence): Rename to ...
(next_common_initial_sequence): ... this.
* typeck.cc (next_common_initial_seqence): Rename to ...
(next_common_initial_sequence): ... this.
(layout_compatible_type_p): Call next_common_initial_sequence
rather than next_common_initial_seqence.
* semantics.cc (is_corresponding_member_aggr): Likewise.

(cherry picked from commit 87c4057b3fc7fe2c2f8914d2755024ca890a3bc1)

2 years agolibatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688]
Jakub Jelinek [Tue, 15 Nov 2022 07:14:45 +0000 (08:14 +0100)] 
libatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688]

We got a response from AMD in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688#c10
so the following patch starts treating AMD with AVX and CMPXCHG16B
ISAs like Intel by using vmovdqa for atomic load/store in libatomic.
We still don't have confirmation from Zhaoxin and VIA (anything else
with CPUs featuring AVX and CX16?).

2022-11-15  Jakub Jelinek  <jakub@redhat.com>

PR target/104688
* config/x86/init.c (__libat_feat1_init): Don't clear
bit_AVX on AMD CPUs.

(cherry picked from commit 4a7a846687e076eae58ad3ea959245b2bf7fdc07)

2 years agonvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'
Thomas Schwinge [Fri, 18 Nov 2022 22:57:52 +0000 (23:57 +0100)] 
nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'

A recent nvptx-tools change: commit 886a95faf66bf66a82fc0fe7d2a9fd9e9fec2820
"ld: Don't search for input files in '-L'directories" (of
<https://github.com/MentorEmbedded/nvptx-tools/pull/38>
"Match standard 'ld' "search" behavior") in GCC/nvptx target testing
generally causes linking to fail with:

    error opening crt0.o
    collect2: error: ld returned 1 exit status
    compiler exited with status 1

Indeed per GCC '-v' output, there is an undecorated 'crt0.o' on the linker
('collect2') command line:

     [...]/build-gcc/./gcc/collect2 -o [...] crt0.o [...]

This is due to:

    gcc/config/nvptx/nvptx.h:#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"

..., and the fix, as used by numerous other GCC targets, is to instead use
'crt0.o%s'; for '%s' means, per 'gcc/gcc.cc', "The Specs Language":

     %s     current argument is the name of a library or startup file of some sort.
            Search for that file in a standard list of directories
            and substitute the full name found.

With that, we get the expected path to 'crt0.o'.

gcc/
* config/nvptx/nvptx.h (STARTFILE_SPEC): Fix 'crt0.o' for
'-mmainkernel'.

(cherry picked from commit dda43e1ef0c9f6c32ad022d3a08ce7651e42a129)

2 years agoLoongArch: Fix atomic_exchange expanding [PR107713]
Jinyang He [Thu, 17 Nov 2022 06:38:52 +0000 (14:38 +0800)] 
LoongArch: Fix atomic_exchange expanding [PR107713]

We used to expand atomic_exchange_n(ptr, new, mem_order) for subword types
into something like:

    {
      __typeof__(*ptr) t = atomic_load_n(ptr, mem_order);
      atomic_compare_exchange_n(ptr, &t, new, true, mem_order, mem_order);
      return t;
    }

It's incorrect because another thread may store a different value into *ptr
after atomic_load_n.  Then atomic_compare_exchange_n will not store into
*ptr, but atomic_exchange_n should always perform the store.

gcc/ChangeLog:

PR target/107713
* config/loongarch/sync.md
(atomic_cas_value_exchange_7_<mode>): New define_insn.
(atomic_exchange): Use atomic_cas_value_exchange_7_si instead of
atomic_cas_value_cmp_and_7_si.

gcc/testsuite/ChangeLog:

PR target/107713
* gcc.target/loongarch/pr107713-1.c: New test.
* gcc.target/loongarch/pr107713-2.c: New test.

(cherry picked from commit f0024bfb228f94e60e06dc32a4983e40a9b90be5)

2 years agoDaily bump.
GCC Administrator [Fri, 18 Nov 2022 18:13:03 +0000 (18:13 +0000)] 
Daily bump.