On Sun, Nov 3, 2024 at 11:23 PM Lewis Hyatt <lhy...@gmail.com> wrote:
>
> While testing 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. Once location_t is configured to be 64-bit, however, it
> produces an -fcompare-debug failure which is what I noticed. 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.

OK. (also for affected branches)

Thanks,
Richard.

> gcc/ChangeLog:
>
>         * tree-cfg.cc (assign_discriminators): Fix incorrect value passed to
>         next_discriminator_for_locus().
> ---
>  gcc/tree-cfg.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
> index 3eede0d61cd..c2100a51a7a 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);

Reply via email to