diff options
author | Jim Wilson <jimw@sifive.com> | 2018-08-23 13:26:48 -0700 |
---|---|---|
committer | Jim Wilson <jimw@sifive.com> | 2018-08-23 13:26:48 -0700 |
commit | bfb218e3e404a6168888df51c03827eacde9ceea (patch) | |
tree | 2b4c11ce08696265181b4a21e715a32ca24209e7 /gas | |
parent | b0ceb98aec8e1ab610deea9fee9ee75c5911bbc0 (diff) | |
download | binutils-bfb218e3e404a6168888df51c03827eacde9ceea.zip binutils-bfb218e3e404a6168888df51c03827eacde9ceea.tar.gz binutils-bfb218e3e404a6168888df51c03827eacde9ceea.tar.bz2 |
RISC-V: Reject empty rouding mode and fence operand.
gas/
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.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 11 | ||||
-rw-r--r-- | gas/config/tc-riscv.c | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/fence-fail.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/fence-fail.l | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/fence-fail.s | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/rouding-fail.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/rouding-fail.l | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/riscv/rouding-fail.s | 3 |
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, |