aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2022-03-21 11:33:59 +0000
committerNick Clifton <nickc@redhat.com>2022-03-21 11:33:59 +0000
commita58b0053f4c4b4f0089f3985a41d0deac4c59ea4 (patch)
tree77300c440e286ed65190cf20f84189bf86b2a2c4 /gas
parent1add37b567a7dee39d99f37b37802034c3fce9c4 (diff)
downloadgdb-a58b0053f4c4b4f0089f3985a41d0deac4c59ea4.zip
gdb-a58b0053f4c4b4f0089f3985a41d0deac4c59ea4.tar.gz
gdb-a58b0053f4c4b4f0089f3985a41d0deac4c59ea4.tar.bz2
z80 assembler: Fix new unexpected overflow warning in v2.37
PR 28791 * config/tc-z80.c (emit_data_val): Do not warn about overlarge constants generated by bit manipulation operators. * testsuite/gas/z80/pr28791.s: New test source file. * testsuite/gas/z80/pr28791.d: New test driver file.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-z80.c10
-rw-r--r--gas/testsuite/gas/z80/pr28791.d16
-rw-r--r--gas/testsuite/gas/z80/pr28791.s7
4 files changed, 40 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e2e4897..c6f177b 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2022-03-21 Nick Clifton <nickc@redhat.com>
+
+ PR 28791
+ * config/tc-z80.c (emit_data_val): Do not warn about overlarge
+ constants generated by bit manipulation operators.
+ * testsuite/gas/z80/pr28791.s: New test source file.
+ * testsuite/gas/z80/pr28791.d: New test driver file.
+
2022-01-28 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation.
diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 522e909..81fbfe3 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -1134,7 +1134,15 @@ emit_data_val (expressionS * val, int size)
if (val->X_op == O_constant)
{
int i;
- if (is_overflow (val->X_add_number, size*8))
+
+ /* PR 28791:
+ Check for overflow, but ignore values that were generated by bit
+ manipulation operators (eg ~0xe6 and -7). This does mean that
+ manipluated overlarge values will not be reported (eg ~0x1234),
+ but it does help to maintain compatibility with earlier versions
+ of the assembler. */
+ if (! val->X_extrabit
+ && is_overflow (val->X_add_number, size*8))
as_warn ( _("%d-bit overflow (%+ld)"), size*8, val->X_add_number);
for (i = 0; i < size; ++i)
p[i] = (char)(val->X_add_number >> (i*8));
diff --git a/gas/testsuite/gas/z80/pr28791.d b/gas/testsuite/gas/z80/pr28791.d
new file mode 100644
index 0000000..4351f1a
--- /dev/null
+++ b/gas/testsuite/gas/z80/pr28791.d
@@ -0,0 +1,16 @@
+#as: -march=ez80
+#objdump: -d
+#name: PR 28791: Do not complain about overlarge bit manipulated constants
+
+.*:.*
+
+Disassembly of section .text:
+
+0+ <.text>:
+\s+0:\s+1e 19\s+ld e,0x19
+\s+2:\s+1e 1a\s+ld e,0x1a
+\s+4:\s+1e e6\s+ld e,0xe6
+\s+6:\s+1e ff\s+ld e,0xff
+\s+8:\s+1e 00\s+ld e,0x00
+\s+a:\s+1e f9\s+ld e,0xf9
+\s+c:\s+1e cb\s+ld e,0xcb
diff --git a/gas/testsuite/gas/z80/pr28791.s b/gas/testsuite/gas/z80/pr28791.s
new file mode 100644
index 0000000..bcfdbe5
--- /dev/null
+++ b/gas/testsuite/gas/z80/pr28791.s
@@ -0,0 +1,7 @@
+ld e, ~0xe6
+ld e, -0xe6
+ld e, 0xe6
+ld e, ~0
+ld e, !0xe6
+ld e, -7
+ld e, ~0x1234