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]

Erroneous warning: will never be executed regression from 3.4


All,
    With gcc 3.1 on linux x86 I get the subject
with the following command line:

gcc -Wunreachable-code  -c -o t.o t.c

t.c
-------------------------------------------
typedef struct
{
	unsigned one_B;
	unsigned two_B;
	unsigned three_B;
	unsigned four_B;
	unsigned five_B;
	unsigned six_B;
	unsigned seven_B;
	unsigned eight_B;
	unsigned nine_B;
	unsigned ten_B;
	unsigned eleven_B;
	unsigned twelve_B;
	unsigned thirteen_B;
	unsigned fourteen_B;
	unsigned fifteen_B;
	unsigned sixteen_B;
	unsigned seventeen_B;
	unsigned eighteen_B	;
	unsigned nineteen_B;
	unsigned twenty_B;
	unsigned twenty_one_B	;
	unsigned twenty_two_B;
	unsigned twenty_three_B;
}A_TYPE;
extern A_TYPE a;

void t(void)
{
	if ((a.one_B == 0) || (a.eleven_B != 0))
	{
#ifdef WARNING_GOES_AWAY
		a.twenty_two_B = 1;
#endif		
		return;
	}
	
	a.twenty_one_B = 1;
}
--------------------------------------------------

gcc -Wunreachable-code -c -o t.o t.c
t.c: In function `t':
t.c:36: warning: will never be executed

gcc -Wunreachable-code -c -o t.o t.c
-DWARNING_GOES_AWAY

gcc 3.4 doesn't have this warning

FYI,

Bill


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com


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