kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [next:akpm 234/309] lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'lo
@ 2012-07-24  0:57 Michel Lespinasse
  2012-07-24  1:14 ` Andrew Morton
  2012-07-24  4:03 ` Fengguang Wu
  0 siblings, 2 replies; 3+ messages in thread
From: Michel Lespinasse @ 2012-07-24  0:57 UTC (permalink / raw)
  To: kernel-janitors

On Sun, Jul 22, 2012 at 11:50 PM, Fengguang Wu <fengguang.wu@intel.com> wrote:
> lib/rbtree_test.c: In function 'rbtree_test_init':
> lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'cycles_t' [-Wformat]
> lib/rbtree_test.c: In function 'check':
> lib/rbtree_test.c:76:4: warning: 'blacks' may be used uninitialized in this function [-Wuninitialized]

Andrew added a cast for the format issue.

Regarding the uninitialized 'blacks' value, gcc is actually wrong
about it (it will always be initialized on the first loop iteration),
but we should probably add = 0 on the variable declaration to make gcc
happy. Andrew, do you want an additional patch for it, or should I
send you a replacement patch (same as before + that fix) ?

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [next:akpm 234/309] lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'lo
  2012-07-24  0:57 [next:akpm 234/309] lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'lo Michel Lespinasse
@ 2012-07-24  1:14 ` Andrew Morton
  2012-07-24  4:03 ` Fengguang Wu
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2012-07-24  1:14 UTC (permalink / raw)
  To: kernel-janitors

On Mon, 23 Jul 2012 17:57:26 -0700 Michel Lespinasse <walken@google.com> wrote:

> On Sun, Jul 22, 2012 at 11:50 PM, Fengguang Wu <fengguang.wu@intel.com> wrote:
> > lib/rbtree_test.c: In function 'rbtree_test_init':
> > lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'cycles_t' [-Wformat]
> > lib/rbtree_test.c: In function 'check':
> > lib/rbtree_test.c:76:4: warning: 'blacks' may be used uninitialized in this function [-Wuninitialized]
> 
> Andrew added a cast for the format issue.
> 
> Regarding the uninitialized 'blacks' value, gcc is actually wrong
> about it (it will always be initialized on the first loop iteration),
> but we should probably add = 0 on the variable declaration to make gcc
> happy.

We should use uninitialized_var() if we're going to do that.  Because
that avoids adding unneeded instructions and is self-documenting.

I saw that warning but assumed that later gcc's didn't emit it.  If
that was wrong then yes, we should fix it.

> Andrew, do you want an additional patch for it, or should I
> send you a replacement patch (same as before + that fix) ?

Incremental patches are preferred please.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [next:akpm 234/309] lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'lo
  2012-07-24  0:57 [next:akpm 234/309] lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'lo Michel Lespinasse
  2012-07-24  1:14 ` Andrew Morton
@ 2012-07-24  4:03 ` Fengguang Wu
  1 sibling, 0 replies; 3+ messages in thread
From: Fengguang Wu @ 2012-07-24  4:03 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Jul 23, 2012 at 06:14:42PM -0700, Andrew Morton wrote:
> On Mon, 23 Jul 2012 17:57:26 -0700 Michel Lespinasse <walken@google.com> wrote:
> 
> > On Sun, Jul 22, 2012 at 11:50 PM, Fengguang Wu <fengguang.wu@intel.com> wrote:
> > > lib/rbtree_test.c: In function 'rbtree_test_init':
> > > lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'cycles_t' [-Wformat]
> > > lib/rbtree_test.c: In function 'check':
> > > lib/rbtree_test.c:76:4: warning: 'blacks' may be used uninitialized in this function [-Wuninitialized]
> > 
> > Andrew added a cast for the format issue.
> > 
> > Regarding the uninitialized 'blacks' value, gcc is actually wrong
> > about it (it will always be initialized on the first loop iteration),
> > but we should probably add = 0 on the variable declaration to make gcc
> > happy.
> 
> We should use uninitialized_var() if we're going to do that.  Because
> that avoids adding unneeded instructions and is self-documenting.
> 
> I saw that warning but assumed that later gcc's didn't emit it.  If
> that was wrong then yes, we should fix it.

Andrew, that false warning is emitted by sparc-linux-gcc 4.6.3.
gcc-4.7 no longer has this problem.

That explains why the x86_64-allmodconfig test didn't complain about
it. Hmm, since many cross compilers still use older gcc, I'll ignore
-Wuninitialized warnings from them in future.

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-24  4:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24  0:57 [next:akpm 234/309] lib/rbtree_test.c:107:2: warning: format '%llu' expects argument of type 'lo Michel Lespinasse
2012-07-24  1:14 ` Andrew Morton
2012-07-24  4:03 ` Fengguang Wu

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).