* [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
@ 2006-10-29 21:04 Stefan Richter
2006-10-30 9:02 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Richter @ 2006-10-29 21:04 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel
Fix warning
arch/i386/kernel/io_apic.c: In function `create_irq':
arch/i386/kernel/io_apic.c:2420: warning: 'vector' might be used uninitialized in this function
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
Only compile-tested.
arch/x86_64/kernel/io_apic.c seems to have the same initialization already.
Index: linux-2.6.19-rc3/arch/i386/kernel/io_apic.c
===================================================================
--- linux-2.6.19-rc3.orig/arch/i386/kernel/io_apic.c 2006-10-29 20:41:20.000000000 +0100
+++ linux-2.6.19-rc3/arch/i386/kernel/io_apic.c 2006-10-29 21:55:19.000000000 +0100
@@ -2421,6 +2421,7 @@ int create_irq(void)
unsigned long flags;
irq = -ENOSPC;
+ vector = 0;
spin_lock_irqsave(&vector_lock, flags);
for (new = (NR_IRQS - 1); new >= 0; new--) {
if (platform_legacy_irq(new))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
2006-10-29 21:04 [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq Stefan Richter
@ 2006-10-30 9:02 ` Ingo Molnar
2006-10-31 1:04 ` Andrew Morton
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2006-10-30 9:02 UTC (permalink / raw)
To: Stefan Richter; +Cc: Ingo Molnar, linux-kernel
* Stefan Richter <stefanr@s5r6.in-berlin.de> wrote:
> Fix warning
> arch/i386/kernel/io_apic.c: In function `create_irq':
> arch/i386/kernel/io_apic.c:2420: warning: 'vector' might be used uninitialized in this function
> @@ -2421,6 +2421,7 @@ int create_irq(void)
> unsigned long flags;
>
> irq = -ENOSPC;
> + vector = 0;
NAK - the code is fine, and this is fixed in Jeff's gcc-warnings tree
via annotation.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
2006-10-30 9:02 ` Ingo Molnar
@ 2006-10-31 1:04 ` Andrew Morton
2006-10-31 9:37 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2006-10-31 1:04 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Stefan Richter, Ingo Molnar, linux-kernel
On Mon, 30 Oct 2006 10:02:31 +0100
Ingo Molnar <mingo@elte.hu> wrote:
> * Stefan Richter <stefanr@s5r6.in-berlin.de> wrote:
>
> > Fix warning
> > arch/i386/kernel/io_apic.c: In function `create_irq':
> > arch/i386/kernel/io_apic.c:2420: warning: 'vector' might be used uninitialized in this function
>
> > @@ -2421,6 +2421,7 @@ int create_irq(void)
> > unsigned long flags;
> >
> > irq = -ENOSPC;
> > + vector = 0;
>
> NAK - the code is fine, and this is fixed in Jeff's gcc-warnings tree
> via annotation.
err, what gcc-warnings tree?
git+ssh://master.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git#gccbug
just does lots of initialise-to-zero thingies, doesn't have any special
annotation and doesn't fix io_apic.c.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
2006-10-31 1:04 ` Andrew Morton
@ 2006-10-31 9:37 ` Ingo Molnar
2006-10-31 9:49 ` Andrew Morton
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2006-10-31 9:37 UTC (permalink / raw)
To: Andrew Morton; +Cc: Ingo Molnar, Stefan Richter, linux-kernel
On Mon, 2006-10-30 at 17:04 -0800, Andrew Morton wrote:
> > > irq = -ENOSPC;
> > > + vector = 0;
> >
> > NAK - the code is fine, and this is fixed in Jeff's gcc-warnings
> tree
> > via annotation.
>
> err, what gcc-warnings tree?
>
> git
> +ssh://master.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git#gccbug
> just does lots of initialise-to-zero thingies, doesn't have any
> special
> annotation and doesn't fix io_apic.c.
this is an initialize-to-zero annotation for a false-positive gcc
warning. If it's not in Jeff tree yet then it should be there ...
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
2006-10-31 9:37 ` Ingo Molnar
@ 2006-10-31 9:49 ` Andrew Morton
2006-10-31 11:15 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2006-10-31 9:49 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Ingo Molnar, Stefan Richter, linux-kernel
On Tue, 31 Oct 2006 10:37:37 +0100
Ingo Molnar <mingo@redhat.com> wrote:
> On Mon, 2006-10-30 at 17:04 -0800, Andrew Morton wrote:
> > > > irq = -ENOSPC;
> > > > + vector = 0;
> > >
> > > NAK - the code is fine, and this is fixed in Jeff's gcc-warnings
> > tree
> > > via annotation.
> >
> > err, what gcc-warnings tree?
> >
> > git
> > +ssh://master.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git#gccbug
> > just does lots of initialise-to-zero thingies, doesn't have any
> > special
> > annotation and doesn't fix io_apic.c.
>
> this is an initialize-to-zero annotation for a false-positive gcc
> warning. If it's not in Jeff tree yet then it should be there ...
>
hm, I wouldn't call that "annotation".
Now, the
#define SHUT_GCC_UP(x) = x
...
int foo SHUT_GCC_UP(foo);
...
(or whatever it was) trick was "annotation". A good way of doing it too, IMO.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
2006-10-31 9:49 ` Andrew Morton
@ 2006-10-31 11:15 ` Ingo Molnar
2006-10-31 19:09 ` Adrian Bunk
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2006-10-31 11:15 UTC (permalink / raw)
To: Andrew Morton; +Cc: Ingo Molnar, Stefan Richter, linux-kernel
* Andrew Morton <akpm@osdl.org> wrote:
> > this is an initialize-to-zero annotation for a false-positive gcc
> > warning. If it's not in Jeff tree yet then it should be there ...
>
> hm, I wouldn't call that "annotation".
>
> Now, the
>
> #define SHUT_GCC_UP(x) = x
>
> ...
> int foo SHUT_GCC_UP(foo);
> ...
>
> (or whatever it was) trick was "annotation". A good way of doing it
> too, IMO.
hm, i thought Jeff's tree was doing that ...
we definitely do not want to hide these places. They both make the code
less readable (why initialize it to some value if that value is never
used) and they hide the problem from the GCC folks too.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
2006-10-31 11:15 ` Ingo Molnar
@ 2006-10-31 19:09 ` Adrian Bunk
2006-11-09 10:31 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Adrian Bunk @ 2006-10-31 19:09 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andrew Morton, Ingo Molnar, Stefan Richter, linux-kernel
On Tue, Oct 31, 2006 at 12:15:02PM +0100, Ingo Molnar wrote:
>...
> we definitely do not want to hide these places. They both make the code
> less readable (why initialize it to some value if that value is never
> used) and they hide the problem from the GCC folks too.
What about cases where it's technically impossible for gcc to ever see
that a variable actually gets initialized?
> Ingo
cu
Adrian
--
"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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq
2006-10-31 19:09 ` Adrian Bunk
@ 2006-11-09 10:31 ` Ingo Molnar
0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2006-11-09 10:31 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Andrew Morton, Ingo Molnar, Stefan Richter, linux-kernel
* Adrian Bunk <bunk@stusta.de> wrote:
> On Tue, Oct 31, 2006 at 12:15:02PM +0100, Ingo Molnar wrote:
> >...
> > we definitely do not want to hide these places. They both make the
> > code less readable (why initialize it to some value if that value is
> > never used) and they hide the problem from the GCC folks too.
>
> What about cases where it's technically impossible for gcc to ever see
> that a variable actually gets initialized?
we should mark them as such or even initialize them outright. But these
are the exception.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-11-09 10:33 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-29 21:04 [PATCH 2.6.19-rc3] i386/io_apic: fix compiler warning in create_irq Stefan Richter
2006-10-30 9:02 ` Ingo Molnar
2006-10-31 1:04 ` Andrew Morton
2006-10-31 9:37 ` Ingo Molnar
2006-10-31 9:49 ` Andrew Morton
2006-10-31 11:15 ` Ingo Molnar
2006-10-31 19:09 ` Adrian Bunk
2006-11-09 10:31 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox