All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] Fix gcc4 warning,
Date: Sun, 22 May 2005 09:25:13 +0000	[thread overview]
Message-ID: <200505221125.13999.arnd@arndb.de> (raw)
In-Reply-To: <428E3224.8030307@cs.pdx.edu>

On Freedag 20 Mai 2005 21:51, Jesse Millan wrote:
> 
> So, the compiler should be able to tell that either one of the two cases
> apply?
> 
> a: an assignment statement will be done on idx before its ever read
> 
> or
> 
> b: no assignment statement, control flow will never allow idx to be read

gcc is normally pretty good at detecting this. Since gcc-4.0, it 
appears to do more checking inside inline functions, where older
versions just assumed that a variable is initialized after a reference
to it is passed to an inline function.

I'd suggest fixing the inline function to always do this instead of
fixing the caller. After all, this needs to be fixed in the kernel,
even if future gcc versions become smarter about it gcc-4.0 will
continue to be used.

	Arnd <><

--- a/fs/bio.c	2005-03-29 03:42:37 +02:00
+++ b/fs/bio.c	2005-05-22 11:22:17 +02:00
@@ -90,6 +90,7 @@
 		case  65 ... 128: *idx = 4; break;
 		case 129 ... BIO_MAX_PAGES: *idx = 5; break;
 		default:
+			*idx = 0;
 			return NULL;
 	}
 	/*
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2005-05-22  9:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-20 18:53 [KJ] [PATCH] Fix gcc4 warning, Jesse Millan
2005-05-20 19:41 ` Alexey Dobriyan
2005-05-22  9:25 ` Arnd Bergmann [this message]
2005-05-23  1:05 ` Arnd Bergmann
2005-05-24  4:52 ` Jesse Millan
2005-05-24  4:56 ` Jesse Millan
2005-05-25  6:09 ` Jesse Millan
2005-05-25 22:41 ` Jesse Millan
2005-05-26 21:07 ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200505221125.13999.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.