public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/8828: [3.2/3.3/3.4 regression] gcc reports some code is unreachable when it is not
@ 2003-02-15 20:06 Steven Bosscher
0 siblings, 0 replies; 3+ messages in thread
From: Steven Bosscher @ 2003-02-15 20:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8828; it has been noted by GNATS.
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
rcampbell@tropicnetworks.com, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:
Subject: Re: c/8828: [3.2/3.3/3.4 regression] gcc reports some code is
unreachable when it is not
Date: 15 Feb 2003 20:56:34 +0100
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8828
We would incorrectly flag the case blocks as unreachable code (with
-Wunreachable-code, or course) for this testcase:
void foo (int i) {
switch (i) {
case 0: break;
case 1: break;
};
};
The problem seems to be that in the loop in
jump.c:never_reached_warning() ignores barriers, so it happily falls
through to the next basic block and thinks that the jump_insn for break
is an unreachable insn.
With the attached patch, we terminate the loop when we hit a barrier.
I hardly tested this patch, but I've made sure that it bootstraps, fixes
the testcase and does not break any of the test cases in the test suite
that have the option "-Wunreachable-code". I can't do a full regression
test (just a bootstrap takes about half a day on my computer :-/), and
it wouldn't even matter for the bootstrap because -Wunreachable-code is
not set for "-Wall".
There's also another change in behavior; for this test case:
int x;
void
foo (int i)
{
switch (i) {
case 0:
startfor:
goto caseend;
x = 1;
case 1:
x = 1;
break;
}
caseend:
return;
}
We used to flag that the "goto caseend;" was unreachable code, instead
of "x=1". I think this is actually an example of this PR (8828), not
warning about "x = 1" is probably the same bug as reported in PR c/5897.
With this patch we don't have a warning for this code at all. I think
this still is better than having false positives.
Can somebody with a better machine give this patch some propper testing?
Greetz
Steven
Index: gcc/jump.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/jump.c,v
retrieving revision 1.216
diff -c -3 -p -r1.216 jump.c
*** gcc/jump.c 10 Jan 2003 13:44:28 -0000 1.216
--- gcc/jump.c 15 Feb 2003 19:16:48 -0000
*************** never_reached_warning (avoided_insn, fin
*** 1918,1924 ****
for (insn = avoided_insn; insn != NULL; insn = NEXT_INSN (insn))
{
! if (finish == NULL && GET_CODE (insn) == CODE_LABEL)
break;
if (GET_CODE (insn) == NOTE /* A line number note? */
--- 1918,1925 ----
for (insn = avoided_insn; insn != NULL; insn = NEXT_INSN (insn))
{
! if ((finish == NULL && GET_CODE (insn) == CODE_LABEL)
! || GET_CODE (insn) == BARRIER)
break;
if (GET_CODE (insn) == NOTE /* A line number note? */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/8828: [3.2/3.3/3.4 regression] gcc reports some code is unreachable when it is not
@ 2003-02-20 9:36 Steven Bosscher
0 siblings, 0 replies; 3+ messages in thread
From: Steven Bosscher @ 2003-02-20 9:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8828; it has been noted by GNATS.
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
rcampbell@tropicnetworks.com, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:
Subject: Re: c/8828: [3.2/3.3/3.4 regression] gcc reports some code is unreachable
when it is not
Date: Thu, 20 Feb 2003 10:33:47 +0100
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8828
Approved patch pending:
http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01317.html
http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01597.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/8828: [3.2/3.3/3.4 regression] gcc reports some code is unreachable when it is not
@ 2003-02-22 5:44 aj
0 siblings, 0 replies; 3+ messages in thread
From: aj @ 2003-02-22 5:44 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, rcampbell
Synopsis: [3.2/3.3/3.4 regression] gcc reports some code is unreachable when it is not
State-Changed-From-To: analyzed->closed
State-Changed-By: aj
State-Changed-When: Sat Feb 22 05:44:21 2003
State-Changed-Why:
Steven's patch was applied to 3.2/3.3 and mainline.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8828
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-02-22 5:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-15 20:06 c/8828: [3.2/3.3/3.4 regression] gcc reports some code is unreachable when it is not Steven Bosscher
2003-02-20 9:36 Steven Bosscher
2003-02-22 5:44 aj
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).