* Question on compiler warning
@ 2013-12-31 1:24 Larry Finger
2013-12-31 9:36 ` Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Larry Finger @ 2013-12-31 1:24 UTC (permalink / raw)
To: linux-wireless; +Cc: Geert Uytterhoeven, LKML
In his regular article entitled Build regressions/improvements in v3.13-rc6"
(http://lkml.indiana.edu/hypermail/linux/kernel/1312.3/01550.html), Geert
Uytterhoeven reports the following warning regression:
+ /scratch/kisskb/src/drivers/net/wireless/b43/phy_n.c: warning: 'val_addr' may
be used uninitialized in this function [-Wuninitialized]: => 178:21
This warning does not show up on any of my compilers, and it should not as the
initialization and usage of that variable both take place in conditional
branches that are testing exactly the same pointer.
Despite the fact that the warning is bogus, should a patch be submitted to clear
it? I lean toward "no" as an answer because that would mask the warning if there
were some future change that screwed up the flow; however, I wanted to check
with the community.
Larry
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Question on compiler warning
2013-12-31 1:24 Question on compiler warning Larry Finger
@ 2013-12-31 9:36 ` Geert Uytterhoeven
2013-12-31 10:56 ` Mark Cave-Ayland
2014-01-02 21:56 ` David Rientjes
2 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2013-12-31 9:36 UTC (permalink / raw)
To: Larry Finger; +Cc: linux-wireless, LKML
On Tue, Dec 31, 2013 at 2:24 AM, Larry Finger <Larry.Finger@lwfinger.net> wrote:
> In his regular article entitled Build regressions/improvements in v3.13-rc6"
> (http://lkml.indiana.edu/hypermail/linux/kernel/1312.3/01550.html), Geert
> Uytterhoeven reports the following warning regression:
>
> + /scratch/kisskb/src/drivers/net/wireless/b43/phy_n.c: warning: 'val_addr'
> may be used uninitialized in this function [-Wuninitialized]: => 178:21
>
> This warning does not show up on any of my compilers, and it should not as
> the initialization and usage of that variable both take place in conditional
> branches that are testing exactly the same pointer.
It depends on the compiler version. Some versions of gcc are not smart enough
to notice all usage sites depends on the same condition.
> Despite the fact that the warning is bogus, should a patch be submitted to
> clear it? I lean toward "no" as an answer because that would mask the
> warning if there were some future change that screwed up the flow; however,
> I wanted to check with the community.
If it's clearly bogus, there's no reason to submit a patch.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Question on compiler warning
2013-12-31 1:24 Question on compiler warning Larry Finger
2013-12-31 9:36 ` Geert Uytterhoeven
@ 2013-12-31 10:56 ` Mark Cave-Ayland
2013-12-31 19:28 ` Larry Finger
2014-01-02 21:56 ` David Rientjes
2 siblings, 1 reply; 7+ messages in thread
From: Mark Cave-Ayland @ 2013-12-31 10:56 UTC (permalink / raw)
To: Larry Finger; +Cc: linux-wireless, Geert Uytterhoeven, LKML
On 31/12/13 01:24, Larry Finger wrote:
> In his regular article entitled Build regressions/improvements in
> v3.13-rc6"
> (http://lkml.indiana.edu/hypermail/linux/kernel/1312.3/01550.html),
> Geert Uytterhoeven reports the following warning regression:
>
> + /scratch/kisskb/src/drivers/net/wireless/b43/phy_n.c: warning:
> 'val_addr' may be used uninitialized in this function [-Wuninitialized]:
> => 178:21
>
> This warning does not show up on any of my compilers, and it should not
> as the initialization and usage of that variable both take place in
> conditional branches that are testing exactly the same pointer.
Hi Larry,
Could it be that you don't see the issue the locally because you've got
different compiler optimisation settings? I've seen a similar bug
recently on another project where the "may be used uninitialized"
warning appears with -O0 and -O1 but magically disappears with the
default -O2 setting (presumably because the optimiser performs some kind
of inlining/reordering that makes the issue go away).
HTH,
Mark.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Question on compiler warning
2013-12-31 10:56 ` Mark Cave-Ayland
@ 2013-12-31 19:28 ` Larry Finger
0 siblings, 0 replies; 7+ messages in thread
From: Larry Finger @ 2013-12-31 19:28 UTC (permalink / raw)
To: Mark Cave-Ayland; +Cc: linux-wireless, Geert Uytterhoeven, LKML
On 12/31/2013 04:56 AM, Mark Cave-Ayland wrote:
> Hi Larry,
>
> Could it be that you don't see the issue the locally because you've got
> different compiler optimisation settings? I've seen a similar bug recently on
> another project where the "may be used uninitialized" warning appears with -O0
> and -O1 but magically disappears with the default -O2 setting (presumably
> because the optimiser performs some kind of inlining/reordering that makes the
> issue go away).
Mark,
It is possible. Certainly, a higher optimization level will force the compiler
to do a better job of flow analysis. I am using -O2, which is the standard in
the kernel makefile. I would expect that Geert is also using the same lever, but
perhaps not.
Larry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Question on compiler warning
2013-12-31 1:24 Question on compiler warning Larry Finger
2013-12-31 9:36 ` Geert Uytterhoeven
2013-12-31 10:56 ` Mark Cave-Ayland
@ 2014-01-02 21:56 ` David Rientjes
2014-01-02 22:14 ` Larry Finger
2 siblings, 1 reply; 7+ messages in thread
From: David Rientjes @ 2014-01-02 21:56 UTC (permalink / raw)
To: Larry Finger; +Cc: Geert Uytterhoeven, linux-wireless, linux-kernel
On Mon, 30 Dec 2013, Larry Finger wrote:
> + /scratch/kisskb/src/drivers/net/wireless/b43/phy_n.c: warning: 'val_addr'
> may be used uninitialized in this function [-Wuninitialized]: => 178:21
>
> This warning does not show up on any of my compilers, and it should not as the
> initialization and usage of that variable both take place in conditional
> branches that are testing exactly the same pointer.
>
You may not be compiling this file depending on your .config or you may
have a different setting for CONFIG_CC_OPTIMIZE_FOR_SIZE.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Question on compiler warning
2014-01-02 21:56 ` David Rientjes
@ 2014-01-02 22:14 ` Larry Finger
2014-01-02 23:40 ` David Rientjes
0 siblings, 1 reply; 7+ messages in thread
From: Larry Finger @ 2014-01-02 22:14 UTC (permalink / raw)
To: David Rientjes; +Cc: Geert Uytterhoeven, linux-wireless, linux-kernel
On 01/02/2014 03:56 PM, David Rientjes wrote:
> On Mon, 30 Dec 2013, Larry Finger wrote:
>
>> + /scratch/kisskb/src/drivers/net/wireless/b43/phy_n.c: warning: 'val_addr'
>> may be used uninitialized in this function [-Wuninitialized]: => 178:21
>>
>> This warning does not show up on any of my compilers, and it should not as the
>> initialization and usage of that variable both take place in conditional
>> branches that are testing exactly the same pointer.
>>
>
> You may not be compiling this file depending on your .config or you may
> have a different setting for CONFIG_CC_OPTIMIZE_FOR_SIZE.
I am definitely building this driver in my configuration. Variable
CONFIG_CC_OPTIMIZE_FOR_SIZE was not set, but changing it to "y" did not change
the result.
Thanks,
Larry
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-01-02 23:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-31 1:24 Question on compiler warning Larry Finger
2013-12-31 9:36 ` Geert Uytterhoeven
2013-12-31 10:56 ` Mark Cave-Ayland
2013-12-31 19:28 ` Larry Finger
2014-01-02 21:56 ` David Rientjes
2014-01-02 22:14 ` Larry Finger
2014-01-02 23:40 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).