This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 2/2] gas: use labs for variables of type long
- From: Pat Pannuto <pat dot pannuto at gmail dot com>
- To: binutils at sourceware dot org
- Cc: Pat Pannuto <pat dot pannuto at gmail dot com>
- Date: Fri, 1 Sep 2017 20:43:59 -0700
- Subject: [PATCH 2/2] gas: use labs for variables of type long
- Authentication-results: sourceware.org; auth=none
- References: <20170902034359.91021-1-pat.pannuto@gmail.com>
Found automatically during a build:
config/tc-arm.c:24326:25: error: absolute value function 'abs' given an argument of
type 'offsetT' (aka 'long') but has parameter of type 'int' which may cause
truncation of value [-Werror,-Wabsolute-value]
bfd_vma addend_abs = abs (value);
^
config/tc-arm.c:24326:25: note: use function 'labs' instead
bfd_vma addend_abs = abs (value);
^~~
labs
* config/tc-arm.c (md_apply_fix): Use labs() over abs() for longs.
---
gas/ChangeLog | 1 +
gas/config/tc-arm.c | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1732187736..151d6cc2cb 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,6 +1,7 @@
2017-09-01 Pat Pannuto <pat.pannuto@gmail.com>
* config/tc-arm.c (conditional_insn): Remove unused function.
+ * config/tc-arm.c (md_apply_fix): Use labs() over abs() for longs.
2017-09-01 Tamar Christina <tamar.christina@arm.com>
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 78d5a1f3ff..52e9641e97 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -24197,7 +24197,7 @@ md_apply_fix (fixS * fixP,
{
bfd_vma insn;
bfd_vma encoded_addend;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = labs (value);
/* Check that the absolute value of the addend can be
expressed as an 8-bit constant plus a rotation. */
@@ -24238,7 +24238,7 @@ md_apply_fix (fixS * fixP,
if (!seg->use_rela_p)
{
bfd_vma insn;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = labs (value);
/* Check that the absolute value of the addend can be
encoded in 12 bits. */
@@ -24277,7 +24277,7 @@ md_apply_fix (fixS * fixP,
if (!seg->use_rela_p)
{
bfd_vma insn;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = labs (value);
/* Check that the absolute value of the addend can be
encoded in 8 bits. */
@@ -24317,7 +24317,7 @@ md_apply_fix (fixS * fixP,
if (!seg->use_rela_p)
{
bfd_vma insn;
- bfd_vma addend_abs = abs (value);
+ bfd_vma addend_abs = labs (value);
/* Check that the absolute value of the addend is a multiple of
four and, when divided by four, fits in 8 bits. */
--
2.13.3