diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-26 02:35:12 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-26 02:35:12 +0000 |
commit | 387f98728aa5d5d60def6d48d286356ef693e40f (patch) | |
tree | 0e00a96cda65c555ffea9114b00f70a43f0e5a86 /gcc | |
parent | ed5fff77de3c47a483d4266954828dd7511e148d (diff) | |
download | gcc-387f98728aa5d5d60def6d48d286356ef693e40f.tar.gz |
Cast return of strtol to unsigned int
strtol returns long, which is compared against unsigned int. On 32-bit
hosts, it leads to
gcc/gentarget-def.c: In function void def_target_insn(const char*, const char*):
gcc/gentarget-def.c:88:34: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
This patch casts return of strtol to unsigned int to avoid the error.
* gentarget-def.c (def_target_insn): Cast return of strtol to
unsigned int.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224993 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/gentarget-def.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63b716b21b6..080aa39a03a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-25 H.J. Lu <hongjiu.lu@intel.com> + + * gentarget-def.c (def_target_insn): Cast return of strtol to + unsigned int. + 2015-06-25 Andrew MacLeod <amacleod@redhat.com> * gimple.h (gimple_call_set_fn): Move inline function. diff --git a/gcc/gentarget-def.c b/gcc/gentarget-def.c index d4839e881d9..bca94804e18 100644 --- a/gcc/gentarget-def.c +++ b/gcc/gentarget-def.c @@ -85,7 +85,7 @@ def_target_insn (const char *name, const char *prototype) That doesn't contribute to the suffix, so skip ahead and process the following character. */ char *endptr; - if (strtol (p + 1, &endptr, 10) != opno + if ((unsigned int) strtol (p + 1, &endptr, 10) != opno || (*endptr != ',' && *endptr != ')')) { error ("invalid prototype for '%s'", name); |