Skip to contentSkip to conversation

janitor project: fix gcc 4 warnings

KJ Andi Kleen 8 participants 12 messages Dec 19, 2004 – Feb 15, 2007 Kernel janitors

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

Here's a proposed janitor project if anybody is interested:

The current gcc 4.0 snapshots include some more warnings in -Wall and changed some existing ones which makes a kernel compilation quite noisy.

The project would be to fix all these warnings.

Short howto:

Get ftp://gcc.gnu.org/pub/gcc/snapshots/4.0-20041219/gcc-core-4.0-20041219.tar.bz2

Untar it and compile with

mkdir obj
../gcc-*/configure --disable-checking --enable-languages=c --prefix=/usr/local/gcc4 make bootstrap
<as root>
make install

Then compile an uptodate 2.6 kernel with:

make allmodconfig
make CC=/usr/local/gcc4/bin/gcc 2>&1 | tee LOG
grep warning LOG

You'll see lots of warnings in LOG. Fix them all and submit patches through the usual janitor channels.

-Andi

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 4 lines · Andi Kleen

Here's a proposed janitor project if anybody is interested:

The current gcc 4.0 snapshots include some more warnings in -Wall and changed some existing ones which makes a kernel compilation quite noisy.

I think it would get more takers if people didn't have to compile a new gcc. If we had a list of -W... flags in older gccs that could simulate 90% of the warnings, this would make it possible for more people to work on it.

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

author
#2 lore raw
In reply to Andi Kleen
Quoted 10 lines · Matthew Wilcox
Quoted 4 lines · Andi Kleen

Here's a proposed janitor project if anybody is interested:

The current gcc 4.0 snapshots include some more warnings in -Wall and changed some existing ones which makes a kernel compilation quite noisy.

I think it would get more takers if people didn't have to compile a new gcc. If we had a list of -W... flags in older gccs that could simulate 90% of the warnings, this would make it possible for more people to work on it.

Problem is that some of the warnings are completely new in gcc 4 and cannot be enabled with options in older versions. Also with a reasonable modern machine (Athlon or P4) it won't take that long to do the gcc compilation.

-Andi

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Andi Kleen

Hi

Quoted 15 lines · Andi Kleen

Short howto:

Get ftp://gcc.gnu.org/pub/gcc/snapshots/4.0-20041219/gcc-core-4.0-20041219.tar. bz2

Untar it and compile with

mkdir obj
../gcc-*/configure --disable-checking --enable-languages=c --prefix=/usr/local/gcc4 make bootstrap
<as root>
make install

Quoted 5 lines

Then compile an uptodate 2.6 kernel with:

make allmodconfig
make CC=/usr/local/gcc4/bin/gcc 2>&1 | tee LOG
grep warning LOG

Cool howto, thanks. Maybe that should go onto the TODO list over at kerneljanitors.org?

Quoted 3 lines

You'll see lots of warnings in LOG. Fix them all and submit patches through the usual janitor channels.

I already compiled GCC4 and it took about 15 minutes on an Athlon Tbird 1.4 GHz to finish. When compiling Linux 2.6.10-rc3 with GCC4 there are lots of warnings (as expected) and even a fatal error.
So I'm trying to fix some of these warnings. They are all over the kernel tree and so I'm curious what would be the best method to split and submit the patches?

Thanks, Tobias

Signature · 4 lines
Tobias Klauser <[email protected]>

GPG-Key 0x3A445520 http://tklauser.politux.org/tklauser.asc
    Fingerprint = 7474 D486 E4FC 5113 561D  B1E3 72BC 0E7E 3A44 5520

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
In reply to Andi Kleen
Quoted 10 lines · Andi Kleen

Here's a proposed janitor project if anybody is interested:

The current gcc 4.0 snapshots include some more warnings in -Wall and changed some existing ones which makes a kernel compilation quite noisy.

The project would be to fix all these warnings.
...
You'll see lots of warnings in LOG. Fix them all and submit patches through the usual janitor channels.

What kind of new warnings does gcc 4.0 emit?

It should be checked whether the warnings are valid and should really be fixed.

A past example are the signed warnings pre-releases of gcc 3.3 (including the pre-release a stable SuSE release shipped as compiler...) emitted with -Wall that were no longer emitted in the final gcc 3.3 release.

Altogether, new warnings in gcc 4.0 might be a nice diagnostics for the people who are also trying to find bugs using -W, but I don't see urgent reasons for fixing them before gcc 4.0 is actually released.

Quoted 1 line

-Andi

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

author
#5 lore raw
In reply to Andi Kleen
Quoted 9 lines · Alexey Dobriyan
Quoted 2 lines · Andi Kleen

make allmodconfig
make CC=/usr/local/gcc4/bin/gcc 2>&1 | tee LOG

CC kernel/acct.o
kernel/acct.c: In function ???encode_float???:
kernel/acct.c:366: fatal error: internal consistency failure compilation terminated.

Looks like another gcc bug. I will file a gcc bug thanks.

Just disable accounting in the .config to continue or use make -k

Quoted 4 lines

here.

Maaaany "differ in signedness" warnings.

Yep, and some new "bla is uninitialized" warnings. Many of them are bogus, because gcc just cannot prove if a variable is uninitialized or not and it now does it for structure fields too. Anyways, they all need to be examined and fixed.

Quoted 11 lines

===============================================================================
init/main.c: In function ???maxcpus???:
init/main.c:150: warning: pointer targets in passing argument 2 of ???get_option??? differ in signedness
===============================================================================
unsigned int maxcpus;
int get_option(char **str, int *pint);
...
get_option(&str, &max_cpus);
===============================================================================
For example, this one should be left as is, shouldn't it?

The warning should be fixed, otherwise the warning noise will hide real valuable warnings. It's a judgement call whether you modify the function prototype or the argument. In this case both would be possible. I would usually do the change that requires less work (e.g. fix the argument in this case because there are a lot more get_option callers). This means make maxcpus an int. Please avoid adding casts if possible.

-Andi

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

author
#6 lore raw
In reply to Andi Kleen
Quoted 4 lines · Adrian Bunk
Quoted 2 lines

You'll see lots of warnings in LOG. Fix them all and submit patches through the usual janitor channels.

What kind of new warnings does gcc 4.0 emit?

http://www.firstfloor.org/~andi/2.6.10rc2-gcc4-warnings.gz has a full list from i386 allmodconfig (including some errors)

Quoted 3 lines

Altogether, new warnings in gcc 4.0 might be a nice diagnostics for the people who are also trying to find bugs using -W, but I don't see urgent reasons for fixing them before gcc 4.0 is actually released.

I disagree. It's better to have the kernel already gcc 4 ready when it is released. And we always ask other people to test mainline kernels, so it's only fair to test and use other people's mainline code too.

-Andi

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

author
#7 lore raw
In reply to Andi Kleen
Quoted 9 lines · Alexey Dobriyan
Quoted 2 lines · Andi Kleen

make allmodconfig
make CC=/usr/local/gcc4/bin/gcc 2>&1 | tee LOG

CC kernel/acct.o
kernel/acct.c: In function ???encode_float???:
kernel/acct.c:366: fatal error: internal consistency failure compilation terminated.

I checked this and it doesn't seem to happen with my compiler (which is a newer CVS checkout). So I assume it has been fixed already.

-Andi

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#8 lore raw
In reply to Andi Kleen
Quoted 10 lines · Matthew Wilcox
Quoted 4 lines · Andi Kleen

Here's a proposed janitor project if anybody is interested:

The current gcc 4.0 snapshots include some more warnings in -Wall and changed some existing ones which makes a kernel compilation quite noisy.

I think it would get more takers if people didn't have to compile a new gcc.  If we had a list of -W... flags in older gccs that could simulate 90% of the warnings, this would make it possible for more people to work on it.

Maybe someone can make gcc-4 build logs available similar to the ones at
http://developer.osdl.org/cherry/compile/. In many cases it's not even necessary to produce the warning with your own compiler in order to fix it. This could also be combined with warnings from the various sparse-like code checkers.

Arnd <><

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#9 lore raw
In reply to Andi Kleen

Hey

"Andi Kleen" <[email protected]> wrote in message
news:[email protected]...

Quoted 8 lines
Quoted 4 lines

CC kernel/acct.o
kernel/acct.c: In function ???encode_float???:
kernel/acct.c:366: fatal error: internal consistency failure compilation terminated.

I checked this and it doesn't seem to happen with my compiler (which is a newer CVS checkout). So I assume it has been fixed already.

I just tried to make a new CVS checkout, but I still get the 'internal consistency failure'. Any advice on what to do?

--
Best Regards
Kovarththanan Rajaratnam

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Kernel-janitor-discuss mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kernel-janitor-discuss

#10 lore raw
In reply to Andi Kleen
Quoted 7 lines · S wrote:

Using gcc-core-4.0-20050130.tar, the "internal consisteny problem" has gone away.
However, during the 2.6.10 kernel compilation, some #warnings stopped the compilation. Any ideas on what needs to be done with the #warnings ?

Quoted 1 line

From the looks of it, a newer snapshot may not have

the #warnings possibly.

What CPU arch. are you building on?
I see that sparc64 and alpha use -Werror (treat warnings as errors, which is what you show below), but other arches don't do that (unless it's in -mm) AFAIK.

If you are using sparc64 or alpha, you can just edit the Makefile(s) to use -Wall instead of -Werror . Or change .config to omit these (few) drivers.

Quoted 67 lines

<snip> drivers/cpufreq/cpufreq_userspace.c:140:2: warning:
#warning The /proc/sys/cpu/ and sysctl interface to cpufreq will be removed from the 2.6. kernel series soon after 2005-01-01

  CC [M]  drivers/cpufreq/cpufreq_ondemand.o
  CC [M]  drivers/cpufreq/freq_table.o
  CC [M]  drivers/cpufreq/proc_intf.o

drivers/cpufreq/proc_intf.c:15:2: warning: #warning This module will be removed
from the 2.6. kernel series soon after 2005-01-01
GEN drivers/eisa/devlist.h
CC drivers/eisa/eisa-bus.o
cc1: warnings being treated as errors drivers/eisa/eisa-bus.c:421: warning: pointer targets in initialization differ in signedness drivers/eisa/eisa-bus.c:422: warning: pointer targets in initialization differ in signedness make[2]: *** [drivers/eisa/eisa-bus.o] Error 1 make[1]: *** [drivers/eisa] Error 2
make: *** [drivers] Error 2

-----------------------------------------------------

List:       kernel-janitor-discuss
Subject:    [KJ] janitor project: fix gcc 4 warnings
From:       Andi Kleen <ak () muc ! de>
Date:       2004-12-19 19:09:03
Message-ID: <20041219190903.GA30192 () muc ! de>

[Download message RAW]

Here's a proposed janitor project if anybody is
interested:

The current gcc 4.0 snapshots include some more warnings in -Wall
and changed some existing ones which makes a kernel compilation quite noisy.

The project would be to fix all these warnings.

Short howto:

Get ftp://gcc.gnu.org/pub/gcc/snapshots/4.0-20041219/gcc-core-4.0-20041219.tar.bz2

Untar it and compile with

mkdir obj
../gcc-*/configure --disable-checking
--enable-languages=c --prefix=/usr/local/gcc4
make bootstrap
<as root>
make install

Then compile an uptodate 2.6 kernel with:

make allmodconfig
make CC=/usr/local/gcc4/bin/gcc 2>&1 | tee LOG
grep warning LOG

You'll see lots of warnings in LOG. Fix them all and submit patches
through the usual janitor channels.

-Andi

Signature · 5 lines
~Randy
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
#11 lore raw
In reply to Andi Kleen

Hello !

i recognized that there are still quite a reasonable number of warnings when i compile a kernel, especially with allmodconfig.

is there somebody systematically working on fixing those warnings being left over in kernel source ?

i&#180;m really a newbie to kernel development and not really a good C programmer, but i`d like to try to help fix those warnings. maybe this will freshen up my programming skills a little bit.

btw - http://developer.osdl.org/cherry/compile/ seems to be very outdated - wouldn&#180;t it be good to monitor the "warnings regression" between kernel releases?

whenever i compile a kernel, i move that window to my second screen and whenever gcc spits out a warning, this draws someone`s attention. leaving that feeling "uuuhhh, ohhh - there must be something wrong with the kernel...."

so, is this the right place to discuss such fixes ? anybody to volunteer on systematically fixing those warnings ?

regards
roland

sysadmin

_______________________________________________________________________
Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos. Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc2222

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors