aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2023-11-09 00:01:30 -0300
committerAlexandre Oliva <oliva@gnu.org>2023-11-09 00:01:30 -0300
commit61d2b4746300a604469df15789194d0a7c73791b (patch)
tree88102c93c35ce4b5c4d375caad31124c00d56196 /gcc
parent339ced829fefe7ac3811707472768a8fdff7bfcb (diff)
downloadgcc-61d2b4746300a604469df15789194d0a7c73791b.zip
gcc-61d2b4746300a604469df15789194d0a7c73791b.tar.gz
gcc-61d2b4746300a604469df15789194d0a7c73791b.tar.bz2
skip debug stmts when assigning locus discriminators
c-c++-common/goacc/kernels-loop-g.c has been failing (compare-debug) on i686-linux-gnu since r13-3172, because the implementation enabled debug stmts to cause discriminators to be assigned differently, and the discriminators are printed in the .gkd dumps that -fcompare-debug compares. This patch prevents debug stmts from affecting the discriminators in nondebug stmts, but enables debug stmts to get discriminators just as nondebug stmts would if their line numbers match. I suppose we could arrange for discriminators to be omitted from the -fcompare-debug dumps, but keeping discriminators in sync is probably good to avoid other potential sources of divergence between debug and nondebug. for gcc/ChangeLog * tree-cfg.cc (assign_discriminators): Handle debug stmts.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-cfg.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index 40a6f2a..a30a2de 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -1214,6 +1214,22 @@ assign_discriminators (void)
{
gimple *stmt = gsi_stmt (gsi);
+ /* Don't allow debug stmts to affect discriminators, but
+ allow them to take discriminators when they're on the
+ same line as the preceding nondebug stmt. */
+ if (is_gimple_debug (stmt))
+ {
+ if (curr_locus != UNKNOWN_LOCATION
+ && same_line_p (curr_locus, &curr_locus_e,
+ gimple_location (stmt)))
+ {
+ location_t loc = gimple_location (stmt);
+ location_t dloc = location_with_discriminator (loc,
+ curr_discr);
+ gimple_set_location (stmt, dloc);
+ }
+ continue;
+ }
if (curr_locus == UNKNOWN_LOCATION)
{
curr_locus = gimple_location (stmt);