[gnu.gcc.bug] gcc don't report unreachable code

murf@CS.UTEXAS.EDU (Steve Murphy) (09/02/89)

A nit, I know, but heck, SUN does. This code, on a SUN3, sunos 3.5,

#include <stdio.h>

	void fprintf();

int main(argc,argv)
char **argv;
int argc;
{
	FILE *fp;
	fp =0;
	if( argc && **argv )
	{
		switch( argc )
		{
		case 0:
			fprintf(fp,"Hi\n");
			break;
			fprintf(fp,"Hi\n");
		case 1:
			fprintf(fp,"Hi\n");
			break;
		default:
			fprintf(fp,"Hi\n");
			break;
		}
	}
	return 0;
}


when compiled with

gcc -c -g -O -traditional -fwritable-strings -Wall ~/sdf31/t.c

using gcc1.35,

returns NOTHING. Look close at case 0.

murf


PS. Are you guys getting my reports? I've  been sending in bug reports
for a while now,  and getting absolutely  no receipts. Either they are
making it, or they are not. I don't know if you guys got or not.  If I
knew they weren't making it, I could attack the  problem. But  the way
it is now, with absolutely no  feedback, I wonder  if I'm wasting time
sending you anything. I'm asking for  very little, just a little note,
perhaps even machine generated, letting me know it  got there. I don't
care if you don't look at it, disagree with it, or are even willing or
not to fix it, all I need to know is it got to the right place.

murf