* [PATCH] kconfig: add comment about 'jump maybe used unitialized'
@ 2013-11-18 21:03 Yann E. MORIN
2013-11-19 6:20 ` Christian Kujau
2013-11-19 7:27 ` Madhavan Srinivasan
0 siblings, 2 replies; 5+ messages in thread
From: Yann E. MORIN @ 2013-11-18 21:03 UTC (permalink / raw)
To: linux-kbuild
Cc: Madhavan Srinivasan, Christian Kujau, Yann E. MORIN,
Benjamin Poirier
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
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@linux.vnet.ibm.com>
Reported-by: Christian Kujau <lists@nerdbynature.de>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Benjamin Poirier <bpoirier@suse.de>
---
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.
---
| 7 +++++++
1 file changed, 7 insertions(+)
--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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] kconfig: add comment about 'jump maybe used unitialized'
2013-11-18 21:03 [PATCH] kconfig: add comment about 'jump maybe used unitialized' Yann E. MORIN
@ 2013-11-19 6:20 ` Christian Kujau
2013-11-19 7:27 ` Madhavan Srinivasan
1 sibling, 0 replies; 5+ messages in thread
From: Christian Kujau @ 2013-11-19 6:20 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: linux-kbuild, Madhavan Srinivasan, Benjamin Poirier
On Mon, 18 Nov 2013 at 22:03, Yann E. MORIN wrote:
> 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.
In my case it's gcc-4.7 from Debian/wheezy (powerpc):
$ gcc --version | head -1
gcc (Debian 4.7.2-5) 4.7.2
Christian.
--
BOFH excuse #34:
(l)user error
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kconfig: add comment about 'jump maybe used unitialized'
2013-11-18 21:03 [PATCH] kconfig: add comment about 'jump maybe used unitialized' Yann E. MORIN
2013-11-19 6:20 ` Christian Kujau
@ 2013-11-19 7:27 ` Madhavan Srinivasan
2013-11-19 10:13 ` Michal Marek
1 sibling, 1 reply; 5+ messages in thread
From: Madhavan Srinivasan @ 2013-11-19 7:27 UTC (permalink / raw)
To: Yann E. MORIN, linux-kbuild; +Cc: Christian Kujau, Benjamin Poirier
On Tuesday 19 November 2013 02:33 AM, Yann E. MORIN wrote:
>
> 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.
When I initially reported this issue, it was in gcc version 4.8.0
20130526. And I am trying this now in a beta release of RHEL7 with gcc
version 4.8.1 20131002 (Red Hat 4.8.1-11) (GCC) and I still see the
reported issue.
--Maddy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kconfig: add comment about 'jump maybe used unitialized'
2013-11-19 7:27 ` Madhavan Srinivasan
@ 2013-11-19 10:13 ` Michal Marek
2013-11-19 16:10 ` Benjamin Poirier
0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2013-11-19 10:13 UTC (permalink / raw)
To: Yann E. MORIN
Cc: Madhavan Srinivasan, linux-kbuild, Christian Kujau,
Benjamin Poirier
On 19.11.2013 08:27, Madhavan Srinivasan wrote:
> On Tuesday 19 November 2013 02:33 AM, Yann E. MORIN wrote:
>>
>> 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.
>
> When I initially reported this issue, it was in gcc version 4.8.0
> 20130526. And I am trying this now in a beta release of RHEL7 with gcc
> version 4.8.1 20131002 (Red Hat 4.8.1-11) (GCC) and I still see the
> reported issue.
In that case, I'd just give up and initialize jump to NULL. Worst case,
we will get a segfault at runtime if a genuine bug is introduced into
the function. What do you think?
Michal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kconfig: add comment about 'jump maybe used unitialized'
2013-11-19 10:13 ` Michal Marek
@ 2013-11-19 16:10 ` Benjamin Poirier
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Poirier @ 2013-11-19 16:10 UTC (permalink / raw)
To: Michal Marek
Cc: Yann E. MORIN, Madhavan Srinivasan, linux-kbuild, Christian Kujau
On 2013/11/19 11:13, Michal Marek wrote:
> On 19.11.2013 08:27, Madhavan Srinivasan wrote:
> > On Tuesday 19 November 2013 02:33 AM, Yann E. MORIN wrote:
> >>
> >> 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.
> >
> > When I initially reported this issue, it was in gcc version 4.8.0
> > 20130526. And I am trying this now in a beta release of RHEL7 with gcc
> > version 4.8.1 20131002 (Red Hat 4.8.1-11) (GCC) and I still see the
> > reported issue.
>
> In that case, I'd just give up and initialize jump to NULL. Worst case,
> we will get a segfault at runtime if a genuine bug is introduced into
> the function. What do you think?
I've tried it again on openSUSE 13.1 which has
gcc (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388]
and I don't see the warning. I may be missing something because I've
also tried on Debian Wheezy (as reported by Christian Kujau) but I don't
see a warning either. It was on x86 however, not ppc.
In any case, given that it's been reported a few times I agree with
Michal and I'd do something like this:
- struct jump_key *jump;
+ /* Initialize jump to work around a spurious warning emitted by
+ * certain versions of gcc */
+ struct jump_key *jump = NULL;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-19 16:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18 21:03 [PATCH] kconfig: add comment about 'jump maybe used unitialized' Yann E. MORIN
2013-11-19 6:20 ` Christian Kujau
2013-11-19 7:27 ` Madhavan Srinivasan
2013-11-19 10:13 ` Michal Marek
2013-11-19 16:10 ` Benjamin Poirier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox