diff options
author | Lewis Hyatt <lhyatt@gmail.com> | 2024-10-25 14:55:09 -0400 |
---|---|---|
committer | Lewis Hyatt <lhyatt@gcc.gnu.org> | 2024-11-20 18:08:57 -0500 |
commit | 81c29232b6f36235693ec12b319f5786ba83de03 (patch) | |
tree | f5ec46be8286878de223c7fe71e46641623f02c5 /gcc | |
parent | 26f3efccaa760ca74ad6e2584ce3056c889fe246 (diff) | |
download | gcc-81c29232b6f36235693ec12b319f5786ba83de03.zip gcc-81c29232b6f36235693ec12b319f5786ba83de03.tar.gz gcc-81c29232b6f36235693ec12b319f5786ba83de03.tar.bz2 |
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().
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/tree-cfg.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index 3eede0d..c2100a5 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -1251,7 +1251,7 @@ assign_discriminators (void) } /* Allocate a new discriminator for CALL stmt. */ if (gimple_code (stmt) == GIMPLE_CALL) - curr_discr = next_discriminator_for_locus (curr_locus); + curr_discr = next_discriminator_for_locus (curr_locus_e.line); } gimple *last = last_nondebug_stmt (bb); |