public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "feqin1023 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/67979] New: dead code elimination deleted the predicated branch within the function block.
Date: Thu, 15 Oct 2015 19:30:00 -0000	[thread overview]
Message-ID: <bug-67979-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 67979
           Summary: dead code elimination deleted the predicated branch
                    within the function block.
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: feqin1023 at gmail dot com
  Target Milestone: ---

Created attachment 36518
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36518&action=edit
the source test dead code elimination.

if i have this input:

/*--------------------test.c----------------------------*/
void bar_i(int);
void foo(int *x) {
  int y = *x; // dead code can be clean
  if (!x)
    return;   // this branch ALSO will be clean 
  bar_i(y);
}
/*------------------------------------------------------*/

we call gcc like this:

  gcc -O2 -S test.c

the the whole branch in function foo(int *) will be clean.
BUT, if foo(int *) is called like this:

  foo(NULL);

gcc has CHANGED the original semantic even sometimes which
 is error. but compiler can do this?

I also test Clang, Clang ALWAYS keep the branch in foo(int *).


             reply	other threads:[~2015-10-15 19:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 19:30 feqin1023 at gmail dot com [this message]
2015-10-15 19:42 ` [Bug c/67979] " pinskia at gcc dot gnu.org
2015-10-15 20:09 ` feqin1023 at gmail dot com
2015-10-16  7:49 ` 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-67979-4@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).