This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/8828: [3.2/3.3 regression] gcc reports some code is unreachable when it is not


The regression reported in PR c/8828 showed up starting
with this patch:

2002-02-12  Jakub Jelinek  <jakub@redhat.com>

        * jump.c (never_reached_warning): Add finish argument.
        If finish is NULL, stop on CODE_LABEL, otherwise stop before
first
        real insn after end.
        * rtl.h (never_reached_warning): Adjust prototype.
        * cse.c (cse_insn): Pass NULL as finish to
never_reached_warning.
        * cfgrtl.c (flow_delete_block): Pass b->end as finish to
        never_reached_warning.

Here's a small test case that causes the compiler to issue
warnings when compiled on i686-linux with -Wunreachable-code:

-------------------
/* incorrect(?) warnings with -Wunreachable-code */

void foo(int i) {
  switch (i)    {
    case 0:         break;
    case 1:         break;
  };
};
-------------------

Output from mainline gcc:

8828.c: In function `foo':
8828.c:6: warning: will never be executed
8828.c:5: warning: will never be executed

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8828




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]