[PATCH] kconfig: add comment about 'jump maybe used unitialized'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Yann E. MORIN" <yann.morin.1998@xxxxxxx>

On some distros shipping gcc 4.8.0 20130526 (as reported by Madhavan),
gcc incorrectly warns about 'jump may be used uninitialized'.

Given the current code path, this is not possible.

gcc 4.6.x, 4.7.x and 4.81+ do not emit this warning.

So, we consider this as a spurious error from the gcc 4.8.0 that is
shipped on a specific (unidentifed so far) distro.

But since two users have reported this issue, lets comment the 'jump'
declaration that it should *not* be initialised, since we will still
want to catch unitialised use in the future, should we were to change
the code.

Reported-by: Madhavan Srinivasan <maddy@xxxxxxxxxxxxxxxxxx>
Reported-by: Christian Kujau <lists@xxxxxxxxxxxxxxx>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@xxxxxxx>
Cc: Benjamin Poirier <bpoirier@xxxxxxx>

---
All,

Here is the patch I'm queuing to 'solve' this issue.
I'll wait a bit for some feedback before I push it.

Madhavan, Christian, if you could give a bit ;ore details on the distro
you're using, that be nice so we can have a more descriptive commit log.

Regards,
Yann E. MORIN.

---
 scripts/kconfig/menu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index c1d5320..a7b0566 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -544,6 +544,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
 {
 	int i, j;
 	struct menu *submenu[8], *menu, *location = NULL;
+	/* gcc 4.8.0 on (on some distros) warns about 'jump may be used
+	   uninitialized', which is wrong, given the current code-path.
+	   The warning does not appear with gcc != 4.8.0.
+	   If we were to change the code below, we would still want gcc to
+	   warn if jump is unitialised, so we explicitly do *not* initialise
+	   it here.
+	 */
 	struct jump_key *jump;
 
 	str_printf(r, _("Prompt: %s\n"), _(prop->text));
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux