This is the mail archive of the gcc@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]

Re: Can the gcc 3.x code be cleaned up to avoid unnecessary warning m



> In many modules the compiler throws up warnings about the following:
> 
> 	unused variables
> 	comparison between signed and unsigned operands
> 	operands being signed in ANSI C and unsigned in traditional.
> 
> Having been a programmer myself, I am surprised that the code which produces
> these messages has not been cleaned up prior to release.

Actually, considerable cleanup work has been done: there are about 1/20
the warnings that were there before, but you might not have noticed this
because we didn't use -Wall in the old days.  However, if you check the
unused variable warnings, you will find that they are almost all false
positives: in code like

void proc(int foo)
{
	int flag;
	if (foo) {
		flag = result_of_some_boolean_function();
	}
	some_other_code();
	if (foo) {
		if (flag)
			do_something();
		else
			do_something_else();
	}
}

gcc will complain that flag can be used uninitialized, which is not
correct.

The others could be cleaned up.  But in some cases, cleaning up false
positives for uninitialized variables may be a bad idea, as adding an
unneeded initialization will make the code marginally slower.

> It is causing me particular confusion as I am trying to track down a back
> end bug
> which causes gcc3.0 and 3.0.4 to crash out unless -O0 is used.
> This bug appears to be fixed in gcc3.1.

I don't see why you think that one of the warnings might be related to
a crash.  Is there a reason why you must use 3.0.x instead of 3.1?

> Could something be done about cleaning up the code to remove the warnings
> before before gcc3.1.x
> and gcc3.2 are released please?

Certainly, if a volunteer can be found.  It's a good beginner project.
Want to help?


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