[Bug debug/94441] [10 Regression] g++: error: gcc/gcc/testsuite/g++.dg/cpp1z/constexpr-if2.C: ‘-fcompare-debug’ failure (length) since r10-7397-gda920d0c46c38fe2

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Apr 4 07:17:01 GMT 2020


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

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

https://gcc.gnu.org/g:aae5d08a8d4dcee576a85ea76febe56c53675ef2

commit r10-7550-gaae5d08a8d4dcee576a85ea76febe56c53675ef2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 4 09:16:07 2020 +0200

    c++: Fix further protected_set_expr_location related -fcompare-debug issues
[PR94441]

    My recent protected_set_expr_location changes work well when
    that function is called unconditionally, but as the testcase shows, the C++
    FE has a few spots that do:
      if (!EXPR_HAS_LOCATION (stmt))
        protected_set_expr_location (stmt, locus);
    or similar.  Now, if we have for -g0 stmt of some expression that can
    have location and has != UNKNOWN_LOCATION, while -g instead has
    a STATEMENT_LIST containing some DEBUG_BEGIN_STMTs + that expression with
    that location, we don't call protected_set_expr_location in the -g0 case,
    but do call it in the -g case, because on the STATEMENT_LIST
    !EXPR_HAS_LOCATION.
    The following patch introduces a helper function which digs up the single
    expression of a STATEMENT_LIST and uses that expression in the
    EXPR_HAS_LOCATION check (plus changes protected_set_expr_location to
    also use that helper).

    Or do we want a further wrapper, perhaps C++ FE only, that would do this
    protected_set_expr_location_if_unset (stmt, locus)?

    2020-04-04  Jakub Jelinek  <jakub@redhat.com>

            PR debug/94441
            * tree-iterator.h (expr_single): Declare.
            * tree-iterator.c (expr_single): New function.
            * tree.h (protected_set_expr_location_if_unset): Declare.
            * tree.c (protected_set_expr_location): Use expr_single.
            (protected_set_expr_location_if_unset): New function.

            * parser.c (cp_parser_omp_for_loop): Use
            protected_set_expr_location_if_unset.
            * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.

            * g++.dg/opt/pr94441.C: New test.


More information about the Gcc-bugs mailing list