aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-06-15 07:58:18 +0200
committerJan Beulich <jbeulich@suse.com>2021-06-15 07:58:18 +0200
commit4fe51f7d3ce96953a62c493b8c2615f8577c0f11 (patch)
treea08b7fc2f4a429a2e28c2f3b8769d5a3cb6af16a /gas/testsuite
parentcc0f96357e0b5bce4a1f02910cec2dd66e8990c5 (diff)
downloadgdb-4fe51f7d3ce96953a62c493b8c2615f8577c0f11.zip
gdb-4fe51f7d3ce96953a62c493b8c2615f8577c0f11.tar.gz
gdb-4fe51f7d3ce96953a62c493b8c2615f8577c0f11.tar.bz2
x86: off-by-1 in offset_in_range()
Just like e.g. 0x10000 triggers a warning for size 2, -0x10000 ought to as well. Note that some of the encodings produced aren't ones one would expect, and hence the generated code is not being checked for in the new testcases.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/i386/disp-imm-16.l10
-rw-r--r--gas/testsuite/gas/i386/disp-imm-16.s17
-rw-r--r--gas/testsuite/gas/i386/disp-imm-64.l22
-rw-r--r--gas/testsuite/gas/i386/disp-imm-64.s28
-rw-r--r--gas/testsuite/gas/i386/i386.exp2
5 files changed, 79 insertions, 0 deletions
diff --git a/gas/testsuite/gas/i386/disp-imm-16.l b/gas/testsuite/gas/i386/disp-imm-16.l
new file mode 100644
index 0000000..f1b5f1f
--- /dev/null
+++ b/gas/testsuite/gas/i386/disp-imm-16.l
@@ -0,0 +1,10 @@
+.*: Assembler messages:
+.*:7: Warning: .* shortened to .*
+.*:8: Warning: .* shortened to .*
+.*:9: Warning: .* shortened to .*
+.*:11: Warning: .* shortened to .*
+.*:12: Warning: .* shortened to .*
+.*:13: Warning: .* shortened to .*
+.*:15: Warning: .* shortened to .*
+.*:16: Warning: .* shortened to .*
+.*:17: Warning: .* shortened to .*
diff --git a/gas/testsuite/gas/i386/disp-imm-16.s b/gas/testsuite/gas/i386/disp-imm-16.s
new file mode 100644
index 0000000..d33b97c
--- /dev/null
+++ b/gas/testsuite/gas/i386/disp-imm-16.s
@@ -0,0 +1,17 @@
+ .text
+ .code16
+ mov -0xffff(%bx), %eax
+ vmovaps -0xffc0(%bx), %zmm0
+ add $-0xffff, %cx
+
+ mov -0xffff-1(%bx), %eax
+ vmovaps -0xffc0-0x40(%bx), %zmm0
+ add $-0xffff-1, %cx
+
+ mov -0xffff-2(%bx), %eax
+ vmovaps -0xffc0-0x80(%bx), %zmm0
+ add $-0xffff-2, %cx
+
+ mov -0x1ffff(%bx), %eax
+ vmovaps -0x1ffc0(%bx), %zmm0
+ add $-0x1ffff, %cx
diff --git a/gas/testsuite/gas/i386/disp-imm-64.l b/gas/testsuite/gas/i386/disp-imm-64.l
new file mode 100644
index 0000000..8eb56e5
--- /dev/null
+++ b/gas/testsuite/gas/i386/disp-imm-64.l
@@ -0,0 +1,22 @@
+.*: Assembler messages:
+.*:2: Error: .*
+.*:4: Error: .*
+.*:6: Error: .*
+.*:9: Error: .*
+.*:10: Warning: .* shortened to .*
+.*:11: Error: .*
+.*:12: Warning: .* shortened to .*
+.*:13: Error: .*
+.*:14: Warning: .* shortened to .*
+.*:16: Error: .*
+.*:17: Warning: .* shortened to .*
+.*:18: Error: .*
+.*:19: Warning: .* shortened to .*
+.*:20: Error: .*
+.*:21: Warning: .* shortened to .*
+.*:23: Error: .*
+.*:24: Warning: .* shortened to .*
+.*:25: Error: .*
+.*:26: Warning: .* shortened to .*
+.*:27: Error: .*
+.*:28: Warning: .* shortened to .*
diff --git a/gas/testsuite/gas/i386/disp-imm-64.s b/gas/testsuite/gas/i386/disp-imm-64.s
new file mode 100644
index 0000000..a5a37a6
--- /dev/null
+++ b/gas/testsuite/gas/i386/disp-imm-64.s
@@ -0,0 +1,28 @@
+ .text
+ mov -0xffffffff(%rax), %eax
+ mov -0xffffffff(%eax), %eax
+ vmovaps -0xffffffc0(%rax), %zmm0
+ vmovaps -0xffffffc0(%eax), %zmm0
+ add $-0xffffffff, %rcx
+ add $-0xffffffff, %ecx
+
+ mov -0xffffffff-1(%rax), %eax
+ mov -0xffffffff-1(%eax), %eax
+ vmovaps -0xffffffc0-0x40(%rax), %zmm0
+ vmovaps -0xffffffc0-0x40(%eax), %zmm0
+ add $-0xffffffff-1, %rcx
+ add $-0xffffffff-1, %ecx
+
+ mov -0xffffffff-2(%rax), %eax
+ mov -0xffffffff-2(%eax), %eax
+ vmovaps -0xffffffc0-0x80(%rax), %zmm0
+ vmovaps -0xffffffc0-0x80(%eax), %zmm0
+ add $-0xffffffff-2, %rcx
+ add $-0xffffffff-2, %ecx
+
+ mov -0x1ffffffff(%rax), %eax
+ mov -0x1ffffffff(%eax), %eax
+ vmovaps -0x1ffffffc0(%rax), %zmm0
+ vmovaps -0x1ffffffc0(%eax), %zmm0
+ add $-0x1ffffffff, %rcx
+ add $-0x1ffffffff, %ecx
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index cf21511..4112a1d 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -87,6 +87,7 @@ if [gas_32_check] then {
run_dump_test "disp"
run_dump_test "disp-intel"
run_dump_test "disp32"
+ run_list_test "disp-imm-16"
run_dump_test "vmx"
run_dump_test "vmfunc"
run_dump_test "smx"
@@ -861,6 +862,7 @@ if [gas_64_check] then {
run_dump_test "x86-64-sib-intel"
run_dump_test "x86-64-disp"
run_dump_test "x86-64-disp-intel"
+ run_list_test "disp-imm-64"
run_dump_test "intel-movs64"
run_dump_test "intel-cmps64"
run_dump_test "x86-64-disp32"