public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67979] New: dead code elimination deleted the predicated branch within the function block.
@ 2015-10-15 19:30 feqin1023 at gmail dot com
  2015-10-15 19:42 ` [Bug c/67979] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: feqin1023 at gmail dot com @ 2015-10-15 19:30 UTC (permalink / raw)
  To: gcc-bugs

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 *).


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-16  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15 19:30 [Bug c/67979] New: dead code elimination deleted the predicated branch within the function block feqin1023 at gmail dot com
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

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).