Commit Graph

221049 Commits

Author SHA1 Message Date
Kwok Cheung Yeung
85115e3494 openmp: Fix regression in libgomp.c++/target-6.C testcase [PR113436]
The fix for PR113436 introduced a regression causing the
libgomp.c++/target-6.C testcase to fail on some configurations.

This was caused by a change in how is_variable_sized is applied for variables
that are references in private clauses, causing the path that was intended for
variables that are variable-sized in themselves to be taken, instead of
that for referencing a variable-sized object.

2026-02-20  Kwok Cheung Yeung  <kcyeung@baylibre.com>

gcc/

	PR middle-end/113436
	* omp-low.cc (omp_lower_target):  Do not check for variable-length
	variables in private clauses by reference when allocating memory.

gcc/testsuite/

	PR middle-end/113436
	* g++.dg/gomp/pr113436-2.C: New.

(cherry picked from commit 92325afa25)
2026-02-20 17:44:37 +00:00
Tobias Burnus
1fd2b76e7d ChangeLog.omp bump 2026-02-13 12:39:49 +01:00
Tobias Burnus
a041efa158 contrib/gcc-changelog/git_update_version.py: Add ignored_commits
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py (ignored_commits): Add one.
2026-02-13 12:39:42 +01:00
Tobias Burnus
186fd25041 Fix gcc/testsuite/*/gomp/pr113436* [PR113436]
Testcases in gcc/testsuite/ may not '#include <omp.h>' or 'use omp_lib';
instead, now a local declaration of the enum/Fortran-parameter values is
used.

gcc/testsuite/ChangeLog:

	PR middle-end/113436
	* c-c++-common/gomp/pr113436-1.c: Replace '#include <omp.h>' by
	local declaration for omp_allocator_handle_t.
	* c-c++-common/gomp/pr113436-2.c: Likewise.
	* g++.dg/gomp/pr113436.C: Likewise.
	* gfortran.dg/gomp/pr113436-1.f90: Replace 'use omp_lib' by local
	omp_*_mem_alloc parameter declarations.
	* gfortran.dg/gomp/pr113436-2.f90: Likewise.
	* gfortran.dg/gomp/pr113436-3.f90: Likewise.
	* gfortran.dg/gomp/pr113436-4.f90: Likewise.

(cherry picked from commit eb311dc3db)
2026-02-13 12:36:04 +01:00
Kwok Cheung Yeung
64a5a58901 openmp: Allocate memory for private/firstprivate clauses as directed by allocate clauses in target constructs [PR113436]
This patch generates calls to GOMP_alloc to allocate memory for firstprivate
and private clauses on target constructs with an allocator and alignment
as specified by the allocate clause.

The decl values of the clause need to be adjusted to refer to the allocated
memory, and the initial values of variables need to be copied into the
allocated space for firstprivate variables.

For variable-length arrays, the size of the array is stored in a separate
variable, so the allocation and initialization need to be delayed until the
size is made available on the target.

gcc/

	PR middle-end/113436
	* omp-low.cc (is_variable_sized): Add extra is_ref argument.  Check
	referenced type if true.
	(lower_omp_target): Call lower_private_allocate to generate code to
	allocate memory for firstprivate/private clauses with allocators, and
	insert code after dependent variables have been initialized.
	Construct calls to free allocate memory and insert after target block.
	Adjust decl values for clause variables.  Copy value of firstprivate
	variables to allocated memory.

gcc/testsuite/

	PR middle-end/113436
	* c-c++-common/gomp/pr113436-1.c: New.
	* c-c++-common/gomp/pr113436-2.c: New.
	* g++.dg/gomp/pr113436.C: New.
	* gfortran.dg/gomp/pr113436-1.f90: New.
	* gfortran.dg/gomp/pr113436-2.f90: New.
	* gfortran.dg/gomp/pr113436-3.f90: New.
	* gfortran.dg/gomp/pr113436-4.f90: New.

libgomp/

	PR middle-end/113436
	* libgomp.texi (OpenMP 5.0): Mark allocate clause as implemented.
	(Memory allocation): Add documentation for use in target construct.
	* testsuite/libgomp.c++/firstprivate-1.C: Enable alignment check.
	* testsuite/libgomp.c++/pr113436-1.C: New.
	* testsuite/libgomp.c++/pr113436-2.C: New.
	* testsuite/libgomp.c++/private-1.C: Enable alignment check.
	* testsuite/libgomp.c-c++-common/pr113436-1.c: New.
	* testsuite/libgomp.c-c++-common/pr113436-2.c: New.
	* testsuite/libgomp.fortran/pr113436-1.f90: New.
	* testsuite/libgomp.fortran/pr113436-2.f90: New.

(cherry picked from commit 6eec7a3687)
2026-02-12 19:50:43 +00:00
Tobias Burnus
a06b9b637c Merge branch 'releases/gcc-15' into devel/omp/gcc-15
Merge up to r15-10797-g68b601e153bad5 (Feb 6, 2026)

In particular, it also contains the commit r15-10729-g786def4bda5209
  openmp: Fix up OpenMP loop parsing in templates [PR123597]
2026-02-06 14:35:16 +01:00
Torbjörn SVENSSON
68b601e153 testsuite: forward extra arguments from $GCC_UNDER_TEST to gcc-ar
gcc/testsuite/ChangeLog:

	* lib/lto.exp (lto-build-archive): Forward extra command line
	arguments from $GCC_UNDER_TEST to gcc-ar.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit c73831b61b)
2026-02-06 13:54:52 +01:00
Torbjörn SVENSSON
f7421d25a2 gcc: avoid redefinition of CONST_CAST2 macro
When building GCC with host=mingw, the following warning can be seen
multiple times in the build log if the MinGW GCC version is older than
r13-4881-g9149a5b7e0a:

In file included from /build/gcc/c/c-typeck.cc:27:0:
/build/gcc/system.h:1172:0: warning: "CONST_CAST2" redefined
 #define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))

In file included from /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/x86_64-w64-mingw32/bits/gthr.h:148:0,
                 from /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/ext/atomicity.h:35,
                 from /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/memory:73,
                 from /build/gcc/gcc/system.h:231,
                 from /build/gcc/gcc/c/c-typeck.cc:27:
/usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/include/c++/x86_64-w64-mingw32/bits/gthr-default.h:33:0: note: this is the location of the previous definition
 #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)

To ensure that the recent definition is used, always undefine any
potential define before defining the new macro.

gcc/ChangeLog:

	* system.h: Avoid redefinition of CONST_CAST2 macro.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2026-02-06 10:38:01 +01:00
Tomasz Kamiński
04e8f8ac94 libstdc++: Do not require assignment for vector::resize(n, v) [PR90192]
This patch introduces a new function, _M_fill_append, which is invoked when
copies of the same value are appended to the end of a vector. Unlike
_M_fill_insert(end(), n, v), _M_fill_append never permute elements in place,
so it does not require:
* vector element type to be assignable;
* a copy of the inserted value, in the case where it points to an
  element of the vector.

vector::resize(n, v) now uses _M_fill_append, fixing the non-conformance where
element types were required to be assignable.

In addition, _M_fill_insert(end(), n, v) now delegates to _M_fill_append, which
eliminates an unnecessary copy of v when the existing capacity is used.

	PR libstdc++/90192

libstdc++-v3/ChangeLog:

	* include/bits/stl_vector.h (vector<T>::_M_fill_append): Declare.
	(vector<T>::fill): Use _M_fill_append instead of _M_fill_insert.
	* include/bits/vector.tcc (vector<T>::_M_fill_append): Define
	(vector<T>::_M_fill_insert): Delegate to _M_fill_append when
	elements are appended.
	* testsuite/23_containers/vector/modifiers/moveable.cc: Updated
	copycount for inserting at the end (appending).
	* testsuite/23_containers/vector/modifiers/resize.cc: New test.
	* testsuite/backward/hash_set/check_construct_destroy.cc: Updated
	copycount, the hash_set constructor uses insert to fill buckets
	with nullptrs.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
(cherry picked from commit 390f3a690c)
2026-02-06 07:59:28 +01:00
GCC Administrator
9df216ec3a Daily bump. 2026-02-06 00:20:01 +00:00
Joseph Myers
d22d02efae Update gcc es.po
* es.po: Update.
2026-02-05 22:01:49 +00:00
Kyrylo Tkachov
41ea5419a9 aarch64: Adjust PR117048 scan assembly test
This test needed adjustment for the changes from PR123584.
Pushing to trunk.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>

gcc/testsuite/

	PR target/117048
	PR target/123584
	* gcc.target/aarch64/simd/pr117048.c: Scan for # in assembly immediate.

(cherry picked from commit 216bda1130)
2026-02-05 16:54:14 +01:00
Karl Meakin
54103e99fa aarch64: fix XAR tests
Some tests were failing because the pattern was not accounting for the
`#` before the immediate argument.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/rotate_xar_1.c
	* gcc.target/aarch64/sha3_1.c
	* gcc.target/aarch64/sha3_2.c
	* gcc.target/aarch64/sha3_3.c
	* gcc.target/aarch64/xar_v2di_nonsve.c: Fix tests.

(cherry picked from commit 2591468a54)
2026-02-05 16:54:05 +01:00
Kyrylo Tkachov
30b077e1f4 aarch64: PR target/123584 - Fix expansion of SHA3 XAR with 0 amount
In this PR the vxarq_u64 intrinisc gets passed a rotate amount of 0
and the patterns don't handle it right.  Because we adjust RTL amount
during expand to account for the canonical representation we end up
emitting a V2DImode rotate of 64, which the output instruction is not
prepared to handle.  What we should be doing is leaving it as 0 in
that case, which is what this patch does.

A XAR with a rotate of 0 is really just an EOR and we could have emitted
it as such but I thought that, at least at -O0, it would be nicer to emit
the XAR-0 form as it's still a legal instruction and the user did ask for
it through the intrinsic.  At -O1 and above the optimisers kick in and simplify
it to an EOR anyway.

Note: the SVE2 XAR instruction doesn't suffer from this problem because a
rotate amount of 0 is actually not allowed by the instruction itself and
the early intrinsic validation rejects it anyway.

Bootstrapped and tested on aarch64-none-linux-gnu.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>

gcc/

	PR target/123584
	* config/aarch64/aarch64-simd.md (aarch64_xarqv2di): Leave zero
	rotate amounts as zero during expansion.
	(*aarch64_xarqv2di_insn): Account for zero rotate amounts.  Print #
	in rotate immediate.

gcc/testsuite/

	PR target/123584
	* gcc.target/aarch64/torture/xar-zero.c: New test.

(cherry picked from commit 47a48e74e4)
2026-02-05 16:53:40 +01:00
Patrick Palka
a423c59498 c++: cv-qualified pack index propagation [PR122169]
Since type pack indexes can be cv-qualified, we need to propagate their
qualifiers when substituting them.

	PR c++/122169

gcc/cp/ChangeLog:

	* pt.cc (tsubst_pack_index): Propagate cv-qualifiers of
	PACK_INDEX_TYPE.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp26/pack-indexing19.C: New test.

Reviewed-by: Marek Polacek <polacek@redhat.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 6385a3582c)
2026-02-05 09:25:01 -05:00
Torbjörn SVENSSON
4fa36577fc testsuite: lto: transform gcc-ar to include prefix
When the the gcc binary is named arm-none-eabi-gcc, the gcc-ar binary
will be named arm-none-eabi-gcc-ar.  The current approach works fine as
long as the binary does not contain any prefix, but if it does, the
gcc-ar binary will not be found.

gcc/testsuite/ChangeLog

	* lib/lto.exp (lto-build-archive): Transform gcc-ar binary name.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
(cherry picked from commit c9addbc79a)
2026-02-05 14:44:30 +01:00
Tomasz Kamiński
aa01b849ab libstdc++: Use overload operator<=> when provided in relational functors [PR114153]
The implementation of less<> did not consider the possibility of t < u being
rewritten from overloaded operator<=>. This lead to situation when for t,u that:
* provide overload operator<=>, such that (t < u) is rewritten to (t <=> u) < 0,
* are convertible to pointers,
the expression std::less<>(t, u) would incorrectly result in call of
std::less<void*> on values converted to the pointers, instead of t < u.
The similar issues also occurred for greater<>, less_equal<>, greater_equal<>,
their range equivalents, and in three_way_compare for heterogeneous calls.

This patch addresses above, by also checking for free-functions and member
overloads of operator<=>, before falling back to pointer comparison. We do
not put any constraints on the return type of selected operator, in particular
in being one of the standard defined comparison categories, as the language
does not put any restriction of returned type, and if (t <=> u) is well
formed, (t op u) is interpreted as (t <=> u) op 0. If that later expression
is ill-formed, the expression using op also is (see included tests).

The relational operator rewrites try both order of arguments, t < u,
can be rewritten into operator<=>(t, u) < 0 or 0 < operator<=>(u, t), it
means that we need to test both operator<=>(T, U) and operator<=>(U, T)
if T and U are not the same types. This is now extracted into
__not_overloaded_spaceship helper concept, placed in <concepts>, to
avoid extending set of includes.

The compare_three_way functor defined in compare, already considers overloaded
operator<=>, however it does not consider reversed candidates, leading
to situation in which t <=> u results in 0 <=> operator<=>(u, t), while
compare_three_way{}(t, u) uses pointer comparison. This is also addressed by
using __not_overloaded_spaceship, that check both order of arguments.

Finally, as operator<=> is introduced in C++20, for std::less(_equal)?<>,
std::greater(_equal)?<>, we use provide separate __ptr_cmp implementation
in that mode, that relies on use of requires expression. We use a nested
requires clause to guarantee short-circuiting of their evaluation.
The operator() of aforementioned functors is reworked to use if constexpr,
in all standard modes (as we allow is as extension), eliminating the need
for _S_cmp function.

	PR libstdc++/114153

libstdc++-v3/ChangeLog:

	* include/bits/ranges_cmp.h (__detail::__less_builtin_ptr_cmp):
	Add __not_overloaded_spaceship spaceship check.
	* include/bits/stl_function.h (greater<void>::operator())
	(less<void>::operator(), greater_equal<void>::operator())
	(less_equal<void>::operator()): Implement using if constexpr.
	(greater<void>::__S_cmp, less<void>::__S_cmp)
	(greater_equal<void>::__ptr_comp, less_equal<void>::S_cmp):
	Remove.
	(greater<void>::__ptr_cmp, less<void>::__ptr_cmp)
	(greater_equal<void>::__ptr_comp, less_equal<void>::ptr_cmp): Change
	tostatic constexpr variable. Define in terms of requires expressions
	and __not_overloaded_spaceship check.
	* include/std/concepts: (__detail::__not_overloaded_spaceship):
	Define.
	* libsupc++/compare: (__detail::__3way_builtin_ptr_cmp): Use
	__not_overloaded_spaceship concept.
	* testsuite/20_util/function_objects/comparisons_pointer_spaceship.cc: New test.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
(cherry picked from commit 8fad43b785)
2026-02-05 08:51:48 +01:00
Hongyu Wang
d0f04bc020 i386: Drop mask subst for define_insn_and_split of extend [PR123779]
For define_insn_and_split, the subst applied only for the define_insn
part, not the define_split part. So several define_insn_and_split with
mask_name is actually producing non-splitable insns, resulting ICE in
lra. Separate them to define_insn_and_split for mask/nonmask variants
to generate corresponding splitters.

	PR target/123779

gcc/ChangeLog:

	* config/i386/sse.md (*sse4_1_<code>v8qiv8hi2<mask_name>_2):
	Rename to ...
	(*sse4_1_<code>v8qiv8hi2_2): ... this, and drop mask conditions.
	(*avx2_<code>v8qiv8si2<mask_name>_2): Rename to ...
	(*avx2_<code>v8qiv8si2_2): ... this, and likewise.
	(*sse4_1_<code>v4qiv4si2<mask_name>_2): Rename to ...
	(*sse4_1_<code>v4qiv4si2_2): ... this, and likewise.
	(*sse4_1_<code>v4hiv4si2<mask_name>_2): Rename to ...
	(*sse4_1_<code>v4hiv4si2_2): ... this, and likewise.
	(*avx2_<code>v4qiv4di2<mask_name>_2): Rename to ...
	(*avx2_<code>v4qiv4di2_2): ... this, and likewise.
	(*avx2_<code>v4hiv4di2<mask_name>_2): Rename to ...
	(*avx2_<code>v4hiv4di2_2): ... this, and likewise.
	(*sse4_1_<code>v2hiv2di2<mask_name>_2): Rename to ...
	(*sse4_1_<code>v2hiv2di2_2): ... this, and likewise.
	(*sse4_1_<code>v2siv2di2<mask_name>_2): Rename to ...
	(*sse4_1_<code>v2siv2di2_2): ... this, and likewise.
	(*avx512f_<code>v8qiv8di2<mask_name>_2): Rename to ...
	(*avx512f_<code>v8qiv8di2_2): ... this.
	(*avx512vl_<code>v8qiv8hi2_mask_2): New define_insn_and_split.
	(*avx512vl_<code>v8qiv8si2_mask_2): Likewise.
	(*avx512vl_<code>v4qiv4si2_mask_2): Likewise.
	(*avx512vl_<code>v4hiv4si2_mask_2): Likewise.
	(*avx512f_<code>v8qiv8di2_mask_2): Likewise.
	(*avx512vl_<code>v4qiv4di2_mask_2): Likewise.
	(*avx512vl_<code>v4hiv4di2_mask_2): Likewise.
	(*avx512vl_<code>v2hiv2di2_mask_2): Likewise.
	(*avx512vl_<code>v2siv2di2_mask_2): Likewise.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 11ef3c2e4f)
2026-02-05 14:36:30 +08:00
Alexandre Oliva
f30695c5b5 testsuite: riscv: drop -mcpu=xt-c920 tests from gcc-15
Testcases were backport to gcc-15 that require support for a cpu that
is not supported by gcc-15.  Drop them.


for  gcc/testsuite/ChangeLog

	PR target/122051
	PR target/120642
	* gcc.target/riscv/pr122051.c: Remove.
	* gcc.target/riscv/rvv/xtheadvector/pr120642.c: Remove.
2026-02-04 23:06:40 -03:00
Alexandre Oliva
01aa184c60 testsuite: require hostedlib for pr123729.C
This testcase uses features not available when libstdc++ doesn't have
the hostedlib bits enabled.


for  gcc/testsuite/ChangeLog

	PR tree-optimization/123729
	* g++.dg/torture/pr123729.C: Require hostedlib.
2026-02-04 23:06:21 -03:00
Alexandre Oliva
54bae31e90 testsuite: aarch64: state pr123775.c requirements
The execution testcase requires sve2 and 128-bit sve hardware, but it
doesn't state those requiremnets.  I'm think the latter is implied by
the former, but I'm not entirely sure, so I'm requiring both
explicitly.


for  gcc/testsuite/ChangeLog

	PR middle-end/123775
	* gcc.target/aarch64/sve2/pr123775.c: Add sve128 and sve2 hw
	requirements.
2026-02-04 23:05:59 -03:00
GCC Administrator
f66cb6f1f3 Daily bump. 2026-02-05 00:19:33 +00:00
GCC Administrator
27531df9b2 Daily bump. 2026-02-04 00:19:47 +00:00
Jeff Law
a4abdfc221 [RISC-V][PR target/122051] Fix pmode_reg_or_uimm5_operand for thead vector
For this bug we're failing during vsetvl insertion, but the real problem
happens earlier.

Basically the slide instructions are using pmode_reg_or_uimm5_operand which has
an implementation that was appropriate when we integrated RVV, but which is
bogus once thead vector was added.  It was just a thin wrapper around
vector_length_operand.

vector_length_operand rejects most constants when thead vector is enabled.  LRA
saw the rK constraint, so it figured the (const_int 1) was a sensible
substitution for the relevant operand.  It was only during vsetvl insertion
that we made another change to the insn and tried to recognize it and boom
things blew up.

This patch makes pmode_reg_or_uimm5_operand independent of
vector_length_operand and everything is happy again.

Tested on riscv32-elf (verifying the selector properly skips the test) and
riscv64-elf where the ICE could be seen.  Bootstrap on the Pioneer and BPI just
started a short while ago, so no data for another 7/24 hours respectively, but
not expecting issues.

	PR target/122051
gcc/
	* config/riscv/predicates.md (pmode_reg_or_uimm5_operand): Implement
	directly rather than using vector_length_operand.

gcc/testsuite/
	* gcc.target/riscv/pr122051.c: New test.

(cherry picked from commit c34ccc8ba2)
2026-02-03 11:39:58 -07:00
Jeff Law
a60ad47c00 [RISC-V][PR target/120642] Avoid propagating constant AVL for theadvector
AVL propagation currently assumes that it can propagate a constant AVL into any
vector insn and trips an assert if the insn fails to recognize after such a
propagation.

However, for xtheadvector that is not a correct assumption; xtheadvector does
not allow the vector length to be a constant integer (other than zero which
allowed via x0).

After consulting with Jin Ma (thanks!) we agree the right fix is to avoid
creating the immediate AVL for xtheadvector.

This has been tested in my tester, just waiting for the pre-commit tester to
spin it.

	PR target/120642
gcc/
	* config/riscv/riscv-avlprop.cc (pass_avlprop::execute): Do not do
	constant AVL propagation for xtheadvector.

gcc/testsuite/
	* gcc.target/riscv/rvv/xtheadvector/pr120642.c: New test.

(cherry picked from commit f2e3886a30)
2026-02-03 10:11:18 -07:00
Alfie Richards
aefa9e6f2d aarch64: Fix issue with __pld builtin at -O0 [PR 123548]
This fixes the issues with __pld by changing the arguments in arm_acle.h
to be const which seems to stop the creation of SSA nodes.

	PR target/123548

gcc/ChangeLog:

	* config/aarch64/arm_acle.h (__plix): Change arguments to be
	const.
	(__pldx): Change arguments to be const.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/pr123548.c: New test.
2026-02-03 14:10:10 +00:00
GCC Administrator
bea4d9ac4a Daily bump. 2026-02-03 00:19:51 +00:00
Richard Biener
36d1b6216e debug/123886 - remove GTY((skip)) from external_die_map entry
The following avoids GCing IDENTIFIER_POINTERs referenced from
external_die_map after we clear ggc_protect_identifiers.  I never
expected those to be GCed.

	PR debug/123886
	* dwarf2out.cc (sym_off_pair::sym): Remove GTY((skip)).

(cherry picked from commit 2b44a1ab15)
2026-02-02 10:42:43 +01:00
Richard Biener
e5aa8dc286 tree-optimization/123794 - fix OMP SIMD scalar call removal
The following makes sure to purge VDEFs for all calls.

	PR tree-optimization/123794
	* tree-vect-slp.cc (vect_remove_slp_scalar_calls): Unlink
	VOPs for all calls.

	* gcc.dg/vect/vect-simd-clone-pr123794.c: New testcase.

(cherry picked from commit 3e0430bca4)
2026-02-02 10:42:43 +01:00
Richard Biener
de2f69adf3 middle-end/123775 - add missing expand_vec_cond_expr_p to patterns
This adds a missing check on supportability of a VEC_COND_EXPR
to a match.pd pattern.  The existing conditions, in particular
known_eq of TYPE_VECTOR_SUBPARTS, is not enough to distinguish
VNx4SImode from V4SImode with -msve-vector-bits=128.

	PR middle-end/123775
	* match.pd ((view_convert (vec_cond ...))): Make sure the
	resulting vec_cond can be expanded.

	* gcc.target/aarch64/sve2/pr123775.c: New testcase.

(cherry picked from commit 4f9a9c26da)
2026-02-02 10:42:43 +01:00
Richard Biener
bdb57f7862 tree-optimization/123729 - fix reduction epilog flowing into abnormal edge
When we vectorize a reduction and the reduction value flows across
an abnormal edge we have to make sure to mark the final SSA properly.
The following serves as a recipie how to avoid blindly copying
SSA_NAME_OCCURS_IN_ABNORMAL_PHI but instead set it when needed during
use replacement.

	PR tree-optimization/123729
	* tree-vect-loop.cc (vect_create_epilog_for_reduction): Set
	SSA_NAME_OCCURS_IN_ABNORMAL_PHI if the reduction flows
	across an abnomal edge.

	* g++.dg/torture/pr123729.C: New testcase.

(cherry picked from commit 06765f2e0f)
2026-02-02 10:42:42 +01:00
Richard Biener
6a0fdbd31f Add phi_arg_edge_from_use helper
I've needed this a few times now and indenting nested
phi_arg_index_from_use inside gimple_phi_arg_edge is difficult.

	* tree-phinodes.h (phi_arg_index_from_use): Use gphi *.
	(phi_arg_edge_from_use): New helper composing
	phi_arg_index_from_use and gimple_phi_arg_edge.

(cherry picked from commit 1acf01fcb6)
2026-02-02 10:42:42 +01:00
Richard Biener
d8f71bdb9d middle-end/123575 - fix ABS_EXPR folding for vectors
Folding away a conversion requires an optab check for vectors.

	PR middle-end/123575
	* match.pd (abs ((T)x) -> absu (x)): For vector type
	arguments require the resulting operation is supported.

	* g++.dg/pr123575.C: New testcase.

(cherry picked from commit 2672387929)
2026-02-02 09:24:09 +01:00
Richard Biener
42ad456350 tree-optimization/123537 - fix too permissive .REDUC_* folding
The following restricts the allowed conversions to those maintaining
the element type size.

	PR tree-optimization/123537
	* match.pd (REDUC (@0 & @1) -> @0[I] & @1[I]): Restrict
	allowed conversions.

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

(cherry picked from commit 6868526bb7)
2026-02-02 09:23:57 +01:00
Richard Biener
76e79a3714 ipa/116296 - avoid overflow in modref_access_node::contains
The following aovids overflow when scaling the param offset
difference by BITS_PER_UNIT by using poly_offset_int instead of
poly_int64 for the computations.

	PR ipa/116296
	* ipa-modref-tree.cc (modref_access_node::contains): Use
	poly_offset_int for the param offset difference and the
	overlap computation.

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

(cherry picked from commit ef652d7bd4)
2026-02-02 09:23:12 +01:00
Richard Biener
38a9c7885e tree-optimization/110043 - avoid overflow in pointer-query
pointer-query is built around using offset_int to avoid needing
to deal with overflow.  This falls apart when trying to analyze
array accesses indexed by __int128.  So don't.

	PR tree-optimization/110043
	* pointer-query.cc (get_offset_range): Fail for integer
	types with precision larger than ptrdiff_type_node.

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

(cherry picked from commit 7fdb0e1b18)
2026-02-02 09:22:36 +01:00
Richard Biener
490531cc07 tree-optimization/109410 - ICE with noreturn and -g
This fixes the -g variant of the original testcase.

	PR tree-optimization/109410
	* tree-ssa-reassoc.cc (build_and_add_sum): Use
	gsi_start_nondebug_after_labels_bb to look for a possible
	returns-twice call.

	* gcc.dg/pr109410-2.c: New testcase.

(cherry picked from commit 4fe48225fa)
2026-02-02 09:22:24 +01:00
Richard Biener
5ea0b7436f rtl-optimization/106859 - fix location dumping from var-tracking
We currently ICE when the locations include one without a setting insn.
Looking at cselib this seems to be a supported state so the following
arranges for this and dumps -1 as UID.

	PR rtl-optimization/106859
	* var-tracking.cc (val_store): Dump -1 as UID if setting_insn
	is NULL.

(cherry picked from commit 974182ec09)
2026-02-02 09:22:09 +01:00
Richard Biener
84a2174162 middle-end/123887 - fix another missing side-effect check
The following fixes up another pattern lacking a check for
side-effects on operands made evaluated unconditional.

	PR middle-end/123887
	* match.pd ((a ? x : y) !=/== (b ? x : y)): Make sure
	x and y have no side-effects before evaluating them
	unconditionally.

	* gcc.dg/torture/pr123887-2.c: New testcase.

(cherry picked from commit cd6c3d19f6)
2026-02-02 09:01:16 +01:00
Richard Biener
a8b02c07cd middle-end/123887 - trapping conditional operand turned unconditional
The following properly checks expr_no_side_effects_p on two patterns
that turns a conditionally evaluated operand into unconditonal.

	PR middle-end/123887
	* match.pd ((zero_one ==/!= 0) ? .. z <op> y .. -> zero_one * z ..):
	Check evaluating z unconditionally has no side-effects, like
	trapping.

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

(cherry picked from commit c1fa15791a)
2026-02-02 09:01:08 +01:00
GCC Administrator
252e7fac5c Daily bump. 2026-02-02 00:19:34 +00:00
Eric Botcazou
f41a53300c Add missing PR reference 2026-02-01 23:01:59 +01:00
Eric Botcazou
e51e2c59cb Ada: Fix prefixed-view notation rejected for discriminated private type
The problem comes from an oversight in Analyze_Selected_Component.

gcc/ada/
	PR ada/123902
	* sem_ch4.adb (Analyze_Selected_Component): Also test
	Core_Extensions_Allowed for discriminated private types.
	Rework and augment commentary throughout the procedure.

gcc/testsuite/
	* gnat.dg/prefix4.adb: New test.
	* gnat.dg/prefix4_pkg.ads: New helper.

Co-authored-by: Liam Powell <liam@liampwll.com>
2026-02-01 20:37:52 +01:00
Eric Botcazou
8a9f2bd7ab Ada: Fix iterator filter ignored on enumeration type with clause
The problem comes from an oversight in Expand_N_Loop_Statement.

gcc/ada/
	PR ada/121316
	* exp_ch5.adb (Expand_Iterator_Loop_Over_Array): Minor tweak.
	(Expand_Iterator_Loop_Over_Container): Likewise.
	(Expand_N_Loop_Statement): Use Statements (N) throughout.

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

Co-authored-by: Liam Powell <liam@liampwll.com>
2026-02-01 20:37:43 +01:00
GCC Administrator
198a9efe58 Daily bump. 2026-02-01 00:19:31 +00:00
GCC Administrator
f0f35f35e3 Daily bump. 2026-01-31 00:19:52 +00:00
Eric Botcazou
86e5c7dbf4 Ada: Fix spurious visibility error from limited_with clause in hierarchy
The problem is that the compiler installs the limited view of a package that
is already installed by the virtue of being an ancestor of the main unit.

gcc/ada/
	PR ada/123867
	* sem_ch10.adb (Analyze_Compilation_Unit): Output info message
	when -gnatdi is specified.
	(Install_Parents): Likewise.  Set the Is_Visible_Lib_Unit flag
	on the unit.
	(Install_Private_With_Clauses): Do not output info message here.
	(Remove_Parents): Output info message when -gnatdi is specified
	and clear the Is_Visible_Lib_Unit flag on the unit.

gcc/testsuite/
	* gnat.dg/specs/limited_with3.ads: New test.
	* gnat.dg/specs/limited_with3-child.ads: New helper.
	* gnat.dg/specs/limited_with3-child-grandchild.ads: Likewise.
	* gnat.dg/specs/limited_with3-child-grandchild-grandgrandchild.ads:
	Likewise.
2026-01-30 12:03:19 +01:00
Iain Buclaw
a5b55378c9 d: Fix infinite loop in dump_generic_node [PR123264]
PR d/123264

gcc/d/ChangeLog:

	* types.cc (finish_aggregate_type): Propagate struct TYPE_NAME to all
	TYPE_NEXT_VARIANT types.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit 94d887ec2b)
2026-01-30 07:45:01 +01:00
Lulu Cheng
c0aae47188 LoongArch: Remove unused function type.
gcc/ChangeLog:

	* config/loongarch/loongarch-ftypes.def: Remove unused type.

(cherry picked from commit a57199cec3)
2026-01-30 11:55:54 +08:00
Lulu Cheng
3534d9af5d LoongArch: Fix bug123766.
The pointer parameter type for the original store class builtin
functions is CVPOINTER (const volatile void *).
Taking the following test as an example:

	```
	v4i64 v = {0, 0, 0, 0};
	void try_store() {
  	  long r[4];
  	  __lasx_xvst(v, r, 0);
	}
	```
At this point, the type of r is CVPOINTER, which means data in memory
can only be read through r.  Therefore, if the array r is not
initialized, an uninitialized warning will be issued.
This patch changes the pointer type of store-class builtin functions
from CVPOINTER to VPOINTER (volatile void *).

	PR target/123766

gcc/ChangeLog:

	* config/loongarch/loongarch-builtins.cc
	(loongarch_build_vpointer_type): New function.  Return a type
	for 'volatile void *'.
	(LARCH_ATYPE_VPOINTER): New macro.
	* config/loongarch/loongarch-ftypes.def: Change the pointer
	type of the store class function from CVPOINTER to VPOINTER.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/vector/lasx/pr123766.c: New test.
	* gcc.target/loongarch/vector/lsx/pr123766.c: New test.

(cherry picked from commit fde8a30085)
2026-01-30 11:55:44 +08:00