[BUILDROBOT, PATCH] Fix sign-compare in dwarf.c

Jan-Benedict Glaw jbglaw@lug-owl.de
Tue Nov 18 21:08:00 GMT 2014


Hi!

Some gcc versions fail for the recent security enhancements, see eg.
http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=377119:

gcc -DHAVE_CONFIG_H -I. -I/home/vaxbuild/repos/binutils_gdb/binutils  -I. -I/home/vaxbuild/repos/binutils_gdb/binutils -I../bfd -I/home/vaxbuild/repos/binutils_gdb/binutils/../bfd -I/home/vaxbuild/repos/binutils_gdb/binutils/../include -DLOCALEDIR="\"/home/vaxbuild/build/sh4-linux/_install_/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT dwarf.o -MD -MP -MF .deps/dwarf.Tpo -c -o dwarf.o /home/vaxbuild/repos/binutils_gdb/binutils/dwarf.c
/home/vaxbuild/repos/binutils_gdb/binutils/dwarf.c: In function ‘process_extended_line_op’:
/home/vaxbuild/repos/binutils_gdb/binutils/dwarf.c:419:38: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   if (len == 0 || data == end || len > (end - data))
                                      ^
cc1: all warnings being treated as errors
Makefile:932: recipe for target 'dwarf.o' failed
make[3]: *** [dwarf.o] Error 1


Just cast it away?

MfG, JBG


2014-11-18  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

binutils/
	* dwarf.c (process_extended_line_op): Fix signedness warning.


diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index e1e2b35..a3a1ebd 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -416,7 +416,7 @@ process_extended_line_op (unsigned char * data,
   len = read_uleb128 (data, & bytes_read, end);
   data += bytes_read;
 
-  if (len == 0 || data == end || len > (end - data))
+  if (len == 0 || data == end || len > (unsigned int) (end - data))
     {
       warn (_("Badly formed extended line op encountered!\n"));
       return bytes_read;

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:         "really soon now":      an unspecified period of time, likly to
the second  :                                 be greater than any reasonable definition
                                              of "soon".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20141118/a012d386/attachment.sig>


More information about the Binutils mailing list