Messages in this thread | | | Date | Fri, 6 Jan 2006 19:41:45 +0100 | From | Jesper Juhl <> | Subject | Re: [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/
| |