This pretty printer was updated for GCC 16 to match a change to
std::atomic<shared_ptr<T>>. But the gdb.Type.is_scalar property was
added in GDB 12.1, so we get an error for older GDB versions.
This adds a workaround for older GDB versions. The gdb.Type.tag property
is None for scalar types, and should always be defined for the
std::atomic class template. Another option would be to use the
is_specialization_of function defined in printers.py, but just checking
for the tag is simpler.
libstdc++-v3/ChangeLog:
* python/libstdcxx/v6/printers.py (SharedPointerPrinter): Only
use gdb.Type.is_scalar if supported.
* testsuite/libstdc++-prettyprinters/compat.cc: Test printer for
old implementation of std::atomic<std::shared_ptr<T>>.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
These tests can be run as C++11, so should use a string literal with the
static assertions.
libstdc++-v3/ChangeLog:
* testsuite/28_regex/algorithms/regex_match/multiline.cc: Add
string to static_assert.
* testsuite/28_regex/sub_match/lwg3204.cc: Likewise.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
this patch fixes cgraph verifier ICE about missing indirect call in the
speculative call sequence. This is triggered when tree-inline manages to
devirtualize call during folding it does and the call has multiple specualtive
targets. cgraph_update_edges_for_call_stmt_node calls
cgraph_edge::resolve_speculation which resolves one edge, but it should make
the whole sequence direct which is done by cgraph_edge::make_direct.
The code was also handling the case that call changed but it is not direct.
This should be impossible (and would require similar updating) so I added unreachable.
Bootstrapped/regtested x86_64-linux and also tested with autofdo and spec2017.
gcc/ChangeLog:
PR ipa/123226
* cgraph.cc (cgraph_update_edges_for_call_stmt_node): Fix handling
of multi-target speculations resolved at clone materialization time
The NVPTX note about ompx_gnu_pinned_mem_alloc was accidentally placed in
the AMD GCN section. This patch moves the paragraph to the NVPTX section.
However, the text was not actually wrong in the context of AMD GCN, so I've
adapted the wording, rather than removing it.
libgomp/ChangeLog:
* libgomp.texi: Separate the ompx_gnu_pinned_mem_alloc notes for
NVPTX and AMD GCN, and move them to right sections.
Turns out that:
build_function_type_list (void_type_node, void_type_node, NULL_TREE)
doesn't do what I thought it does. It resulted in a function type
getting two `void' arguments, and this was triggering a warning in LTO
mode.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog
* a68-low-clauses.cc (a68_lower_revelation_ludes): Fix function
type for fdecl.
As reported in PR123870 we miscompile an RVV-optimized jpeg-quantsmooth
with xtheadvector. The core issue is that we forget to emit a vsetvl
before a -fschedule-insn induced spill restore. Spills are usually
handled by full-register loads and stores but xtheadvector doesn't have
those. Instead, the regular loads and stores are used which differ from
full-register loads/store in the fact that they don't encode the LMUL
in the instruction directly and thus require a proper SEW and LMUL in
the vtype rather than just the ratio.
This patch makes vlds have an SEW/LMUL demand instead of a "ratio only"
demand for theadvector.
I didn't manage to come up with a simple test case, though.
PR123969 has a test but it won't fail without slight changes to the
16 codebase. I'm still adding it for documentation and backport
reasons.
Regtested on rv64gcv_zvl512b.
PR target/123870
PR target/123969
gcc/ChangeLog:
* config/riscv/vector.md: Add vlds to "no ratio" for
theadvector.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/xtheadvector/pr123969.c: New test.
Signed-off-by: Robin Dapp <rdapp@oss.qualcomm.com>
In riscv_vector_mode_supported_any_target_p we disallow any vector mode
when TARGET_XTHEADVECTOR.
Things go wrong when we check if a permutation for a mode is supported
by just looking at the optab (e.g. in forwprop). Then later we try to
expand that permutation but cannot find a related int vector mode because
we don't allow any vector mode.
Strictly speaking, this is fallout from the simplify_vector_constructor
changes but it's still a target issue as the common code has done the
proper check and we don't live up to the promise of being able to extend
a certain mode.
This patch just allows all modes in
riscv_vector_mode_supported_any_target_p, even for theadvector.
PR target/123971
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_vector_mode_supported_any_target_p):
Remove TARGET_XTHEADVECTOR.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/xtheadvector/pr123971.c: New test.
Signed-off-by: Robin Dapp <rdapp@oss.qualcomm.com>
The same handling for nop conversions we did in the !maybe_ident case is
also necessary in for maybe_ident. This patch performs the necessary
preprocessing before the if and unifies the nop-conversion handling.
PR tree-optimization/123925
gcc/ChangeLog:
* tree-ssa-forwprop.cc (simplify_vector_constructor):
Add nop-conversion handling for maybe_ident.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr123925.c: New test.
Signed-off-by: Robin Dapp <rdapp@oss.qualcomm.com>
This patch disables memsets with size less than a vector for
xtheadvector. As xtheadvector does not support fractional
LMUL we need to ensure to not emit those vectors that might
use it.
PR target/123910
gcc/ChangeLog:
* config/riscv/riscv-string.cc (riscv_expand_block_move):
Remove !xtheadvector guard.
(use_vector_stringop_p): Guard small LMULs.
(check_vectorise_memory_operation): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr123910.c: New test.
* gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c: xfail.
Signed-off-by: Robin Dapp <rdapp@oss.qualcomm.com>
Update the check-params-in-docs.py script so that it works with params
newly being documented in params.texi instead of in invoke.texi.
Committing as obvious.
contrib/ChangeLog:
* check-params-in-docs.py: Extend architecture-specific options
filtering. Remove the mechanism for seeking to the param
section.
Signed-off-by: Filip Kastl <fkastl@suse.cz>
After some discussion at the working group we have decided that the
bits operators SET, CLEAR and TEST, which are a GNU extension, shall
get bit numbers which are zero-based rather than one-based.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog
* a68-low-bits.cc (a68_bits_set): Make bit number zero-based rathe
than one-based.
(a68_bits_clear): Likewise.
(a68_bits_test): Likewise.
* ga68.texi (Extended bits operators): Adapt documentation
accordingly.
gcc/testsuite/ChangeLog
* algol68/execute/bits-clear-1.a68: Adapt test to new CLEAR
semantics.
* algol68/execute/bits-set-1.a68: Likewise for SET.
* algol68/execute/bits-test-1.a68: Likewise for TEST.
In Standard Algol 68:
- ABS (b) < bits_width results in the expected result.
- ABS (b) = bits_width results in all bits set to zero.
- ABS (b) > bits_width is undefined.
In GNU algol 68:
- ABS (b) < bits_width results in the expected result.
- ABS (b) >= bits_width results in all bits set to zero.
Our behavior is:
1. Conformant and backwards compatible.
2. Matches well with the similar extension of skip of integral, bits,
real, etc values to always yield zeroes.
3. Intuitive.
This patch fixes the lowering of the standard operators SHR and SHL
accordingly, including an update for the manual and a few tests.
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog
PR algol68/123959
* a68.h: Expand prototype of a68_bits_shift to get a node argument
for location purposes.
* a68-low-bits.cc (a68_bits_shift): Implement RR compatible
semantics.
* a68-low-prelude.cc (a68_lower_shl3): Fix call to a68_bit_shift.
(a68_lower_shr3): Likewise.
* ga68.texi (Bits operators): Fix documentation of SHR and SHL.
gcc/testsuite/ChangeLog
PR algol68/123959
* algol68/execute/bits-shift-1.a68: New test.
* algol68/execute/bits-shift-2.a68: Likewise.
* algol68/execute/bits-shift-3.a68: Likewise.
With commit r16-5947-ga6c50ec2c6ebcbda2b032eee0552a6a486355e12
"Add -ffuse-ops-with-volatile-access", GCC/nvptx avoids use of intermediate
registers in applicable cases (nice!). This causes one test suite regression:
PASS: gcc.target/nvptx/alloca-5.c (test for excess errors)
XFAIL: gcc.target/nvptx/alloca-5.c execution test
[-PASS:-]{+FAIL:+} gcc.target/nvptx/alloca-5.c check-function-bodies f
PASS: gcc.target/nvptx/alloca-5.c check-function-bodies g
Adjust the FAILing 'check-function-bodies' as per the improved code generation.
PR target/122343
gcc/testsuite/
* gcc.target/nvptx/alloca-5.c: Adjust.
The following fixes re-materialization of aggregates before calls
that take the address of a scalarized decl. The issue here is that
we do not know the appropriate effective type to use for the stores.
So we use ref-all accesses for the re-materialization to properly
support TBAA info modref might have recorded. The same holds
true for the re-load after the call.
PR tree-optimization/121726
* tree-sra.cc (build_ref_for_offset): Add force_ref_all
parameter and use ptr_type_node as alias pointer type in
that case.
(build_ref_for_model): Add force_ref_all parameter and
pass it through, forcing build_ref_for_offset.
(generate_subtree_copies): Likewise.
(sra_modify_call_arg): Force ref-all accesses.
* gcc.target/i386/pr121726.c: New testcase.
If we defer an FMA creation the code tries to determine the order of the
operands before deferring. To do this it compares the operands against the
result expression (which should contain the multiplication expression).
However the multiply might be wrapped in a conversion. This change has us strip
one level of conversion (the most that convert_mult_to_fma) supports handling
and only then do the comparison.
We cannot strip ops[0] and ops[1] and store them stripped since after the
deferrence, if we create an FMA we need to know the original types and
convert_mult_to_fma handles the conversions during FMA creation anyway.
There's probably a similar helper to strip_nop_view_converts but I couldn't
find one, since many of the stripping helpers are recursive or don't support
stripping VIEW_CONVERTS.
gcc/ChangeLog:
PR tree-optimization/123898
* tree-ssa-math-opts.cc (strip_nop_view_converts): New.
(convert_mult_to_fma): Use it.
gcc/testsuite/ChangeLog:
PR tree-optimization/123898
* gcc.target/aarch64/sve/pr123898.c: New test.
The execution testcase needed SVE support but didn't state that as a
requirement. Add it.
for gcc/testsuite/ChangeLog
PR testsuite/123936
PR tree-optimization/122103
* gcc.target/aarch64/sve/pr122103_1.c: Add sve hw requirement.
The execution testcase requires sve2 and 128-bit sve hardware, but it
doesn't state those requiremnets. I'm think the latter is implied by
the former, but I'm not entirely sure, so I'm requiring both
explicitly.
for gcc/testsuite/ChangeLog
PR middle-end/123775
* gcc.target/aarch64/sve2/pr123775.c: Add sve128 and sve2 hw
requirements.
This testcase uses features not available when libstdc++ doesn't have
the hostedlib bits enabled.
for gcc/testsuite/ChangeLog
PR tree-optimization/123729
* g++.dg/torture/pr123729.C: Require hostedlib.
The insn simplification expected by the test, to get a bset
instruction, has been prevented since r15-9239, because we get rotates
for bit clear and shifts for bit flip, and we don't know how to
simplify those.
Teach the rtl simplifier, at the spots where it had been extended to
handle these logical simplifications, to also handle these less
obvious negations.
for gcc/ChangeLog
* simplify-rtx.cc (negated_ops_p): New.
(simplify_context::simplify_binary_operation_1): Use it.
Due to middle-end and new param change, adjust the test cases asm check
as it cannot be vectorized.
PR/target 123916
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i16.c: Adjust the
asm check to not.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-5-i8.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i16.c: Ditto.
* gcc.target/riscv/rvv/autovec/vx_vf/vx-6-i8.c: Ditto.
Signed-off-by: Pan Li <pan2.li@intel.com>
Add test case to ensure vectorization on gpr2vr-cost=0.
PR/target 123916
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr123916.c: New test.
Signed-off-by: Pan Li <pan2.li@intel.com>
Similar to vr2gpr-cost=, add the one for fpr as well.
PR/target 123916
gcc/ChangeLog:
* config/riscv/riscv-opts.h (VR2FPR_COST_UNPROVIDED): Add new
sentinel for unprovided cost.
* config/riscv/riscv-protos.h (get_vr2fr_cost): Add new func
decl.
* config/riscv/riscv-vector-costs.cc (costs::adjust_stmt_cost):
Leverage new func to get cost of vr2fpr.
* config/riscv/riscv.cc (riscv_register_move_cost): Ditto.
(get_vr2fr_cost): Add new func to wrap access to the cost
of the vr2fpr.
* config/riscv/riscv.opt: Add new param vr2fpr-cost.
Signed-off-by: Pan Li <pan2.li@intel.com>
The middle-end pass NULL_TREE in previous, and then skip the
adjust_stmt_cost step which has count the cost of vr2gpr.
After Richard introduced more like slp_node with its vectype for
recording the cost, the adjust_stmt_cost will be hit and plus
the cost of vr2gpr now.
And then fail to vectorize due to cost value of vr2gpr is counted.
This PATCH would like to introduce another param named vr2gpr-cost,
to allow the cmdline provide the cost value of vr2gpr. Then we can
leverage the this param to make the failed test happy.
For further enhancement of the cost value customization, we would
like to defer to next stage-1, aka GCC-17.
PR/target 123916
gcc/ChangeLog:
* config/riscv/riscv-opts.h (GPR2VR_COST_UNPROVIDED): Depend on
default unprovided value.
(FPR2VR_COST_UNPROVIDED): Ditto.
(VR2GPR_COST_UNPROVIDED): Ditto.
(COST_UNPROVIDED): Add new default unprovided value.
* config/riscv/riscv-protos.h (get_vr2gr_cost): Add new func
decl.
* config/riscv/riscv-vector-costs.cc (costs::adjust_stmt_cost):
Leverage new func to get cost of vr2gpr.
* config/riscv/riscv.cc (riscv_register_move_cost): Ditto.
(get_vr2gr_cost): Add new func to wrap access to the cost
of the vr2gpr.
* config/riscv/riscv.opt: Add new param vr2gpr-cost.
Signed-off-by: Pan Li <pan2.li@intel.com>
Remaining to do:
* Add new declarations in debug headers too.
Implement C++23 P2077R3 "Heterogeneous erasure overloads for
associative containers". Adds template overloads for members
erase and extract to address elements using an alternative key
type, such as string_view for a container of strings, without
need to construct an actual key object.
The new overloads enforce concept __heterogeneous_tree_key or
__heterogeneous_hash_key to verify the function objects provided
meet requirements, and that the key supplied is not an iterator
or the native key.
libstdc++-v3/ChangeLog:
PR libstdc++/117404
* include/bits/version.def (associative_heterogeneous_erasure):
Define.
* include/bits/version.h: Regenerate.
* include/std/map: Request new feature from version.h.
* include/std/set: Same.
* include/std/unordered_map: Same.
* include/std/unordered_set: Same.
* include/bits/stl_map.h (extract, erase): Define overloads.
* include/bits/stl_set.h: Same.
* include/bits/stl_multimap.h: Same.
* include/bits/stl_multiset.h: Same.
* include/bits/unordered_map.h: Same, 2x.
* include/bits/unordered_set.h: Same, 2x.
* include/bits/stl_function.h (concepts __not_container_iterator,
__heterogeneous_key): Define.
* include/bits/hashtable.h (_M_find_before_node, _M_locate, extract):
Delegate to more-general _tr version.
(_M_find_before_node_tr, _M_locate_tr, _M_extract_tr, _M_erase_tr):
Add new members to support a heterogeneous key argument.
(_M_erase_some): Add new helper function.
(concept __heterogeneous_hash_key): Define.
* include/bits/stl_tree.h (_M_lower_bound_tr, _M_upper_bound_tr,
_M_erase_tr, _M_extract_tr): Add new members to support a
heterogeneous key argument.
(concept __heterogeneous_tree_key): Define.
* testsuite/23_containers/map/modifiers/hetero/erase.cc: New test.
* testsuite/23_containers/multimap/modifiers/hetero/erase.cc: Same.
* testsuite/23_containers/multiset/modifiers/hetero/erase.cc: Same.
* testsuite/23_containers/set/modifiers/hetero/erase.cc: Same.
* testsuite/23_containers/unordered_map/modifiers/hetero/erase.cc: Same.
* testsuite/23_containers/unordered_multimap/modifiers/hetero/erase.cc:
Same.
* testsuite/23_containers/unordered_multiset/modifiers/hetero/erase.cc:
Same.
* testsuite/23_containers/unordered_set/modifiers/hetero/erase.cc: Same.
LRA rarely splits hard reg live ranges to assign regs to pseudos when
other possibility to allocate regs failed. During the pseudo
assignment LRA updates hard reg preferences of pseudos connected to
given pseudo through copies. For this LRA uses array
update_hard_regno_preference_check which was not allocated during hard
reg live range splitting. The patch fixes the bug by allocation of
the array during hard reg live range splitting.
gcc/ChangeLog:
PR rtl-optimization/123922
* lra-assigns.cc (lra_split_hard_reg_for): Allocate and free
update_hard_regno_preference_check. Clear non_reload_pseudos for
successful spilling too.
Currently extract_component uses force_gimple_operand_gsi to emit
gimple including loads. The problem with that decls that have
DECL_EXPR_DECL set on it will change over to use the DECL_EXPR_DECL instead.
Normally this is ok except for nested functions where the original decl
is a PARAM_DECL, there is a copy from the param decl to the new frame based
location.
Well instead we should just create the gimple ourselves.
The only special case that needs to be handled is BIT_FIELD_REF and
a VCE of SSA_NAME. BIT_FIELD_REF was already handled specially
so we can just emit the load there. VCE of SSA_NAME on the other
hand needed some extra code.
Note VCE of s SSA_NAME case could be optimized, I filed PR 123968
for that. Since that is not a regression at this point and we are
now producing the same code as before.
Bootstrapped and tested on x86_64-linux-gnu.
PR middle-end/121661
gcc/ChangeLog:
* tree-complex.cc (extract_component): Create gimple
assign statements directly rather than call force_gimple_operand_gsi.
gcc/testsuite/ChangeLog:
* gcc.dg/torture/pr121661-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
The OpenMP 6.0 spec reads (Section 7.9.6 "map Clause"):
"Unless otherwise specified, if a list item is a referencing variable then the
effect of the map clause is applied to its referring pointer and, if a
referenced pointee exists, its referenced pointee."
In other words, the map clause (and its modifiers) applies to the array
descriptor (unconditionally), and also to the array data if it is allocated.
Without this patch, the semantics enforced in libgomp is incorrect: an
allocatable is deemed present only if it is allocated. Correct semantics: an
allocatable is in the present table as long as its descriptor is mapped, even if
no data exists.
libgomp/ChangeLog:
* target.c (gomp_present_fatal): New function.
(gomp_map_vars_internal): For a Fortran allocatable array, present
causes runtime termination only if the descriptor is not mapped.
(gomp_update): Call gomp_present_fatal.
* testsuite/libgomp.fortran/map-alloc-present-1.f90: New test.
I made a pass through the parameter documentation to fix various
issues with grammar, markup, punctuation, capitalization, inconsistent
use of terminology, and so on. I'm sure there's still room for improvement
but this is at least a step in the right direction.
As internal documentation, the parameter descriptions naturally
contain a lot of jargon and abbreviations for compiler passes. This
patch does not attempt to fix that. Probably a more critical area for
future improvement is making it more obvious what pass or part of the
compiler each parameter controls and perhaps adding some additional
subsectioning to group them.
gcc/ChangeLog
PR translation/89915
* doc/params.texi: Copy-edit text throughout the file.
* params.opt: Likewise in documentation strings.
We shouldn't point users at specific parameters that control GCC
behavior since those are explicitly internal GCC interfaces subject to
incompatible changes or removal. This patch removes all such
references in the GCC user manual, either by replacing them with more
user-centric language, vague references to parameters generally, or
just removing the text as being unhelpful.
gcc/ChangeLog
PR target/123245
PR translation/89915
* doc/invoke.texi (Warning Options): Remove discussion of parameters
from -Winterference-size documentation.
(Static Analyzer Options): Ditto for -Wanalyzer-symbol-too-complex,
the list of things the analyzer has specific knowledge of, and
-fanalyzer-call-summaries.
(Optimize Options): Ditto for -finline-limit and fipa-cp-clone.
(Instrumentation Options): Likewise for -fsanitize=kernel-hwaddress
and -fharden-control-flow-redundancy.
(C++ Compiled Module Interface): Likewise for discussion of limits
on number of open files.
There appears to be some consensus that parameter documentation should
be moved from the GCC user manual to the internals manual. Aside from
the explicit disclaimer that parameters are implementation details and
subject to change, many of them are documented in pure "implementor-speak"
using jargon that users are unlikely to be familiar with.
This patch moves the documentation more or less as-is. I added some
sectioning and a new index to make things easier to find, but I did
not modify the parameter descriptions to correct even obvious grammar
and markup issues. That will be addressed in a subsequent patch.
There are several places in the user manual that make dangling
reference to parameters controlling the behavior of user-visible
options, in spite of the caveats elsewhere that parameters are
internal and can't be relied on. There's also a separate patch for this.
gcc/ChangeLog
PR target/123245
PR translation/89915
* Makefile.in (TEXI_GCCINT_FILES): Add params.texi.
* doc/gccint.texi (pa): New index.
(Top): Add new Parameters and Parameters Index nodes to menu.
Include params.texi.
(Parameter Index): New.
* doc/invoke.texi (Option Summary): Move --param from Optimization
Options to Developer Options.
(Optimization Options): Move parameter documentation to params.texi.
(Developer Options): Add abbreviated discussion of --param here.
(LoongArch Options): Move parameter documentation to params.texi.
(RISC-V Options): Likewise.
(RS/6000 and PowerPC Options): Likewise.
* doc/params.texi: New file.
When parsing target attributes, if an invalid architecture string is
provided, the function parse_single_ext may return nullptr. The existing
code does not check for this case, leading to a nullptr dereference when
attempting to access the returned pointer. This patch adds a check to
ensure that the returned pointer is not nullptr before dereferencing it.
If it is nullptr, an appropriate error message is generated.
gcc/ChangeLog:
* config/riscv/riscv-target-attr.cc
(riscv_target_attr_parser::parse_arch): Fix nullptr dereference
when parsing invalid arch string.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/target-attr-bad-11.c: New test.
eval_parameters_of was trying to share 3 lines of code between the
function declaration and function type cases, but got it wrong in
multiple ways for the latter. One thing is that we should override
reflect_kind only for the function decl case to REFLECT_PARM, there
we need to differentiate function parameter reflection vs. variable
reflection, for function type it is just type. Another one is that
we iterate over PARM_DECLs through DECL_CHAIN in the function decl
case, but for types we iterate over the TREE_LIST nodes and the
type is only TREE_VALUE of that.
And last, but am not sure about that, maybe
https://eel.is/c++draft/meta.reflection#queries-62.2 should be clarified,
I think we want to apply dealias. We have notes like
https://eel.is/c++draft/meta.reflection#queries-note-7https://eel.is/c++draft/meta.reflection#traits-5
but those don't apply to type_of or parameters_of. And I think there was
an agreement that meta fns which return reflection of a type don't return
type aliases, but can't see it written explicitly except for the traits.
2026-02-04 Jakub Jelinek <jakub@redhat.com>
PR c++/123913
PR c++/123964
* reflect.cc (eval_parameters_of): Fix up handling of function
types.
* g++.dg/reflect/parameters_of7.C: New test.
For the N evaluation for iterating expansion stmts where the standard says
to evaluate:
[] consteval {
std::ptrdiff_t result = 0;
for (auto i = begin; i != end; ++i) ++result;
return result; // distance from begin to end
}()
right now (subject to further changes in CWG3140) I wanted to save compile
time/memory and effort to actually construct the lambda and it is evaluated
just using TARGET_EXPRs. On the following testcase it makes a difference,
when the lambda is consteval, the expressions inside of it are evaluated
in immediate context and so the testcase should be accepted, but we
currently reject it when i has consteval-only type and expansion stmt
doesn't appear in an immediate or immediate-escalating function.
The following patch fixes this by forcing in_immediate_context () to be true
around the evaluation.
2026-02-04 Jakub Jelinek <jakub@redhat.com>
PR c++/123611
* pt.cc (finish_expansion_stmt): Temporarily enable
in_immediate_context () for the iterating expansion stmt N
computation.
* g++.dg/reflect/expansion-stmt1.C: New test.
The following patch saves ~ 2.4GiB of disk space in x86_64-linux
bootstrapped object directory:
find obj80 -name \*.gch -a -type f | xargs du -shc | grep total
3.7G total
find obj82 -name \*.gch -a -type f | xargs du -shc | grep total
1.3G total
and ~ 800MiB for i686-linux:
find obj81 -name \*.gch -a -type f | xargs du -shc | grep total
1.2G total
find obj83 -name \*.gch -a -type f | xargs du -shc | grep total
409M total
by disabling PCH in stage1/stage2/stageprofile builds, so only
building it in stage3/stagefeedback etc.
I think in stage1/stage2 it is a pure waste of bootstrap time and disk
space, for profiledbootstrap I'd say PCH isn't used commonly enough
in the wild that it is worth training GCC on that (but if you disagree,
I can surely take out that single line in there).
2026-02-04 Jakub Jelinek <jakub@redhat.com>
* Makefile.tpl (STAGE1_CONFIGURE_FLAGS, STAGE2_CONFIGURE_FLAGS,
STAGEprofile_CONFIGURE_FLAGS): Append --disable-libstdcxx-pch if
target-libstdc++-v3-bootstrap.
* Makefile.in: Regenerate.
The following testcase is miscompiled since r0-69852-g4038c495f (at least
if one can somehow arrange in C++98 to have AGGR_INIT_EXPR or any other
FE specific trees nested in constructor elts for CONSTRUCTOR nested inside
of default argument, if not, then since C++11 support that allows that has
been implemented).
The problem is that we unfortunately store default arguments in TREE_PURPOSE
of TYPE_ARG_TYPES nodes of the FUNCTION/METHOD_TYPE and those are shared,
with type_hash_canon used to unify them. The default arguments aren't
considered in type_hash_canon_hash at all, but the equality hook considers
them in type_list_equal by calling simple_cst_equal on those default
arguments. That function is a tri-state, returns 0 for surely unequal,
1 for equal and -1 for "I don't know", usually because there are FE trees
etc. (though, admittedly it is unclear why such distinction is done, as
e.g. for VAR_DECLs etc. it sees in there it returns 0 rather than -1).
Anyway, the r0-69852-g4038c495f change changed CONSTRUCTOR_ELTS from
I think a tree list of elements to a vector and changed the simple_cst_equal
implementation of CONSTRUCTOR from just recursing on CONSTRUCTOR_ELTS (which
I think would just return -1 because I don't see simple_cst_equal having
TREE_LIST nor TREE_VEC handling) to something that thinks simple_cst_equal
returns a bool rather than tri-state, plus has a comment whether it should
handle indexes too.
So, in particular on the testcase which has in default arguments with
CONSTRUCTOR inside it with AGGR_INIT_EXPR as the single element (but
could be as well in multiple elements), the recursive call returns -1
for "I don't know" on the element and the function considers it the same
as if it returned 1, they are equal.
The following patch fixes it by calling the recursive non tail-recursive
simple_cst_equal calls like everywhere else in the function, by returning
what it returned if it returned <= 0 and otherwise continuing.
Plus given the comment I've also implemented checking the index.
The special case for FIELD_DECL is so that if both indexes are FIELD_DECLs
and they are different, we don't return -1 but 0.
2026-02-04 Jakub Jelinek <jakub@redhat.com>
PR c++/123818
* tree.cc (simple_cst_equal) <case CONSTRUCTOR>: Return -1 if some
recursive call returns -1. Also compare indexes.
* g++.dg/cpp0x/pr123818.C: New test.
The following testcase is miscompiled on aarch64-linux, the problem is that
the PHI argument is lowered to
VIEW_CONVERT_EXPR<unsigned long[196]>(y) = VIEW_CONVERT_EXPR<unsigned long[196]>(*.LC0);
MEM <unsigned long[1]> [(unsigned _BitInt(12419) *)&y + 1568B] = {};
on the edge, where for aarch64 unsigned _BitInt(12419) the size of the type
is already 1568 bytes (aka 196 DImode limbs, 98 TImode ABI limbs), so the
fir stmt copies everything and the second stmt clobbers random unrelated memory
after it.
Usually when min_prec == prec (otherwise we guarantee that min_prec is either 0,
or a single limb (which doesn't have padding bits) or something without any
padding bits (multiple of abi_limb_prec)) we take the
if (c)
{
if (VAR_P (v1) && min_prec == prec)
{
tree v2 = build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (v1), c);
g = gimple_build_assign (v1, v2);
gsi_insert_on_edge (e, g);
edge_insertions = true;
break;
}
path and need nothing else, but in this case v1 is a PARM_DECL, so we need to
take the code path with VCE on the lhs side as well. But after the assignment
we fall through into the handling of the extension, but for min_prec == prec
that isn't needed and is actually harmful, we've already copied everything
and the code later on assumes there are no padding bits and uses just
TYPE_SIZE_UNIT.
So, this patch just avoids the rest after we've copied all the bits for
min_prec == prec.
2026-02-04 Jakub Jelinek <jakub@redhat.com>
PR middle-end/122689
* gimple-lower-bitint.cc (gimple_lower_bitint): For the PHI handling
if min_prec == prec, break after emitting assignment from c.
* gcc.dg/bitint-127.c: New test.
This patch turns off -fipa-reorder-for-locality for -fprofile-generate because
it's not required and contributes to the bloated time taken by bootstrap. It
also reduces the default partition size by half; the increased number of
partitions speeds up LTRANS phase.
Bootstrapped and tested on aarch64-none-linux-gnu. OK for mainline?
Signed-off-by: Prachi Godbole <pgodbole@nvidia.com>
config/ChangeLog:
* bootstrap-lto-locality.mk (STAGEprofile_CFLAGS): Remove
-fipa-reorder-for-locality.
(STAGEtrain_CFLAGS): Ditto.
gcc/ChangeLog:
* params.opt: Change default param value.
gcc/analyzer/ChangeLog:
PR analyzer/116865
* region-model-manager.cc
(region_model_manager::get_offset_region): Use POINTER_PLUS_EXPR
rather than PLUS_EXPR for pointer offsets.
gcc/testsuite/ChangeLog:
PR analyzer/116865
* c-c++-common/analyzer/ice-pr116865.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
At the time a68_extract_indicants executes nothing guarantees that the
module text following a module symbol is well formed.
gcc/algol68/ChangeLog:
* a68-parser-extract.cc (a68_extract_indicants): Don't call FORWARD if
skip_module_text returns NO_NODE.
gcc/testsuite/ChangeLog:
* algol68/compile/error-module-definition-1.a68: New test.
* algol68/compile/error-module-definition-2.a68: New test.