Skip to content

Commit 81c2923

Browse files
Lewis HyattLewis Hyatt
authored andcommitted
tree-cfg: Fix call to next_discriminator_for_locus()
While testing future 64-bit location_t support, I ran into an -fcompare-debug issue that was traced back here. Despite the name, next_discriminator_for_locus() is meant to take an integer line number argument, not a location_t. There is one call site which has been passing a location_t instead. For the most part that is harmless, although in case there are two CALL stmts on the same line with different location_t, it may fail to generate a unique discriminator where it should. If/when location_t changes to be 64-bit, however, it will produce an -fcompare-debug failure. Fix it by passing the line number rather than the location_t. I am not aware of a testcase that demonstrates any observable wrong behavior, but the file debug/pr53466.C is an example where the discriminator assignment is indeed different before and after this change. gcc/ChangeLog: * tree-cfg.cc (assign_discriminators): Fix incorrect value passed to next_discriminator_for_locus().
1 parent 26f3efc commit 81c2923

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gcc/tree-cfg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ assign_discriminators (void)
12511251
}
12521252
/* Allocate a new discriminator for CALL stmt. */
12531253
if (gimple_code (stmt) == GIMPLE_CALL)
1254-
curr_discr = next_discriminator_for_locus (curr_locus);
1254+
curr_discr = next_discriminator_for_locus (curr_locus_e.line);
12551255
}
12561256

12571257
gimple *last = last_nondebug_stmt (bb);

0 commit comments

Comments
 (0)