* [PATCH] kconfig: plug false-positive warning in get_prompt_str() seen with gcc-4.9
@ 2014-05-25 16:47 Konstantin Khlebnikov
2014-05-25 23:18 ` Kirill A. Shutemov
2014-06-23 5:48 ` Uwe Kleine-König
0 siblings, 2 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2014-05-25 16:47 UTC (permalink / raw)
To: Yann E. MORIN, linux-kbuild; +Cc: linux-kernel
scripts/kconfig/menu.c: In function ‘get_symbol_str’:
scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
jump->offset = strlen(r->s);
^
scripts/kconfig/menu.c:551:19: note: ‘jump’ was declared here
struct jump_key *jump;
^
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 3ac2c9c..5cd0f5e 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -548,7 +548,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
{
int i, j;
struct menu *submenu[8], *menu, *location = NULL;
- struct jump_key *jump;
+ struct jump_key *jump = NULL;
str_printf(r, _("Prompt: %s\n"), _(prop->text));
menu = prop->menu->parent;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kconfig: plug false-positive warning in get_prompt_str() seen with gcc-4.9
2014-05-25 16:47 [PATCH] kconfig: plug false-positive warning in get_prompt_str() seen with gcc-4.9 Konstantin Khlebnikov
@ 2014-05-25 23:18 ` Kirill A. Shutemov
2014-06-23 5:48 ` Uwe Kleine-König
1 sibling, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2014-05-25 23:18 UTC (permalink / raw)
To: Konstantin Khlebnikov; +Cc: Yann E. MORIN, linux-kbuild, linux-kernel
On Sun, May 25, 2014 at 08:47:51PM +0400, Konstantin Khlebnikov wrote:
> scripts/kconfig/menu.c: In function ‘get_symbol_str’:
> scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> jump->offset = strlen(r->s);
> ^
BTW, why do we need strlen() there? what's wrong with r->len?
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kconfig: plug false-positive warning in get_prompt_str() seen with gcc-4.9
2014-05-25 16:47 [PATCH] kconfig: plug false-positive warning in get_prompt_str() seen with gcc-4.9 Konstantin Khlebnikov
2014-05-25 23:18 ` Kirill A. Shutemov
@ 2014-06-23 5:48 ` Uwe Kleine-König
2014-06-23 9:29 ` David Rientjes
1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2014-06-23 5:48 UTC (permalink / raw)
To: Konstantin Khlebnikov; +Cc: Yann E. MORIN, linux-kbuild, linux-kernel
Hello,
On Sun, May 25, 2014 at 08:47:51PM +0400, Konstantin Khlebnikov wrote:
> scripts/kconfig/menu.c: In function ‘get_symbol_str’:
> scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> jump->offset = strlen(r->s);
> ^
> scripts/kconfig/menu.c:551:19: note: ‘jump’ was declared here
> struct jump_key *jump;
> ^
I'm seeing that problem with a 4.8.2 toolchain on next-20140623 with
ARCH=arm, too.
Maybe better use uninitialized_var? And point out the commit that
introduced the issue please.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kconfig: plug false-positive warning in get_prompt_str() seen with gcc-4.9
2014-06-23 5:48 ` Uwe Kleine-König
@ 2014-06-23 9:29 ` David Rientjes
0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2014-06-23 9:29 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Konstantin Khlebnikov, Yann E. MORIN, linux-kbuild, linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 868 bytes --]
On Mon, 23 Jun 2014, Uwe Kleine-König wrote:
> > scripts/kconfig/menu.c: In function ‘get_symbol_str’:
> > scripts/kconfig/menu.c:590:18: warning: ‘jump’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> > jump->offset = strlen(r->s);
> > ^
> > scripts/kconfig/menu.c:551:19: note: ‘jump’ was declared here
> > struct jump_key *jump;
> > ^
>
> I'm seeing that problem with a 4.8.2 toolchain on next-20140623 with
> ARCH=arm, too.
>
> Maybe better use uninitialized_var? And point out the commit that
> introduced the issue please.
>
If the compiler can't figure out if a variable is always intialized before
its referenced, then it indicates the code is poorly written and isn't
clear to the code reader either. uninitialized_var() would be a lazy way
to solve this particular issue.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-23 9:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-25 16:47 [PATCH] kconfig: plug false-positive warning in get_prompt_str() seen with gcc-4.9 Konstantin Khlebnikov
2014-05-25 23:18 ` Kirill A. Shutemov
2014-06-23 5:48 ` Uwe Kleine-König
2014-06-23 9:29 ` David Rientjes
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.