lkml.org 
[lkml]   [2006]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] bio: gcc warning fix.
On 1/6/06, Khushil Dep <khushil.dep@help.basilica.co.uk> wrote:
> I wonder however whether this is not correct? I was always taught to
> initialise variables so there is no doubt as to their starting value?
>
There is no doubt, the idx variable is used on the very next line,
it's address is being passed to bvec_alloc_bs() which as the very
first thing it does fills in a value or returns NULL (in which case
idx is undefined anyway).

So there's no doubt at all that idx will always get a value assigned to it.

gcc is right to warn in the sense that it doesn't know if
bvec_alloc_bs() will read or write into idx when its address is passed
to it. But since we know that bvec_alloc_bs() only reads from it after
having assigned a value we know that gcc's warning is wrong, idx can
never *actually* be used uninitialized.

--
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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-06 19:44    [W:0.064 / U:1.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site