public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: thorpej@shagadelic.org
To: gcc-gnats@gcc.gnu.org
Subject: optimization/5230: Spurious warning compiling duffs device with optimization
Date: Mon, 31 Dec 2001 10:16:00 -0000	[thread overview]
Message-ID: <20011231181104.4EEED9869@dr-evil.shagadelic.org> (raw)


>Number:         5230
>Category:       optimization
>Synopsis:       Spurious warning compiling duffs device with optimization
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 31 10:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jason R. Thorpe
>Release:        3.1 20011230 (experimental)
>Organization:
Wasabi Systems, Inc.
>Environment:
System: NetBSD dr-evil 1.5Z NetBSD 1.5Z (DR-EVIL) #252: Sun Dec 9 17:39:53 PST 2001 thorpej@dr-evil:/u1/netbsd/src/sys/arch/i386/compile/DR-EVIL i386


	
host: i386-unknown-netbsdelf
build: i386-unknown-netbsdelf
target: i386-unknown-netbsdelf
configured with: ../../gcc/configure --disable-shared --prefix=/usr/local/gnu --host=i386-unknown-netbsdelf --target=i386-unknown-netbsdelf : (reconfigured)  : (reconfigured) 
>Description:
	GCC produces a spurious warning when compiling a duffs device
	with optimization:

dr-evil:thorpej 41$ i386-unknown-netbsdelf-gcc -S -O1 foo.c 
foo.c: In function `cksum':
foo.c:13: warning: unreachable code at beginning of switch statement
dr-evil:thorpej 42$ 

	The resulting assembly code appears correct, and produces the
	expected result when given a test input.  The warning does not
	appear if no optimization is used.

>How-To-Repeat:
	The following C program will produce the warning when compiled
	with -O1.  It will not produce a warning when compiled with
	-O0.  In both cases, the generated assembly code is correct,
	and correct results are produced by the test inputs.

begin 644 foo.c.gz
M'XL("(6I,#P"`V9O;RYC`'70T6K",!3&\>N<I_CHF"1,H4E$Q.*>Q)L2,PVU
M4=JH@^&[+U'!(NG=:?/[EYPZ'ZBMG>>"_HC8J7,^_/#"_IZL"78+.<7N&/"Y
MW?AB"M/TYY9+(:H,U1FJ\G21H3I/99FQ\[Q5.;M,]D84+3W>Q`D^[<O29!JL
M459Q^?[J@MF#>TR@!;'KWAUL>OQ&*1"YJ7N+<D6,U7V+R_%0ARAX\8''29%N
MQ>('O]:8IW$V\]4STZ.9'F;Z+5.CF1IFZBV3HYD<9O*5W8AU-IP[#VZ:^Q_[
)!]824U<;`@``
`
end

>Fix:
	The warning can be avoided by not using optimization.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-12-31 18:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-31 10:16 thorpej [this message]
2002-04-03  1:50 rth
2002-11-07  9:30 thorpej
2002-12-06 15:49 bangerth
2002-12-06 15:56 Wolfgang Bangerth
2002-12-06 16:06 Jason R Thorpe

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=20011231181104.4EEED9869@dr-evil.shagadelic.org \
    --to=thorpej@shagadelic.org \
    --cc=gcc-gnats@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).