🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by David Keppel Tue, 06 Oct 1992 20:58
gcc 2.2.2 warning on statically unreachable code
#1262
Author: David Keppel
Date: Tue, 06 Oct 1992 20:58
37 lines
2459 bytes
GCC 2.2.2 emits a warning on code that is statically unreachable.  I'm
not sure if this is a bug or merely the way things are; at any rate,
the warning is printed whether or not `-W*' flags are given.

Input:

	  int
	tst (int m, int a, int b)
	{
	  return (1 ? (a) : ((a) << (0) | (b) >> (32)));
	}

Note that `1' is always true, so the second alternative is never
reached, thus `b >> 32' is never reached.

Repeat-by:

% /uns/trial/bin/gcc -v -c gcc-warning.c
Reading specs from /uns/trial/lib/gcc-lib/decstation/2.2.2/specs
gcc version 2.2.2
 /uns/trial/lib/gcc-lib/decstation/2.2.2/cpp -lang-c -v -undef -D__GNUC__=2 -D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -Dbsd4_2 -Dhost_mips -Dmips -Dultrix -Dunix -D__ANSI_COMPAT -D__MIPSEL__ -D__R3000__ -D__SYSTYPE_BSD__ -D___SYSTYPE_BSD__ -D__bsd4_2__ -D__host_mips__ -D__mips__ -D__ultrix__ -D__unix__ -D__ANSI_COMPAT -D__MIPSEL -D__R3000 -D__SYSTYPE_BSD -D___SYSTYPE_BSD -D__bsd4_2 -D__host_mips -D__mips -D__ultrix -D__unix -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C gcc-warning.c /usr

/tmp/cca22589.i
GNU CPP version 2.2.2 [AL 1.1, MM 19] DECstation running ultrix
 /uns/trial/lib/gcc-lib/decstation/2.2.2/cc1 /usr/tmp/cca22589.i -quiet -dumpbase gcc-warning.c -version -o /usr/tmp/cca22589.s
GNU C version 2.2.2 [AL 1.1, MM 19] DECstation running ultrix compiled by CC.
gcc-warning.c: In function `tst':
gcc-warning.c:5: warning: shift count exceeds width of value shifted
 as -nocpp -EL -v -o gcc-warning.o /usr/tmp/cca22589.s
/usr/lib/cmplrs/cc/as0 -v -G 8 -EL -g0 -O1 /usr/tmp/cca22589.s -o /tmp/ctmaa22592 -t /tmp/ctmsta22592 
as0: tst 
0.0u 0.0s 0:00 20% 61+64k 0+6io 5pf+0w
/usr/lib/cmplrs/cc/as1 -v -G 8 -p0 -EL -g0 -O1 /tmp/ctmaa22592 -o gcc-warning.o -t /tmp/ctmsta22592 
as1: tst 
0.0u 0.0s 0:00 29% 80+70k 0+3io 8pf+0w
 /uns/trial/lib/gcc-lib/decstation/2.2.2/mips-tfile -v -o gcc-warning.o /usr/tmp/cca22589.s
mips-tfile version 2.2.2 [AL 1.1, MM 19] DECstation running ultrix
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads