From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fix: tools: kwbimage.c: Initialize headersz to suppress warning
Date: Mon, 24 Nov 2014 09:39:45 +0100 [thread overview]
Message-ID: <20141124093945.54847988@amdc2363> (raw)
In-Reply-To: <20141123183815.56d68f90@jawa>
Hi Albert,
> Hi Albert,
>
> Sorry for a late reply.
>
> > Hello Lukasz,
> >
> > On Sat, 22 Nov 2014 07:56:35 +0100, Lukasz Majewski
> > <l.majewski@majess.pl> wrote:
> >
> > > > Agreed in general, but not for this one, since "fixing" is the
> > > > carpet,
> > >
> > > I assume that you are presenting below an answer to a "general"
> > > case.
> > >
> > > However, as Thomas pointed out earlier, this "fix" is perfectly
> > > safe regarding the underlying kwbimage code.
> >
> > Jeroen and I (full disclaimer: we have discussed the topic on IRC)
> > do not contend that the proposed fix would be unsafe; it *is* safe,
> > i.e. it does not adversely affect the code behavior in any
> > measurable way.
> >
> > What we contend is that the fix be the /right/ fix (although Jeroen
> > and I have slightly differing criteria for defining what "the right
> > fix" would be).
> >
> > > > > and
> > > > > the only justification I see as acceptable for doing so is
> > > > > when leaving the warning enabled would cause an obnoxiously
> > > > > high number of false positives.
> > > >
> > > > Well let me add, if "fixing the warning" causes real error
> > > > to be hidden, we shouldn't "fix" the warnings by modifying
> > > > valid code.
> > >
> > > Each subsequent "fix" for this kind of warning should be
> > > considered case by case IMHO, therefore I agree with Albert.
> >
> > Jeroen also agreed on IRC that disabling the compiler warning is not
> > the right fix either; and I agreed that there had to be a better fix
> > than pseudo-initializing headersz. I therefore suggested refactoring
> > kwbimage_set_header in order to ensure gcc does not emit the
> > warning, but without resorting to non-functional code such as a
> > functionally meaningless initialization.
> >
> > Problem is, to refactor the code, one needs a gcc which emits the
> > warnig. I tried various versions of gcc (4.7.4, 4.8.3, 4.9.1) and
> > all remained silent when compiling tools/kwbimage.c.
> >
> > Hence my request: Lukasz, which toolchain are you using exactly?
> > Where can we download it from?
>
> The warning appear on my personal laptop too:
>
> lukma at jawa:~/work/embedded/u-boot-denx (master)$ cc -v
> Using built-in specs.
> COLLECT_GCC=cc
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Debian
> 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
> --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
> --program-suffix=-4.7 --enable-shared --enable-linker-build-id
> --with-system-zlib --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
> --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
> --enable-libstdcxx-debug --enable-libstdcxx-time=yes
> --enable-gnu-unique-object --enable-plugin --enable-objc-gc
> --with-arch-32=i586 --with-tune=generic --enable-checking=release
> --build=x86_64-linux-gnu --host=x86_64-linux-gnu
> --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2
> (Debian 4.7.2-5)
>
>
> HOSTCC tools/kwbimage.o
> tools/kwbimage.c: In function ?kwbimage_set_header?:
> tools/kwbimage.c:803:8: warning: ?headersz? may be used uninitialized
> in this function [-Wmaybe-uninitialized]
>
> Debian distro: version 7.6 (Wheezy)
>
>
> I will check the exact gcc on my office PC tomorrow.
On my office PC I've got following gcc:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-gnu-unique-object --enable-plugin --enable-objc-gc
--with-arch-32=i586 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian
4.7.2-5
I've got a stable debian (Wheezy - 7.4)
>
>
> Heiko also complained about this Warning. Heiko could you also share
> information about your setup?
>
> >
> > > > Regards,
> > > > Jeroen
> > >
> > > Best regards,
> > > Lukasz Majewski
> >
> > Amicalement,
>
> Best regards,
> Lukasz Majewski
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
next prev parent reply other threads:[~2014-11-24 8:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-21 8:22 [U-Boot] [PATCH] fix: tools: kwbimage.c: Initialize headersz to suppress warning Lukasz Majewski
2014-11-21 8:35 ` Thomas Petazzoni
2014-11-21 9:20 ` Lukasz Majewski
2014-11-21 12:34 ` Jeroen Hofstee
2014-11-21 15:30 ` Albert ARIBAUD
2014-11-21 19:34 ` Jeroen Hofstee
2014-11-22 6:56 ` Lukasz Majewski
2014-11-22 12:17 ` Albert ARIBAUD
2014-11-23 17:38 ` Lukasz Majewski
2014-11-24 8:39 ` Lukasz Majewski [this message]
2014-11-24 18:00 ` Albert ARIBAUD
2014-12-08 11:40 ` Lukasz Majewski
2014-11-24 8:52 ` Guillaume Gardet
2014-11-21 9:54 ` Stefan Roese
2014-11-21 10:14 ` Heiko Schocher
2014-11-21 21:52 ` Albert ARIBAUD
2015-01-10 19:10 ` [U-Boot] " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141124093945.54847988@amdc2363 \
--to=l.majewski@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox