[nasm:master] travis: add br3392637

nasm-bot for Cyrill Gorcunov gorcunov at gmail.com
Wed Nov 4 02:18:14 PST 2020


Commit-ID:  dc4a6194265962f288b73cca8097b850283bfb5f
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=dc4a6194265962f288b73cca8097b850283bfb5f
Author:     Cyrill Gorcunov <gorcunov at gmail.com>
AuthorDate: Wed, 4 Nov 2020 13:15:52 +0300
Committer:  Cyrill Gorcunov <gorcunov at gmail.com>
CommitDate: Wed, 4 Nov 2020 13:15:52 +0300

travis: add br3392637

Code for testcase provided by Suhwan.

Reported-by: Suhwan <prada960808 at gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>


---
 travis/test/br3392637.asm    |  46 +++++++++++++++++++++++++++++++++++++++++++
 travis/test/br3392637.json   |  21 ++++++++++++++++++++
 travis/test/br3392637.o.t    | Bin 0 -> 848 bytes
 travis/test/br3392637.stderr |  15 ++++++++++++++
 4 files changed, 82 insertions(+)

diff --git a/travis/test/br3392637.asm b/travis/test/br3392637.asm
new file mode 100644
index 00000000..1a5ee975
--- /dev/null
+++ b/travis/test/br3392637.asm
@@ -0,0 +1,46 @@
+; -----------------------------------------------------------------------------
+; A 64-bit Linux application that writes the first 90 Fibonacci numbers. To
+; assemble and run:
+;
+;     nasm -felf64 fib.asm && gcc fib.o && ./a.out
+; -----------------------------------------------------------------------------
+
+        global  main
+        extern  printf
+
+        section .text
+main:
+        push    rbx                     ; we have to save this since we use it
+
+        mov     ecx, 90                 ; ecx will countdown to 0
+        xor     rax, rax                ; rax will hold the current number
+        xor     rbx, rbx                ; rbx will hold the next number
+        inc     rbx                     ; rbx is originally 1
+print:
+        ; We need to call printf, but we are using rax, rbx, and rcx.  printf
+        ; may destroy rax and rcx so we will save these before the call and
+        ; restore them afterwards.
+
+        push    rax                     ; caller-save register
+        push    rcx                     ; caller-save register
+
+        mov     rdi, format             ; set 1st parameter (format)
+        mov     rsi, rax                ; set 2nd parameter (current_number)
+        xor     rax, rax                ; because printf is varargs
+
+        ; Stack is already aligned because we pushed three 8 byte registers
+        call    printf                  ; printf(format, current_number)
+
+        pop     rcx                     ; restore caller-save register
+        pop     rax                     ; restore caller-save register
+
+        mov     rdx, rax                ; save the current number
+        mov     rax, rbx                ; next number is now current
+        add     rbx, rdx                ; get the new next number
+        dec     ecx                     ; count down
+        jnz     print                   ; if not done counting, do some more
+
+        pop     rbx                     ; restore rbx before returning
+        ret
+format:
+        db  "%20ld", 10, 0
diff --git a/travis/test/br3392637.json b/travis/test/br3392637.json
new file mode 100644
index 00000000..3a3de297
--- /dev/null
+++ b/travis/test/br3392637.json
@@ -0,0 +1,21 @@
+[
+	{
+		"description": "Test for br3392637 (pass)",
+		"id": "br3392637",
+		"source": "br3392637.asm",
+		"format": "elf64",
+		"option": "-Ox",
+		"target": [
+			{ "output": "br3392637.o" }
+		]
+	},
+	{
+		"description": "Test for br3392637 (nil dereference)",
+		"ref": "br3392637",
+		"format": "ieee",
+		"target": [
+			{ "stderr": "br3392637.stderr" }
+		],
+		"error" : "expected"
+	}
+]
diff --git a/travis/test/br3392637.o.t b/travis/test/br3392637.o.t
new file mode 100644
index 00000000..e96bb76b
Binary files /dev/null and b/travis/test/br3392637.o.t differ
diff --git a/travis/test/br3392637.stderr b/travis/test/br3392637.stderr
new file mode 100644
index 00000000..5016bd40
--- /dev/null
+++ b/travis/test/br3392637.stderr
@@ -0,0 +1,15 @@
+./travis/test/br3392637.asm:13: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:16: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:17: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:18: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:24: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:25: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:27: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:28: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:29: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:34: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:35: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:37: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:38: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:39: error: instruction not supported in 16-bit mode
+./travis/test/br3392637.asm:43: error: instruction not supported in 16-bit mode


More information about the Nasm-commits mailing list