aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Cook <simon.cook@embecosm.com>2020-05-27 17:34:58 +0100
committerJim Wilson <jimw@sifive.com>2020-05-27 16:38:37 -0700
commit5c5055683b980c71e96b642565418ffdefc6f171 (patch)
treebd69fd566ae5bc42aa9b94f048cb55fe9b0c179f
parent2a37823bfe57d43f6c43a48a00237ba169599c3c (diff)
downloadgdb-5c5055683b980c71e96b642565418ffdefc6f171.zip
gdb-5c5055683b980c71e96b642565418ffdefc6f171.tar.gz
gdb-5c5055683b980c71e96b642565418ffdefc6f171.tar.bz2
RISC-V: Fix missing initialization of riscv_csr_extra structs
The next pointer of struct riscv_csr_extra was not always initilized to NULL or a valid pointer, causing the assembler to attempt to read through an uninitialized pointer on startup. gas/ChangeLog: * config/tc-riscv.c (riscv_init_csr_hash): NULL initilize next pointer when creating struct riscv_csr_extra.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-riscv.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 97d8776..0d1565f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-27 Simon Cook <simon.cook@embecosm.com>
+
+ * config/tc-riscv.c (riscv_init_csr_hash): NULL initilize next
+ pointer when creating struct riscv_csr_extra.
+
2020-05-26 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/gas/i386/align-branch-9.d: Updated for PECOFF.
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 2a03a44..da94b5b 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -695,6 +695,7 @@ riscv_init_csr_hash (const char *name,
entry->address = address;
entry->define_version = define_version;
entry->abort_version = abort_version;
+ entry->next = NULL;
/* If the CSR hasn't been inserted in the hash table, then insert it.
Otherwise, attach the extra information to the entry which is already