mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan
       [not found] <200602261639.15657.jesper.juhl@gmail.com>
@ 2006-02-26 18:21 ` James Bottomley
  2006-02-26 18:23   ` Jesper Juhl
  0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2006-02-26 18:21 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, Eric Youngdale, Eric Youngdale, linux-scsi

On Sun, 2006-02-26 at 16:39 +0100, Jesper Juhl wrote:
> Gcc can't see that 'result' will always be initialized inside the for loop
> and thus it warns
>   drivers/scsi/scsi_scan.c:445: warning: 'result' might be used uninitialized in this function
> This patch silences the warning by initializing 'result' to zero.

Really, this is a gcc bug.  My version of the compiler:

gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)

Doesn't give this warning.  And, since the loop has fixed parameters,
gcc should see not only that it's always executed, but that it could be
unrolled.

Which version is causing the problem?

James



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan
  2006-02-26 18:21 ` [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan James Bottomley
@ 2006-02-26 18:23   ` Jesper Juhl
  2006-02-26 18:59     ` James Bottomley
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2006-02-26 18:23 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-kernel, Eric Youngdale, Eric Youngdale, linux-scsi

On 2/26/06, James Bottomley <James.Bottomley@steeleye.com> wrote:
> On Sun, 2006-02-26 at 16:39 +0100, Jesper Juhl wrote:
> > Gcc can't see that 'result' will always be initialized inside the for loop
> > and thus it warns
> >   drivers/scsi/scsi_scan.c:445: warning: 'result' might be used uninitialized in this function
> > This patch silences the warning by initializing 'result' to zero.
>
> Really, this is a gcc bug.  My version of the compiler:
>
> gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
>
> Doesn't give this warning.  And, since the loop has fixed parameters,
> gcc should see not only that it's always executed, but that it could be
> unrolled.
>
> Which version is causing the problem?
>
2.6.16-rc4-mm2 build with gcc 3.4.5

and I agree that gcc really should be noticing, but in fact it
doesn't. It's no big deal, I just thought we might want to shut gcc up
and give people one less warning to worry about.

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan
  2006-02-26 18:23   ` Jesper Juhl
@ 2006-02-26 18:59     ` James Bottomley
  2006-02-26 19:01       ` Jesper Juhl
  0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2006-02-26 18:59 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, Eric Youngdale, Eric Youngdale, linux-scsi

On Sun, 2006-02-26 at 19:23 +0100, Jesper Juhl wrote:
> > gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
> >
> > Doesn't give this warning.  And, since the loop has fixed parameters,
> > gcc should see not only that it's always executed, but that it could be
> > unrolled.
> >
> > Which version is causing the problem?
> >
> 2.6.16-rc4-mm2 build with gcc 3.4.5

I also tried with

gcc version 3.3.5 (Debian 1:3.3.5-13)

which likewise fails to give this warning, so I really think this is a
bug in your particular version of gcc.

James


> and I agree that gcc really should be noticing, but in fact it
> doesn't. It's no big deal, I just thought we might want to shut gcc up
> and give people one less warning to worry about.
> 
> --
> Jesper Juhl <jesper.juhl@gmail.com>
> Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please      http://www.expita.com/nomime.html
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan
  2006-02-26 18:59     ` James Bottomley
@ 2006-02-26 19:01       ` Jesper Juhl
  2006-02-26 19:21         ` James Bottomley
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2006-02-26 19:01 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-kernel, Eric Youngdale, Eric Youngdale, linux-scsi

On 2/26/06, James Bottomley <James.Bottomley@steeleye.com> wrote:
> On Sun, 2006-02-26 at 19:23 +0100, Jesper Juhl wrote:
> > > gcc version 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
> > >
> > > Doesn't give this warning.  And, since the loop has fixed parameters,
> > > gcc should see not only that it's always executed, but that it could be
> > > unrolled.
> > >
> > > Which version is causing the problem?
> > >
> > 2.6.16-rc4-mm2 build with gcc 3.4.5
>
> I also tried with
>
> gcc version 3.3.5 (Debian 1:3.3.5-13)
>
> which likewise fails to give this warning, so I really think this is a
> bug in your particular version of gcc.
>

Hmm, it's quite reproducible and the gcc 3.4.5 I have here is not
patched by the distribution (Slackware). If you want I can send you
the .config that results in the warning..

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan
  2006-02-26 19:01       ` Jesper Juhl
@ 2006-02-26 19:21         ` James Bottomley
  2006-02-26 20:41           ` Jesper Juhl
  0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2006-02-26 19:21 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, Eric Youngdale, linux-scsi

On Sun, 2006-02-26 at 20:01 +0100, Jesper Juhl wrote:
> Hmm, it's quite reproducible and the gcc 3.4.5 I have here is not
> patched by the distribution (Slackware). If you want I can send you
> the .config that results in the warning..

I really don't think it's a config issue.  scsi_probe_lun() is always
compiled in if CONFIG_SCSI is set.  I think you have a compiler problem.

James



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan
  2006-02-26 19:21         ` James Bottomley
@ 2006-02-26 20:41           ` Jesper Juhl
  0 siblings, 0 replies; 6+ messages in thread
From: Jesper Juhl @ 2006-02-26 20:41 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-kernel, Eric Youngdale, linux-scsi

On 2/26/06, James Bottomley <James.Bottomley@steeleye.com> wrote:
> On Sun, 2006-02-26 at 20:01 +0100, Jesper Juhl wrote:
> > Hmm, it's quite reproducible and the gcc 3.4.5 I have here is not
> > patched by the distribution (Slackware). If you want I can send you
> > the .config that results in the warning..
>
> I really don't think it's a config issue.  scsi_probe_lun() is always
> compiled in if CONFIG_SCSI is set.  I think you have a compiler problem.
>

I must admit I think the compiler is OK.
I have two different boxes with gcc 3.4.5 and they both give the same
warning (not to mention that that gcc builds everything I've thrown at
it correctly).
But nevermind, it's just a silly little warning - just leave it be.

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-26 20:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200602261639.15657.jesper.juhl@gmail.com>
2006-02-26 18:21 ` [PATCH] silence gcc warning about possibly uninitialized use of variable in scsi_scan James Bottomley
2006-02-26 18:23   ` Jesper Juhl
2006-02-26 18:59     ` James Bottomley
2006-02-26 19:01       ` Jesper Juhl
2006-02-26 19:21         ` James Bottomley
2006-02-26 20:41           ` Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®