https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105415

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:02f03c5c826d0cb7c32398af0c4282921e6e072a

commit r13-68-g02f03c5c826d0cb7c32398af0c4282921e6e072a
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Mon May 2 11:30:58 2022 +0200

    expand: Throw away non-external decls without varpool nodes [PR105415]

    The following testcase fails -fcompare-debug on aarch64-linux.  The problem
    is that for the n variable we create a varpool node, then remove it again
    because the var isn't really used, but it keeps being referenced in debug
    stmts/insns with -g.  Later during sched1 pass we ask whether the n var
    can be modified through some store to an anchored variable and with -g
    we create a new varpool node for it again just so that we can find its
    ultimate alias target.  Even later on we create some cgraph node for the
    loop parallelization, but as there has been an extra varpool node creation
    in between, we get higher node->order with -g than without.

    The patch fixes that by throwing variables without varpool nodes away
    during expansion time, they are very unlikely to actually end up with
    useful debug info anyway.

    I've bootstrapped/regtested the following on x86_64-linux and i686-linux,
    then bootstrapped with the patch reverted, reapplied the patch and did make
    cc1plus in stage3.  The debug section sizes are identical, .debug_info and
    .debug_loc is identical too, so I think we don't lose any debug info
through
    it.
    So at least on cc1plus it makes no difference.

    2022-05-02  Jakub Jelinek  <ja...@redhat.com>

            PR debug/105415
            * cfgexpand.cc (expand_debug_expr): Don't make_decl_rtl_for_debug
            if there is no symtab node for the VAR_DECL.

            * gcc.dg/pr105415.c: New test.

Reply via email to