Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

Re: [2.6.29-rc2-git2] compilation warnings

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


tiwai at suse

Jan 26, 2009, 11:32 PM

Post #1 of 7 (881 views)
Permalink
Re: [2.6.29-rc2-git2] compilation warnings

At Tue, 27 Jan 2009 08:15:29 +0100,
Rufus & Azrael wrote:
>
> Here are my compilation warnings for fresh 2.6.29-rc2-git2 kernel :
>
> > sound/pci/hda/hda_codec.c: In function ‘get_empty_pcm_device’:
> > sound/pci/hda/hda_codec.c:2544: attention : ‘dev’ may be used
> > uninitialized in this function

A bogus warning. Ignore this.


thanks,

Takashi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


khali at linux-fr

Jan 27, 2009, 12:46 AM

Post #2 of 7 (812 views)
Permalink
Re: [2.6.29-rc2-git2] compilation warnings [In reply to]

On Tue, 27 Jan 2009 08:32:17 +0100, Takashi Iwai wrote:
> At Tue, 27 Jan 2009 08:15:29 +0100,
> Rufus & Azrael wrote:
> >
> > Here are my compilation warnings for fresh 2.6.29-rc2-git2 kernel :
> >
> > > sound/pci/hda/hda_codec.c: In function ‘get_empty_pcm_device’:
> > > sound/pci/hda/hda_codec.c:2544: attention : ‘dev’ may be used
> > > uninitialized in this function
>
> A bogus warning. Ignore this.

No matter how bogus it is, it should be fixed. Otherwise this is
wasting the time of users and developers over and over again.

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


tiwai at suse

Jan 27, 2009, 1:34 AM

Post #3 of 7 (808 views)
Permalink
Re: [2.6.29-rc2-git2] compilation warnings [In reply to]

At Tue, 27 Jan 2009 09:46:28 +0100,
Jean Delvare wrote:
>
> On Tue, 27 Jan 2009 08:32:17 +0100, Takashi Iwai wrote:
> > At Tue, 27 Jan 2009 08:15:29 +0100,
> > Rufus & Azrael wrote:
> > >
> > > Here are my compilation warnings for fresh 2.6.29-rc2-git2 kernel :
> > >
> > > > sound/pci/hda/hda_codec.c: In function ‘get_empty_pcm_device’:
> > > > sound/pci/hda/hda_codec.c:2544: attention : ‘dev’ may be used
> > > > uninitialized in this function
> >
> > A bogus warning. Ignore this.
>
> No matter how bogus it is, it should be fixed. Otherwise this is
> wasting the time of users and developers over and over again.

Well, it's a bug of gcc appearing only in a certain version, so most
people won't see it.

Of course, we can put uninitialized_var(). But, I don't basically
like adding it unconditionally...


Takashi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


mingo at elte

Jan 27, 2009, 3:16 AM

Post #4 of 7 (806 views)
Permalink
Re: [2.6.29-rc2-git2] compilation warnings [In reply to]

* Takashi Iwai <tiwai [at] suse> wrote:

> At Tue, 27 Jan 2009 09:46:28 +0100,
> Jean Delvare wrote:
> >
> > On Tue, 27 Jan 2009 08:32:17 +0100, Takashi Iwai wrote:
> > > At Tue, 27 Jan 2009 08:15:29 +0100,
> > > Rufus & Azrael wrote:
> > > >
> > > > Here are my compilation warnings for fresh 2.6.29-rc2-git2 kernel :
> > > >
> > > > > sound/pci/hda/hda_codec.c: In function ‘get_empty_pcm_device’:
> > > > > sound/pci/hda/hda_codec.c:2544: attention : ‘dev’ may be used
> > > > > uninitialized in this function
> > >
> > > A bogus warning. Ignore this.
> >
> > No matter how bogus it is, it should be fixed. Otherwise this is
> > wasting the time of users and developers over and over again.
>
> Well, it's a bug of gcc appearing only in a certain version, so most
> people won't see it.
>
> Of course, we can put uninitialized_var(). But, I don't basically like
> adding it unconditionally...

People will again and again look at this warning and waste time deciding
that "it's a bogus warning" or even report it. As time goes on does the
human cost get larger, linearly.

Furthermore, if everyone in the kernel behaves like that we'll literally
have dozens (even hundreds) of build warnings that might be bogus but
which also obscure other, real warnings by their sheer mass.

The cost of you adding a oneliner annotation is miniscule compared to that
and it is a one-time effort. We already spent more energy on discussing
this than it would have taken you to annotate it. Please.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


tiwai at suse

Jan 27, 2009, 3:49 AM

Post #5 of 7 (807 views)
Permalink
Re: [2.6.29-rc2-git2] compilation warnings [In reply to]

At Tue, 27 Jan 2009 12:16:31 +0100,
Ingo Molnar wrote:
>
>
> * Takashi Iwai <tiwai [at] suse> wrote:
>
> > At Tue, 27 Jan 2009 09:46:28 +0100,
> > Jean Delvare wrote:
> > >
> > > On Tue, 27 Jan 2009 08:32:17 +0100, Takashi Iwai wrote:
> > > > At Tue, 27 Jan 2009 08:15:29 +0100,
> > > > Rufus & Azrael wrote:
> > > > >
> > > > > Here are my compilation warnings for fresh 2.6.29-rc2-git2 kernel :
> > > > >
> > > > > > sound/pci/hda/hda_codec.c: In function ‘get_empty_pcm_device’:
> > > > > > sound/pci/hda/hda_codec.c:2544: attention : ‘dev’ may be used
> > > > > > uninitialized in this function
> > > >
> > > > A bogus warning. Ignore this.
> > >
> > > No matter how bogus it is, it should be fixed. Otherwise this is
> > > wasting the time of users and developers over and over again.
> >
> > Well, it's a bug of gcc appearing only in a certain version, so most
> > people won't see it.
> >
> > Of course, we can put uninitialized_var(). But, I don't basically like
> > adding it unconditionally...
>
> People will again and again look at this warning and waste time deciding
> that "it's a bogus warning" or even report it. As time goes on does the
> human cost get larger, linearly.
>
> Furthermore, if everyone in the kernel behaves like that we'll literally
> have dozens (even hundreds) of build warnings that might be bogus but
> which also obscure other, real warnings by their sheer mass.

The question is rather how often it's really seen.
I've tested 4 different gcc versions and a couple of other versions
with cross compiling occasionally, and this warning doesn't appear on
any versions.

> The cost of you adding a oneliner annotation is miniscule compared to that
> and it is a one-time effort. We already spent more energy on discussing
> this than it would have taken you to annotate it. Please.

Well, did we get a consensus about this? If yes, I'll follow it, of
course.

Adding uninitialized_var() essentially means to disable the check,
thus a new real bug in future might be overlooked. This is a bigger
drawback if it's just a warning that appears in only one old buggy gcc
version.

That's why I wrote "adding it *unconditionally*". If the warning
appears in many gcc versions, it's worth to hide.


thanks,

Takashi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


khali at linux-fr

Jan 27, 2009, 4:48 AM

Post #6 of 7 (804 views)
Permalink
Re: [2.6.29-rc2-git2] compilation warnings [In reply to]

Hi Takashi,

On Tue, 27 Jan 2009 10:34:20 +0100, Takashi Iwai wrote:
> At Tue, 27 Jan 2009 09:46:28 +0100,
> > On Tue, 27 Jan 2009 08:32:17 +0100, Takashi Iwai wrote:
> > > A bogus warning. Ignore this.
> >
> > No matter how bogus it is, it should be fixed. Otherwise this is
> > wasting the time of users and developers over and over again.
>
> Well, it's a bug of gcc appearing only in a certain version, so most
> people won't see it.
>
> Of course, we can put uninitialized_var(). But, I don't basically
> like adding it unconditionally...

I didn't know about uninitialized_var(), thanks for the hint.

My experience with these warnings is that, in many cases, it is
possible to write the code differently so that it is clear to the
compiler that the variable is never used uninitialized. In some cases,
doing so also makes the code easier to read for humans and less likely
to break in the future.

Of course, in some cases the problem is simply that the compiler is too
stupid to understand even simple things, but in other cases these
warnings might be a good opportunity to rewrite the code in a way that
is easier to understand.

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


mingo at elte

Jan 27, 2009, 5:06 AM

Post #7 of 7 (799 views)
Permalink
Re: [2.6.29-rc2-git2] compilation warnings [In reply to]

* Jean Delvare <khali [at] linux-fr> wrote:

> Hi Takashi,
>
> On Tue, 27 Jan 2009 10:34:20 +0100, Takashi Iwai wrote:
> > At Tue, 27 Jan 2009 09:46:28 +0100,
> > > On Tue, 27 Jan 2009 08:32:17 +0100, Takashi Iwai wrote:
> > > > A bogus warning. Ignore this.
> > >
> > > No matter how bogus it is, it should be fixed. Otherwise this is
> > > wasting the time of users and developers over and over again.
> >
> > Well, it's a bug of gcc appearing only in a certain version, so most
> > people won't see it.
> >
> > Of course, we can put uninitialized_var(). But, I don't basically
> > like adding it unconditionally...
>
> I didn't know about uninitialized_var(), thanks for the hint.
>
> My experience with these warnings is that, in many cases, it is possible
> to write the code differently so that it is clear to the compiler that
> the variable is never used uninitialized. In some cases, doing so also
> makes the code easier to read for humans and less likely to break in the
> future.
>
> Of course, in some cases the problem is simply that the compiler is too
> stupid to understand even simple things, but in other cases these
> warnings might be a good opportunity to rewrite the code in a way that
> is easier to understand.

And even in the cases where the compiler is stupid, leaving a warning
around:

1) Does not get compiler bugs fixed any faster [.only true competition
between compilers gets compiler bugs fixed any faster]

2) Has ongoing and irreversible maintenance costs for _all of us in the
kernel_

3) for every bogus compiler warning there's a dozen warnings where the
compiler told us that _we_ were doing something stupid. All things
considered the false positive ratio is still a fair deal.

So leaving them around is a bit like making a political point by burning
yourself in front of the cameras - leaves the political opponent largely
unimpressed and unscathed while being self-destructive in 99% of the
cases.

gcc_is_utterly_stupid(var) type of annotations (that initialize to zero
instead of the current 'turn off the warning' dangerous construct) would
be far better. Albeit even that would in all likelyhood be a rather
pointless (but admittedly satisfying) gesture.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.