+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.
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));
--- /dev/null
+#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
--- /dev/null
+ld e, ~0xe6
+ld e, -0xe6
+ld e, 0xe6
+ld e, ~0
+ld e, !0xe6
+ld e, -7
+ld e, ~0x1234