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]

optimization/5230: Spurious warning compiling duffs device with optimization



>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:


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