This updates test01, so it properly handle 128bit floating points,
including situation when long double uses such representation.
Firstly, the computation of skips is corrected, by discarding number
values equal to number of calls required to generate element
(skips become zero for all non-float correctly). Furthermore, checks
of histogram for types using iec559 representation, is moved inside
test01 function, so we use correct value for long double, depending
on number of digits in mantissa on given platform.
We also extend test to cover __float128, to test 128bit floating
point on more platforms.
libstdc++-v3/ChangeLog:
* testsuite/26_numerics/random/uniform_real_distribution/operators/gencanon.cc:
Updated test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
The following fixes enough of const VEC_PERM folding and lowering
to deal with the fallout for the two testcases from the PR. We
usually do not generate such problematic VEC_PERM expressions, but
we allow those since GCC 14. As can be seen we mishandle those,
including failure to expand/lower them by zero-extending inputs (which is
what __builtin_shufflevector does).
I'm unsure as to what extent we get such permutes but Tamar indicates
that aarch64 can handle those at least.
PR middle-end/123175
* match.pd (vec_perm @0 @1 @2): Fixup for inputs having a
different number of elements than the result.
* tree-vect-generic.cc (lower_vec_perm): Likewise.
* gcc.dg/torture/pr123175-1.c: New testcase.
* gcc.dg/torture/pr123175-2.c: Likewise.
The libgomp.c++/target-cdtor-2.C test FAILs on Solaris:
FAIL: libgomp.c++/target-cdtor-2.C output pattern test
Compared to the Linux output
~S, 5, 1
[...]
finiDH1, 1
the Solaris output has a different order:
finiDH1, 1
[...]
~S, 5, 1
This is another instance of the long-standing PR c++/81337. As detailed
there, the relative order of ~S::S() and __attribute__((destructor()))
functions isn't guaranteed. Since xfail'ing the dg-output parts isn't
practical, this patch skips the whole test on Solaris.
Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.
2025-12-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
libgomp:
PR c++/81337
* testsuite/libgomp.c++/target-cdtor-2.C: Skip on Solaris.
Fix comments.
This patch adds a note to indicate if any viable explicit conversion
functions were skipped if an implicit conversion failed to occur.
Perhaps the base diagnostic in ocp_convert can be further improved for
class types as well, as the current message is not very clear, but I've
not looked into that for this patch.
PR c++/115163
gcc/cp/ChangeLog:
* call.cc (implicit_conversion_error): Add flags argument, call
maybe_show_nonconverting_candidate.
(build_converted_constant_expr_internal): Pass flags to
implicit_conversion_error.
(perform_implicit_conversion_flags): Likewise.
* cvt.cc (ocp_convert): Call maybe_show_nonconverting_candidate
on conversion error.
gcc/testsuite/ChangeLog:
* g++.dg/ext/is_convertible7.C: Add new testcases.
* g++.dg/diagnostic/explicit2.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
The following testcase ICEs on i686-linux, because the HW in that
case implements the shift as shifting by 64-bit count (anything larger
or equal to number of bits in the first operand's element results
in 0 or sign copies), so the machine description implements it as
such as well.
Now, because shifts/rotates can have different modes on the first
and second operand, when the second one has VOIDmode (i.e. CONST_INT,
I think CONST_WIDE_INT has non-VOIDmode and CONST_DOUBLE with VOIDmode
is hopefully very rarely used), we need to choose some mode for the
wide_int conversion. And so far we've been choosing BITS_PER_WORD/word_mode
or the mode of the first operand's element, whichever is wider.
That works fine on 64-bit targets, CONST_INT has always at most 64 bits,
but for 32-bit targets uses SImode.
Because HOST_BITS_PER_WIDE_INT is always 64, the following patch just
uses that plus DImode instead of BITS_PER_WORD and word_mode.
2026-01-12 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/123523
* simplify-rtx.cc (simplify_const_binary_operation): Use
DImode for VOIDmode shift and truncation counts if int_mode
is narrower than HOST_BITS_PER_WIDE_INT rather than
word_mode if int_mode it is narrower than BITS_PER_WORD.
* gcc.target/i386/pr123523.c: New test.
The recent addition of gnu::gnu_inline attributes to some C++26 constexpr
methods broke classes which inherit e.g. from std::logic_error or other
C++26 classes with gnu::gnu_inline constructors and use inheriting
constructors. On std::logic_error etc. it has the desired effect that
the ctor itself can be constexpr evaluated and even inlined, but is not
emitted in each TU that needs it and didn't inline it, but is still
contained in libstdc++.{a,so.6}.
Unfortunately inheriting ctors inherit also attributes of the corresponding
ctors except those that clone_attrs filter out and that includes the
gnu_inline attribute if explicitly specified on the base class ctor.
That has the undesirable effect that the implementation detail of e.g.
the std::logic_error class leaks into the behavior of a class that inherits
from it if it is using inheriting constructors, those will result in
undefined symbols for the inheriting constructors if they aren't inlined,
unless one also inherits from it in some TU without gnu_inline there (e.g.
one compiled with -std=c++23 or earlier).
So, the following patch fixes it by removing the gnu::gnu_inline attribute
from the inheriting constructor. Not done in clone_attrs because that
function is also used for the normal constructor cloning and in that case
we do want to clone those attributes.
2026-01-12 Jakub Jelinek <jakub@redhat.com>
PR c++/123526
* method.cc: Include attribs.h.
(implicitly_declare_fn): Remove gnu::gnu_inline attribute.
* g++.dg/ext/gnu-inline-inh-ctor1.C: New test.
* g++.dg/ext/gnu-inline-inh-ctor2.C: New test.
The test gcc.target/i386/pr123121.c does not rely on LP64-specific
behavior. Drop the dg-require-effective-target lp64 directive so the
test can run on 32-bit i386 targets as well.
PR rtl-optimization/123121
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr123121.c:
Several AVX512BW and AVX512DQ tests FAIL on Solaris/x86 with the native
assembler. As detailed in the PR, this is for two reasons:
* Due to a misunderstanding, %k0 isn't accepted as source or destination
register of some insns.
* {sae} is considered implicit for some insns, so specifying it
explicitly was deemed unnecessary.
It's unclear if and when this will be fixed, so avx512bw and avx512dq
tests are disabled for now.
Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.
2025-12-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc/testsuite:
PR target/123415
* lib/target-supports.exp (check_effective_target_avx512dq):
Disable with Solaris/x86 as.
(check_effective_target_avx512bw): Likewise.
The testcase test-frame-related.c fails in 32-bit mode due to
constraints not matching. Use -mpowerpc64 option to ensure that the
testcase works with -m32.
gcc/testsuite:
PR testsuite/123129
* gcc.dg/rtl/powerpc/test-frame-related.c: Add -mpowerpc64.
This was a trivial check that was missing and was causing ICEs due to
segmentation faults in some tests.
Bootstrapped and regtested on aarch64-linux-gnu.
Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:
* auto-profile.cc (autofdo_source_profile::offline_unrealized_inlines):
Add missing check for in_map.
So arm is a bit special, non_strict_align is sometimes true but
it does not represent the true value of STRICT_ALIGN inside the compiler,
so this testcase fails. This disables the testcase for arm targets where
STRICT_ALIGN is always true even when there is unaligned loads.
Pushed as obvious after testing on x86_64 and arm-eabi (with -march=armv7) to make
sure the testcase no longer run on arm.
PR testsuite/121752
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/vector-compare-1.C: Disable for arm targets.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Adding two testcases from Gerhard Steinmetz from 2016-08-30.
These have had the dejagnu directives added. The last comment
in the PR is from Andrew Pinski notes the PR was fixed in the 9.3,
10+ timeframe. The testcases are small. Committing the tests to
ensure things are not broken in the future.
PR fortran/77415
gcc/testsuite/ChangeLog:
* gfortran.dg/pr77415_1.f90: New test.
* gfortran.dg/pr77415_2.f90: New test.
If GC_DEBUG is defined then all-upper-case macros will expand to calls
to the debug variant of collector functions.
So add the configury bit to define GC_DEBUG if the user wants and
switch all `GC_` calls to the corresponding macros.
libga68/ChangeLog:
* configure: Regenerate.
* configure.ac: Add --enable-algol68-gc-debug option and
define GC_DEBUG accordingly.
* ga68-alloc.c (_libga68_realloc): Use the C macro version of
the GC function.
(_libga68_realloc_unchecked): Likewise.
(_libga68_malloc): Likewise.
Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
During LTO symbol merging, weak symbols may be resolved to external
definition.
We reset the symbol, so the body might be released in unreachability
pass. But we didn't mark the symbol with body_removed, so ICF assumed
the body was still there causing SegFault.
gcc/lto/ChangeLog:
* lto-symtab.cc (lto_symtab_merge_symbols): Set body_removed
for symbols resolved outside of IR.
gcc/testsuite/ChangeLog:
* gcc.dg/lto/attr-weakref-2_0.c: New test.
* gcc.dg/lto/attr-weakref-2_1.c: New test.
This new pass heuristically detects symbols referenced by toplevel
assembly to prevent their optimization.
Heuristics is done by comparing identifiers in assembly to known
symbols.
The pass is split into 2 passes, in LGEN and in WPA.
There must be one pass for WPA to be able to reference any symbol.
However in WPA there may be multiple symbols with the same name,
so we handle those local symbols in LGEN.
gcc/ChangeLog:
* asm-toplevel.cc (mark_fragile_ref_by_asm):
Add marked_local to handle symbol as local.
(ipa_asm_heuristics): New.
(class pass_ipa_asm): New.
(make_pass_ipa_asm_lgen): New.
(make_pass_ipa_asm_wpa): New.
* common.opt: New flto-toplevel-asm-heuristics.
* passes.def: New asm passes.
* timevar.def (TV_IPA_LTO_ASM): New.
* tree-pass.h (make_pass_ipa_asm_lgen): New.
(make_pass_ipa_asm_wpa): New.
gcc/testsuite/ChangeLog:
* gcc.dg/lto/toplevel-simple-asm-1_0.c: New test.
* gcc.dg/lto/toplevel-simple-asm-1_1.c: New test.
* gcc.dg/lto/toplevel-simple-asm-2_0.c: New test.
* gcc.dg/lto/toplevel-simple-asm-2_1.c: New test.
For balanced and max partitioning this adds proper partitioning of asm
and related symbols.
The special symbols are partitioned with 1to1 and joined together if
there is no name conflict. All other symbols are partitioned with the
requested partitioning.
In typical usage with small number of toplevel assembly and no name
conflicts, all special symbols will be in the single first partition.
balanced partitioning will continue filling last asm partition.
gcc/lto/ChangeLog:
* lto-partition.cc (join_partitions): Declare.
(lto_1_to_1_map): Split out to..
(map_1_to_1): ..here.
(create_asm_partition): Replaced by..
(create_asm_partitions): ..this.
(lto_max_map): Use new create_asm_partitions.
(lto_balanced_map): Use new create_asm_partitions.
gcc/testsuite/ChangeLog:
* gcc.dg/lto/toplevel-extended-asm-2_0.c: More partitionings.
* gcc.dg/lto/toplevel-extended-asm-2_1.c: Likewise.
.local symbols cannot become global, so we have to use must_remain_in_tu.
There is no way to mark declaration as both external and static/.local
in C. So we have to disable the implicit definition of static variables.
Also .local asm function still produces "used but never defined" warning.
gcc/ChangeLog:
* asm-toplevel.cc (mark_fragile_ref_by_asm): New.
(struct constraint_data): New.
(walk_through_constraints): Handle .local definitions.
(analyze_toplevel_extended_asm): Propagate constraint_data.
gcc/testsuite/ChangeLog:
* gcc.dg/lto/toplevel-extended-asm-2_0.c: New test.
* gcc.dg/lto/toplevel-extended-asm-2_1.c: New test.
* gcc.dg/lto/toplevel-extended-asm-3_0.c: New test.
* gcc.dg/lto/toplevel-extended-asm-3_1.c: New test.
With toplevel assembly we are sometimes not allowed to globalize static
symbols. So such symbols cannot be in more than one partition.
must_remain_in_tu_* guarantee that such symbols or references to them do
not escape the original translation unit. Thus 1to1 partitioning is always
valid.
gcc/ChangeLog:
* cgraph.h: Add must_remain_in_tu_*.
* cgraphclones.cc (cgraph_node::create_clone): Propagate
must_remain_in_tu_body.
* cif-code.def (MUST_REMAIN_IN_TU): New.
* ipa-icf.cc (sem_function::equals_wpa): Check
must_remain_in_tu_*
(sem_variable::equals_wpa): Likewise.
* ipa-inline-transform.cc (inline_call): Propagate
must_remain_in_tu_body.
* ipa-inline.cc (can_inline_edge_p): Check
must_remain_in_tu_body.
* lto-cgraph.cc (lto_output_node): Output must_remain_in_tu_*
(lto_output_varpool_node): Likewise.
(input_overwrite_node): Input must_remain_in_tu_*.
(input_varpool_node): Likewise.
* tree.cc (decl_address_ip_invariant_p): Check
must_remain_in_tu_name.
* varpool.cc (varpool_node::ctor_useable_for_folding_p): Check
must_remain_in_tu_body.
gcc/lto/ChangeLog:
* lto-symtab.cc (lto_cgraph_replace_node): Propagate
must_remain_in_tu_*.
(lto_varpool_replace_node): Likewise.
Previous patch added asm_node streaming, so we need to add referenced
symbols to partition.
asm_nodes must be added to partition before computing the boundary.
gcc/ChangeLog:
* lto-cgraph.cc (compute_ltrans_boundary): Add symbols
referenced from asm_nodes.
* lto-streamer-out.cc (lto_output): Move adding asm_nodes
to...
* passes.cc (ipa_write_summaries): ...here.
gcc/testsuite/ChangeLog:
* gcc.dg/lto/toplevel-extended-asm-1_0.c: New test.
* gcc.dg/lto/toplevel-extended-asm-1_1.c: New test.
Streaming of toplevel extended assembly was missing implementation.
Streaming must be after merging of decls, otherwise we would have to
fix the pointers to new decls.
gcc/ChangeLog:
* ipa-free-lang-data.cc (find_decls_types_in_asm): New.
(free_lang_data_in_cgraph): Use find_decls_types_in_asm.
* lto-cgraph.cc (input_cgraph_1): Move asm to..
(input_toplevel_asms): ..here.
* lto-streamer-in.cc (lto_input_toplevel_asms):
Allow extended asm.
* lto-streamer-out.cc (lto_output_toplevel_asms):
Allow extended asm.
(lto_output_toplevel_asms): Allow ASM_EXPR.
* lto-streamer.h (input_toplevel_asms): New.
gcc/lto/ChangeLog:
* lto-common.cc (read_cgraph_and_symbols): Call
input_toplevel_asms after decl merging.
gcc/testsuite/ChangeLog:
* g++.dg/lto/toplevel_asm-0_0.C: New test.
Analyzes references from toplevel extended assembly.
We cannot perform IPA optimizations with toplevel assembly, so
symtab_node only needs ref_by_asm to know that it should not be removed.
PR ipa/122458
gcc/ChangeLog:
* Makefile.in: Add new file.
* cgraph.h (analyze_toplevel_extended_asm): New.
* cgraphunit.cc (symbol_table::finalize_compilation_unit):
Call analyze_toplevel_extended_asm.
* asm-toplevel.cc: New file.
gcc/lto/ChangeLog:
* lto-common.cc (read_cgraph_and_symbols):
Call analyze_toplevel_extended_asm.
gcc/testsuite/ChangeLog:
* gcc.dg/ipa/pr122458.c: New test.
ref_by_asm will be used by toplevel assembly to mark symbols that cannot
be removed.
It largely overlaps with force_output. Main difference is that ref_by_asm
is meaningful on declarations by not removing them. force_output with
declaration is ignored, which cannot be easily changed, since several
places depend on this behavior.
Global ref_by_asm should not be localized, because they cannot benefit
from it. It would only result in complications, for example by renaming
the symbol.
Notes on different solutions in unreachability analysis:
First unreachability analysis is done in analyze_functions. Marking
ref_by_asm declarations as needed from the start would require reprocessing,
because some declarations may gain definition during the analysis.
Since at this point declarations do not need adding any other symbol,
we can check for ref_by_asm at the end, next to referred_to_p check.
Second unreachability analysis is in remove_unreachable_nodes. Here
declarations (or symbols in_other_partition) may require an alias.
So there we need to add the declarations from the start.
gcc/ChangeLog:
* cgraph.cc (cgraph_node_cannot_be_local_p_1): Check ref_by_asm.
(cgraph_node::verify_node): Likewise.
* cgraph.h (cgraph_node::only_called_directly_or_aliased_p):
Likewise.
(cgraph_node::can_remove_if_no_direct_calls_and_refs_p):
Likewise.
(varpool_node::can_remove_if_no_refs_p): Likewise.
(varpool_node::all_refs_explicit_p): Likewise.
* cgraphunit.cc (symtab_node::needed_p): Likewise.
(analyze_functions): Likewise.
* gimple-ssa-pta-constraints.cc (refered_from_nonlocal_fn):
Likewise.
(refered_from_nonlocal_var): Likewise.
(ipa_create_global_variable_infos): Likewise.
* ipa-comdats.cc (ipa_comdats): Likewise.
* ipa-visibility.cc (cgraph_externally_visible_p): Likewise.
(varpool_node::externally_visible_p): Likewise.
* ipa.cc (symbol_table::remove_unreachable_nodes): Likewise.
* lto-cgraph.cc (lto_output_node): Output ref_by_asm.
(lto_output_varpool_node): Likewise.
(input_overwrite_node): Input ref_by_asm.
(input_varpool_node): Likewise.
* symtab.cc (address_matters_1): Check ref_by_asm.
gcc/lto/ChangeLog:
* lto-symtab.cc (lto_cgraph_replace_node): Propagate ref_by_asm.
(lto_varpool_replace_node): Propagate ref_by_asm.
POST_INC is a code that's only supposed to be valid in an address, so
it should only be calculated through the TARGET_ADDRESS_COST hook, not
by the TARGET_RTX_COSTS hook. But, because rtx_cost does not
special-case MEM costs by calling TARGET_ADDRESS_COST, we get here as
part of e.g. the auto-inc-dec and combine passes, so deal with it for
the time being. Without this, the cost is the value of size_factor *
COSTS_N_INSNS (1), i.e. 4 per word. There's no obvious observable
effect for generated code (coremark, libgcc and newlib-libc checked
for -march=v10), but it may make a difference in the future, so be
safe and correct the cost.
Tested at r16-6493-ge77ba7ef8c75 for cris-elf. That the cost actually
is changed is observable mostly simply by applying -dp when compiling
int incref(int n, char *p)
{
int sum = 0;
while (n--)
sum += *p++;
return sum;
}
and seeing that the cost for the single autoincrement is changed from e.g.
adds.b [$r11+],$r10 ;# 15 [c=12 l=2] *addsqisi_swap/1
to
adds.b [$r11+],$r10 ;# 15 [c=8 l=2] *addsqisi_swap/1
gcc:
* config/cris/cris.cc (cris_rtx_costs) <POST_INC>: Handle POST_INC
as ZERO_EXTEND and SIGN_EXTEND, i.e. as an operator without cost.
This header is not used any more and its inclusion is problematic
when building against Helix Cert as it might end up dragging LLVM-specific
headers from spinLockLib.h.
libgcc/
* config/gthr-vxworks.h: Remove #include of tickLib.h.
PR libfortran/123012
libgfortran/ChangeLog:
* io/list_read.c (read_character): Add new check when no
quate is provided and the character string is digits only.
gcc/testsuite/ChangeLog:
* gfortran.dg/namelist_100.f90: New test.
Filip's recent change to re-enable switch conversion at -Og triggered a
regression on the mcore-elf target.
If we look at tree-switch-conversion.cc we have this:
if (flag_pic)
return false;
The mcore-elf port defines a dummy ASM_OUTPUT_ADDR_DIFF_ELT which is designed
to trigger an assembler syntax error and thus fail loudly. That definition
comes from a time when it appears we had to define that macro in every port,
even if it wasn't being used.
These days we do not need to define that macro unless it's really needed. And
a definition like the one for mcore-elf will cause problems
(compile/pr69102.c). That definition has also been the cause of a long
standing failure in the port (gcc.dg/pr47446-2.c).
Naturally this has been through a round of testing where it fixes the two
issues noted above without any regressions.
gcc/
* config/mcore/mcore.h (ASM_OUT_ADDR_DIFF_ELT): Remove.
This patch adds support for _Float16. As time of writing this, there is
no hardware _Float16 support on s390. Therefore, _Float16 operations
have to be extended and truncated which is supported via soft-fp.
The ABI demands that _Float16 values are left aligned in FP registers
similar as it is already the case for 32-bit FP values. If vector
extensions are available, copying between left-aligned FPRs and
right-aligned GPRs is natively supported. Without vector extensions,
the alignment has to be taken care of manually. For target z10,
instructions lgdr/ldgr can be used in conjunction with shifts. Copying
via lgdr from an FPR into a GPR is the easy case since for the shift the
target GPR can be utilized. However, copying via ldgr from a GPR into a
FPR requires a secondary reload register which is used for the shift
result and is then copied into the FPR. Prior z10, there is no hardware
support in order to copy directly between FPRs and GPRs. Therefore, in
order to copy from a GPR into an FPR we would require a secondary reload
register for the shift and secondary memory for copying the aligned
value. Since this is not supported, _Float16 support starts with z10.
As a consequence, for all targets older than z10 test
libstdc++-abi/abi_check fails.
gcc/ChangeLog:
* config/s390/s390-modes.def (FLOAT_MODE): Add HF mode.
(VECTOR_MODE): Add V{1,2,4,8,16}HF modes.
* config/s390/s390.cc (s390_scalar_mode_supported_p): For 64-bit
targets z10 and newer support HF mode.
(s390_vector_mode_supported_p): Add HF mode.
(s390_register_move_cost): Keep HF mode operands in registers.
(s390_legitimate_constant_p): Support zero constant.
(s390_secondary_reload): For GPR to FPR moves a secondary reload
register is required.
(s390_secondary_memory_needed): GPR<->FPR moves don't require
secondary memory.
(s390_libgcc_floating_mode_supported_p): For 64-bit targets z10
and newer support HF mode.
(s390_hard_regno_mode_ok): Allow HF mode for FPRs and VRs.
(s390_function_arg_float): Consider HF mode, too.
(s390_excess_precision): For EXCESS_PRECISION_TYPE_FLOAT16
return FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16.
(TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Define.
* config/s390/s390.md (movhf): Define.
(reload_half_gprtofpr_z10): Define.
(signbithf2): Define.
* config/s390/vector.md: Add new vector modes to various
iterators.
libgcc/ChangeLog:
* config.host: Include s390/t-float16.
* config/s390/libgcc-glibc.ver: Export symbols
__trunc{sf,df,tf}hf2, __extendhf{sf,df,tf}2, __fix{,uns}hfti,
__float{,un}tihf, __floatbitinthf.
* config/s390/t-softfp: Add to softfp_extras instead of setting
it.
* configure: Regenerate.
* configure.ac: Support float16 only for 64-bit targets z10 and
newer.
* config/s390/_dpd_dd_to_hf.c: New file.
* config/s390/_dpd_hf_to_dd.c: New file.
* config/s390/_dpd_hf_to_sd.c: New file.
* config/s390/_dpd_hf_to_td.c: New file.
* config/s390/_dpd_sd_to_hf.c: New file.
* config/s390/_dpd_td_to_hf.c: New file.
* config/s390/t-float16: New file.
libstdc++-v3/ChangeLog:
* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
names {,P,K}DF16.
gcc/testsuite/ChangeLog:
* g++.target/s390/float16-1.C: New test.
* g++.target/s390/float16-2.C: New test.
* gcc.target/s390/float16-1-2.h: New test.
* gcc.target/s390/float16-1.c: New test.
* gcc.target/s390/float16-10.c: New test.
* gcc.target/s390/float16-2.c: New test.
* gcc.target/s390/float16-3.c: New test.
* gcc.target/s390/float16-4.c: New test.
* gcc.target/s390/float16-5.c: New test.
* gcc.target/s390/float16-6.c: New test.
* gcc.target/s390/float16-7.c: New test.
* gcc.target/s390/float16-8.c: New test.
* gcc.target/s390/float16-9.c: New test.
* gcc.target/s390/float16-signbit.h: New test.
* gcc.target/s390/vector/vec-extract-4.c: New test.
* gcc.target/s390/vector/vec-float16-1.c: New test.
Similar to the changes in r16-6620, the improved gnatwu warning finds a 'use'
clause that is not needed in s-osinte__darwin.abd leading to a bootstrap
fail building the libraries.
Fixed by removing the extraneous 'use' clause.
gcc/ada/ChangeLog:
* libgnarl/s-osinte__darwin.adb: Delete unneeded use clause.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
On the mingw32 target, std::system_category().message(int) uses
FormatMessage api to format error messages. When the error message
contains insert sequences, it is unsafe not to use the
FORMAT_MESSAGE_OGNORE_INSERTS flag, as seen at:
https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353
The output of FormatMessage ends with "\r\n" and includes a Full stop
character used by the current thread's UI language. Now, we will remove
"\r\n" and any trailing '.' from the output in any language environment.
In the testsuite for std::system_category().message(int), we first
switch the thread UI language to en-US to meet expectations in any
language environment.
libstdc++-v3/ChangeLog:
* src/c++11/system_error.cc (system_error_category) [_WIN32]:
Use FormatMessageA function instead of FormatMessage macro.
* testsuite/19_diagnostics/error_category/system_category.cc:
Fix typo in __MINGW32__ macro name. Adjust behavior on the
mingw32 target.
So it turns out LOOPS_MAY_HAVE_MULTIPLE_LATCHES is set in places
along compiling. Setting it only means there might be multiple
latches currently. It does not mean let's go in an delete them
all; which is what remove_forwarder_block does currently. This
was happening before my set of patches too but since it was
only happening in merge_phi pass, latches were not cleared away
al of the time and then recreated.
This solves the problem by protecting latches all of the time
instead of depedent on LOOPS_MAY_HAVE_MULTIPLE_LATCHES not being set.
vect-uncounted_7.c needs to be xfailed here because we no longer
vectorize the code. Note the IR between GCC 15 and after this patch
is the same so I think this was just a case were the testcase
was added after the remove forwarder changes and should not have
vectorized (or vectorize differently).
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/123417
gcc/ChangeLog:
* tree-cfgcleanup.cc (maybe_remove_forwarder_block): Always
protect latches.
gcc/testsuite/ChangeLog:
* gcc.dg/vect/vect-uncounted_7.c: xfail vect test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
As written earlier, the config-ml.in change from the
--with-multi-buildlist patch broke build of Ada, Ada uses
RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
and expects that the primary multilib will result in rts
rather than rts_. it results in after the --with-multi-buildlist
changes.
The following patch fixes it by restoring previous behavior for
ml_subdir / MULTISUBDIR such that for primary multilib it is
still empty rather than /.
2026-01-10 Jakub Jelinek <jakub@redhat.com>
PR ada/123490
* config-ml.in: Restore ml_subdir being empty instead of /.
for the primary multilib.
While gimple_call_combined_fn already do call
gimple_builtin_call_types_compatible_p and for most of builtins ensures
the right types of arguments, for type generic builtins it does not,
from POV of that function those functions are rettype (...).
Now, while the FE does some number of argument checking for the type
generic builtins, as the testcase below shows, it can be gamed.
So, this patch checks the number of arguments for type generic builtins
and does nothing if they have unexpected number of arguments.
Also for the returns arg verifies it can access the first argument.
2026-01-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/123431
* gimple-range-op.cc (gimple_range_op_handler::maybe_builtin_call):
Punt if type-generic builtins with a single argument don't have
exactly one argument. For returns_arg punt if call doesn't have
at least one argument.
* gcc.dg/pr123431.c: New test.
We accept a mismatch in qualifiers for enumerations and integers
because we switch to the underlying type before checking that qualifiers
match.
PR c/123435
PR c/123463
gcc/c/ChangeLog:
* c-typeck.cc (comptypes_internal): Test for qualifiers first.
gcc/testsuite/ChangeLog:
* gcc.dg/pr123435-1.c: New test.
* gcc.dg/pr123435-2.c: New test.
* gcc.dg/pr123463.c: New test.
RVV's vectors can get very large with LMUL8. In the PR we have
256-element char vectors which get permuted. For permuting them
we use a mask vectype that is deduced from the element type
without checking if the permute indices fit this type.
That leads to an invalid permute mask which gets optimized away.
This patch uses ssizetype as masktype instead.
PR tree-optimization/123414
gcc/ChangeLog:
* tree-ssa-forwprop.cc (simplify_vector_constructor):
Use ssizetype as mask type.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr123414.c: New test.
As analyzed by Steve, on freebsd __gthread_t is a pointer type.
I thought it the cleanest solution to remove the #ifdef in gfc_unit,
make the "self" member a intptr_t and cast the return value of
__gthread_t to that type.
PR fortran/123512
libgfortran/ChangeLog:
* io/io.h: Change type of self to intptr_t.
* io/async.h (LOCK_UNIT): Cast __gthread_self () to intptr_t.
(TRYLOCK_UNIT): Likewise.
(OWN_THREAD_ID): Likewise.
On Fri, Jan 09, 2026 at 05:54:47PM +0000, Joseph Myers wrote:
> I think updates to gcc/config/loongarch/genopts/gen-evolution.awk's calls
> to copyright_header are needed as well. At present, building for
> loongarch can result in files in the source tree being reverted to older
> copyright dates because the generation hasn't been updated (discovered via
> my glibc bot with GCC mainline stopping updating its GCC source tree
> because such modifications appeared in the sources). Of course this also
> shows up missing entries in contrib/gcc_update for the three files
> generated by gen-evolution.awk.
gen-evolution.awk was explicitly blacklisted
and so was gen-cxxapi-file.py, both because update-copyright.py
matched Copyright line also within the printing code but it wasn't
matching the expected form.
Fixed by making sure the printing code doesn't match it by using
print " Copy" "right (C) " ... in the awk case and
Copy{:s}right in the python case (with "" arg added).
2026-01-09 Jakub Jelinek <jakub@redhat.com>
contrib/
* update-copyright.py (GCCFilter): Don't filter out
gen-evolution.awk and gen-cxxapi-file.py.
gcc/
* config/loongarch/genopts/gen-evolution.awk: Update
copyright year.
(copyright_header): Separate parts of Copyright word
with " " so that it doesn't get matched by update-copyright.py.
(gen_full_header, gen_full_source, gen_full_def): Include
2026 year in the ranges.
gcc/cp/
* gen-cxxapi-file.py: Update copyright year. Separate
parts of Copyright word with {:s} so that it doesn't get matched
by update-copyright.py.
More simplification/consolidation of some callback logic in analyzer in
favor of using the analyzer pub/sub channel.
No functional change intended.
gcc/analyzer/ChangeLog:
* common.h (struct on_frame_popped): New.
(subscriber::on_message): New vfunc for on_frame_popped.
* region-model.cc: Include "context.h" and "channels.h".
(region_model::pop_frame_callbacks): Delete.
(region_model::pop_frame): Port from notify_on_pop_frame to
using pub/sub channel.
* region-model.h (pop_frame_callback): Delete typedef.
(region_model::register_pop_frame_callback): Delete.
(region_model::pop_frame_callbacks): Delete.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc
(cpython_analyzer_events_subscriber::on_message): Implement for
on_frame_popped.
(plugin_init): Drop call to
region_model::register_pop_frame_callback in favor of the above
pub/sub handler.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Simplification/consolidation of some callback logic in analyzer in
favor of using the analyzer pub/sub channel.
No functional change intended.
gcc/analyzer/ChangeLog:
* analyzer-language.cc: Include "context.h" and "channels.h".
(finish_translation_unit_callbacks): Delete.
(register_finish_translation_unit_callback): Delete.
(run_callbacks): Delete.
(on_finish_translation_unit): Port from run_callbacks to pub/sub.
* analyzer-language.h (finish_translation_unit_callback): Delete
typedef.
(register_finish_translation_unit_callback): Delete decl.
* common.h (class translation_unit): New forward decl.
(struct analyzer_events::on_tu_finished): New.
(analyzer_events::subscriber::on_message): Add vfunc for
on_tu_finished messages.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc
(cpython_analyzer_events_subscriber::on_message): New.
(plugin_init): Port stashing of named types and global vars to
pub/sub framework.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This patch eliminates the PLUGIN_ANALYZER_INIT event in favor of a new
analyzer_events_channel that can be subscribed to, and ports all the
in-tree analyzer plugins to using it.
The PLUGIN_* approach isn't typesafe, and the name suggests it's only
meant to be used for plugins, whereas the pub/sub approach is typesafe,
and treats the publish/subscribe network as orthogonal to whether the
code is built into the executable or is a plugin.
gcc/analyzer/ChangeLog:
* common.h: Define INCLUDE_LIST.
(class plugin_analyzer_init_iface): Replace with...
(gcc::topics::analyzer_events::on_ana_init): ...this.
(gcc::topics::analyzer_events::subscriber): New.
* engine.cc: Include "context.h" and "channels.h".
(class plugin_analyzer_init_impl): Replace with...
(class impl_on_ana_init): ...this. Fix some overlong lines.
(impl_run_checkers): Port from PLUGIN_ANALYZER_INIT to using
publish/subscribe framework.
gcc/ChangeLog:
* channels.h (gcc::topics::analyzer_events::subscriber): New
forward decl.
(compiler_channels::analyzer_events_channel): New field.
* doc/plugins.texi (PLUGIN_ANALYZER_INIT): Delete.
* plugin.cc (register_callback): Delete PLUGIN_ANALYZER_INIT.
(invoke_plugin_callbacks_full): Likewise.
* plugin.def (PLUGIN_ANALYZER_INIT): Delete this event.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/analyzer_cpython_plugin.cc: Port from
PLUGIN_ANALYZER_INIT to subscribing to analyzer_events_channel.
* gcc.dg/plugin/analyzer_gil_plugin.cc: Likewise.
* gcc.dg/plugin/analyzer_kernel_plugin.cc: Likewise.
* gcc.dg/plugin/analyzer_known_fns_plugin.cc: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This patch adds a new key/value pair "cfgs={yes,no}" to diagnostics
sinks, "no" by default.
If set to "yes" for a SARIF sink, then GCC will add the internal state
of the CFG for all functions after each pertinent optimization pass in
graph form to theRun.graphs in the SARIF output.
If set to "yes" for an HTML sink, the generated HTML will contain SVG
displaying the graphs, adapted from code in graph.cc
Text sinks ignore it.
The SARIF output is thus a machine-readable serialization of (some of)
GCC's intermediate representation (as JSON), but it's much less than
GCC-XML used to provide. The precise form of the information is
documented as subject to change without notice.
Currently it shows both gimple statements and RTL instructions,
depending on the pass. My hope is that it should be possible to write a
"cfg-grep" tool that can read the SARIF and automatically identify
in which pass a particular piece of our IR appeared or disappeared,
for tracking down bugs in our optimization passes.
Implementation-wise:
* this uses the publish-subscribe mechanism from the earlier patch, by
having the diagnostics sink subscribe to pass_events::after_pass
messages from the pass_events_channel.
* the patch adds a new hook to cfghooks.h for dumping a basic block
into a SARIF property bag
gcc/ChangeLog:
* Makefile.in (OBJS): Add tree-diagnostic-cfg.o.
(OBJS-libcommon): Add custom-sarif-properties/cfg.o,
diagnostics/digraphs-to-dot.o, and
diagnostics/digraphs-to-dot-from-cfg.o.
* cfghooks.cc: Define INCLUDE_VECTOR. Add includes of
"diagnostics/sarif-sink.h" and "custom-sarif-properties/cfg.h".
(dump_bb_as_sarif_properties): New.
* cfghooks.h (diagnostics::sarif_builder): New forward decl.
(json::object): New forward decl.
(cfg_hooks::dump_bb_as_sarif_properties): New callback field.
(dump_bb_as_sarif_properties): New decl.
* cfgrtl.cc (rtl_cfg_hooks): Populate the new callback
field with rtl_dump_bb_as_sarif_properties.
(cfg_layout_rtl_cfg_hooks): Likewise.
* custom-sarif-properties/cfg.cc: New file.
* custom-sarif-properties/cfg.h: New file.
* diagnostics/digraphs-to-dot-from-cfg.cc: New file, partly
adapted from gcc/graph.cc.
* diagnostics/digraphs-to-dot.cc: New file.
* diagnostics/digraphs-to-dot.h: New file, based on material in...
* diagnostics/digraphs.cc: Include
"diagnostics/digraphs-to-dot.h".
(class conversion_to_dot): Rework and move to above.
(make_dot_graph_from_diagnostic_graph): Likewise.
(make_dot_node_from_digraph_node): Likewise.
(make_dot_edge_from_digraph_edge): Likewise.
(conversion_to_dot::get_dot_id_for_node): Likewise.
(conversion_to_dot::has_edges_p): Likewise.
(digraph::make_dot_graph): Use to_dot::converter::make and invoke
the result to make the dot graph.
* diagnostics/digraphs.h (digraph:get_all_nodes): New accessor.
* diagnostics/html-sink.cc
(html_builder::m_per_logical_loc_graphs): New field.
(html_builder::add_graph_for_logical_loc): New.
(html_sink::report_digraph_for_logical_location): New.
* diagnostics/sarif-sink.cc (sarif_array_of_unique::get_element):
New.
(sarif_builder::report_digraph_for_logical_location): New.
(sarif_sink::report_digraph_for_logical_location): New.
* diagnostics/sink.h: Include "diagnostics/logical-locations.h".
(sink::report_digraph_for_logical_location): New vfunc.
* diagnostics/text-sink.h
(text_sink::report_digraph_for_logical_location): New.
* doc/invoke.texi (fdiagnostics-add-output): Clarify wording.
Distinguish between scheme-specific vs GCC-specific keys, and add
"cfgs" as the first example of the latter.
* gimple-pretty-print.cc: Include "cfghooks.h", "json.h", and
"custom-sarif-properties/cfg.h".
(gimple_dump_bb_as_sarif_properties): New.
* gimple-pretty-print.h (diagnostics::sarif_builder): New forward
decl.
(json::object): Likewise.
(gimple_dump_bb_as_sarif_properties): New.
* graphviz.cc (get_compass_pt_from_string): New
* graphviz.h (get_compass_pt_from_string): New decl.
* libsarifreplay.cc (sarif_replayer::handle_graph_object): Fix
overlong line.
* opts-common.cc: Define INCLUDE_VECTOR.
* opts-diagnostic.cc: Define INCLUDE_LIST. Include
"diagnostics/sarif-sink.h", "tree-diagnostic-sink-extensions.h",
"opts-diagnostic.h", and "pub-sub.h".
(class gcc_extra_keys): New class.
(opt_spec_context::opt_spec_context): Add "client_keys" param and
pass to dc_spec_context.
(handle_gcc_specific_keys): New.
(try_to_make_sink): New.
(gcc_extension_factory::singleton): New.
(handle_OPT_fdiagnostics_add_output_): Rework to use
try_to_make_sink.
(handle_OPT_fdiagnostics_set_output_): Likewise.
* opts-diagnostic.h: Include "diagnostics/sink.h".
(class gcc_extension_factory): New.
* opts.cc: Define INCLUDE_LIST.
* print-rtl.cc: Include "dumpfile.h", "cfghooks.h", "json.h", and
"custom-sarif-properties/cfg.h".
(rtl_dump_bb_as_sarif_properties): New.
* print-rtl.h (diagnostics::sarif_builder): New forward decl.
(json::object): Likewise.
(rtl_dump_bb_as_sarif_properties): New decl.
* tree-cfg.cc (gimple_cfg_hooks): Use
gimple_dump_bb_as_sarif_properties for new callback field.
* tree-diagnostic-cfg.cc: New file, based on material in graph.cc.
* tree-diagnostic-sink-extensions.h: New file.
* tree-diagnostic.cc: Define INCLUDE_LIST. Include
"tree-diagnostic-sink-extensions.h".
(compiler_ext_factory): New.
(tree_diagnostics_defaults): Set gcc_extension_factory::singleton
to be compiler_ext_factory.
gcc/testsuite/ChangeLog:
* gcc.dg/diagnostic-cfgs-html.py: New test.
* gcc.dg/diagnostic-cfgs-sarif.py: New test.
* gcc.dg/diagnostic-cfgs.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This patch adds a new "struct compiler_channels" to hold channels
relating to the compiler that plugins (or diagnostic sinks) might want
to subscribe to events for, accessed from the global gcc::context
object, along with a new gcc/topics/ source subdirectory to hold
strongly-typed publish/subscribe topics relating to the compiler.
For now, there is just one: pass_events_channel, which, if there are any
subscribers, issues notifications about passes starting/stopping on
particular functions, using topics::pass_events, declared in
topics/pass-events.h, but followup patches add more kinds of
notification channel.
A toy plugin in the testsuite shows how this could be used to build a
progress notification UI for the compiler, and a followup patch uses the
channel to (optionally) capture CFG information at each stage of
optimization in machine-readable form into a SARIF sink.
gcc/ChangeLog:
* channels.h: New file.
* context.cc: Define INCLUDE_LIST. Include "channels.h".
(gcc::context::context): Create m_channels.
(gcc::context::~context): Delete it.
* context.h (struct compiler_channels): New forward decl.
(gcc::context::get_channels): New accessor.
(gcc::context::m_channels): New field.
* passes.cc: Define INCLUDE_LIST. Include "topics/pass-events.h"
and "channels.h".
(execute_one_pass): If the global context's pass_events_channel
has subscribers, publish before_pass and after_pass events to it.
* topics/pass-events.h: New file.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/plugin.exp: Add progress_notifications_plugin.cc.
* gcc.dg/plugin/progress_notifications_plugin.cc: New test plugin.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This patch introduces a publish/subscribe mechanism, allowing for
loosely-coupled senders and receivers, with strongly-typed messages
passing between them. For example, a GCC subsystem could publish
messages about events, and a plugin could subscribe to them.
An example can be seen in the selftests.
gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Add pub-sub.o.
* pub-sub.cc: New file.
* pub-sub.h: New file.
* selftest-run-tests.cc (selftest::run_tests): Call
selftest::pub_sub_cc_tests.
* selftest.h (selftest::pub_sub_cc_tests): New decl.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
The problem here is function_table was not in the GGC memory space and not
streamed out. So even though the builtins were reloaded, function_table was
a nullptr as it was not reloaded.
Also noticed initial_indexes should be marked with GTY so it is reloaded correctly
from PCH.
Built and tested for aarch64-linux-gnu.
PR target/123457
gcc/ChangeLog:
* config/aarch64/aarch64-sve-builtins.cc (struct registered_function_hasher):
Change base class to ggc_ptr_hash.
(initial_indexes): Mark with GTY.
(function_table): Likewise.
(handle_arm_sve_h): Allocate function_table from ggc instead of heap.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>