]> git.ipfire.org Git - thirdparty/gcc.git/commit
discriminators: Fix assigning discriminators on edge [PR113546]
authorAndrew Pinski <quic_apinski@quicinc.com>
Sat, 15 Mar 2025 23:37:41 +0000 (16:37 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Sun, 16 Mar 2025 18:46:06 +0000 (11:46 -0700)
commitc5ca45b8069229b6ad9bc845f03f46340f6316d7
tree7ffdc9cd857477ea8db9cd7c32c1e9f80fff0e09
parent5ed0564f2879db35106272556ba91f028177c5cd
discriminators: Fix assigning discriminators on edge [PR113546]

The problem here is there was a compare debug since the discriminators
would still take into account debug statements. For the edge we would look
at the first statement after the labels and that might have been a debug statement.
So we need to skip over debug statements otherwise we could get different
discriminators # with and without -g.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

PR middle-end/113546

gcc/ChangeLog:

* tree-cfg.cc (first_non_label_stmt): Rename to ...
(first_non_label_nondebug_stmt): This and use gsi_start_nondebug_after_labels_bb.
(assign_discriminators): Update call to first_non_label_nondebug_stmt.

gcc/testsuite/ChangeLog:

* c-c++-common/torture/pr113546-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/c-c++-common/torture/pr113546-1.c [new file with mode: 0644]
gcc/tree-cfg.cc