public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
Date: Thu, 26 Mar 2020 08:19:25 +0000	[thread overview]
Message-ID: <bug-94272-4-LQVNWqFl6q@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94272-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 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:5a1706f63a2024a5c2d878f2efeb8d198214542f

commit r10-7393-g5a1706f63a2024a5c2d878f2efeb8d198214542f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Mar 26 09:18:35 2020 +0100

    c++: Fix a -fcompare-debug issue with DEBUG_BEGIN_STMT stmts in
STATEMENT_LISTs [PR94272]

    The following testcase FAILs with -fcompare-debug.  The problem is that
    the C++ FE initially uses IF_STMTs, tcc_statement which default to
    TREE_SIDE_EFFECTS set, but later on is genericized into COND_EXPRs,
    tcc_expression which default to TREE_SIDE_EFFECTS ored from all 3 operands.
    Furthermore, with -g we emit by default DEBUG_BEGIN_STMTs
(TREE_SIDE_EFFECTS
    clear) and so end up with a STATEMENT_LIST containing DEBUG_BEGIN_STMT
    + e.g. the IF_STMT, while with -g0 we would end up with just the IF_STMT
    alone and in that case there is no STATEMENT_LIST wrapping it.

    Now, the STATEMENT_LIST has TREE_SIDE_EFFECTS set to match the IF_STMT,
    but if none of the 3 operands (condition and both branches) have
    TREE_SIDE_EFFECTS, genericize_if_stmt will replace the IF_STMT with
    COND_EXPR without TREE_SIDE_EFFECTS, but with -g only STATEMENT_LIST
    wrapping it will keep TREE_SIDE_EFFECTS.  Then during gimplification,
    shortcut_cond_expr checks TREE_SIDE_EFFECTS of the operands and as it
    is differennt between -g and -g0, will generate different code.

    The following patch attempts to fix this by clearing TREE_SIDE_EFFECTS
    on STATEMENT_LISTs that initially have it set and contain only
    DEBUG_BEGIN_STMT or at most one other statement that lost TREE_SIDE_EFFECTS
    during the genericization.

    2020-03-26  Jakub Jelinek  <jakub@redhat.com>

            PR c++/94272
            * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.

            * g++.dg/debug/pr94272.C: New test.

  parent reply	other threads:[~2020-03-26  8:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
2020-03-23 11:23 ` [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241 jakub at gcc dot gnu.org
2020-03-23 12:39 ` jakub at gcc dot gnu.org
2020-03-23 14:06 ` jakub at gcc dot gnu.org
2020-03-23 14:08 ` jakub at gcc dot gnu.org
2020-03-23 14:09 ` rguenth at gcc dot gnu.org
2020-03-26  8:19 ` cvs-commit at gcc dot gnu.org [this message]
2020-03-26  8:26 ` [Bug debug/94272] [8/9 " jakub at gcc dot gnu.org
2021-05-14  9:53 ` [Bug debug/94272] [9 " jakub at gcc dot gnu.org
2021-06-01  8:17 ` rguenth at gcc dot gnu.org
2022-05-27  8:48 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94272-4-LQVNWqFl6q@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).