]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
5 weeks agolibgomp.{c-c++-common,fortran}/target-is-accessible-1.c: Fix testcases for omp_defaul...
Tobias Burnus [Wed, 12 Nov 2025 13:15:43 +0000 (14:15 +0100)] 
libgomp.{c-c++-common,fortran}/target-is-accessible-1.c: Fix testcases for omp_default_device [P119677]

Commit r16-5188-g5da963d988e8ea added omp_default_device such that -5
became a conforming device number, but the tests used them to test
for as non-conforming number; now -6 is used.

libgomp/ChangeLog:

PR libgomp/119677

* testsuite/libgomp.c-c++-common/target-is-accessible-1.c: Modify
test as -5 is now a conforming device number.
* testsuite/libgomp.fortran/target-is-accessible-1.f90: Likewise.

5 weeks agoarm: Fix out of bounds when using cmse with FP types in aggregates [PR122539]
Andre Vieira [Wed, 12 Nov 2025 10:33:09 +0000 (10:33 +0000)] 
arm: Fix out of bounds when using cmse with FP types in aggregates [PR122539]

Skip partial register clearing logic when dealing with FP_REGS in aggregates as
these are always fully cleared and the logic assumes a mask for each of the 4
argument GPR_REGS.

gcc/ChangeLog:

PR target/122539
* config/arm/arm.cc (comp_not_to_clear_mask_str_un): Skip partial
register clearing logic for FP_REGS.
(compute_not_to_clear_mask): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/arm/cmse/mainline/8m/hard/union-fp.c: New.
* gcc.target/arm/cmse/baseline/union-4.c: New.
* gcc.target/arm/cmse/mainline/8m/hard/union-4.c: New.
* gcc.target/arm/cmse/mainline/8m/soft/union-4.c: New.
* gcc.target/arm/cmse/mainline/8m/softfp/union-4.c: New.
* gcc.target/arm/cmse/union-4.x: New.

5 weeks agoarm: Fix CMSE clearing of union members with no padding [PR122539]
Andre Vieira [Wed, 12 Nov 2025 10:25:14 +0000 (10:25 +0000)] 
arm: Fix CMSE clearing of union members with no padding [PR122539]

This patch fixes the CMSE register clearing to make sure we don't clear
registers used by a function call.  Before this patch the algorithm would only
correctly handle registers with padding bits to clear, any registers that were
fully utilised would be wrongfully cleared.

gcc/ChangeLog:

PR target/122539
* config/arm/arm.cc (comp_not_to_clear_mask_str_un): Update
not_to_clear_reg_mask for union members.

gcc/testsuite/ChangeLog:

* gcc.target/arm/cmse/union-3.x: New test.
* gcc.target/arm/cmse/baseline/union-3.c: New test.
* gcc.target/arm/cmse/mainline/8m/union-3.c: New test.
* gcc.target/arm/cmse/mainline/8_1m/union-3.c: New test.

5 weeks agos390: Support global stack protector
Stefan Schulze Frielinghaus [Wed, 12 Nov 2025 10:24:38 +0000 (11:24 +0100)] 
s390: Support global stack protector

So far only a per thread canary in the TLS block is supported.  This
patch adds support for a global canary, too.  For this the new option
-mstack-protector-guard={global,tls} is added which defaults to tls.

The global canary is expected at symbol __stack_chk_guard which means
for a function prologue instructions larl/l(g)fr + mvc are emitted and
for an epilogue larl/l(g)fr + clc.

Furthermore, option -mstack-protector-guard-record is added which is
inspired by -mrecord-mcount and generates section __stack_protector_loc
containing pointers to all instructions which load the address of the
global guard.  Thus, this option has only an effect in conjunction with
-mstack-protector-guard=global.  The intended use is for the Linux
kernel in order to support run-time patching.  In each task_struct of
the kernel a canary is held which will be copied into the lowcore.
Since the kernel supports migration of the lowcore at boot time,
addresses are not necessarily constant.  Therefore, the kernel expects
that all instructions loading the address of the canary to be of format
RIL or more precisely are either larl or lgrl and that the instructions
addresses are recorded in section __stack_protector_loc.  The kernel is
then required to patch those instructions e.g. to llilf during boot.

In total this means -mstack-protector-guard=global emits code suitable
for user and kernel space.

gcc/ChangeLog:

* config/s390/s390-opts.h (enum stack_protector_guard): Define
SP_TLS and SP_GLOBAL.
* config/s390/s390.h (TARGET_SP_GLOBAL_GUARD): Define predicate.
(TARGET_SP_TLS_GUARD): Define predicate.
* config/s390/s390.md (stack_protect_global_guard_addr<mode>):
New insn.
(stack_protect_set): Also deal with a global guard.
(stack_protect_test): Also deal with a global guard.
* config/s390/s390.opt (-mstack-protector-guard={global,tls}):
New option.
(-mstack-protector-guard-record) New option.

gcc/testsuite/ChangeLog:

* gcc.target/s390/stack-protector-guard-global-1.c: New test.
* gcc.target/s390/stack-protector-guard-global-2.c: New test.
* gcc.target/s390/stack-protector-guard-global-3.c: New test.
* gcc.target/s390/stack-protector-guard-global-4.c: New test.

5 weeks agotree-optimization/122647 - missing bool pattern for bool -> float conversion
Richard Biener [Wed, 12 Nov 2025 09:03:23 +0000 (10:03 +0100)] 
tree-optimization/122647 - missing bool pattern for bool -> float conversion

The following adds missing support for bool to float conversion which
can be exposed via C++ __builtin_bit_cast.  It also corrects a too
lose check in vectorizable_conversion which would have resolved the
ICE but left us with the missed optimization.

PR tree-optimization/122647
* tree-vect-stmts.cc (vectorizable_conversion): Fix guard on
bool to non-bool conversion.
* tree-vect-patterns.cc (vect_recog_bool_pattern): Also handle
FLOAT_EXPR from bool.

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

5 weeks agoRISC-V: Add Andes 25 series pipeline description.
Kuan-Lin Chen [Wed, 12 Nov 2025 02:44:26 +0000 (10:44 +0800)] 
RISC-V: Add Andes 25 series pipeline description.

gcc/ChangeLog:

* config/riscv/andes-25-series.md: New file.
* config/riscv/riscv-cores.def (RISCV_TUNE): Add andes-25-series.
(RISCV_CORE): Add Andes 25-series cpu list.
* config/riscv/riscv-opts.h
(enum riscv_microarchitecture_type): Add andes_25_series_.
* config/riscv/riscv.cc: Add andes_25_tune_info.
* config/riscv/riscv.md: Add andes_25.
* doc/riscv-mcpu.texi: Regenerated for Andes cpu list.
* doc/riscv-mtune.texi: Regenerated for andes-25-series.

5 weeks agolibgomp.texi: Add OpenMP TR14 implementation status
Tobias Burnus [Wed, 12 Nov 2025 09:20:02 +0000 (10:20 +0100)] 
libgomp.texi: Add OpenMP TR14 implementation status

libgomp/ChangeLog:

* libgomp.texi (OpenMP Implementation Status): Add TR14.

5 weeks agoOpenMP: Add omp_default_device named constant [PR119677]
Tobias Burnus [Wed, 12 Nov 2025 09:18:18 +0000 (10:18 +0100)] 
OpenMP: Add omp_default_device named constant [PR119677]

OpenMP TR 14 (OpenMP 6.1) adds omp_default_device < -1 as
named constant alongside omp_initial_device and omp_default_device.

GCC supports it already internally via GOMP_DEVICE_DEFAULT_OMP_61,
but this patch now adds the omp_default_device enum/PARAMETER to
omp.h / omp_lib.

Note that PR119677 requests some cleanups, which still have to be
done.

PR libgomp/119677

gcc/fortran/ChangeLog:

* intrinsic.texi (OpenMP Modules): Add omp_default_device.
* openmp.cc (gfc_resolve_omp_context_selector): Accept
omp_default_device as conforming device number.

libgomp/ChangeLog:

* omp.h.in (omp_default_device): New enum value.
* omp_lib.f90.in: New parameter.
* omp_lib.h.in: Likewise
* target.c (gomp_get_default_device): New. Split off from ...
(resolve_device): ... here; call it.
(omp_target_alloc, omp_target_free, omp_target_is_present,
omp_target_memcpy_check, omp_target_memset, omp_target_memset_async,
omp_target_associate_ptr, omp_get_mapped_ptr,
omp_target_is_accessible, omp_pause_resource,
omp_get_uid_from_device): Handle omp_default_device.
* testsuite/libgomp.c/device_uid.c: Likewise.
* testsuite/libgomp.fortran/device_uid.f90: Likewise.
* testsuite/libgomp.c-c++-common/omp-default-device.c: New test.
* testsuite/libgomp.fortran/omp-default-device.f90: New test.

5 weeks agolibstdc++: Add ranges::borrowed_range specialization for optional<T&> [PR122425]
Tomasz Kamiński [Thu, 6 Nov 2025 15:02:42 +0000 (16:02 +0100)] 
libstdc++: Add ranges::borrowed_range specialization for optional<T&> [PR122425]

PR libstdc++/122425

libstdc++-v3/ChangeLog:

* include/std/optional
(ranges::enable_borrowed_range<optional<_Tp&>>): Define.
* testsuite/20_util/optional/range.cc: Update tests.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 weeks agolibstdc++: optional<T&> for function and unbounded array should not be range [PR122396]
Tomasz Kamiński [Thu, 6 Nov 2025 14:22:12 +0000 (15:22 +0100)] 
libstdc++: optional<T&> for function and unbounded array should not be range [PR122396]

This implements proposed resolution for LWG4308 [1].

For T denoting either function type or unbounded array, the optional<T&> no
longer exposes iterator, and viable begin/end members. The conditionally
provided iterator type, it is now defined in __optional_ref_base
base class.

Furthermore, range support for optional<T&> is now also guarded by
__cpp_lib_optional_range_support.

[1] https://cplusplus.github.io/LWG/issue4308

PR libstdc++/122396

libstdc++-v3/ChangeLog:

* include/std/optional (__optional_ref_base): Define.
(std::optional<_Tp&>): Inherit from __optional_ref_base<_Tp>.
(optional<_Tp&>::iterator): Move to base class.
(optional<_Tp&>::begin, optional<_Tp&>::end): Use deduced return
type and constrain accordingly.
* testsuite/20_util/optional/range.cc: Add test for optional<T&>.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
5 weeks agoAda: Fix variable initialized with if-expression not flagged as constant
Eric Botcazou [Wed, 12 Nov 2025 08:03:18 +0000 (09:03 +0100)] 
Ada: Fix variable initialized with if-expression not flagged as constant

This is a regression present on the mainline and 15 branch: the -gnatwk
switch no longer flags a string variable initialized with an if-expression
as constant when it is not modified in the program.  The fix is to set the
Has_Initial_Value and Never_Set_In_Source flags earlier during analysis in
the Analyze_Object_Declaration procedure.

gcc/ada/
PR ada/122640
* sem_ch3.adb (Analyze_Object_Declaration): Set Is_True_Constant
on entry for constants and Never_Set_In_Source in all cases.
If an initialization expression is present, set Has_Initial_Value
and Is_True_Constant on variables.

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

5 weeks agoFortran: Update test case. [PR36725]
Jerry DeLisle [Wed, 12 Nov 2025 03:29:36 +0000 (19:29 -0800)] 
Fortran: Update test case. [PR36725]

PR libfortran/36725

gcc/testsuite/ChangeLog:

* gfortran.dg/fmt_g0_4.f08: Change test case from
compile only to compile and run. Adjust test conditions.

5 weeks agolibstdc++: use -Wno-deprecated-declarations
Jason Merrill [Fri, 7 Nov 2025 13:16:30 +0000 (18:46 +0530)] 
libstdc++: use -Wno-deprecated-declarations

-Wno-deprecated doesn't work with header units, since the testcase can't
change the header unit's version of the __DEPRECATED macro.  But
-Wno-deprecated-declarations works just fine to avoid warning about
deprecated things.

libstdc++-v3/ChangeLog:

* testsuite/18_support/exception_ptr/62258.cc: Use
-Wno-deprecated-declarations instead of -Wno-deprecated.
* testsuite/18_support/uncaught_exception/14026.cc
* testsuite/20_util/headers/functional/synopsis.cc
* testsuite/20_util/is_literal_type/requirements/explicit_instantiation.cc
* testsuite/20_util/is_literal_type/requirements/typedefs.cc
* testsuite/20_util/is_literal_type/value.cc
* testsuite/20_util/is_pod/requirements/explicit_instantiation.cc
* testsuite/20_util/is_pod/requirements/typedefs.cc
* testsuite/20_util/is_pod/value.cc
* testsuite/20_util/shared_ptr/assign/auto_ptr.cc
* testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc
* testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
* testsuite/20_util/shared_ptr/atomic/1.cc
* testsuite/20_util/shared_ptr/atomic/2.cc
* testsuite/20_util/shared_ptr/atomic/3.cc
* testsuite/20_util/shared_ptr/cons/43820_neg.cc
* testsuite/20_util/shared_ptr/cons/auto_ptr.cc
* testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc
* testsuite/20_util/shared_ptr/creation/dr925.cc
* testsuite/20_util/unique_ptr/cons/auto_ptr.cc
* testsuite/20_util/unique_ptr/cons/auto_ptr_neg.cc
* testsuite/20_util/variable_templates_for_traits.cc
* testsuite/29_atomics/atomic/lwg3220.cc
* testsuite/experimental/type_traits/value.cc: Likewise.

5 weeks agolibstdc++: sync prune.exp with GCC
Jason Merrill [Tue, 11 Nov 2025 13:15:31 +0000 (18:45 +0530)] 
libstdc++: sync prune.exp with GCC

I needed to add module context to dg-prune for libstdc++, and figured it
made sense to sync it with the GCC version rather than maintain slightly
different approaches to stripping the same messages.

libstdc++-v3/ChangeLog:

* testsuite/lib/prune.exp: Sync with gcc prune.exp.

5 weeks agoAdd stdarch to the list of ignored prefixes
Owen Avery [Thu, 6 Nov 2025 00:44:21 +0000 (19:44 -0500)] 
Add stdarch to the list of ignored prefixes

Since libgrust/rustc-lib/stdarch is a library copied from rustc, we
should include the directory in ignored_prefixes.

contrib/ChangeLog:

* gcc-changelog/git_commit.py (ignored_prefixes): Add
'libgrust/rustc-lib/stdarch/'.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
5 weeks agoDaily bump.
GCC Administrator [Wed, 12 Nov 2025 00:22:41 +0000 (00:22 +0000)] 
Daily bump.

5 weeks agoFortran: Remove unused variable. [PR 96255]
Jerry DeLisle [Tue, 11 Nov 2025 21:57:06 +0000 (13:57 -0800)] 
Fortran: Remove unused variable. [PR 96255]

PR fortran/96255

gcc/fortran/ChangeLog:

* resolve.cc (gfc_resolve_forall): Delete outer_sym

5 weeks agofortran: Fix ICE and self-assignment bugs with recursive allocatable finalizers ...
Christopher Albert [Fri, 7 Nov 2025 11:41:42 +0000 (12:41 +0100)] 
fortran: Fix ICE and self-assignment bugs with recursive allocatable finalizers [PR90519]

Derived types with recursive allocatable components and FINAL procedures
trigger an ICE in gimplify_call_expr because the finalizer wrapper's result
symbol references itself (final->result = final), creating a cycle. This
patch creates a separate __result_<typename> symbol to break the cycle.

Self-assignment (a = a) with such types causes use-after-free because the
left-hand side is finalized before copying, destroying the source. This
patch adds detection using gfc_dep_compare_expr at compile time and pointer
comparison at runtime to skip finalization when lhs == rhs.

Parenthesized self-assignment (a = (a)) creates a temporary, defeating the
simple self-assignment detection. This patch adds strip_parentheses() to
look through INTRINSIC_PARENTHESES operators and ensure deep_copy is enabled
for such cases.

Test pr112459.f90 now expects 6 _final calls instead of 12 because separate
result symbols eliminate double-counting in tree dumps.

PR fortran/90519

gcc/fortran/ChangeLog:

* trans-expr.cc (strip_parentheses): New helper function to strip
INTRINSIC_PARENTHESES operators from expressions.
(is_runtime_conformable): Use strip_parentheses to handle cases
like a = (a) when checking for self-assignment.
(gfc_trans_assignment_1): Strip parentheses before checking if
expr2 is a variable, ensuring deep_copy is enabled for cases like
a = (a). Also strip parentheses when checking for self-assignment
to avoid use-after-free in finalization.
(gfc_trans_scalar_assign): Add comment about parentheses handling.
* class.cc (generate_finalization_wrapper): Create separate result
symbol for finalizer wrapper functions instead of self-referencing
the procedure symbol, avoiding ICE in gimplify_call_expr.

gcc/testsuite/ChangeLog:

* gfortran.dg/finalizer_recursive_alloc_1.f90: New test for ICE fix.
* gfortran.dg/finalizer_recursive_alloc_2.f90: New execution test.
* gfortran.dg/finalizer_self_assign.f90: New test for self-assignment
including a = a, a = (a), and a = (((a))) cases using if/stop pattern.
* gfortran.dg/pr112459.f90: Update to expect 6 _final calls instead
of 12, reflecting corrected self-assignment behavior.

Signed-off-by: Christopher Albert <albert@tugraz.at>
5 weeks agofortran: Implement optional type spec for DO CONCURRENT [PR96255]
Jerry DeLisle [Tue, 11 Nov 2025 18:47:31 +0000 (10:47 -0800)] 
fortran: Implement optional type spec for DO CONCURRENT [PR96255]

This patch adds support for the F2008 optional integer type specification
in DO CONCURRENT and FORALL headers, allowing constructs like:

  do concurrent (integer :: i=1:10)

The implementation handles type spec matching, creates shadow variables
when the type spec differs from any outer scope variable, and converts
iterator expressions to match the specified type.

Shadow variable implementation:
When a type-spec is provided and differs from an outer scope variable,
a shadow variable with the specified type is created (with _ prefix).
A recursive expression walker substitutes all references to the outer
variable with the shadow variable throughout the DO CONCURRENT body,
including in array subscripts, substrings, and nested operations.

Constraint enforcement:
Sets gfc_do_concurrent_flag properly (1 for block context, 2 for mask
context) to enable F2008 C1139 enforcement, ensuring only PURE procedures
are allowed in DO CONCURRENT constructs.

Additional fixes:
- Extract apply_typespec_to_iterator() helper to eliminate duplicated
  shadow variable creation code (~70 lines)
- Add NULL pointer checks for shadow variables
- Fix iterator counting to handle both EXEC_FORALL and EXEC_DO_CONCURRENT
- Skip FORALL obsolescence warning for DO CONCURRENT (F2018)
- Suppress many-to-one assignment warning for DO CONCURRENT (reductions
  are valid, formalized with REDUCE locality-spec in F2023)

PR fortran/96255

gcc/fortran/ChangeLog:

* gfortran.h (gfc_forall_iterator): Add bool shadow field.
* match.cc (apply_typespec_to_iterator): New helper function to
consolidate shadow variable creation logic.
(match_forall_header): Add type-spec parsing for DO CONCURRENT
and FORALL. Create shadow variables when type-spec differs from
outer scope. Replace duplicated code with apply_typespec_to_iterator.
* resolve.cc (replace_in_expr_recursive): New function to recursively
walk expressions and replace symbol references.
(replace_in_code_recursive): New function to recursively walk code
blocks and replace symbol references.
(gfc_replace_forall_variable): New entry point for shadow variable
substitution.
(gfc_resolve_assign_in_forall): Skip many-to-one assignment warning
for DO CONCURRENT.
(gfc_count_forall_iterators): Handle both EXEC_FORALL and
EXEC_DO_CONCURRENT with assertion.
(gfc_resolve_forall): Skip F2018 obsolescence warning for DO
CONCURRENT. Fix memory allocation check. Add NULL checks for shadow
variables. Implement shadow variable walker.
(gfc_resolve_code): Set gfc_do_concurrent_flag for DO CONCURRENT
constructs to enable constraint checking.

gcc/testsuite/ChangeLog:

* gfortran.dg/do_concurrent_typespec_1.f90: New test covering all
shadowing scenarios: undeclared variable, same kind shadowing, and
different kind shadowing.

Co-authored-by: Steve Kargl <kargl@gcc.gnu.org>
Co-authored-by: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Signed-off-by: Christopher Albert <albert@tugraz.at>
5 weeks agogcc/: Factor out helper function
Alejandro Colomar [Sun, 2 Nov 2025 18:45:40 +0000 (19:45 +0100)] 
gcc/: Factor out helper function

No functional change intended.

gcc/c-family/ChangeLog:

* c-warn.cc (warn_parms_array_mismatch): Split out body of
per-pair in parameter lists iteration into...
(warn_parm_array_mismatch): ...this new function.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agogcc/: Reduce scope of local variable (refactor)
Alejandro Colomar [Sun, 2 Nov 2025 18:45:36 +0000 (19:45 +0100)] 
gcc/: Reduce scope of local variable (refactor)

No functional change intended.

gcc/c-family/ChangeLog:

* c-warn.cc (warn_parms_array_mismatch): Reduce scope of local
variable.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agoFortran: Final cleanup of zero width formats [PR90374]
Jerry DeLisle [Tue, 11 Nov 2025 17:25:06 +0000 (09:25 -0800)] 
Fortran: Final cleanup of zero width formats [PR90374]

PR libfortran/90374

libgfortran/ChangeLog:

PR libfortran/90374
* io/format.c (parse_format_list): Set exponent width to unspecified.

gcc/testsuite/ChangeLog:

PR libfortran/90374
* gfortran.dg/fmt_error_10.f: Update test case to pass.
* gfortran.dg/fmt_zero_width.f90: Likewise.
* gfortran.dg/pr111022.f90: Likewise.
* gfortran.dg/pr96436_4.f90: Likewise.
* gfortran.dg/pr96436_5.f90: Likewise.

5 weeks agoc++/modules: avoid too many hidden friends in ADL
Jason Merrill [Mon, 10 Nov 2025 13:02:53 +0000 (18:32 +0530)] 
c++/modules: avoid too many hidden friends in ADL

Most of the add_fns calls in adl_namespace_fns also call ovl_skip_hidden,
but we were forgetting that in the case of imports, which meant that for
24_iterators/const_iterator/112490.cc we were considering the
unreachable_sentinel_t hidden friend operator== and therefore failing.

gcc/cp/ChangeLog:

* name-lookup.cc (name_lookup::adl_namespace_fns): Also skip hidden
in the module case.

5 weeks agoc++/modules: use set_cfun
Jason Merrill [Sat, 8 Nov 2025 23:45:00 +0000 (05:15 +0530)] 
c++/modules: use set_cfun

Assigning directly to cfun doesn't properly update the target and
optimization options for the new function, which causes trouble if we load a
function from a module that has different options than the one we were in
the middle of when the load happened.  This broke the use of #pragma
optimize in 23_containers/array/iterators/begin_end.cc.

Nathan's comment in module.cc complained about the API doing too much, but
set_cfun seems to me to be exactly what we want here.

gcc/cp/ChangeLog:

* module.cc (module_state::read_cluster): Use set_cfun.
(post_load_processing): Likewise.

5 weeks agoamdgcn: Consolidate mkoffload setup constructors
Andrew Stubbs [Tue, 11 Nov 2025 15:04:09 +0000 (15:04 +0000)] 
amdgcn: Consolidate mkoffload setup constructors

We don't need every mkoffload runtime setting to use it's own constructor.
There was only two committed, but I have more uses for this soon.  In theory,
we could also use this setup to choose not to register the kernel with libgomp.

The behaviour is not changed, just the generated code structure.

gcc/ChangeLog:

* config/gcn/mkoffload.cc (process_asm): Replace "configure_stack_size"
constructor with a new regular function, "mkoffload_setup".
(process_obj): Call mkoffload_setup from the "init" constructor.

5 weeks agodiagnostics: add experimental SARIF JSON-RPC notifications for IDEs [PR115970]
David Malcolm [Tue, 11 Nov 2025 15:20:47 +0000 (10:20 -0500)] 
diagnostics: add experimental SARIF JSON-RPC notifications for IDEs [PR115970]

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3358r0.html#msvc
describes a feature of Visual Studio 2022 version 17.8. which can send its
diagnostics in SARIF form to a pipe when setting the environment variable
SARIF_OUTPUT_PIPE:
  https://learn.microsoft.com/en-us/cpp/build/reference/sarif-output?view=msvc-170#retrieving-sarif-through-a-pipe

The precise mechanism above involves Windows-specific details (windows pipes
and HANDLEs).

The following patch implements an analogous feature for GCC, using Unix
domain sockets rather than the Windows-specific details.

With this patch, GCC's cc1, cc1plus, etc will check if
EXPERIMENTAL_SARIF_SOCKET is set in the environment, and if so,
will attempt to connect to that socket.  It will send a JSON-RPC
notification to the socket for every diagnostic emitted.  Like the
MSVC feature, the diagnostics are sent one-at-a-time as SARIF
"result" objects, rather than sending a full SARIF "log" object.

The patch includes a python test script which runs a server.
Tested by running the script in one terminal:

$ ../../src/contrib/sarif-listener.py
listening on socket: /tmp/tmpjgts0u0i/socket

and then invoking a build in another terminal with the envvar
set to the pertinent socket:

$ EXPERIMENTAL_SARIF_SOCKET=/tmp/tmpjgts0u0i/socket \
    make check-gcc RUNTESTFLAGS="analyzer.exp=*"

and watching as all the diagnostics generated during the build
get sent to the listener.

The idea is that an IDE ought to be able to create a socket and
set the environment variable when invoking a build, and then listen
for all the diagnostics, without needing to manually set build flags
to inject SARIF output.

This feature is experimental and subject to change or removal
without notice; I'm adding it to make it easier for IDE developers to
try it out and give feedback.

contrib/ChangeLog:
PR diagnostics/115970
* sarif-listener.py: New file.

gcc/ChangeLog:
PR diagnostics/115970
* diagnostics/sarif-sink.cc: Include <sys/un.h> and <sys/socket.h>.
(sarif_builder::end_group): Update comment.
(sarif_sink::on_end_group): Drop "final".
(class sarif_socket_sink): New subclass.
(maybe_open_sarif_sink_for_socket): New function.
* diagnostics/sarif-sink.h: (maybe_open_sarif_sink_for_socket):
New decl.
* doc/invoke.texi (EXPERIMENTAL_SARIF_SOCKET): Document new
environment variable.
* toplev.cc: Define INCLUDE_VECTOR. Add include of
"diagnostics/sarif-sink.h".
(toplev::main): Call
diagnostics::maybe_open_sarif_sink_for_socket.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
5 weeks agoEnable ranger for the vectorizer
Richard Biener [Fri, 7 Nov 2025 12:54:14 +0000 (13:54 +0100)] 
Enable ranger for the vectorizer

The following enables ranger for the vectorizer, this lets niter
analysis use the active ranger to simplify conditions.

PR tree-optimization/122587
* tree-vectorizer.cc (pass_vectorize::execute): Enable
ranger around analysis and code generation.

5 weeks agoUse ranger when simplifying conditions during niter analysis
Richard Biener [Fri, 7 Nov 2025 12:52:09 +0000 (13:52 +0100)] 
Use ranger when simplifying conditions during niter analysis

The following uses ranger to try to simplify boolean expressions
in simplify_using_initial_conditions as used by niter analysis.
We also try to simplify niter expressions themselves, but we cannot
use ranger directly for this.

* tree-ssa-loop-niter.cc (simplify_using_initial_conditions):
Use the active ranger to simplify boolean expressions.

5 weeks ago[RISC-V] Improve detection of packw
Jeff Law [Tue, 11 Nov 2025 14:19:03 +0000 (07:19 -0700)] 
[RISC-V] Improve detection of packw

More infrastructure on the way to eliminating the define_insn_and_split
for zero-extensions.

Exposing the shift-pair approach in the expander may change the order in which
operands appear in later RTL.  In the case of packw detection order matters.
It shouldn't, it's an IOR after all, but it does.  So we should fix that.

In addition to the ordering issue it slightly changes the form of one operand.
So we want to handle that too.  So there's a total of 3 new patterns.

There isn't commonly available hardware with zbkb and it's only lightly tested
in the testsuite.  So I wouldn't be terribly surprised to find out there's
other ways we want to represent those operands to ultimately generate a pack
instruction.

Built and tested on riscv32-elf and riscv64-elf in my tester.  I'll wait for
pre-commit CI to render a verdict before moving forward.

gcc/

* config/riscv/crypto.md (packf splitters): Variant with
operands reversed.  Add variants with the ashift/sign extend
exchanged as well.

5 weeks ago[RISC-V] Simplify riscv_extend_to_xmode_reg
Jeff Law [Tue, 11 Nov 2025 14:17:12 +0000 (07:17 -0700)] 
[RISC-V] Simplify riscv_extend_to_xmode_reg

So I was trying to untangle our define_insn_and_split situation for
zero-extensions and stumbled over some code we need to adjust & simplify in the
RISC-V backend.  I probably should have caught this earlier.

riscv_extend_to_xmode_reg is just a poor implementation of convert_modes; we
can replace the whole thing will a call to convert_modes + force_reg.

Why is this important beyond code hygene?

convert_modes works with the expansion code wheres extend_to_xmode_reg makes
assumptions about the kinds of insns the target directly supports.
This shows up if you try to untangle the zero-extension support where the base ISA doesn't support zero extensions and should be going through an expander rather than using a define_insn_and_split.

The define_insn_and_split for the reg->reg case isn't split until after reload.
Naturally this inhibits some optimizations and forces further work in this
space that should be simple define_splits into also needing to be
define_insn_and_splits.

Anyway, without going further into the zero-extend rathole, this removes the
assumption that the target is providing a single insn zero/sign extension thus
allowing me to continue to untangle that mess.

Bootstrapped and regression tested on the Pioneer (which thoroughly exercises
this code as it does not have the B extension.  I don't think the BPI has
picked up this one yet.   Also built and regression tested riscv32-elf and
riscv64-elf.

Waiting on pre-commit CI before moving forward.

* config/riscv/riscv.cc (riscv_extend_to_xmode_reg): Simplify
by using convert_modes + force_reg.

5 weeks agoRISC-V: Add test for vec_duplicate + vmseq.vv combine case 1 with GR2VR cost 0, 1...
Pan Li [Mon, 10 Nov 2025 01:08:13 +0000 (09:08 +0800)] 
RISC-V: Add test for vec_duplicate + vmseq.vv combine case 1 with GR2VR cost 0, 1 and 15

Add asm dump check and run test for vec_duplicate + vmseq.vv
combine to vmseq.vx, with the GR2VR cost is 0, 2 and 15.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c: Add asm check
for vmseq.vx.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test
helper macros.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add test
data for run test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-u16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-u32.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-u64.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-u8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
5 weeks agoRISC-V: Add test for vec_duplicate + vmseq.vv combine case 0 with GR2VR cost 0, 1...
Pan Li [Sun, 9 Nov 2025 13:15:01 +0000 (21:15 +0800)] 
RISC-V: Add test for vec_duplicate + vmseq.vv combine case 0 with GR2VR cost 0, 1 and 15

Add asm dump check and run test for vec_duplicate + vmseq.vv
combine to vmseq.vx, with the GR2VR cost is 0, 2 and 15.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i16.c: Add asm check
for vmseq.vx.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i32.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i64.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-i16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-i32.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-i64.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmseq-run-1-i8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
5 weeks agoImprove range_on_edge for GENERIC expressions
Richard Biener [Fri, 7 Nov 2025 12:50:02 +0000 (13:50 +0100)] 
Improve range_on_edge for GENERIC expressions

When feeding non-SSA names to range_on_edge we degrade to a
non-contextual query.  The following uses the argument added in
the previous patch to indicate the edge as the location of the
range query.

* gimple-range.cc (gimple_ranger::range_on_edge): Pass
the edge as 'edge' to get_tree_range.
(dom_ranger::range_on_edge): Likewise.

5 weeks agoSupport edge query for range_query::get_tree_range
Andrew MacLeod [Tue, 11 Nov 2025 07:27:43 +0000 (08:27 +0100)] 
Support edge query for range_query::get_tree_range

The following adds an edge argument to get_tree_range and invoke_range_of_expr
to support range_on_edge queries for GENERIC expressions.

* value-query.cc (range_query::invoke_range_of_expr): New
edge argument.  If set invoke range_on_edge.
(range_query::get_tree_range): Likewise and adjust.
* value-query.h (range_query::invoke_range_of_expr): New
edge argument.
(range_query::get_tree_range): Likewise.

5 weeks agomatch.pd: Fold (y << x) <rel op> x -> 0 or 1
Dhruv Chawla [Thu, 21 Aug 2025 09:06:07 +0000 (02:06 -0700)] 
match.pd: Fold (y << x) <rel op> x -> 0 or 1

- (y << x) == x -> 0 when y != 0
- (y << x) {<,<=} x -> 0 when y > 0.
- (y << x) != x -> 1 when y != 0.
- (y << x) {>,>=} x -> 1 when y > 0.

Bootstrapped and regtested on aarch64-linux-gnu.

Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:

* match.pd: New patterns.

gcc/testsuite/ChangeLog:

* gcc.dg/match-shift-cmp-1.c: New test.
* gcc.dg/match-shift-cmp-2.c: Likewise.
* gcc.dg/match-shift-cmp-3.c: Likewise.
* gcc.dg/match-shift-cmp-4.c: Likewise.

5 weeks agoLoongArch: doc: Add description of function attrubute.
Lulu Cheng [Thu, 16 Oct 2025 03:26:45 +0000 (11:26 +0800)] 
LoongArch: doc: Add description of function attrubute.

Added implementation description of function attributes
target_clones and target_version under LoongArch.
Include the list of supported options and their corresponding
priorities, as well as the rules for setting priorities.

gcc/ChangeLog:

* doc/extend.texi: Add description for LoongArch function
attributes.

5 weeks agoLoongArch: Add testsuites for FMV.
Lulu Cheng [Tue, 23 Sep 2025 06:17:30 +0000 (14:17 +0800)] 
LoongArch: Add testsuites for FMV.

gcc/testsuite/ChangeLog:

* g++.target/loongarch/mv-symbols1.C: New test.
* g++.target/loongarch/mv-symbols2.C: New test.
* g++.target/loongarch/mv-symbols3.C: New test.
* g++.target/loongarch/mv-symbols4.C: New test.
* g++.target/loongarch/mv-symbols5.C: New test.
* g++.target/loongarch/mv-symbols6.C: New test.
* g++.target/loongarch/mvc-symbols1.C: New test.
* g++.target/loongarch/mvc-symbols2.C: New test.
* g++.target/loongarch/mvc-symbols3.C: New test.
* g++.target/loongarch/mvc-symbols4.C: New test.
* g++.target/loongarch/mvc-symbols5.C: New test.
* gcc.target/loongarch/attr-check-error-message1.c: New test.
* gcc.target/loongarch/attr-check-error-message2.c: New test.
* gcc.target/loongarch/attr-check-error-message3.c: New test.
* gcc.target/loongarch/attr-check-error-message4.c: New test.
* gcc.target/loongarch/attr-check-error-message5.c: New test.
* gcc.target/loongarch/attr-check-error-message6.c: New test.
* gcc.target/loongarch/attr-check-error-message7.c: New test.
* gcc.target/loongarch/attr-check-error-message8.c: New test.
* gcc.target/loongarch/attr-check-error-message9.c: New test.

5 weeks agoLoongArch: Do not inline when callee is versioned but caller is not.
Lulu Cheng [Tue, 30 Sep 2025 12:26:02 +0000 (20:26 +0800)] 
LoongArch: Do not inline when callee is versioned but caller is not.

gcc/ChangeLog:

* config/loongarch/loongarch.cc (loongarch_can_inline_p):
Do not inline when callee is versioned but caller is not.

5 weeks agoLoongArch: Implement TARGET_OPTION_SAME_FUNCTION_VERSIONS.
Lulu Cheng [Wed, 15 Oct 2025 08:55:25 +0000 (16:55 +0800)] 
LoongArch: Implement TARGET_OPTION_SAME_FUNCTION_VERSIONS.

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(loongarch_option_same_function_versions): Compare the target
attributes in two functions to determine which function’s
features get higher priority.
(TARGET_OPTION_SAME_FUNCTION_VERSIONS): Define.

5 weeks agoLoongArch: Add support for setting priority in fmv.
Lulu Cheng [Wed, 15 Oct 2025 08:53:16 +0000 (16:53 +0800)] 
LoongArch: Add support for setting priority in fmv.

gcc/ChangeLog:

* config/loongarch/loongarch-protos.h
(loongarch_parse_fmv_features): Modify the type of parameter.
(loongarch_compare_version_priority): Function declaration.
* config/loongarch/loongarch-target-attr.cc
(enum features_prio): Define LA_PRIO_MAX to indicate the
highest priority of supported attributes.
(loongarch_parse_fmv_features): Added handling of setting
priority in attribute string.
(loongarch_compare_version_priority): Likewise.
* config/loongarch/loongarch.cc
(loongarch_process_target_version_attr): Likewise.
(get_feature_mask_for_version): Likewise.
(loongarch_compare_version_priority): Delete.

5 weeks agoLoongArch: Implement __init_loongarch_features_resolver.
Lulu Cheng [Sat, 20 Sep 2025 02:11:35 +0000 (10:11 +0800)] 
LoongArch: Implement __init_loongarch_features_resolver.

This patch can obtain the CPUCFG and HWCAP value at runtime and
extract the flag bits of features for function selection.
HWCAP is used to obtain the support of LSX and LASX because the
kernel can control the enable/disable of these two features.

Note that this requires glibc version 2.38 or higher to compile
and run.

libgcc/ChangeLog:

* config/loongarch/t-loongarch64: Add cpuinfo.c to LIB2ADD.
* config/loongarch/cpuinfo.c: New file.

5 weeks agoLoongArch: Implement TARGET_COMPARE_VERSION_PRIORITY.
Lulu Cheng [Wed, 15 Oct 2025 08:51:21 +0000 (16:51 +0800)] 
LoongArch: Implement TARGET_COMPARE_VERSION_PRIORITY.

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(loongarch_compare_version_priority): Returns true if DECL1
and DECL2 are versions of the same function.
(TARGET_COMPARE_VERSION_PRIORITY): Define.

5 weeks agoLoongArch: Implement TARGET_GENERATE_VERSION_DISPATCHER_BODY.
Lulu Cheng [Tue, 28 Oct 2025 07:25:55 +0000 (15:25 +0800)] 
LoongArch: Implement TARGET_GENERATE_VERSION_DISPATCHER_BODY.

gcc/ChangeLog:

* config/loongarch/genopts/gen-evolution.awk:
* config/loongarch/loongarch-evol-attr.def: Regenerate.
* config/loongarch/loongarch-protos.h
(loongarch_parse_fmv_features): Function declaration.
(get_feature_mask_for_version): Likewise.
* config/loongarch/loongarch-target-attr.cc
(enum features_prio): Defining the priority of features.
(struct loongarch_attribute_info): Add members about
features.
(LARCH_ATTR_MASK): Likewise.
(LARCH_ATTR_ENUM): Likewise.
(LARCH_ATTR_BOOL): Likewise.
(loongarch_parse_fmv_features): Parse a function
multiversioning feature string STR.
* config/loongarch/loongarch.cc
(get_suffixed_assembler_name): Return an identifier for the
base assembler name of a versioned function.
(get_feature_mask_for_version): Get the mask and priority of
features.
(add_condition_to_bb): Insert judgment statements for different
features functions.
(dispatch_function_versions): Generates the dispatch function for
multi-versioned functions.
(make_resolver_func): Make the resolver function decl to dispatch
the versions of a multi-versioned function.
(loongarch_generate_version_dispatcher_body): Generate the
dispatcher logic to invoke the right function version at run-time
for a given set of function versions.
(TARGET_GENERATE_VERSION_DISPATCHER_BODY): Define.
* common/config/loongarch/cpu-features.h: New file.

5 weeks agoLoongArch: Implement TARGET_MANGLE_DECL_ASSEMBLER_NAME.
Lulu Cheng [Sat, 20 Sep 2025 01:22:32 +0000 (09:22 +0800)] 
LoongArch: Implement TARGET_MANGLE_DECL_ASSEMBLER_NAME.

Implements TARGET_MANGLE_DECL_ASSEMBLER_NAME for LoongArch.
This is used to add function multiversioning suffixes to the assembler
name.

gcc/ChangeLog:

* config/loongarch/loongarch.cc (INCLUDE_STRING): Include.
(loongarch_mangle_decl_assembler_name): New function.
(TARGET_MANGLE_DECL_ASSEMBLER_NAME): Define.

5 weeks agoLoongArch: Implement TARGET_GET_FUNCTION_VERSIONS_DISPATCHER.
Lulu Cheng [Fri, 19 Sep 2025 08:13:01 +0000 (16:13 +0800)] 
LoongArch: Implement TARGET_GET_FUNCTION_VERSIONS_DISPATCHER.

This hook is used to get the dispatcher function for a set of function
versions.  This function is copied from aarch64.

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(loongarch_get_function_versions_dispatcher): New function.
(TARGET_GET_FUNCTION_VERSIONS_DISPATCHER): Define.

5 weeks agoLoongArch: Implement TARGET_OPTION_VALID_VERSION_ATTRIBUTE_P.
Lulu Cheng [Tue, 30 Sep 2025 12:23:50 +0000 (20:23 +0800)] 
LoongArch: Implement TARGET_OPTION_VALID_VERSION_ATTRIBUTE_P.

Implement TARGET_OPTION_VALID_VERSION_ATTRIBUTE_P for LoongArch.
This is used to determine whether the attribute ((target_version ("...")))
is valid and process it.

Define TARGET_HAS_FMV_TARGET_ATTRIBUTE to 0 to use "target_version"
for function versioning.

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(loongarch_process_target_version_attr): New function.
(loongarch_option_valid_version_attribute_p): New function.
(TARGET_OPTION_VALID_VERSION_ATTRIBUTE_P): Define.
* config/loongarch/loongarch.h
(TARGET_HAS_FMV_TARGET_ATTRIBUTE): Define it to 0.

5 weeks agoLoongArch: Support la64v1.1 evolution features in the target pragma and attribute.
Lulu Cheng [Fri, 19 Sep 2025 06:51:34 +0000 (14:51 +0800)] 
LoongArch: Support la64v1.1 evolution features in the target pragma and attribute.

Supported options:
 -mfrecipe -mdiv32 -mlam-bh -mlamcas -mscq -mld-seq-sa.

gcc/ChangeLog:

* config/loongarch/genopts/gen-evolution.awk: Output the
info needed for handling evolution features when parsing
the target pragma and attribute.
* config/loongarch/genopts/genstr.sh: Add support for
generating *.def files.
* config/loongarch/loongarch-target-attr.cc
(struct loongarch_attribute_info): Add structure member
record option mask.
(LARCH_ATTR_MASK): New macro.
(LARCH_ATTR_ENUM): Likewise.
(LARCH_ATTR_BOOL): Likewise.
(loongarch_handle_option): Support for new options.
(loongarch_process_one_target_attr): Added support for
the la64v1.1 extended instruction set.
* config/loongarch/t-loongarch: Generate loongarch-evol-attr.def.
* doc/extend.texi: Add new attribute description information.
* config/loongarch/loongarch-evol-attr.def: Generate.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/pragma-la64V1_1.c: New test.
* gcc.target/loongarch/pragma-la64V1_1-2.c: New test.

5 weeks agoLoongArch: Fix ICE for illegal strings in the target attribute.
Lulu Cheng [Tue, 14 Oct 2025 08:20:04 +0000 (16:20 +0800)] 
LoongArch: Fix ICE for illegal strings in the target attribute.

Modify the two situations:

1. __attribute__ ((target ("arch")))
ICE will be reported before modification, and there will be an error
prompt after modification.

2. __attribute__ ((target ("arch=12345")))
Fixed the issue where the attribute string was not printed completely
in the previous error message.

gcc/ChangeLog:

* config/loongarch/loongarch-target-attr.cc
(loongarch_process_one_target_attr): Fix ICE.

gcc/testsuite/ChangeLog:

* gcc.target/loongarch/attr-check-error-message.c: Add tests.

5 weeks agoifcvt: Fix factor_out_operators for BIT_FIELD_REF and BIT_INSERT_EXPR [PR122629]
Andrew Pinski [Mon, 10 Nov 2025 20:22:28 +0000 (12:22 -0800)] 
ifcvt: Fix factor_out_operators for BIT_FIELD_REF and BIT_INSERT_EXPR [PR122629]

So factor_out_operators will factor out some expressions but in the case
of BIT_FIELD_REF and BIT_INSERT_EXPR, this only allowed for operand 0 as the
other operands need to be constant.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122629

gcc/ChangeLog:

* tree-if-conv.cc (factor_out_operators): Reject
BIT_FIELD_REF and BIT_INSERT_EXPR if operand other
than 0 is different.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr122629-1.c: New test.
* gcc.dg/torture/pr122629-2.c: New test.
* gcc.dg/tree-ssa/pr122629-1.c: New test.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 weeks agogimplify-me: Fix regimplification of gimple-reg-type clobbers [PR122620]
Jakub Jelinek [Tue, 11 Nov 2025 07:29:22 +0000 (08:29 +0100)] 
gimplify-me: Fix regimplification of gimple-reg-type clobbers [PR122620]

Since r11-2238-ge443d8213864ac337c29092d4767224f280d2062 the C++ FE
emits clobbers like *_1 = {CLOBBER}; where *_1 MEM_REF has some scalar
type like int for -flifetime-dse={1,2} and most of the compiler manages
to cope with that.
If we are very unlucky, we trigger an ICE while trying to regimplify it
(at least during inlining), as happens with GCC 15.2 on firefox-145.0
built with LTO+PGO.
I haven't managed to reduce that to a small testcase that would ICE though,
the clobber certainly appears in code like
template <typename T>
struct S {
  T *p;
  union { char a; T b; };
  static S foo (T *x) { S s; s.p = x; s.b.~T (); return s; }
  ~S ();
};

void
bar ()
{
  int i = 42;
  S <int> s = S <int>::foo (&i);
}
but convincing inliner that it should id->regimplify = true; on exactly
that stmt has been difficult.

The ICE is because we try (in two spots) to regimplify the rhs of the
gimple_clobber_p stmt if gimple-reg-type type (i.e. the TREE_CLOBBER),
because it doesn't satisfy the is_gimple_mem_rhs_or_call predicate
returned by rhs_predicate_for for the MEM_REF lhs.  And regimplify it
by trying to gimplify SSA_NAME = {CLOBBER}; INIT_EXPR and in there reach
a special case which stores that freshly made SSA_NAME into memory and
loads it from memory, so uses a SSA_NAME without SSA_NAME_DEF_STMT.

Fixed thusly by saying clobbers are ok even for the gimple-reg-types.

2025-11-11  Jakub Jelinek  <jakub@redhat.com>

PR lto/122620
* gimplify-me.cc (gimple_regimplify_operands): Don't try to regimplify
TREE_CLOBBER on rhs of gimple_clobber_p if it has gimple_reg_type.

5 weeks agoi386: Support C++ template parameters in AMX intrinsics [PR122446]
Hu, Lin1 [Tue, 28 Oct 2025 08:11:47 +0000 (16:11 +0800)] 
i386: Support C++ template parameters in AMX intrinsics [PR122446]

The AMX intrinsics previously used string concatenation with the '#'
operator to construct register names, which prevented their use with
C++ template non-type parameters. This patch converts all AMX intrinsics
to use inline assembly constraints with the %c format specifier.

And Intel style registers also have % prefix, update Intel syntax to use plain
register names without % preifx.

gcc/ChangeLog:

PR target/122446
* config/i386/amxavx512intrin.h (_tile_cvtrowps2bf16hi_internal):
Input register name by inline asm %c[...], and remove %% before tmm
from intel side.
(_tile_cvtrowps2bf16li_internal): Ditto.
* config/i386/amxbf16intrin.h (_tile_dpbf16ps_internal): Ditto
* config/i386/amxcomplexintrin.h (_tile_cmmimfp16ps_internal): Ditto
(_tile_cmmrlfp16ps_internal): Ditto
(_tile_cmmimfp16ps): Ditto
(_tile_cmmrlfp16ps): Ditto
* config/i386/amxfp16intrin.h (_tile_dpfp16ps_internal): Ditto
(_tile_dpfp16ps): Ditto
* config/i386/amxfp8intrin.h (_tile_dpbf8ps_internal): Ditto
(_tile_dpbhf8ps_internal): Ditto
(_tile_dphbf8ps_internal): Ditto
(_tile_dphf8ps_internal): Ditto
(_tile_dpbf8ps): Ditto
(_tile_dpbhf8ps): Ditto
(_tile_dphbf8ps): Ditto
(_tile_dphf8ps): Ditto
* config/i386/amxint8intrin.h (_tile_int8_dp_internal): Ditto
* config/i386/amxmovrsintrin.h (_tile_loaddrs_internal): Ditto
(_tile_loaddrst1_internal): Ditto
(_tile_loaddrs): Ditto
(_tile_loaddrst1): Ditto
* config/i386/amxtf32intrin.h (_tile_mmultf32ps_internal): Ditto
* config/i386/amxtileintrin.h (_tile_loadd): Ditto
(_tile_loadd_internal): Ditto
(_tile_stream_loadd): Ditto
(_tile_stream_loadd_internal): Ditto
(_tile_stored): Ditto
(_tile_stored_internal): Ditto
(_tile_zero): Ditto
(_tile_zero_internal): Ditto

gcc/testsuite/ChangeLog:

PR target/122446
* gcc.target/i386/amxbf16-asmintel-1.c: Modify dg-final to check intel
form.
* gcc.target/i386/amxcomplex-asmintel-1.c: Ditto.
* gcc.target/i386/amxfp16-asmintel-1.c: Ditto.
* gcc.target/i386/amxfp8-asmintel-1.c: Ditto.
* gcc.target/i386/amxint8-asmintel-1.c: Ditto.
* gcc.target/i386/amxmovrs-asmintel-1.c: Ditto.
* gcc.target/i386/amxtf32-asmintel-1.c: Ditto.
* gcc.target/i386/amxtile-asmintel-1.c: Ditto.
* g++.target/i386/pr122446-1.C: New test.
* g++.target/i386/pr122446-amxavx512.C: Ditto.
* g++.target/i386/pr122446-amxbf16.C: Ditto.
* g++.target/i386/pr122446-amxcomplex.C: Ditto.
* g++.target/i386/pr122446-amxfp16.C: Ditto.
* g++.target/i386/pr122446-amxfp8.C: Ditto.
* g++.target/i386/pr122446-amxint8.C: Ditto.
* g++.target/i386/pr122446-amxmovrs.C: Ditto.
* g++.target/i386/pr122446-amxtf32.C: Ditto.
* g++.target/i386/pr122446-amxtile.C: Ditto.

5 weeks agoDaily bump.
GCC Administrator [Tue, 11 Nov 2025 00:21:25 +0000 (00:21 +0000)] 
Daily bump.

5 weeks agoc++/modules: Fix ICE in instantiating_tu_local_entity [PR122628]
Nathaniel Shead [Mon, 10 Nov 2025 23:16:58 +0000 (10:16 +1100)] 
c++/modules: Fix ICE in instantiating_tu_local_entity [PR122628]

I'd missed a STRIP_TEMPLATE when attempting to query whether DECL was
an imported entity.

PR c++/122628

gcc/cp/ChangeLog:

* module.cc (instantiating_tu_local_entity): Add missing
STRIP_TEMPLATEs.

gcc/testsuite/ChangeLog:

* g++.dg/modules/internal-18.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
5 weeks agoc++/modules: Propagate purviewness to all parent namespaces
Nathaniel Shead [Mon, 10 Nov 2025 12:41:25 +0000 (23:41 +1100)] 
c++/modules: Propagate purviewness to all parent namespaces

In PR c++/100134, tsubst_friend_function was adjusted to ensure that
instantiating a friend function in an unopened namespace still correctly
marked the namespace as purview.  This adjusts the fix to also apply
to nested namespaces.

gcc/cp/ChangeLog:

* pt.cc (tsubst_friend_function): Mark all parent namespaces as
purview if needed.

gcc/testsuite/ChangeLog:

* g++.dg/modules/tpl-friend-8_a.H: Add testcase.
* g++.dg/modules/tpl-friend-8_b.C: Add testcase.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
5 weeks agoc: Refactor c_parser_unary_expression()
Alejandro Colomar [Sat, 8 Nov 2025 21:52:07 +0000 (22:52 +0100)] 
c: Refactor c_parser_unary_expression()

Store the 'rid' value in a local variable, and pass it to functions that
handle various keywords.  This simplifies the code, and removes some
wrappers.

No functional change intended.

gcc/c/ChangeLog:

* c-parser.cc (c_parser_sizeof_expression): Remove function.
(c_parser_countof_expression): Remove function.
(c_parser_unary_expression): Store the 'rid', and pass it
directly to the function calls, without calling wrappers.

Suggested-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agoUpdate gcc es.po
Joseph Myers [Mon, 10 Nov 2025 21:18:41 +0000 (21:18 +0000)] 
Update gcc es.po

* es.po: Update.

5 weeks agodoc: regenerate-opt-urls after .opt file/invoke.texi changes [PR122243]
Sandra Loosemore [Mon, 10 Nov 2025 20:17:39 +0000 (20:17 +0000)] 
doc: regenerate-opt-urls after .opt file/invoke.texi changes [PR122243]

gcc/analyzer/ChangeLog
PR other/122243
* analyzer.opt.urls: Regenerated.

gcc/c-family/ChangeLog
PR other/122243
* c.opt.urls: Regenerated.

gcc/cobol/ChangeLog
PR other/122243
* lang.opt.urls: Regenerated.

gcc/ChangeLog
PR other/122243
* common.opt.urls: Regenerated.
* config/dragonfly.opt.urls: Regenerated.
* config/freebsd.opt.urls: Regenerated.
* config/gcn/gcn.opt.urls: Regenerated.
* config/gnu-user.opt.urls: Regenerated.

gcc/fortran/ChangeLog
PR other/122243
* lang.opt.urls: Regenerated.

5 weeks agogcc: quote some expressions in `test x...`
Sam James [Sun, 9 Nov 2025 02:00:52 +0000 (02:00 +0000)] 
gcc: quote some expressions in `test x...`

$gcc_cv_nm may contain a string with spaces since r16-4178-g6051a849aa1e8e and
r16-5013-gf8bb20167f8127. It was possible for this to happen via strange user
input in the past too. `test x$gcc_cv_nm != x` therefore produces some noise
like:
```
checking assembler for working .subsection -1...
/usr/m68k-unknown-linux-gnu/tmp/portage/sys-devel/gcc-16.0.9999/work/gcc-16.0.9999/gcc/configure: line 26132: test: syntax error: `--plugin' unexpected
```

Quote a bunch of such tests. I've drive-by quoted other such tests where
they're for a program and may have a similar problem, but not all other
such tests (much larger patch and not at least strictly necessary).

gcc/ChangeLog:

* acinclude.m4: Quote "$gcc_cv_nm" and friends.
* configure.ac: Ditto.
* configure: Regenerate.

5 weeks agoc: Fix return type of _Countof [PR122591]
Alejandro Colomar [Mon, 10 Nov 2025 19:26:21 +0000 (19:26 +0000)] 
c: Fix return type of _Countof [PR122591]

PR c/122591

gcc/c-family/ChangeLog:

* c-common.cc (c_countof_type): Convert return value to size_t.

gcc/testsuite/ChangeLog:

* gcc.dg/countof-compile.c (type): Test return type of _Countof.

Reported-by: Sam James <sam@gentoo.org>
Suggested-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agobuiltins: Fix atomics expansion after build_call_nary change [PR122605]
Andrew Pinski [Sat, 8 Nov 2025 05:08:42 +0000 (21:08 -0800)] 
builtins: Fix atomics expansion after build_call_nary change [PR122605]

So before r16-5089-gc66ebc3e22138, we could call build_call_nary with more
arguments than was passed as the nargs. Afterwards we get an assert if there
were not exactly that amount.
In this case the code is easier to read when passing the correct number of args
in the first place.
This fixes the two places in builtins.cc where this pattern shows up.

Bootstrapped and tested on x86_64-linux-gnu (and tested the testcase with -m32 where
the failure showed up).

PR middle-end/122605
gcc/ChangeLog:

* builtins.cc (expand_ifn_atomic_bit_test_and): Split out the call to
build_call_nary into two different statements.
(expand_ifn_atomic_op_fetch_cmp_0): Likewise.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
5 weeks agoDocumentation for -fident and -Qy/-Qn options [PR122243]
Sandra Loosemore [Thu, 30 Oct 2025 00:56:22 +0000 (00:56 +0000)] 
Documentation for -fident and -Qy/-Qn options [PR122243]

I noticed that the comments for -fident in common.opt were garbled,
and its description is confusing; this is classed as a code generation
option rather than a preprocessor option, and it controls emission of all
".ident" directives in the assembly file, not just those inserted by the
"#ident" preprocessor directive.  Also, the -Qy/-Qn options which have the
same effect as -fident/-fno-ident were documented as System V Options when
in fact they are available on all targets.  Fixed thusly.

gcc/ChangeLog
PR other/122243
* common.opt: Clean up comments/documentation for -fident.
* doc/invoke.texi: Move -Qy/-Qn documentation from System V options
and combine with -fident/-fno-ident entry.

5 weeks agoDocument linker options + -Q and -S [PR122243]
Sandra Loosemore [Wed, 29 Oct 2025 22:11:44 +0000 (22:11 +0000)] 
Document linker options + -Q and -S [PR122243]

This patch adds documentation for several options that the GCC driver
passes to the linker via specs without further interpretation.  I've
also added some comments/documentation strings to common.opt for these
and a couple other options that previously didn't have any.

gcc/ChangeLog
PR other/122243
* common.opt: Add comments/documentation for -N, -Q, -S, -T,
-Tbss, -Tdata, -Ttext, -Z, -n, -Q, -s, -t, -z.
* doc/invoke.texi: Add documentation for -Tbss, -Tdata, -Ttext,
-N, -n, -t, -Z.

5 weeks agoAdd missing documentation for some -f, -g, and -W options [PR122243] [PR120064]
Sandra Loosemore [Mon, 27 Oct 2025 21:56:48 +0000 (21:56 +0000)] 
Add missing documentation for some -f, -g, and -W options [PR122243] [PR120064]

gcc/ChangeLog
PR other/122243
PR rtl-optimization/120064
* doc/invoke.texi: Document -fconcepts-diagnostics-depth,
-Wdeprecated-copy-dtor, -Wformat-diag, -Wcannot-profile,
-fvar-tracking-uninit, -gno-pubnames, -finline-atomics,
-fext-dce, -fipa-icf-functions, -fipa-icf-variables,
-fprofile, -fdump-internal-locations, and -Wopenacc-dims.
Minor copy-editing and rearrangement of items in the option
summary lists.

5 weeks agoDocument long-form command-line options [PR122243]
Sandra Loosemore [Sun, 26 Oct 2025 21:16:13 +0000 (21:16 +0000)] 
Document long-form command-line options [PR122243]

GCC has long supported long-form command-line options with the same
meanings as its traditional one-character options, e.g. --output as an
alias for -o, --language for -x, and so on.  However, these have never
been documented in the manual.  This patch adds the missing
documentation for these options, plus some additional options that
have previously undocumented two-dash aliases with the same names as
the one-dash form (e.g., -dumpdir and --dumpdir).

gcc/ChangeLog
PR other/122243
* doc/cppdiropts.texi: Document --include-directory,
--include-directory-after, --include-barrier, --include-prefix,
--include-with-prefix, --include-with-prefix-after,
--include-with-prefix-before, --no-standard-includes.
--embed-directory.
* doc/cppopts.texi: Document --define-macro, --undefine-macro,
--include, --imacros, --dependencies, --user-dependencies,
--print-missing-file-dependencies, --write-dependencies,
--write-user-dependencies, --comments, --comments-in-macros,
--no-line-commands, --traditional, --traditional-cpp,
--trigraphs, --trace-includes, --dump.
* doc/invoke.texi: Add missing long options to Option Summary.
Document --language, --compile, --assemble, --preprocess,
--output, --dumpbase, --dumpbase-ext, --dumpdir,
--verbose, --pass-exit-codes, --pipe, --specs, --ansi,
--no-warnings, --pedantic, --pedantic-errors, --all-warnings,
--extra-warnings, --debug, --optimize, --profile, -coverage,
--no-integrated-cpp, --for-assembler, --no-standard-libraries,
--entries, --pie, --static-pie, --static, --shared, --symbolic,
--for-linker, --force-link, --library-directory, --prefix,
--no-canonical-prefixes, --dump, --save-temps, --print-file-name,
--print-multi-directory, --print-multi-lib,
--print-multi-os-directory, --print-multiarch,
--print-prog-name, --print-libgcc-file-name, --print-search-dirs,
--print-sysroot, --print-sysroot-headers-suffix.

5 weeks agoOnly document -A/--assert options in cpp manual [PR122243]
Sandra Loosemore [Wed, 22 Oct 2025 01:58:01 +0000 (01:58 +0000)] 
Only document -A/--assert options in cpp manual [PR122243]

Assertions are a preprocessor feature that has been declared obsolete
with strong warnings not to use them since 2001.  The main GCC manual
documents the -A command-line option but doesn't include the section
that explains the purpose of the feature or that it is obsolete; that
material appears only in the preprocessor manual.  It seems rather pointless
to clutter up the GCC manual with unhelpful documentation of an obsolete
feature, so I've restricted the option documentation to the
preprocessor manual too.  I've also added the missing documentation
entries for the long form of the option, --assert.

gcc/ChangeLog
PR other/122243
* doc/cppopts.texi (-A): Restrict option documentation to the CPP
manual.  Also document the --assert form.
* doc/invoke.texi (Option Summary): Don't list the -A option.

5 weeks agoAdd missing options to option summary [PR122243]
Sandra Loosemore [Thu, 6 Nov 2025 23:29:50 +0000 (23:29 +0000)] 
Add missing options to option summary [PR122243]

I noticed that several options (mostly C++ options, including those
for contracts) were documented in the manual but were not listed in
the corresponding option summary table.  Besides adding the entries, I
also corrected the alphabetization in the C++ option table and some
formatting issues for option arguments.

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary): Add missing entries,
also correct alphabetization and formatting of the C++ options.
(C++ Language Options): Fix some formatting issues.

5 weeks agoMark some undocumented options as such [PR122243]
Sandra Loosemore [Tue, 28 Oct 2025 22:38:08 +0000 (22:38 +0000)] 
Mark some undocumented options as such [PR122243]

We have a number of command-line options that are undocumented (either
intentionally or because they are obsolete and retained only for
compatibility), that ought to be marked as "Undocumented".  I've also
added some comments to the .opt files.

gcc/c-family/ChangeLog
PR other/122243
* c.opt (fmodule-version-ignore): Mark as "Undocumented".

gcc/ChangeLog
PR other/122243
* common.opt (fhelp, fhelp=, ftarget-help, fversion): Mark as
"Undocumented".
(fbounds-check): Update comments.
(flag-graphite, fsel-sched-reschedule-pipelined): Mark as
"Undocumented".
(fstack-limit): Add comment.

5 weeks agoAdd "RejectNegative" to some options where it doesn't make sense [PR122243]
Sandra Loosemore [Fri, 17 Oct 2025 15:11:47 +0000 (15:11 +0000)] 
Add "RejectNegative" to some options where it doesn't make sense [PR122243]

This patch adds the "RejectNegative" property to several options where
it doesn't make sense.  These are either options of the form
"name=value" rather than an on/off switch, those that are already in a
"no-" form, or options that form a mutually-exclusive set.

Also, the fhelp, ftarget-help, and fversion options that do not take
arguments ignore the "-no" prefix so that even "-fno-help" (etc)
causes help to be printed instead of suppressing help output.  Since that
behavior is not useful, I've added RejectNegative to those options as well.

gcc/analyzer/ChangeLog
PR other/122243
* analyzer.opt (fanalyzer-verbosity=): Add RejectNegative.

gcc/c-family/ChangeLog
PR other/122243
* c.opt: (fdeps-format=): Add RejectNegative.
(fdeps-file=): Likewise.
(fdeps-target=): Likewise.
(Walloc-size-larger-than=): Likewise.
(Wno-alloc-size-larger-than): Likewise.
(Walloca-larger-than=): Likewise.
(Wno-alloca-larger-than): Likewise.
(Woverloaded-virtual=): Likewise.
(Wvla-larger-than=): Likewise.
(Wno-vla-larger-than): Likewise.
(fopenacc-dim=): Likewise.
(femit-struct-debug-baseonly): Likewise.
(femit-struct-debug-reduced): Likewise.
(femit-struct-debug-detailed=): Likewise.

gcc/ChangeLog
PR other/122243
* common.opt (fhelp): Add RejectNegative.
(fhelp=): Likewise.
(ftarget-help): Likewise.
(fversion): Likewise.
(Wno-frame-larger-than): Likewise.
(Wno-larger-than): Likewise.
(Wno-stack-usage): Likewise.
(fdiagnostics-minimum-margin-width=): Likewise.
(flto-incremental=): Likewise.
(foffload=): Likewise.
(foffload-options=): Likewise.
(foffload-abi-host-opts=): Likewise.
(fpatchable-function-entry=): Likewise.
(gno-pubnames): Likewise.
(gpubnames): Likewise.
(ggnu-pubnames): Likewise.

5 weeks agoMark some unused/undocumented options as "Ignore" [PR122243]
Sandra Loosemore [Thu, 16 Oct 2025 18:21:40 +0000 (18:21 +0000)] 
Mark some unused/undocumented options as "Ignore" [PR122243]

gcc/c-family/ChangeLog
PR other/122243
* c.opt (Wsynth): Mark as "Ignore".

gcc/ChangeLog
PR other/122243
* common.opt (ftree-lrs): Mark as "Ignore".

5 weeks agoAdd some missing @opindex entries [PR122243]
Sandra Loosemore [Wed, 15 Oct 2025 23:30:00 +0000 (23:30 +0000)] 
Add some missing @opindex entries [PR122243]

The options handled in this patch already have documentation but are
either missing an @opindex entry entirely, or index only the negative
option form.

gcc/ChangeLog
PR other/122243
* doc/cppopts.texi (fcanonical-system-headers): Add @opindex.
* doc/invoke.texi (fdump-ada-spec-slim): Add @opindex.
(fcontract-semantic): Likewise.
(fdiagnostics-plain-output): Likewise.
(Wc11-c2x-compat): Likewise.
(Wvla-parameter): Likewise.
(fanalyzer-verbose-edges): Likewise.
(fanalyzer-verbose-state-changes): Likewise.
(fanalyzer-verbosity): Likewise.
(flimit-function-alignment): Likewise.

5 weeks agoFix typos in @opindex entries [PR122243]
Sandra Loosemore [Wed, 15 Oct 2025 20:29:57 +0000 (20:29 +0000)] 
Fix typos in @opindex entries [PR122243]

gcc/ChangeLog
PR other/122243
* doc/invoke.texi (fdump-analyzer-exploded-nodes): Correct
spelling of option in @opindex.
(fdump-analyzer-exploded-nodes-2): Likewise.
(fdump-analyzer-exploded-nodes-3): Likewise.
(fdump-analyzer-feasibility): Likewise.
(fdump-analyzer-infinite-loop): Likewise.
(fstack-reuse): Likewise.

5 weeks agopru: Use unsigned constants for register classes
Dimitar Dimitrov [Sun, 9 Nov 2025 15:45:14 +0000 (17:45 +0200)] 
pru: Use unsigned constants for register classes

Fix the following warning:

  .../gcc/gcc/config/pru/pru.h:249:43: warning: narrowing conversion of ‘-1’ from ‘int’ to ‘unsigned int’ [-Wnarrowing]
    249 |     /* ALL_REGS       */ { ~0,~0, ~0, ~0, ~0}                   \

gcc/ChangeLog:

* config/pru/pru.h (REG_CLASS_CONTENTS): Use unsigned integer
constants.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
5 weeks agopru: Implement TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS [PR122415]
Dimitar Dimitrov [Fri, 7 Nov 2025 20:09:06 +0000 (22:09 +0200)] 
pru: Implement TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS [PR122415]

Splitting a CONST_INT address into base and offset can be beneficial
when accessing multiple addresses in the same UBYTE region.  The base
constant load can be shared among those accesses.

There is no regression for single accesses per UBYTE memory region.
The transformation by TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS generates
practically equivalent code:

   **before**                  **after**
   ldi32 r0, 0x11223344        ldi32 r0, 0x11223300
   lbbo  r1, r0, 0, 4          lbbo  r1, r0, 0x44, 4

For PRU there is a small complication.  While load/store instructions
support base+offset addressing, the call instructions do not.
But the TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS arguments do not show
which operation is using the address, so invalid address is emitted for
call instructions to CONST_INT addresses.  This is solved by fixing up
the call address operands during expansion.

PR target/122415

gcc/ChangeLog:

* config/pru/pru-protos.h (pru_fixup_jump_address_operand):
Declare.
* config/pru/pru.cc (pru_fixup_jump_address_operand): New
function.
(pru_addr_space_legitimize_address): New function.
(TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Declare.
* config/pru/pru.md (call): Fixup the address operand.
(call_value): Ditto.
(sibcall): Ditto.
(sibcall_value): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/pru/pr122415-1.c: New test.
* gcc.target/pru/pr122415-2.c: New test.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
5 weeks agoAArch64: Update test to reflect new message
Tejas Belagod [Tue, 29 Jul 2025 10:35:59 +0000 (11:35 +0100)] 
AArch64: Update test to reflect new message

Update test error message as svbool_t is now treated as a GNU vector.

gcc/testsuite/ChangeLog

* gcc.target/aarch64/sve/acle/general-c/svcount_1.c: Update message.

5 weeks agoAArch64: Update existing test with svbool_t operations
Tejas Belagod [Mon, 6 Jan 2025 05:59:00 +0000 (11:29 +0530)] 
AArch64: Update existing test with svbool_t operations

Update existing compile test with tests to cover C/C++ operations on svbool_t
type objects.

gcc/testsuite/ChangeLog:

* g++.dg/ext/sve-sizeless-1.C: Add new tests.
* g++.dg/ext/sve-sizeless-2.C: Add new tests.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_1.C: Add new tests.
* g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C: Add new tests.
* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_1.c: Add new tests.
* gcc.target/aarch64/sve/acle/general-c/gnu_vectors_2.c: Add new tests.
* gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Add new tests.
* gcc.target/aarch64/sve/acle/general-c/sizeless-2.c : Add new tests.

5 weeks agoAArch64: Support C/C++ operations on svbool_t
Tejas Belagod [Mon, 6 Jan 2025 05:53:44 +0000 (11:23 +0530)] 
AArch64: Support C/C++ operations on svbool_t

Support a subset of C/C++ operations (bitwise, conditional etc.) on svbool_t.

gcc/c-family/ChangeLog:

* c-common.cc (c_build_vec_convert): Support vector boolean
types for __builtin_convertvector ().

gcc/c/ChangeLog:

* c-typeck.cc (build_binary_op): Support vector boolean types.

gcc/cp/ChangeLog:

* typeck.cc (cp_build_binary_op): Likewise.
* call.cc (build_conditional_expr): Support vector booleans.
* cvt.cc (ocp_convert): Call target hook to resolve conversion
between standard and non-standard booleans.

gcc/ChangeLog:

* config/aarch64/aarch64-sve-builtins.cc (register_builtin_types): Make
SVE vector boolean type equivalent to GNU vectors.
* config/aarch64/aarch64-sve.md (extend<vpred><mode>2,
zero_extend<vpred><mode>2, trunc<mode><vpred>2, vec_cmp<mode><mode>):
New patterns to support additional operations on predicate modes.
* config/aarch64/aarch64.cc (aarch64_valid_vector_boolean_op): New.
(aarch64_invalid_unary_op): Consider vector bool types.
(aarch64_invalid_binary_op): Likewise.
(aarch64_convert_to_type): Define target hook and handle standard to
non-standard bool conversion.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/acle/general/cops_bool.c: New.

5 weeks agoarm: Don't reject early mov?fcc patterns that we might be able to handle
Richard Earnshaw [Fri, 7 Nov 2025 10:03:43 +0000 (10:03 +0000)] 
arm: Don't reject early mov?fcc patterns that we might be able to handle

The define_expand patterns for movdfcc, movsfcc and movhfcc had overly
tight contstraints that could cause the compiler to reject these
patterns when re-ordering the operands could lead to a successful
match.  Relax the initial predicate test and rely on the test after
arm_validize_comparison has run to determine whether this is something
we can support.  This fixes some test failures which were introduced
in the fix for PR118460

gcc/ChangeLog:

PR target/118460
* config/arm/arm.md (movhfcc): Use expandable_comparison_operator.
(movsfcc, movdfcc): Likewise.

5 weeks agovect: Do not set range for step != 1 [PR121985].
Robin Dapp [Fri, 7 Nov 2025 14:54:52 +0000 (15:54 +0100)] 
vect: Do not set range for step != 1 [PR121985].

In PR120922 we first disabled setting a range on niters_vector for
partial vectorization and later introduced a ceiling division instead.

In PR121985 we ran into this again where a bogus range caused wrong code
later.  On top I saw several instances of this issue on a local branch
that enables more VLS length-controlled loops.

I believe we must not set niter_vector's range to TYPE_MAX / VF, no
matter the rounding due to the way niters_vector is used.  It's not
really identical to the number of vector iterations but the actual
number the loop will iterate is niters_vector / step where step = VF
for partial vectors.

Thus, only set the range to TYPE_MAX / VF if step == 1.

gcc/ChangeLog:

PR middle-end/121985

* tree-vect-loop-manip.cc (vect_gen_vector_loop_niters): Only
set niter_vector's range if step == 1.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr121985.c: New test.

5 weeks agooptabs: Do not pun modes smaller than QImode.
Robin Dapp [Fri, 7 Nov 2025 09:21:36 +0000 (10:21 +0100)] 
optabs: Do not pun modes smaller than QImode.

In can_vec_perm_const_p if we cannot directly permute a vector mode we
try to pun it with a byte mode.  qimode_for_vec_perm checks gets the
mode size and uses that as number of elements for the new QImode vector.

This doesn't work for RVV mask vectors, though.  First, their
precision might be smaller than a byte and second, there is no
way to easily pun them.  The most common way would be a vector select
from {0, 0, ...} and {1, 1, ...} vectors.  Therefore this patch checks
if the perm's innermode precision is a multiple of QImode's precision.

Bootstrapped and regtested on x86 and power10.  Regtested on aarch64 and
riscv64.

gcc/ChangeLog:

* optabs-query.cc (qimode_for_vec_perm): Check if QImode's
precision divides the inner mode's precision.

5 weeks agovect: Give up if there is no offset_vectype.
Robin Dapp [Fri, 7 Nov 2025 16:18:02 +0000 (17:18 +0100)] 
vect: Give up if there is no offset_vectype.

vect_gather_scatter_fn_p currently ICEs if offset_vectype is NULL.
This is an oversight in the patches that relax gather/scatter detection.
Catch this.

gcc/ChangeLog:

* tree-vect-data-refs.cc (vect_gather_scatter_fn_p): Bail if
offset_vectype is NULL.

5 weeks agovect: Reduce group size of consecutive strided accesses.
Robin Dapp [Thu, 9 Oct 2025 15:25:59 +0000 (17:25 +0200)] 
vect: Reduce group size of consecutive strided accesses.

Consecutive load permutations like {0, 1, 2, 3} or {4, 5, 6, 7} in a
group of 8 only read a part of the group, leaving a gap.

For strided accesses we can elide the permutation and, instead of
accessing the whole group, use the number of SLP lanes.  This
effectively increases the vector size as we don't load gaps.  On top we
do not need to emit the permutes at all.

gcc/ChangeLog:

* tree-vect-slp.cc (vect_load_perm_consecutive_p): New function.
(vect_lower_load_permutations): Use.
(vect_optimize_slp_pass::remove_redundant_permutations): Use.
* tree-vect-stmts.cc (has_consecutive_load_permutation): New
function that uses vect_load_perm_consecutive_p.
(get_load_store_type): Use.
(vectorizable_load): Reduce group size.
* tree-vectorizer.h (struct vect_load_store_data): Add
subchain_p.
(vect_load_perm_consecutive_p): Declare.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr118019-2.c:

5 weeks agoc++: Implement C++26 P3920R0 - Wording for NB comment resolution on trivial relocation
Jakub Jelinek [Mon, 10 Nov 2025 11:52:45 +0000 (12:52 +0100)] 
c++: Implement C++26 P3920R0 - Wording for NB comment resolution on trivial relocation

Trivial relocation was voted out of C++26, the following patch
removes it (note, the libstdc++ part was still waiting for patch review
and so doesn't need to be removed).

This isn't a mere revert of r16-2206; I've kept -Wc++26-compat option,
from earlier patches the non-terminal stays to be class-property-specifier,
and I had to partially revert also various follow-up changes, e.g. for
modules to handle the new flags and test them, for -Wkeyword-macro
etc. to diagnose the conditional keywords or the feature test macro
etc.

2025-11-10  Jakub Jelinek  <jakub@redhat.com>

PR c++/119064
gcc/c-family/
* c-cppbuiltin.cc (c_cpp_builtins): Revert 2025-07-11
changes.
gcc/cp/
* cp-tree.h (struct lang_type): Revert 2025-07-11 changes.
(CLASSTYPE_TRIVIALLY_RELOCATABLE_BIT): Remove.
(CLASSTYPE_TRIVIALLY_RELOCATABLE_COMPUTED): Remove.
(CLASSTYPE_REPLACEABLE_BIT): Remove.
(CLASSTYPE_REPLACEABLE_COMPUTED): Remove.
(enum virt_specifier): Revert 2025-07-11 changes.
(trivially_relocatable_type_p): Remove.
(replaceable_type_p): Remove.
* cp-trait.def (IS_NOTHROW_RELOCATABLE): Remove.
(IS_REPLACEABLE): Remove.
(IS_TRIVIALLY_RELOCATABLE): Remove.
* parser.cc (cp_parser_class_specifier, cp_parser_class_head):
Revert 2025-07-11 changes.
* pt.cc (instantiate_class_template): Likewise.
* semantics.cc (trait_expr_value): Likewise.
(finish_trait_expr): Likewise.
* tree.cc (default_movable_type_p): Remove.
(union_with_no_declared_special_member_fns): Remove.
(trivially_relocatable_type_p): Remove.
(replaceable_type_p): Remove.
* constraint.cc (diagnose_trait_expr): Revert 2025-07-11 changes.
* module.cc (trees_out::lang_type_bools): Revert part of
2025-07-26 changes related to trivial relocatability.
(trees_in::lang_type_bools): Likewise.
* lex.cc (cxx_init): Don't call cpp_warn on
trivially_relocatable_if_eligible and replaceable_if_eligible.
gcc/testsuite/
* g++.dg/cpp26/feat-cxx26.C: Revert 2025-07-11 changes.
* g++.dg/DRs/dr2581-1.C (__cpp_trivial_relocatability): Remove test.
* g++.dg/DRs/dr2581-2.C (__cpp_trivial_relocatability): Likewise.
* g++.dg/warn/Wkeyword-macro-1.C: Don't expect any diagnostics on
#define or #undef of trivially_relocatable_if_eligible or
replaceable_if_eligible.
* g++.dg/warn/Wkeyword-macro-2.C: Likewise.
* g++.dg/warn/Wkeyword-macro-4.C: Likewise.
* g++.dg/warn/Wkeyword-macro-5.C: Likewise.
* g++.dg/warn/Wkeyword-macro-7.C: Likewise.
* g++.dg/warn/Wkeyword-macro-8.C: Likewise.
* g++.dg/cpp26/trivially-relocatable1.C: Remove.
* g++.dg/cpp26/trivially-relocatable2.C: Remove.
* g++.dg/cpp26/trivially-relocatable3.C: Remove.
* g++.dg/cpp26/trivially-relocatable4.C: Remove.
* g++.dg/cpp26/trivially-relocatable5.C: Remove.
* g++.dg/cpp26/trivially-relocatable6.C: Remove.
* g++.dg/cpp26/trivially-relocatable7.C: Remove.
* g++.dg/cpp26/trivially-relocatable8.C: Remove.
* g++.dg/cpp26/trivially-relocatable9.C: Remove.
* g++.dg/cpp26/trivially-relocatable10.C: Remove.
* g++.dg/cpp26/trivially-relocatable11.C: Remove.
* g++.dg/modules/class-11_a.H: Remove trivial relocatability
related parts.
* g++.dg/modules/class-11_b.C: Likewise.

5 weeks agoc++: Diagnose #define/#undef indeterminate
Jakub Jelinek [Mon, 10 Nov 2025 10:36:42 +0000 (11:36 +0100)] 
c++: Diagnose #define/#undef indeterminate

While working on CWG3053 I've noticed I forgot to enable diagnostics
on #define indeterminate or #undef indeterminate now that it is handled
as valid C++26 attribute.

2025-11-10  Jakub Jelinek  <jakub@redhat.com>

gcc/cp/
* lex.cc (cxx_init): For C++26 call cpp_warn on "indeterminate".
gcc/testsuite/
* g++.dg/warn/Wkeyword-macro-1.C: Expect diagnostics on define/undef
of indeterminate.
* g++.dg/warn/Wkeyword-macro-2.C: Likewise.
* g++.dg/warn/Wkeyword-macro-4.C: Likewise.
* g++.dg/warn/Wkeyword-macro-5.C: Likewise.
* g++.dg/warn/Wkeyword-macro-7.C: Likewise.
* g++.dg/warn/Wkeyword-macro-8.C: Likewise.

5 weeks agoc++, libcpp: Implement CWG3053
Jakub Jelinek [Mon, 10 Nov 2025 10:34:20 +0000 (11:34 +0100)] 
c++, libcpp: Implement CWG3053

The following patch implements CWG3053 approved in Kona, where it is now
valid not just to #define likely(a) or #define unlikely(a, b, c) but also
to #undef likely or #undef unlikely.

2025-11-10  Jakub Jelinek  <jakub@redhat.com>

libcpp/
* directives.cc: Implement CWG3053.
(do_undef): Don't pedwarn or warn about #undef likely or #undef
unlikely.
gcc/testsuite/
* g++.dg/warn/Wkeyword-macro-4.C: Don't diagnose for #undef likely
or #undef unlikely.
* g++.dg/warn/Wkeyword-macro-5.C: Likewise.
* g++.dg/warn/Wkeyword-macro-9.C: Likewise.
* g++.dg/warn/Wkeyword-macro-8.C: Likewise.
* g++.dg/warn/Wkeyword-macro-10.C: Likewise.

5 weeks agolibstdc++: Implement final wording of C++26 P3778R0 - type_order
Jakub Jelinek [Mon, 10 Nov 2025 08:59:13 +0000 (09:59 +0100)] 
libstdc++: Implement final wording of C++26 P3778R0 - type_order

The approved P3778R0 wording doesn't have type_order<_Tp, _Up>::type, so
this patch removes it.

2025-11-10  Jakub Jelinek  <jakub@redhat.com>

* libsupc++/compare: Implement final wording of C++26 P3778R0 - Fix
for type_order template definition.
(std::type_order): Remove type member.

5 weeks agolibcpp: Improve locations for macros defined prior to PCH include [PR105608]
Lewis Hyatt [Wed, 30 Jul 2025 23:20:55 +0000 (19:20 -0400)] 
libcpp: Improve locations for macros defined prior to PCH include [PR105608]

It is permissible to define macros prior to including a PCH, as long as
these definitions are disjoint from or identical to the macros in the
PCH. The PCH loading process replaces all libcpp data structures with those
from the PCH, so it is necessary to remember the extra macros separately and
then restore them after loading the PCH, which all is handled by
cpp_save_state() and cpp_read_state() in libcpp/pch.cc. The restoration
process consists of pushing a buffer containing the macro definition and
then lexing it from there, similar to how a command-line -D option is
processed. The current implementation does not attempt to set up the
line_map for this process, and so the locations assigned to the macros are
often not meaningful. (Similar to what happened in the past with lexing the
tokens out of a _Pragma string, lexing out of a buffer rather than a file
produces "sorta" reasonable locations that are often close enough, but not
reliably correct.)

Fix that up by remembering enough additional information (more or less, an
expanded_location for each macro definition) to produce a reasonable
location for the newly restored macros.

One issue that came up is the treatment of command-line-defined macros. From
the perspective of the generic line_map data structures, the command-line
location is not distinguishable from other locations; it's just an ordinary
location created by the front ends with a fake file name by convention. (At
the moment, it is always the string `<command-line>', subject to
translation.)  Since libcpp needs to assign macros to that location, it
needs to know what location to use, so I added a new member
line_maps::cmdline_location for the front ends to set, similar to how
line_maps::builtin_location is handled.

This revealed a small issue, in c-opts.cc we have:

    /* All command line defines must have the same location.  */
      cpp_force_token_locations (parse_in, line_table->highest_line);

But contrary to the comment, all command line defines don't actually end up
with the same location anymore. This is because libcpp/lex.cc has been
expanded (r6-4873) to include range information on the returned
locations. That logic has never been respecting the request of
cpp_force_token_locations. I believe this was not intentional, and so I have
corrected that here. Prior to this patch, the range logic has been leading
to command-line macros all having similar locations in the same line map (or
ad-hoc locations based from there for sufficiently long tokens); with this
change, they all have exactly the same location and that location is
recorded in line_maps::cmdline_location.

With that change, then it works fine for pch.cc to restore macros whether
they came from the command-line or from the main file.

gcc/c-family/ChangeLog:

PR preprocessor/105608
* c-opts.cc (c_finish_options): Set new member
line_table->cmdline_location.
* c-pch.cc (c_common_read_pch): Adapt linemap usage to changes in
libcpp pch.cc; it is now possible that the linemap is in a different
file after returning from cpp_read_state().

libcpp/ChangeLog:

PR preprocessor/105608
* include/line-map.h: Add new member CMDLINE_LOCATION.
* lex.cc (get_location_for_byte_range_in_cur_line): Do not expand
the token location to include range information if token location
override was requested.
(warn_about_normalization): Likewise.
(_cpp_lex_direct): Likewise.
* pch.cc (struct saved_macro): New local struct.
(struct save_macro_data): Change DEFNS vector to hold saved_macro
rather than uchar*.
(save_macros): Adapt to remember the location information for each
saved macro in addition to the definition.
(cpp_prepare_state): Likewise.
(cpp_read_state): Use the saved location information to generate
proper locations for the restored macros.

gcc/testsuite/ChangeLog:

PR preprocessor/105608
* g++.dg/pch/line-map-3.C: Remove xfails.
* g++.dg/pch/line-map-4.C: New test.
* g++.dg/pch/line-map-4.Hs: New test.

5 weeks agoDaily bump.
GCC Administrator [Mon, 10 Nov 2025 00:17:30 +0000 (00:17 +0000)] 
Daily bump.

5 weeks agoapx-ndd-tls-1b.c: Change to xfail for ! ia32
H.J. Lu [Sun, 9 Nov 2025 22:47:33 +0000 (06:47 +0800)] 
apx-ndd-tls-1b.c: Change to xfail for ! ia32

commit be671ec1f30ecd55aaff09048afb2a619018cb8a
Author: liuhongt <hongtao.liu@intel.com>
Date:   Sun Mar 16 22:28:44 2025 -0700

    Mark gcc.target/i386/apx-ndd-tls-1b.c as xfail.

marked gcc.target/i386/apx-ndd-tls-1b.c as xfail for lp64.  But this test
is enabled for ! ia32:

/* { dg-do assemble { target { apxf && { ! ia32 } } } } */

Change gcc.target/i386/apx-ndd-tls-1b.c to xfail for ! ia32.

* gcc.target/i386/apx-ndd-tls-1b.c: Change to xfail for ! ia32.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agoindirect-thunk-(|extern|inline)-(5|6).c: Drop x32 scan
H.J. Lu [Sun, 9 Nov 2025 22:38:19 +0000 (06:38 +0800)] 
indirect-thunk-(|extern|inline)-(5|6).c: Drop x32 scan

Since the x32 codegen is similar to lp64, drop x32 scan and use the same
scan for x32.

* gcc.target/i386/indirect-thunk-5.c: Drop x32 scan.
* gcc.target/i386/indirect-thunk-6.c: Likewise.
* gcc.target/i386/indirect-thunk-extern-5.c: Likewise.
* gcc.target/i386/indirect-thunk-extern-6.c: Likewise.
* gcc.target/i386/indirect-thunk-inline-5.c: Likewise.
* gcc.target/i386/indirect-thunk-inline-6.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agogcc.target/i386/cmov12.c: Limit to lp64
H.J. Lu [Sun, 9 Nov 2025 22:26:59 +0000 (06:26 +0800)] 
gcc.target/i386/cmov12.c: Limit to lp64

Since gcc.target/i386/cmov12.c also fails for x32, similar to ia32, limit
it to lp64.

* gcc.target/i386/cmov12.c: Limit to lp64.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agoRegenerate libgfortran Makefile.in and aclocal.m4
Mark Wielaard [Sun, 9 Nov 2025 21:12:19 +0000 (22:12 +0100)] 
Regenerate libgfortran Makefile.in and aclocal.m4

Commit a1fe2cfa8965 ("fortran: [PR121628]") regenerated libgfortran
Makefile.an and aclocal.m4 files with automake 1.15 instead of 1.15.1.
Run autoreconf version 2.69 with automake 1.15.1 inside libgfortran.

libgfortran/ChangeLog:

* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.

6 weeks agoFix typo
Eric Botcazou [Sun, 9 Nov 2025 12:10:24 +0000 (13:10 +0100)] 
Fix typo

6 weeks agogcc.target/i386/shrink_wrap_1.c: Limit to lp64
H.J. Lu [Sun, 9 Nov 2025 07:13:08 +0000 (15:13 +0800)] 
gcc.target/i386/shrink_wrap_1.c: Limit to lp64

Since gcc.target/i386/shrink_wrap_1.c also fails for x32, similar to ia32,
limit it to lp64.

* gcc.target/i386/shrink_wrap_1.c: Limit to lp64.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 weeks agogcc.dg/pr90838.c: Adjust for x32
H.J. Lu [Sat, 8 Nov 2025 21:45:25 +0000 (05:45 +0800)] 
gcc.dg/pr90838.c: Adjust for x32

Adjust gcc.dg/pr90838.c for x32 which has 32-bit long with x86-64 ISA.

* gcc.dg/pr90838.c: Adjust for x32

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 weeks agoDaily bump.
GCC Administrator [Sun, 9 Nov 2025 00:19:46 +0000 (00:19 +0000)] 
Daily bump.

6 weeks agoAda: Fix bogus error on limited with clause and private parent package
Eric Botcazou [Sat, 8 Nov 2025 18:15:46 +0000 (19:15 +0100)] 
Ada: Fix bogus error on limited with clause and private parent package

The implementation of the 10.1.2(8/2-11/2) subclauses that establish rules
for the legality of "with" clauses of private child units is done separately
for regular "with" clauses (in Check_Private_Child_Unit) and for limited
"with" clauses (in Check_Private_Limited_Withed_Unit).  The testcase, which
contains the regular and the "limited" version of the same pattern, exhibits
a disagreement between them; the former implementation is correct and the
latter is wrong in this case.

The patch fixes the problem and also cleans up the latter implementation by
aligning it with the former as much as possible.

gcc/ada/
PR ada/34374
* sem_ch10.adb (Check_Private_Limited_Withed_Unit): Use a separate
variable for the private child unit, streamline the loop locating
the nearest private ancestor, fix a too early termination of the
loop traversing the ancestor of the current unit, and use the same
privacy test as Check_Private_Child_Unit.

gcc/testsuite/
* gnat.dg/specs/limited_with4.ads: Rename to...
* gnat.dg/specs/limited_with1.ads: ...this.
* gnat.dg/specs/limited_with4_pkg.ads: Rename to...
* gnat.dg/specs/limited_with1_pkg.ads: ...this.
* gnat.dg/specs/limited_with2-child1.ads: New test.
* gnat.dg/specs/limited_with2-child2.ads: Likewise.
* gnat.dg/specs/limited_with2.ads: New helper.

6 weeks ago[RISC-V] Add testcase for shifted truthvalue
Philipp Tomsich [Sat, 8 Nov 2025 16:28:07 +0000 (09:28 -0700)] 
[RISC-V] Add testcase for shifted truthvalue

I was doing some cleanup on our internal tree and noticed a pattern that I
didn't think was actually useful in practice.  Thankfully the internal commit
included a testcase clearly targeting that pattern.

I'm upstreaming the testcase, but not the unnecessary pattern.

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

6 weeks agoFortran: F2018 extensions to interoperability of procedures [PR113338]
Harald Anlauf [Fri, 7 Nov 2025 21:22:42 +0000 (22:22 +0100)] 
Fortran: F2018 extensions to interoperability of procedures [PR113338]

PR fortran/113338

gcc/fortran/ChangeLog:

* decl.cc (gfc_verify_c_interop_param): Allow further types of
dummy argument without the VALUE attribute as specified in
F2018 18.3.6 item (5).

gcc/testsuite/ChangeLog:

* gfortran.dg/c-interop/pr113338-c.c: New test.
* gfortran.dg/c-interop/pr113338.f90: New test.

6 weeks agoisel: Check bounds before converting VIEW_CONVERT to VEC_SET.
Avinash Jayakar [Sat, 8 Nov 2025 04:27:59 +0000 (09:57 +0530)] 
isel: Check bounds before converting VIEW_CONVERT to VEC_SET.

The function gimple_expand_vec_set_expr in the isel pass, converted
VIEW_CONVERT_EXPR to VEC_SET_EXPR without checking the bounds on the index,
which cause ICE on targets that supported VEC_SET_EXPR like x86 and powerpc.
This patch adds a bound check on the index operand and rejects the conversion
if index is out of bound.

2025-11-08  Avinash Jayakar  <avinashd@linux.ibm.com>

gcc/ChangeLog:
PR tree-optimization/122126
* gimple-isel.cc (gimple_expand_vec_set_extract_expr): Add bound check.

gcc/testsuite/ChangeLog:
PR tree-optimization/122126
* gcc.dg/pr122126_vextr.c: New test.
* gcc.dg/pr122126_vset.c: New test.

6 weeks agoLoongArch: Fix PR122097 (2).
Lulu Cheng [Mon, 3 Nov 2025 09:53:52 +0000 (17:53 +0800)] 
LoongArch: Fix PR122097 (2).

r16-4703 does not completely fix PR122097.  Floating-point vectors
were not processed in the function loongarch_const_vector_same_bytes_p.
This patch will completely resolve this issue.

PR target/122097

gcc/ChangeLog:

* config/loongarch/loongarch.cc
(loongarch_const_vector_same_bytes_p): Add processing for
floating-point vector data.