S12Z/GAS: Correct a signed vs unsigned comparison error with GCC 4.1
authorMaciej W. Rozycki <macro@linux-mips.org>
Thu, 20 Sep 2018 14:49:01 +0000 (15:49 +0100)
committerMaciej W. Rozycki <macro@linux-mips.org>
Thu, 20 Sep 2018 14:49:01 +0000 (15:49 +0100)
commitfa9d2bd6b819ce143c149cee83456fa9dfe729b4
treea947ec6d63b2e103a659cd06bd4d8c9d341f4602
parent16de26a611b78bd353af5b86ce67ace81ec1bfec
S12Z/GAS: Correct a signed vs unsigned comparison error with GCC 4.1

Fix a build error:

cc1: warnings being treated as errors
.../gas/config/tc-s12z.c: In function 'lex_opr':
.../gas/config/tc-s12z.c:617: warning: comparison between signed and unsigned
.../gas/config/tc-s12z.c:624: warning: comparison between signed and unsigned
make[4]: *** [config/tc-s12z.o] Error 1

observed with GCC 4.1.2 with the `s12z-elf' target.

Here we have a constant assembly instruction operand, whose value is
within the 24-bit unsigned range, to be placed in a machine instruction
such as to use the least space-consuming encoding.  So the sign of that
value does not matter, because signed values are out of range and are
not supposed to appear here, and we only have this warning here because
the `X_add_number' member of `struct expressionS' is of the `offsetT'
type, which is signed.

Use an auxiliary variable of an unsigned data type then, observing that
both `offsetT' and `valueT' have the same width, as they correspond to
`bfd_signed_vma' and `bfd_vma' respectively.

gas/
* config/tc-s12z.c (lex_opr): Use an auxiliary unsigned variable
in encoding a constant operand.
gas/ChangeLog
gas/config/tc-s12z.c
This page took 0.027689 seconds and 4 git commands to generate.