On Fri, Mar 13, 2026 at 10:54:33AM +0100, Jørgen Kvalsvik wrote:
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/gcov/pr124462.C
> @@ -0,0 +1,29 @@
> +/* PR ipa/124462 */
> +/* { dg-options "-O -fcondition-coverage -fdump-tree-gimple-all" } */
Without the -fdump-tree-gimple-all part in there.
> --- a/gcc/tree-profile.cc
> +++ b/gcc/tree-profile.cc
> @@ -542,6 +542,8 @@ masking_vectors (conds_ctx& ctx, array_slice<basic_block>
> blocks,
> for (edge e : b->preds)
> if (!(e->flags & EDGE_COMPLEX))
> ctx.edges.quick_push (contract_edge_up (e));
> + if (ctx.edges.length () < 2)
> + continue;
> ctx.edges.sort (topological_src_cmp, &ctx.top_index);
>
> for (size_t i0 = 0, i1 = 1; i1 != ctx.edges.length (); ++i0, ++i1)
Otherwise LGTM.
Note, big parts of tree-profile.cc now use some weird formatting, not GCC
style, indentation by 4 columns instead of 2, { on the same column as line
above it instead of 2 columns to the right, etc. I think it would be nice
to get that incrementally fixed.
for (basic_block b : blocks)
{
if (!bitmap_bit_p (core, b->index))
continue;
should have been
for (basic_block b : blocks)
{
if (!bitmap_bit_p (core, b->index))
continue;
or
const_basic_block l = *(const basic_block*) lhs;
should have been
const_basic_block l = *(const basic_block *) lhs;
etc.
See https://gcc.gnu.org/contribute.html#standards
Jakub