|
| 1 | +From 786eb936fd461e09d6bac819ba7486e64b216244 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Jim Wilson < [email protected]> |
| 3 | +Date: Thu, 23 Aug 2018 13:26:48 -0700 |
| 4 | +Subject: [PATCH 04/15] RISC-V: Reject empty rouding mode and fence operand. |
| 5 | + |
| 6 | + gas/ |
| 7 | + 2018-08-23 Kito Cheng < [email protected]> |
| 8 | + * config/tc-riscv.c (arg_lookup): Checking |
| 9 | + length before look up. |
| 10 | + * testsuite/gas/riscv/fence-fail.d: New file. |
| 11 | + * testsuite/gas/riscv/fence-fail.l: Likewise. |
| 12 | + * testsuite/gas/riscv/fence-fail.s: Likewise. |
| 13 | + * testsuite/gas/riscv/rouding-fail.d: Likewise. |
| 14 | + * testsuite/gas/riscv/rouding-fail.l: Likewise. |
| 15 | + * testsuite/gas/riscv/rouding-fail.s: Likewise. |
| 16 | +--- |
| 17 | + gas/ChangeLog | 11 +++++++++++ |
| 18 | + gas/config/tc-riscv.c | 3 +++ |
| 19 | + gas/testsuite/gas/riscv/fence-fail.d | 3 +++ |
| 20 | + gas/testsuite/gas/riscv/fence-fail.l | 4 ++++ |
| 21 | + gas/testsuite/gas/riscv/fence-fail.s | 4 ++++ |
| 22 | + gas/testsuite/gas/riscv/rouding-fail.d | 3 +++ |
| 23 | + gas/testsuite/gas/riscv/rouding-fail.l | 3 +++ |
| 24 | + gas/testsuite/gas/riscv/rouding-fail.s | 3 +++ |
| 25 | + 8 files changed, 34 insertions(+) |
| 26 | + create mode 100644 gas/testsuite/gas/riscv/fence-fail.d |
| 27 | + create mode 100644 gas/testsuite/gas/riscv/fence-fail.l |
| 28 | + create mode 100644 gas/testsuite/gas/riscv/fence-fail.s |
| 29 | + create mode 100644 gas/testsuite/gas/riscv/rouding-fail.d |
| 30 | + create mode 100644 gas/testsuite/gas/riscv/rouding-fail.l |
| 31 | + create mode 100644 gas/testsuite/gas/riscv/rouding-fail.s |
| 32 | + |
| 33 | +diff --git a/gas/ChangeLog b/gas/ChangeLog |
| 34 | +index f3e42b66ec..7014ef36b2 100644 |
| 35 | +--- a/gas/ChangeLog |
| 36 | ++++ b/gas/ChangeLog |
| 37 | +@@ -1,3 +1,14 @@ |
| 38 | ++2018-08-23 Kito Cheng <[email protected]> |
| 39 | ++ |
| 40 | ++ * config/tc-riscv.c (arg_lookup): Checking |
| 41 | ++ length before look up. |
| 42 | ++ * testsuite/gas/riscv/fence-fail.d: New file. |
| 43 | ++ * testsuite/gas/riscv/fence-fail.l: Likewise. |
| 44 | ++ * testsuite/gas/riscv/fence-fail.s: Likewise. |
| 45 | ++ * testsuite/gas/riscv/rouding-fail.d: Likewise. |
| 46 | ++ * testsuite/gas/riscv/rouding-fail.l: Likewise. |
| 47 | ++ * testsuite/gas/riscv/rouding-fail.s: Likewise. |
| 48 | ++ |
| 49 | + 2018-07-27 Jim Wilson < [email protected]> |
| 50 | + |
| 51 | + * configure.tgt (riscv*): Accept as alias for riscv32*. |
| 52 | +diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c |
| 53 | +index bdec30741b..4a3648a9ee 100644 |
| 54 | +--- a/gas/config/tc-riscv.c |
| 55 | ++++ b/gas/config/tc-riscv.c |
| 56 | +@@ -618,6 +618,9 @@ arg_lookup (char **s, const char *const *array, size_t size, unsigned *regnop) |
| 57 | + const char *p = strchr (*s, ','); |
| 58 | + size_t i, len = p ? (size_t)(p - *s) : strlen (*s); |
| 59 | + |
| 60 | ++ if (len == 0) |
| 61 | ++ return FALSE; |
| 62 | ++ |
| 63 | + for (i = 0; i < size; i++) |
| 64 | + if (array[i] != NULL && strncmp (array[i], *s, len) == 0) |
| 65 | + { |
| 66 | +diff --git a/gas/testsuite/gas/riscv/fence-fail.d b/gas/testsuite/gas/riscv/fence-fail.d |
| 67 | +new file mode 100644 |
| 68 | +index 0000000000..05b158fd75 |
| 69 | +--- /dev/null |
| 70 | ++++ b/gas/testsuite/gas/riscv/fence-fail.d |
| 71 | +@@ -0,0 +1,3 @@ |
| 72 | ++#as: -march=rv32i |
| 73 | ++#source: fence-fail.s |
| 74 | ++#error-output: fence-fail.l |
| 75 | +diff --git a/gas/testsuite/gas/riscv/fence-fail.l b/gas/testsuite/gas/riscv/fence-fail.l |
| 76 | +new file mode 100644 |
| 77 | +index 0000000000..0d0912d5a9 |
| 78 | +--- /dev/null |
| 79 | ++++ b/gas/testsuite/gas/riscv/fence-fail.l |
| 80 | +@@ -0,0 +1,4 @@ |
| 81 | ++.*: Assembler messages: |
| 82 | ++.*: Error: illegal operands `fence ,' |
| 83 | ++.*: Error: illegal operands `fence w,' |
| 84 | ++.*: Error: illegal operands `fence ,w' |
| 85 | +diff --git a/gas/testsuite/gas/riscv/fence-fail.s b/gas/testsuite/gas/riscv/fence-fail.s |
| 86 | +new file mode 100644 |
| 87 | +index 0000000000..9ce460ecfa |
| 88 | +--- /dev/null |
| 89 | ++++ b/gas/testsuite/gas/riscv/fence-fail.s |
| 90 | +@@ -0,0 +1,4 @@ |
| 91 | ++target: |
| 92 | ++ fence , |
| 93 | ++ fence w, |
| 94 | ++ fence ,w |
| 95 | +diff --git a/gas/testsuite/gas/riscv/rouding-fail.d b/gas/testsuite/gas/riscv/rouding-fail.d |
| 96 | +new file mode 100644 |
| 97 | +index 0000000000..3544507e8b |
| 98 | +--- /dev/null |
| 99 | ++++ b/gas/testsuite/gas/riscv/rouding-fail.d |
| 100 | +@@ -0,0 +1,3 @@ |
| 101 | ++#as: -march=rv32ifd |
| 102 | ++#source: rouding-fail.s |
| 103 | ++#error-output: rouding-fail.l |
| 104 | +diff --git a/gas/testsuite/gas/riscv/rouding-fail.l b/gas/testsuite/gas/riscv/rouding-fail.l |
| 105 | +new file mode 100644 |
| 106 | +index 0000000000..ea46e7c2d5 |
| 107 | +--- /dev/null |
| 108 | ++++ b/gas/testsuite/gas/riscv/rouding-fail.l |
| 109 | +@@ -0,0 +1,3 @@ |
| 110 | ++.*: Assembler messages: |
| 111 | ++.*: Error: illegal operands `fadd.s fa1,fa1,fa1,' |
| 112 | ++.*: Error: illegal operands `fadd.d fa1,fa1,fa1,' |
| 113 | +diff --git a/gas/testsuite/gas/riscv/rouding-fail.s b/gas/testsuite/gas/riscv/rouding-fail.s |
| 114 | +new file mode 100644 |
| 115 | +index 0000000000..d18f53efb5 |
| 116 | +--- /dev/null |
| 117 | ++++ b/gas/testsuite/gas/riscv/rouding-fail.s |
| 118 | +@@ -0,0 +1,3 @@ |
| 119 | ++target: |
| 120 | ++ fadd.s fa1,fa1,fa1, |
| 121 | ++ fadd.d fa1,fa1,fa1, |
| 122 | +-- |
| 123 | +2.20.1 |
| 124 | + |
0 commit comments