This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix pointer comparison in gold


While building gold with a recent GCC trunk, I ran into this:

gold/options.cc: In function 'void gold::options::parse_uint(const char*, const char*, int*)':
gold/options.cc:201:35: error: ordered comparison of pointer with integer zero [-Werror=extra]
cc1plus: all warnings being treated as errors

Fixed with the patch below.  OK for binutils trunk?


Diego.



	* options.cc (parse_uint): Fix dereference of RETVAL.

Index: options.cc
===================================================================
RCS file: /cvs/src/src/gold/options.cc,v
retrieving revision 1.115
diff -u -d -u -p -r1.115 options.cc
--- options.cc	26 Sep 2011 23:42:06 -0000	1.115
+++ options.cc	3 Oct 2011 11:59:17 -0000
@@ -198,7 +198,7 @@ parse_uint(const char* option_name, cons
 {
   char* endptr;
   *retval = strtol(arg, &endptr, 0);
-  if (*endptr != '\0' || retval < 0)
+  if (*endptr != '\0' || *retval < 0)
     gold_fatal(_("%s: invalid option value (expected an integer): %s"),
                option_name, arg);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]