aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/config/tc-riscv.c3
-rw-r--r--gas/testsuite/gas/riscv/fence-fail.d3
-rw-r--r--gas/testsuite/gas/riscv/fence-fail.l4
-rw-r--r--gas/testsuite/gas/riscv/fence-fail.s4
-rw-r--r--gas/testsuite/gas/riscv/rouding-fail.d3
-rw-r--r--gas/testsuite/gas/riscv/rouding-fail.l3
-rw-r--r--gas/testsuite/gas/riscv/rouding-fail.s3
8 files changed, 34 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index a9325fb..42523c8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,14 @@
+2018-08-23 Kito Cheng <kito@andestech.com>
+
+ * config/tc-riscv.c (arg_lookup): Checking
+ length before look up.
+ * testsuite/gas/riscv/fence-fail.d: New file.
+ * testsuite/gas/riscv/fence-fail.l: Likewise.
+ * testsuite/gas/riscv/fence-fail.s: Likewise.
+ * testsuite/gas/riscv/rouding-fail.d: Likewise.
+ * testsuite/gas/riscv/rouding-fail.l: Likewise.
+ * testsuite/gas/riscv/rouding-fail.s: Likewise.
+
2018-08-23 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23536
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 5ba997e..ee4b4f5 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -618,6 +618,9 @@ arg_lookup (char **s, const char *const *array, size_t size, unsigned *regnop)
const char *p = strchr (*s, ',');
size_t i, len = p ? (size_t)(p - *s) : strlen (*s);
+ if (len == 0)
+ return FALSE;
+
for (i = 0; i < size; i++)
if (array[i] != NULL && strncmp (array[i], *s, len) == 0)
{
diff --git a/gas/testsuite/gas/riscv/fence-fail.d b/gas/testsuite/gas/riscv/fence-fail.d
new file mode 100644
index 0000000..05b158f
--- /dev/null
+++ b/gas/testsuite/gas/riscv/fence-fail.d
@@ -0,0 +1,3 @@
+#as: -march=rv32i
+#source: fence-fail.s
+#error-output: fence-fail.l
diff --git a/gas/testsuite/gas/riscv/fence-fail.l b/gas/testsuite/gas/riscv/fence-fail.l
new file mode 100644
index 0000000..0d0912d
--- /dev/null
+++ b/gas/testsuite/gas/riscv/fence-fail.l
@@ -0,0 +1,4 @@
+.*: Assembler messages:
+.*: Error: illegal operands `fence ,'
+.*: Error: illegal operands `fence w,'
+.*: Error: illegal operands `fence ,w'
diff --git a/gas/testsuite/gas/riscv/fence-fail.s b/gas/testsuite/gas/riscv/fence-fail.s
new file mode 100644
index 0000000..9ce460e
--- /dev/null
+++ b/gas/testsuite/gas/riscv/fence-fail.s
@@ -0,0 +1,4 @@
+target:
+ fence ,
+ fence w,
+ fence ,w
diff --git a/gas/testsuite/gas/riscv/rouding-fail.d b/gas/testsuite/gas/riscv/rouding-fail.d
new file mode 100644
index 0000000..3544507
--- /dev/null
+++ b/gas/testsuite/gas/riscv/rouding-fail.d
@@ -0,0 +1,3 @@
+#as: -march=rv32ifd
+#source: rouding-fail.s
+#error-output: rouding-fail.l
diff --git a/gas/testsuite/gas/riscv/rouding-fail.l b/gas/testsuite/gas/riscv/rouding-fail.l
new file mode 100644
index 0000000..ea46e7c
--- /dev/null
+++ b/gas/testsuite/gas/riscv/rouding-fail.l
@@ -0,0 +1,3 @@
+.*: Assembler messages:
+.*: Error: illegal operands `fadd.s fa1,fa1,fa1,'
+.*: Error: illegal operands `fadd.d fa1,fa1,fa1,'
diff --git a/gas/testsuite/gas/riscv/rouding-fail.s b/gas/testsuite/gas/riscv/rouding-fail.s
new file mode 100644
index 0000000..d18f53e
--- /dev/null
+++ b/gas/testsuite/gas/riscv/rouding-fail.s
@@ -0,0 +1,3 @@
+target:
+ fadd.s fa1,fa1,fa1,
+ fadd.d fa1,fa1,fa1,