Some of these tests need -Wno-psabi to pass on ia32, forwprop-43.c
uses the vect* effective targets which rely on vect.exp added options
but doesn't provide those (added -msse2 for ia32).
And lastly, part-vect-absnegbf.c is a really weird test, it needs
at least -msse2 to pass on ia32 obviously (otherwise it is an error
to even use __bf16 or _Float16), but doesn't use -mavx512bf16 but
has avx512bf16 runtime check. No idea what was meant, perhaps we
need 2 copies of the test, one with plain -msse2 and just requiring
sse2 at runtime and another wiht -mavx512bf16 requiring that? Just
added -msse2 for now.
2026-03-18 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tree-ssa/forwprop-42.c: Add -Wno-psabi to dg-options.
* gcc.dg/tree-ssa/forwprop-43.c: Likewise. For ia32 add -msse2 as
dg-additional-options.
* gcc.dg/torture/pr65270-3.c: Add -Wno-psabi to dg-options.
* gcc.target/i386/part-vect-absnegbf.c: Add -msse2 to dg-options.
Here is a partial fix for the PR124547 breakages.
Setting {gas,gnu_ld}_flag to no when user didn't specify any of
--with{,out}-gnu-{as,ld} nor --with-gnu-{as,ld}={yes,no} seems wrong
when we want to later override it based on
# Check if we are using GNU ld if not already set.
if test -z "$gnu_ld_flag"; then
if $gcc_cv_ld --version 2>/dev/null | grep GNU > /dev/null; then
gnu_ld_flag=yes
else
gnu_ld_flag=no
fi
fi
or
# Check if we are using GNU as if not already set.
if test -z "$gas_flag"; then
if $gcc_cv_as --version 2>/dev/null | grep GNU > /dev/null; then
gas_flag=yes
else
gas_flag=no
fi
fi
So, this patch unsets it if not explicitly specified so that the later
overriding works.
On x86_64-linux it restores the auto-host.h and Makefile differences:
-LD_VERSION_SCRIPT_OPTION =
-LD_SONAME_OPTION =
+LD_VERSION_SCRIPT_OPTION = --version-script
+LD_SONAME_OPTION = -soname
and
-#define HAVE_AS_IX86_GOT32X 0
+#define HAVE_AS_IX86_GOT32X 1
#endif
-#define HAVE_AS_IX86_TLSLDM 0
+#define HAVE_AS_IX86_TLSLDM 1
-#define HAVE_AS_IX86_TLS_GET_ADDR_GOT 0
+#define HAVE_AS_IX86_TLS_GET_ADDR_GOT 1
-/* #undef HAVE_LD_DEMANGLE */
+#define HAVE_LD_DEMANGLE 1
I agree with Andreas in the PR that after including config.gcc configure
should be using gas and gnu_ld vars rather than gas_flag and gnu_ld_flag,
but this patch doesn't implement that (yet). I think to do that,
it would need to move the
AS_VAR_SET_IF(gcc_cv_as,, [
AC_MSG_CHECKING(Solaris assembler)
# Check if we are using GNU as if not already set.
and
AC_MSG_CHECKING(Solaris linker)
# Identify the linker which will work hand-in-glove with the newly
# Check if we are using GNU ld if not already set.
hunks in configure.ac from where they are to before config.gcc inclusion,
and sed s/\(gnu_ld\|gas\)_flag/\1/g after the config.gcc inclusion.
I can prepare/test the patch tomorrow, but IMHO this patch is a good start.
2026-03-18 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/124547
* configure.ac (--with-gnu-ld): Set gnu_ld_flag= instead of
gnu_ld_flag=no if not explicitly specified.
(--with-gnu-as): Similarly for gas_flag.
(DEFAULT_ASSEMBLER): Use wording without GNU as whenever gas_flag
is not yes rather than when it is no.
* configure: Regenerate.
The following makes gather_edges_for_value return an auto_vec,
simplifying the single caller decide_about_value and fixing the
leak of the callers vector upon early return.
* ipa-cp.cc (gather_edges_for_value): Return an auto_vec.
(decide_about_value): Simplify, fixing leak of callers.
This patch fixes PR123749 which caused by an empty partition created in WPA
partitioning pass as a result of -fipa-reorder-for-locality creating one.
This also fixes an indentation issue.
Bootstrapped and regtested on aarch64-none-linux-gnu. OK for mainline?
Signed-off-by: Prachi Godbole <pgodbole@nvidia.com>
gcc/Changelog:
PR target/123749
* ipa-locality-cloning.cc (partition_callchain): Start new partition
if no. of insns exceeds size and if there are nodes to process.
On arm*-linux-gnueabi init11.C emits extra diagnostics which the testcase
doesn't expect.
E.g. it emits
init11.C: At global scope:
init11.C:19:13: error: function of consteval-only type must be declared ‘consteval’
19 | constexpr C() : i{} {} // { dg-error "function of consteval-only type must be declared .consteval." }
| ^
init11.C: In constructor ‘constexpr C::C()’:
init11.C:19:24: error: consteval-only expressions are only allowed in a constant-evaluated context
19 | constexpr C() : i{} {} // { dg-error "function of consteval-only type must be declared .consteval." }
| ^
while on most other targets only the first error from these and not
the second is emitted.
This is because of targetm.cxx.cdtor_returns_this (), the error is emitted
on the constructor declaration and then again during
check_out_of_consteval_use on its body, when walking RETURN_EXPR (which
normally isn't there).
The following patch arranges diagnostics parity.
Though, as I wrote in the PR, I wonder if it makes sense to report
any errors on bodies of functions for which we've already diagnosed
function of consteval-only type must be declared ‘consteval’.
Especially for methods of consteval-only types, any use of this keyword
will result in an extra error (sure, only the first occurrence in a
function). But even if a function has only some other consteval-only
argument and that argument is used somewhere in the body. Though, wonder
if it is worth trying to improve that now when we don't know if
consteval-only will not be removed completely or changed significantly.
2026-03-18 Jakub Jelinek <jakub@redhat.com>
PR c++/124474
* reflect.cc (check_out_of_consteval_use_r): Don't walk subtrees
of RETURN_EXPR on cdtor_returns_this targets in cdtors.
Jakub wrote a plugin which identified some non-reserved names being used
in our headers. The "count" one is actually a reserved name (there's
std::set::count and std::count and std::bitset::count) but we might as
well uglify it when used as a function parameter name. I think the "ext"
ones must have happened when moving function definitions from fs_path.cc
to fs_path.h and I forgot to change them.
The __cond::wait and __cond::wait_recursive member functions are using
non-reserved names, so that should be changed too, but this patch
doesn't fix that. I don't think we use the __gnu_cxx::__cond type in any
headers, so maybe that should just be moved into libsupc++/guard.cc or a
new header which is not installed and only used while building the
library.
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (__formatter_duration::_S_subseconds):
Uglify subs variable name.
* include/bits/fs_path.h (path::stem, path::extension)
(path::has_stem, path::has_extension): Uglify ext parameter
name.
* include/ext/concurrence.h (__cond::wait, __cond::wait_recursive):
Uglify mutex parameter names.
* include/pstl/glue_algorithm_defs.h (generate_n): Uglify count
parameter name.
* include/std/ranges (zip_transform_view): Uglify Rs template
parameter name.
(__cartesian_is_sized_sentinel): Uglify FirstSent template
parameter name.
* include/tr1/riemann_zeta.tcc: Uglify max_size variable name.
I reimplemented uninitialized_copy and uninitialized_move in
r15-4473-g3abe751ea86e34 so that they no longer delegate to std::copy,
but that meant that they were no longer optimized for std::deque
iterators, leading to performance regressions for operations on a
std::deque with trivial element types. This adds new overloads of
__uninitialized_copy_a and __uninitialized_move_a to handle std::deque
iterators, restoring the lost performance.
There are also overloads of std::fill for deque iterators which are no
longer used for std::uninitialized_fill. This does not add replacements
for those, so there will still be lost performance for std::deque
operations that depend on std::uninitialized_fill. Similarly, inserting
or assigning from istreambuf_iterator into a std::deque no longer uses
the std::copy overloads for those types, and that isn't fixed by this
patch either.
libstdc++-v3/ChangeLog:
PR libstdc++/124463
* include/bits/deque.tcc (__uninitialized_copy_a): Define
overloads for input and output iterators being std::deque
iterators, and for only the output iterator being a std::deque
iterator.
(__uninitialized_move_a): Overload for input and output
iterators being std::deque iterators.
* include/bits/stl_uninitialized.h (__uninitialized_copy_a)
(__uninitialized_move_a): Declare overloads for std::deque
iterators.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Modifying the recently added crash22.C test to use a variable template
shows that inform_tree_category doesn't say reflection of what we
actually got. With this patch we say:
• but 'Y<T>' is a variable template
crash23.C:6:13:
6 | constexpr T Y{};
| ^
I couldn't figure out a test for alias templates so I'm not adding
that now.
PR c++/124493
gcc/cp/ChangeLog:
* error.cc (inform_tree_category): Handle variable templates.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/crash23.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
The redundant-store tracking introduced in ec5349c37a replaced a
safe bitmap_bit_in_range_p check (which bailed on any overlap) with
bitmap_all_bits_in_range_p (which only removed fully redundant stores).
This broke "last writer wins" semantics for partially overlapping
stores: when an earlier store's BFI was applied after the base store's
value, it overwrote bytes that should have belonged to the later store.
Restore the original overlap check from 1d8de1e93e: bail out of the
optimization when any bit in a store's byte range is already claimed
by a later store in program order. Remove the now-unnecessary
redundant-store tracking (redundant_stores, store_ind_to_remove).
gcc/ChangeLog:
PR rtl-optimization/124476
* avoid-store-forwarding.cc
(store_forwarding_analyzer::process_store_forwarding): Replace
bitmap_all_bits_in_range_p with bitmap_any_bit_in_range_p and
return false on partial overlap. Remove redundant-store vectors
and their associated removal, dump, and deletion logic.
gcc/testsuite/ChangeLog:
PR rtl-optimization/124476
* gcc.dg/pr124476.c: New test.
This test with invalid ^^decltype crashes. finish_decltype_type
got a USING_DECL because they sometimes aren't stripped when
using -freflection. We should give an error like we do for TYPE_DECL,
otherwise finish_decltype_type returns NULL_TREE and eventually we
crash in cp_parser_qualifying_entity after calling cp_parser_decltype.
Fixed by r16-8132 which moved the cp_preserve_using_decl overriding.
PR c++/124494
gcc/testsuite/ChangeLog:
* g++.dg/reflect/decltype1.C: New test.
Here we emit a bogus "type/value mismatch" error because
convert_template_argument gets a USING_DECL instead of an expected
TYPE_DECL. When we are parsing a reflect-expression we set
cp_preserve_using_decl not to strip USING_DECLs. The flag should
probably go, subject to 124169, but meanwhile we can at least move
overriding cp_preserve_using_decl below, just before the call to
cp_parser_lookup_name_simple, where it actually matters. The wrong
error comes from _reflection_name -> _nested_name_specifier_opt
which happens before cp_parser_identifier.
PR c++/124472
gcc/cp/ChangeLog:
* parser.cc (cp_parser_reflection_name): Move the
cp_preserve_using_decl overriding below, before
cp_parser_lookup_name_simple.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/using2.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
This is a crash on invalid [:X:]<args> where [:X:] doesn't
designate a template. Like in cp_parser_template_id, we should
check that we have an appropriate template before calling
finish_template_type on it.
PR c++/124493
gcc/cp/ChangeLog:
* pt.cc (tsubst) <case TEMPLATE_ID_EXPR>: Check that templ is
either DECL_TYPE_TEMPLATE_P or DECL_TEMPLATE_TEMPLATE_PARM_P.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/crash19.C: New test.
* g++.dg/reflect/crash22.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
When I made the function to fail when SLP discovery fails I failed
to release the BST map.
* tree-vect-slp.cc (vect_analyze_slp): Release BST map when
returning.
With uncounted loop support we can leave LOOP_VINFO_LOOP_IV_COND
uninitialized but that's accessed from vect_stmt_relevant_p,
unlikely to match by chance, but the following fixes it nevertheless.
* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info):
Initialize loop_iv_cond given it's no longer always
initialized ...
(vect_create_loop_vinfo): ... here. Fix formatting.
This decouples the PRE reference IL from the VN hash tables, following
the corresponding PR103037 fix for nary expressions in r12-7389 to avoid
correctness issues regarding to access paths when inserting expressions.
Unfortunately this makes existing workarounds for alignment and alias
mismatches ineffective so those have to be re-implemented. Instead
of going back to implement canonexpr() during the ANTIC dataflow the
following does this at insertion time, hoping all relevant reaching
expressions will survive. A convenient place to do this is
sorted_array_from_bitmap_set, the actual magic worker is 'prefer',
for the moment handling alignment and innermost access size only,
as those are the cases we have test coverage. In particular the
access path difference seen in this PR is not covered - it is enough
to fix the AVAIL_OUT computation in compute_avail for this.
Where the old fixup code massaged the expressions the new code selects
from existing expressions or as fallback makes sure to not perform
code insertion when two incompatible expressions met.
PR tree-optimization/122380
* tree-ssa-sccvn.h (copy_reference_ops_from_ref): Declare.
(vn_reference_compute_hash): Likewise.
(vn_reference_eq): Add parameter indicating lexical equivalence,
defaulted to false.
* tree-ssa-sccvn.cc (vn_reference_eq): Likewise.
(print_vn_reference_ops): Print alias type and alignment.
(vn_reference_compute_hash): Export.
(copy_reference_ops_from_ref): Likewise.
* tree-ssa-pre.cc (pre_expr_d::equal): Use lexical equivalence.
(get_or_alloc_expr_for_reference): Also get value-id, upon
zero assign a new value-id if the expression is unknown.
(expr_cmp): New helper.
(prefer): Likewise.
(pre_expr_DFS): Get expression exclusion bitmap and honor it.
(sorted_array_from_bitmap_set): If done for insertion, do limited
canonexpr() via pairwise prefer on expression pairs with the same
value, populating an exclution bitmap.
(phi_translate_1): Do not use the VN hashtable expressions
or insert there. Instead maintain a PRE view of expressions.
(clean): Adjust.
(do_hoist_insertion): Likewise.
(insert): Likewise.
(compute_avail): Use gimple_could_trap_p_1
on the original stmt rather than vn_reference_may_trap on
the VN leader. Use the original stmt operands for the PRE
view of reference expressions, only use the value number from the VN
tables. Remove no longer effective workarounds for semantically
different references with same value.
(fini_pre): Release operand vectors for PRE IL reference
expressions.
* g++.dg/torture/pr122380.C: New testcase.
* gcc.dg/torture/pr65270-3.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-30.c: XFAIL.
When a target_clones function is inlined, the resolver function's
assembler name must be properly registered in the symbol table.
Using SET_DECL_ASSEMBLER_NAME only updates the tree node without
notifying the symbol table, which can lead to an ICE during IPA
inlining when the assembler name hash becomes inconsistent.
Replace SET_DECL_ASSEMBLER_NAME with symtab->change_decl_assembler_name
in make_resolver_func to properly update the symbol table's assembler
name mapping.
This only happens on x86, other targets already uses
symtab->change_decl_assembler_name.
Fixes: b500cd2634 ("x86: fmv: Refactor FMV name mangling.")
gcc/ChangeLog:
* config/i386/i386-features.cc (make_resolver_func): Use
symtab->change_decl_assembler_name instead of
SET_DECL_ASSEMBLER_NAME to properly update the symbol table.
gcc/testsuite/ChangeLog:
* gcc.target/i386/tct-ipa-inline-ice.c: New test.
Signed-off-by: Yangyu Chen <cyy@cyyself.name>
The condition was checking if extents<int, ...> is convertible to index_type,
and not the reverse. This patch tests implicit conversion from braced
initializer list (to cover multiple arguments) and is_convertible in case of
single index.
libstdc++-v3/ChangeLog:
* testsuite/23_containers/mdspan/extents/ctor_ints.cc: Updated
is_explicit, and added more test cases.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
In r16-8116 Marek has fixed not just whitespace around
std::meta::info in diagnostics, but also std::nullptr_t.
This patch adds a testcase for that, such that the part of the
change related to NULLPTR_TYPE and this test can be backported.
2026-03-17 Jakub Jelinek <jakub@redhat.com>
PR c++/124489
* g++.dg/cpp0x/pr124489.C: New test.
OpenMP privatization currently treats scalar class pointers like owned
polymorphic class objects. In the worker cleanup for private/firstprivate
class pointers, the generated code finalizes and frees ptr._data even though
the clause only copied pointer association status from a shared target.
Fix this in gfc_omp_clause_copy_ctor and gfc_omp_clause_dtor by unwrapping
saved descriptors first and by recognizing class-pointer container types
locally in those hooks. That keeps scalar class pointers on the
association-only path without changing the broader polymorphic mapping
classification used for OpenMP warnings and deep mapping.
Add a runtime regression test for the original private(ptr) crash plus a
firstprivate(ptr) association check.
gcc/fortran/ChangeLog:
PR fortran/120286
* trans-openmp.cc (gfc_is_class_pointer_type): New helper.
(gfc_omp_clause_copy_ctor): Unwrap saved descriptors before
deciding whether privatization should preserve only pointer
association. Handle scalar class pointers on that path too.
(gfc_omp_clause_dtor): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/120286
* gfortran.dg/pr120286.f90: New test.
Signed-off-by: Christopher Albert <albert@tugraz.at>
Just an ICE-on-invalid, but while writing tests for 123237 my
typos would result in this crash often enough to prompt me to
go ahead and fix it.
We crash here because we are asserting that we've emitted hard
errors when cp_parser_splice_specifier returns error_mark_node
even when parsing tentatively. In the crash20.C case we have
[:R<T>:] where we interpret the < as a "less than" operator and
expect that T will produce a primary expression, which it does
not. But cp_parser_error won't emit any errors yet.
PR c++/124496
gcc/cp/ChangeLog:
* parser.cc (cp_parser_splice_specifier): Use NULL_TREE instead of
NULL.
(cp_parser_splice_expression): Don't assert seen_error() when not
committed to tentative parse.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/crash20.C: New test.
* g++.dg/reflect/crash21.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Annotations on void parameter don't make much sense so they
should be rejected, even if the wording isn't currently so
clear on that.
PR c++/123618
gcc/cp/ChangeLog:
* tree.cc (handle_annotation_attribute): Reject annotations on void
parameters.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/annotations14.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
After r16-6808-g4b0e94b394fa38, we started to ICE when the
std_attrs was error_mark_node. This fixes the problem by
checking if it was an error_mark_node before looking for
annotations.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
Changes since v1:
* v2: Move the check for error mark earlier.
* v3: small formating changes.
PR c++/124307
gcc/cp/ChangeLog:
* parser.cc (cp_parser_base_specifier): Check for
error mark like checking for non-nullness on the
attribute.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alignas24.C: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
This ensures that the module init functions are present in libstdc++.so
and libstdc++.a, so that users of the std and std.compat modules don't
need to manually link to std.o and/or std.compat.o in addition to
compiling the CMIs.
This also adds a clean-local target to remove the generated interface
units and manifest, and the gcm.cache directory for the CMIs.
libstdc++-v3/ChangeLog:
PR libstdc++/124268
* config/abi/pre/gnu.ver: Export symbols.
* src/Makefile.am: Add libmodulesconvenience.la to libstdc++
link.
* src/Makefile.in: Regenerate.
* src/c++23/Makefile.am: Create libmodulesconvenience.la
and populate it with std.o and std.compat.o interface units.
Add clean-local target.
* src/c++23/Makefile.in: Regenerate.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
This implements LWG 4242 which was approved in Sofia 2025.
I don't think the change from static_cast<const decay_t<I>&> to just
static_cast<decay_t<I>> is observable, but it doesn't hurt. What fixes
the problem identified in the issue is the is_array_v check, which
avoids the static_cast entirely for volatile-qualified iterators.
libstdc++-v3/ChangeLog:
* include/bits/ranges_base.h (distance(It&&, Sent)): Only decay
arrays to pointers when the type is actually an array, as per
LWG 4242.
* testsuite/24_iterators/range_operations/distance.cc: Add test
for LWG 4242.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
When printing the diagnostics in this test, we're saying
"constexprstd::meta::info dm" which misses a space. We
should use pp_cxx_ws_string which does pp_c_maybe_whitespace
when printing "std::meta::info".
PR c++/124489
gcc/cp/ChangeLog:
* error.cc (dump_type) <case NULLPTR_TYPE>: Use pp_cxx_ws_string
instead of pp_string.
<case META_TYPE>: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/reflect/diag6.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/ChangeLog
* doc/install.texi (Configuration): Fix copy pasto
--enable-objc-gc to --enable-algol68-gc.
Change the struct to ensure there is a padding byte between the members,
which was previously not the case for byte-aligned targets such as
cris-elf.
Add a new helper function to verify that the padding bits in a struct S
and in the std::atomic<S> are zero, without needing to disable SRA. Then
rewrite the test in terms of that helper, so we check directly that the
atomic object has the correct value and has no padding bits. Previously
we loaded a value (with -fno-tree-sra to hopefully preserve padding) and
then just using memcmp on that value to see if it was bitwise identical
to another value, but didn't actually check the members were correct or
that the padding was clear.
Also add a loop around the weak compare-exchange, to tolerate spurious
failures as described in
https://gcc.gnu.org/pipermail/gcc-patches/2026-March/710289.html
libstdc++-v3/ChangeLog:
* testsuite/29_atomics/atomic/compare_exchange_padding.cc:
Rewrite to be robust against spurious failures of weak compare
exchange, and to check padding bits more directly.
Using requires { sizeof(T); } in __new_allocator::allocate gives a
better diagnostic when the static_assert fails.
We can also reduce the total number of diagnostics due to invalid
sizeof(T) and alignof(T) by using the same requires-expression to make
the body of the function a discarded statement when the static_assert
already failed. This fixes a regression in diagnostic quality due to
making __new_allocator::allocate constexpr in r16-7271-g7197d0cce70525,
which caused a cascade of seven errors instead of just one for
std::allocator<incomplete-type>().allocate(1).
libstdc++-v3/ChangeLog:
* include/bits/allocator.h (allocator::allocate): Use specific
feature test macro for constexpr allocate and deallocate. Make
consteval path a discarded statement if sizeof(T) is ill-formed.
* include/bits/new_allocator.h (__new_allocator::allocate): Use
requires-expression for static_cast. Make function body a
discarded stament if sizeof(T) is ill-formed. Use if-constexpr
for alignment checks.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
This adds a testcase for PR124491, which was fixed by these commits:
r16-6709-ga4716ece529dfd29d169ccc96979f7c747231f25
r16-6743-ge787d5ace5cc315892868f3e5e2a2a16fd31bcc8
I originally just added the test to the 15 branch with the backports for
those commits, but richi pointed out in the PR that we should have it on
trunk too, so this adds it to the trunk.
gcc/testsuite/ChangeLog:
PR middle-end/124491
* gcc.target/aarch64/torture/pr124491.c: New test.
SCEV has a long-standing issue in that it negates the addend of
a subtraction within a SSA cycle without considering UB from
negating of the most negative value. The following tries to
rectify this.
PR tree-optimization/124528
* tree-scalar-evolution.cc (scev_dfs::add_to_evolution):
Perform the negation in an unsigned type if we cannot make
sure it will not cause UB.
* gcc.dg/tree-ssa/scev-17.c: New testcase.
The RISC-V big-endian ABI is not yet stable, add a note to the
-mbig-endian option documentation to warn users that support is
experimental and could change in incompatible ways.
gcc/ChangeLog:
* doc/invoke.texi: Add experimental warning for RISC-V
big-endian support.
2026-03-16 Paul Thomas <pault@gcc.gnu.org>
Steve Kargl <kargls@comcast.net>
gcc/fortran
PR fortran/93832
* array.cc (resolve_array_bound): Emit error and return false
if bound expression is derived type or class.
* primary.cc (gfc_convert_to_structure_constructor): Do not
dereference NULL in character component test. Define 'shorter'
and use it help cure one of several whitespace issues.
gcc/testsuite/
PR fortran/93832
* gfortran.dg/pr93832.f90: New test.
2026-03-16 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/105168
* trans-expr.cc (gfc_conv_class_to_class): If the argument expr
is not a class type use the parent tree if that is a class.
(gfc_conv_procedure_call): If the argument expression is not a
variable, shift the bounds to give unity lbounds.
(gfc_trans_arrayfunc_assign): Return NULL_TREE instead of NULL.
gcc/testsuite/
PR fortran/105168
* gfortran.dg/pr105168.f90: New test.
The following two testcases ICE during instantation.
Normally for the artificial var used for structured binding as condition
(which has NULL DECL_NAME) there is a DECL_EXPR which registers local
specialization and so tsubst_expr works fine.
But if there are errors while parsing the initializer, the VAR_DECL
has still NULL_TREE DECL_NAME, but error_mark_node TREE_TYPE and
when tsubst_expr is called on it, it falls back to calling lookup_name
(NULL_TREE) and ICEs on that.
The following patch fixes it by not calling lookup_name if DECL_NAME is
NULL.
2026-03-16 Jakub Jelinek <jakub@redhat.com>
PR c++/120039
PR c++/122559
* pt.cc (tsubst_expr) <case VAR_DECL>: Don't call lookup_name on
DECL_NAME (t) if it is NULL_TREE.
* g++.dg/cpp26/decomp28.C: New test.
* g++.dg/cpp26/decomp29.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
The error recovery added in r16-8021 (PR106946) freed CLASS container
symbols when removing invalid CLASS components from a derived type.
However, gfc_build_class_symbol reuses existing containers when multiple
components share the same class type and attributes. Freeing the
container for a failed component also invalidated it for previously
committed components, causing a use-after-free detectable with valgrind
and manifesting as a SEGV on Solaris/SPARC.
Fix by deferring CLASS container cleanup until after all failed
components are unlinked, then freeing the container only if no remaining
component still references it.
gcc/fortran/ChangeLog:
PR fortran/124482
* decl.cc (gfc_match_data_decl): Defer CLASS container cleanup
until after all failed components are unlinked. Check remaining
component list before freeing a shared container.
Signed-off-by: Christopher Albert <albert@tugraz.at>