Adjust alignment check forcing a local copy if the argument on stack is
not aligned to its type and the current alignment, which is determined
by the backend, is less than MAX_SUPPORTED_STACK_ALIGNMENT when the
parameter has its address taken.
For x86, ignore argument passed on stack when updating stack alignment
since caller is responsible to align the outgoing stack for arguments
passed on stack.
gcc/
PR target/120839
PR middle-end/124671
* function.cc (assign_parm_adjust_stack_rtl): Get the parameter
as argument. Adjust alignment check forcing a local copy.
(assign_parms): Adjust.
* config/i386/i386.cc (ix86_argument_passed_on_stack_p): New.
(ix86_update_stack_alignment): Ignore argument passed on stack.
gcc/testsuite/
PR target/120839
PR middle-end/124671
* gcc.dg/pr124671.c: New test.
* gcc.target/i386/pr120839-1a.c: Likewise.
* gcc.target/i386/pr120839-1b.c: Likewise.
* gcc.target/i386/pr120839-2.c: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-Authored-By: Richard Biener <rguenther@suse.de>
PR libfortran/124543
libgfortran/ChangeLog:
* io/inquire.c (inquire_via_unit): Fix return value for
NAMED. Add check for ACTION. Fix return values for
ENCODING, PENDING, READ, WRITE, READWRITE.
(inquire_via_filename): Add checks for ACTION, DELIM,
ASYNCHRONOUS, and PENDING. Fix return value for
ENCODING.
* io/unix.c (inquire_access): Change return value from no
to unknown.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr124543.f90: New test.
... by adjusting the asm template reg string to 'W', similar to commit
gbd275e81812c for zero_extendsidi2. However unlike that change, this is
not a bug fix: zero_extendsidi2 relies on wN reg move to achieve the
32->64 semantics. A {8,16}->64 extension needs to be emulated anyways
by masking out extra bits so the reg used is not important.
However wN reg based codegen is still preferable in general:
- It is easier on verifier as it has to track fewer bits and avoids
corner case false positives.
- Better native codegen as upper bits are guaranteed to be zero and can
leverage target ISA mechanisms to achieve that mostly for free.
- Better native codegen on 32-bit targets which need to use 2 regs for
rN regs.
gcc/ChangeLog:
* config/bpf/bpf.md (zero_extendhidi2): Add alternates for
alu32 and use 'W' for reg operands.
(zero_extendqidi2): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/bpf/zero-ext.c: Add tests for {HI,QI}mode values.
Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
This patch adds runtime tests for BPF target.
These tests are based on existing compile-time tests and depends on
bpf.exp baseboard
To run the testsuite:
make check-gcc RUNTESTFLAGS="--target_board=bpf-vmtest bpf-torture.exp KERNEL_VERSION=6.15 LOG_LEVEL=ERROR"
Options:
KERNEL_VERSION (default: 6.15)
LOG_LEVEL (default: ERROR)
Note: VMTEST_DIR must be set in the environment.
See the bpf-vmtest-tool README for details.
gcc/testsuite/ChangeLog:
* gcc.target/bpf/torture/bpf-torture.exp: New testsuite.
* gcc.target/bpf/torture/invalid-memory-access.c: New test.
* gcc.target/bpf/torture/memcpy.c: New test.
* gcc.target/bpf/torture/memmove.c: New test.
* gcc.target/bpf/torture/memset.c: New test.
* gcc.target/bpf/torture/naked.c: New test.
* gcc.target/bpf/torture/nop.c: New test.
* gcc.target/bpf/torture/trace_openat.c: New test.
This implements with P3936R1 Safer atomic_ref::address with
the bump to __cpp_lib_atomic_ref feture test macro.
libstdc++-v3/ChangeLog:
* include/bits/atomic_base.h (__atomic_ref_base::_Address_return_t):
Define.
(__atomic_ref_base::address): Change return type to _Address_return_t.
* include/bits/version.def (atomic_ref): Bump to 202603.
* include/bits/version.h: Regenerate.
* testsuite/29_atomics/atomic_ref/address.cc: Update check for
return type.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
The following makes sure SSA operands are up-to-date before folding.
Esp. when replace_uses_by is invoked from SCEV cprop which now has
ranger enabled we can otherwise end up ICEing where purpoted SSA
names now are constants. This follows what forwprop does.
PR tree-optimization/124692
* tree-cfg.cc (replace_uses_by): Call update_stmt after
substitution and before folding.
* gcc.dg/torture/pr124692.c: New testcase.
The Windows ABI doesn't support _Float128:
https://learn.microsoft.com/en-us/cpp/build/ieee-floating-point-representation.
While it can be emulated for this target, the current implementation
prevents fortran from being built with this emulation.
This patch disables _Float128 emulation for aarch64-w64-mingw32 target.
This enables fortran to be built with no additional changes.
gcc/ChangeLog:
* config/aarch64/aarch64.cc
(aarch64_scalar_mode_supported_p): Only return true on TFmode if
TARGET_LONG_DOUBLE_128 is set.
libgcc/ChangeLog:
* config.host: Disable soft floating point.
Co-Authored-By: Evgeny Karpov <evgeny.karpov@arm.com>
The following makes -fno-math-errno not affect non-math builtins.
PR tree-optimization/88576
* tree-ssa-alias.cc (check_fnspec): Remove flag_errno_math check.
* ipa-modref.cc (modref_access_analysis::process_fnspec):
Likewise.
* gcc.dg/pr88576.c: New testcase.
When vectorizing a recurrence we have to skip inserted vector
stmts for the latch definition when finding the insertion point
for the permute.
PR tree-optimization/124677
* tree-vect-loop.cc (vectorizable_recurr): Skip vector
stmts for the def.
* gcc.dg/vect/vect-pr124677.c: New testcase.
Clear the opposite directive flag only for fresh free-form OpenMP/OpenACC
sentinel lines so continued directives do not leak OpenACC/OpenMP state into
the next independent directive.
PR fortran/108382
gcc/fortran/ChangeLog:
* scanner.cc (skip_free_oacc_sentinel): Clear openmp_flag only for
fresh OpenACC directive lines.
(skip_free_omp_sentinel): Clear openacc_flag only for fresh OpenMP
directive lines.
gcc/testsuite/ChangeLog:
* gfortran.dg/goacc/omp-108382.f90: New test.
Signed-off-by: Christopher Albert <albert@tugraz.at>
Unhappy about the old and new names, as a function type is not a function,
but ces't la vie.
2026-03-30 Jakub Jelinek <jakub@redhat.com>
gcc/cp/
* metafns.gperf (enum metafn_code): Remove
METAFN_HAS_ELLIPSIS_PARAMETER, add METAFN_IS_VARARG_FUNCTION.
(has_ellipsis_parameter): Remove.
(is_vararg_function): Add.
* reflect.cc (eval_has_ellipsis_parameter): Rename to ...
(eval_is_vararg_function): ... this. Adjust function comment.
(process_metafunction): Handle METAFN_IS_VARARG_FUNCTION
instead of METAFN_HAS_ELLIPSIS_PARAMETER.
* metafns.h: Regenerate.
gcc/testsuite/
* g++.dg/reflect/has_ellipsis_parameter1.C: Rename to ...
* g++.dg/reflect/is_vararg_function1.C: this. New test. Rename
has_ellipsis_parameter to is_vararg_function everywhere.
libstdc++-v3/
* include/std/meta (has_ellipsis_parameter): Rename to ...
(is_vararg_function): ... this. New declaration.
* src/c++23/std.cc.in: Remove std::meta::has_ellipsis_parameter
export, add std::meta::is_vararg_function export.
The values for chip IDs and the LITTLE.big variants have been confirmed
in the XNU sources (xnu/osfmk/arm/cpuid.h).
gcc/ChangeLog:
* config/aarch64/aarch64-cores.def (AARCH64_CORE): Add Apple M5
cores.
* config/aarch64/aarch64-tune.md: Regenerate.
* doc/invoke.texi: Add apple-m5 core to the ones listed
for arch and tune selections.
gcc/ChangeLog:
PR target/102309
* config/arm/arm.cc (arm_constant_limit): Allways allow at least
one insn when loading a constant.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
This testcase tries to call build_nonstandard_integer_type for a 192-bit
precision type. This eventually faults because we don't have a suitably wide
mode.
Somewhat surprisingly, the targets are responsible for defining OImode. So
this adds it to the RISC-V port as well which trivially fixes the ICE. The
test is limited to rv64 as rv32 doesn't support int128. That could have been
handled with a target-supports selector just as easily.
Tested on riscv32-elf and riscv64-elf. Both the BPI and Pioneer are
experiencing NVME drive failures, so no bootstraps until I figure that out.
Waiting on the pre-commit tester to do its thing before pushing
PR target/124674
gcc/
* config/riscv/riscv-modes.def: Create OImode.
gcc/testsuite
* gcc.target/riscv/pr124674.c: New test.
The test for the D std library incorrectly returned true on targets
--with-libphobos-druntime-only=yes.
The function cos() is treated as an intrinsic, so always exists.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp
(check_effective_target_d_runtime_has_std_library): Test for
acos rather than cos.
Simple an obvious fix to avoid integer overflow.
PR fortran/124666
gcc/fortran/ChangeLog:
* io.cc (format_lex): Use enclosing parens to subtract
before adding.
2026-03-28 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/95879
* parse.cc (fixup_st_func_formals): New function to update
statement function formal argument lists referencing a symbol
about to be freed.
(gfc_fixup_sibling_symbols): Call fixup_st_func_formals before
gfc_release_symbol.
gcc/testsuite
PR fortran/95879
* gfortran.dg/pr95879.f90: New test.
2026-03-28 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/84245
* match.cc (gfc_match_select_type): Free the temporary namespace
only on MATCH_NO. Return immediately on MATCH_ERROR.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr84245.f90: New test.
VxWorks involves linking oddities in both kernel and rtp modes that
prevent the testcases for finding the expected outputs in the
erratas_opt_*.c testcases. One of the modes doesn't even perform
final linking, so it's kind of hopeless. Just skip them.
for gcc/testsuite/ChangeLog
* gcc.target/aarch64/erratas_opt_0.c: Skip on VxWorks.
* gcc.target/aarch64/erratas_opt_1.c: Likewise.
* gcc.target/aarch64/erratas_opt_2.c: Likewise.
* gcc.target/aarch64/erratas_opt_3.c: Likewise.
* gcc.target/aarch64/erratas_opt_4.c: Likewise.
* gcc.target/aarch64/erratas_opt_5.c: Likewise.
* gcc.target/aarch64/erratas_opt_6.c: Likewise.
* gcc.target/aarch64/erratas_opt_7.c: Likewise.
* gcc.target/aarch64/erratas_opt_8.c: Likewise.
* gcc.target/aarch64/erratas_opt_9.c: Likewise.
* gcc.target/aarch64/erratas_opt_10.c: Likewise.
* gcc.target/aarch64/erratas_opt_11.c: Likewise.
* gcc.target/aarch64/erratas_opt_12.c: Likewise.
* gcc.target/aarch64/erratas_opt_13.c: Likewise.
* gcc.target/aarch64/erratas_opt_14.c: Likewise.
* gcc.target/aarch64/erratas_opt_15.c: Likewise.
Though gcc most often installs a stdint-gcc.h, that's not necessarily
the case, and it isn't the case for sure when targeting vxworks.
The file history doesn't justify the oddity, so I'm assuming it was a
mistake.
for gcc/testsuite/ChangeLog
* gcc.target/aarch64/crc-builtin-pmul64.c: Include stdint.h.
!a-b-c is not the same as ! a-b-c. In !a-b-c, the '!' is part of the
triplet that istarget attempts to match. Fix all occurrences, except
for gcc.dg/vect/vect-93.c, that is taken care of separately.
for gcc/testsuite/ChangeLog
* gcc.dg/debug/btf/btf-variables-5.c: Separate ! from triplet.
* gcc.dg/hoist-register-pressure-1.c: Likewise.
* gcc.dg/hoist-register-pressure-2.c: Likewise.
* gcc.dg/hoist-register-pressure-3.c: Likewise.
* gcc.target/powerpc/safe-indirect-jump-1.c: Likewise.
* gfortran.dg/gomp/declare-variant-14.f90: Likewise.
In RTP mode, defining TLS_DELETE_HOOK_ARG as NULL AKA 0 elicits a
warning, that casting it to TASK_ID avoids.
objLibP.h defines an inline function that, depending on the
configuration, will have unused parameters. Allow warnings about
them.
vxTas calls are supposed to take __vx_tas_t, but upon passing it that
on aarch64, we get warnings about discarding volatile qualifiers, that
not even explicit type casts avoid. So, allow the warnings.
for libgcc/ChangeLog
* config/gthr-vxworks-tls.c (TLS_DELETE_HOOK_ARG): Type-cast
NULL constant to avoid warning.
* config/t-vxworks (LIBGCC2_CFLAGS): Tolerate unused-parameter
and discarded-qualifiers errors.
On a target that defaults to -mlong-double-64 -msse,
standard_abi_usable.cc and other tests fail to compile because of the
assert that rejects long double. As on ppc, we can trivially make
things work for -mlong-double-64.
for libstdc++-v3/ChangeLog
* include/experimental/bits/simd.h (__intrinsic_type): Accept
64-bit long doubles on x86 SSE.
Currently the following RTL for zero extension
| (insn 8 7 9 (set (reg:DI 0 %r0 [25])
| (zero_extend:DI (reg:SI 0 %r0 [24]))) {zero_extendsidi2}
| (nil))
generates
| r0 = r0
which is just a 64-bit copy and doesn't clear the upper 32-bits as
semantically required by the pattern.
The issue is pattern's asm template missing ‘w’/'W' causing bpf_print_register ()
to only emit 'r' regs. Using ‘W’ in template generates correct code.
| w0 = w0
Note that 'W specifier ignores the RTL mode and unconditionally emits
the 'w' reg which might feel like creating a potential future bug.
However for this insn, it is correct/completely safe as follows:
- 'W1' for src operand: src operand has a SI mode in pattern.
- 'W0' for dst: Technically dst is DI, but the upper 32-bits of output
have to be 0 due to zero-extension, thus a 'w' reg is OK.
For selftests this is a wash, except for some spurious changes.
PR target/124670
gcc/ChangeLog:
* config/bpf/bpf.md (zero_extendsidi2): Use 'W' in asm template.
gcc/testsuite/ChangeLog:
* gcc.target/bpf/zero-ext.c: New test.
Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
2026-03-27 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/102619
* trans-expr.cc (gfc_get_interface_mapping_array): Add argument
'assumed_rank_formal', which if true returns the descriptor in
'ifm'.
(gfc_add_interface_mapping): Detect an assumed rank formal arg
of a non-intrinsic function to set 'assumed_rank_formal' and
pass the descriptor to gfc_get_interface_mapping_array.
gcc/testsuite/
PR fortran/102619
* gfortran.dg/pr102619.f90: New test.
When an entity of a library-level package is used as actual in an attempted
structural instantiation of a library-level generic unit in the package, an
error is given since the structural instance is a library unit with circular
semantic dependence on the package.
This change lifts the restriction for generic subprograms by demoting the
structural instance into a local instance in this case, which means that
several instances might end up being present in a single partition, unless
the optimizer is run on the entire partition, for example by means of LTO.
gcc/ada/
* sem_ch12.adb (Analyze_Structural_Associations): Create a local
instance instead of a structural instance when a local entity of
a library-level package is used in a subprogram instantiation.
PR fortran/124656
gcc/fortran/ChangeLog:
* check.cc (min_max_args): Fix array index used for registering
labeled arguments of the MIN/MAX intrinsics for subsequent
duplicate label checks.
The case itself is fairly pathological (and very likely not human made), but
it's a clear incentive to get rid of an old kludge in generic instantiation,
whereby the full view of a type is forced on nodes in the generic unit even
though only the partial declaration is visible to them.
gcc/ada/
PR ada/124596
* sem_ch12.ads (Check_Private_View): Move around.
* sem_ch12.adb (Check_Private_View): Retrieve the partial view
by means of a call to Incomplete_Or_Partial_View.
(Save_Global_References.Set_Global_Type): Do not force the full
view of a type when only the partial declaration is visible.
* sem_res.adb (Resolve_Actuals.Insert_Default): Remove obsolete
code coping with the above kludge.
gcc/testsuite/
* gnat.dg/generic_inst21.adb: New test.
There were a few minor issues with the two routines, partially because of
not handling corner cases and partially some clarifications are only in
newer versions of the spec.
In particular, for omp_target_is_present
* NULL pointer aren't regarded as present
* For (unified-)shared memory, claiming that something has always corresponding
storage is wrong - it mostly never has. (but it is omp_target_is_accessible).
* Even with shared memory, 'declare target' usually has device memory. For
'link' it is made to point to the host, i.e. it is not mapped, all others
are still mapped. (With 'requires self_mapping', 'enter' should also not be
mapped (and turned internally to 'link'), only 'local' needs to be mapped.)
For omp_get_mapped_ptr
* For NULL we can return NULL early also for devices.
* For shared memory, we shouldn't touch link (it is not counting as mapped);
hence return NULL for it.
The documentation was updated add some missing cross references as the more
useful ones were missing. Additionally, the description for the two modified
routines has been updated.
libgomp/ChangeLog:
* target.c (omp_target_is_present, omp_get_mapped_ptr): Update handling
for nullptr and shared-memory devices.
* libgomp.texi (omp_target_is_present, omp_get_mapped_ptr): Update
description, add see-also @refs.
(omp_target_is_accessible, omp_target_associate_ptr): Add see-also
@refs.
* testsuite/libgomp.c/omp_target_is_present.c: New test.
* testsuite/libgomp.c/omp_target_is_present-2.c: New test.
Like r16-727-g2ec5082dd24cef but the call to partial_subreg_p happens
in a later place, maybe_mode_change.
For this example we have VNx4QImode and DImode which are not ordered.
Bootstrapped and tested on aarch64-linux-gnu.
PR rtl-optimization/124649
gcc/ChangeLog:
* regcprop.cc (maybe_mode_change): Return early
for unordered modes.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr124649-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
2026-03-27 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/114021
* symbol.cc (gfc_get_unique_symtree): If the namespace argument
is NULL, allocate a new symtree and provide it with the unique
name.
* trans-expr.cc (trans_scalar_assign): In the deep copy of a
derived type with allocatable components, fix the rhs value if
it is not a constant or a variable.
* trans-stmt.cc (gfc_trans_allocate): Do not deallocate
allocatable components of a source that is not a variable and
is a pointer. If the DECL_NAME or its IDENTIFIER_POINTER are
null,use gfc_get_unique_symtree with NULL namespace to obtain a
symtree for the assignment.
gcc/testsuite/
PR fortran/114021
* gfortran.dg/pr114021.f90: New test.
In r16-7312-gecc37444062b40 we allowed all vector modes for the
any_target hook. Since then we would ICE in gcc.target/riscv/pr122051.c
as emit_move_multi_word would choose a fractional vector mode.
This patch disallows fractional vector modes for xtheadvector in
riscv_vector_mode_supported_p but makes an exception for builtin
registration (through a global variable). During registration we
need to have all modes available in order to maintain the registration
order for LTO streaming.
PR target/124613
gcc/ChangeLog:
* config/riscv/riscv-vector-builtins.cc (rvv_switcher::rvv_switcher):
Add riscv_registering_builtins.
(rvv_switcher::~rvv_switcher): Set riscv_registering_builtins to
false.
* config/riscv/riscv.cc (riscv_vector_mode_supported_p): Use
riscv_registering_builtins.
* config/riscv/riscv.h: Declare.
We can attempt to add DW_AT_artificial because of two reasons,
because of DECL_ARTIFICIAL on the decl and because of the
artificial function attribute which is attempted when marking
a decl DIE for inlining. The following guards the latter,
avoiding an ICE with checking enabled.
PR debug/124644
* dwarf2out.cc (dwarf2out_abstract_function): Only
add DW_AT_artificial if the decl isn't DECL_ARTIFICIAL.
* g++.dg/debug/pr124644.C: New testcase.
2026-03-26 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/115315
* decl.cc (insert_parameter_exprs): Make strcmp condition more
concise.
(gfc_get_pdt_instance): Use gf_replace_expr where possible and
use return value of gfc_simplify_expr. Correct error in which
params->expr was being simplified instead of c2->initializer.
* expr.cc (gfc_simplify_expr): If the substring 'start' value
is less than zero, it is clearly out of range and so return
false.
gcc/testsuite/
PR fortran/115315
* gfortran.dg/pdt_90.f03: New test.
TCL 9 removed case command which has been deprecated before.
https://core.tcl-lang.org/tcl/wiki?name=Migrating+scripts+to+Tcl+9
says "Replace case with switch" and switch has been working in TCL 8
just fine.
2026-03-26 Jakub Jelinek <jakub@redhat.com>
* lib/mike-gcc.exp (postbase): Use switch instead of case for
TCL 9 compatibility.
* lib/mike-g++.exp (postbase): Likewise.
This patch adds create_asm_partitions to cache partitioning
to prevent issues with non-renameable symbols (while partition
joining) and static asm symbols (while partition splitting).
All other relevant partitionings use create_asm_partitions.
This was not used in cache partitioning, because toplevel asm
could be in principle special handled in cache partitioning
with marginally better results, but I never implemented it.
lto/124289
gcc/lto/ChangeLog:
* lto-partition.cc (enum map1to1_content): New.
(map_1_to_1): Use map1to1_content.
(lto_1_to_1_map): Likewise.
(create_asm_partitions): Likewise.
(lto_max_map): Likewise.
(lto_cache_map): Use create_asm_partitions.
gcc/testsuite/ChangeLog:
* gcc.dg/lto/toplevel-extended-asm-2_0.c: Add padding to asm label.
* gcc.dg/lto/toplevel-extended-asm-2_1.c: Add padding to asm label.
In substitute7.C we have
template <typename T, auto ... Vs>
constexpr auto construct_from = T{Vs...}; // #1
struct Inner {};
struct Outer { Inner m; };
constexpr auto r = substitute(^^construct_from,
{ ^^Outer, ^^construct_from<Inner> });
which crashes because the auto in #1 hadn't been deduced when we
called eval_can_substitute -> lookup_template_variable when processing
the substitute call. We can call mark_used to resolve this, because
it has:
if (undeduced_auto_decl (decl))
maybe_instantiate_decl (decl);
and to make the json-parser.C test work, we have to do something
similar in eval_substitute, otherwise we crash due to another
undeduced auto.
PR c++/123613
gcc/cp/ChangeLog:
* reflect.cc (get_reflection): Call mark_used.
(eval_can_substitute): Don't resolve_nondeduced_context here.
(eval_substitute): Call lookup_and_finish_template_variable instead
of lookup_template_variable and finish_template_variable.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/json-parser.C: New test.
* g++.dg/reflect/substitute7.C: New test.
* g++.dg/reflect/test.json: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>