]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR 33229 nds32 gas segfaults on gcc output
authorAlan Modra <amodra@gmail.com>
Tue, 29 Jul 2025 22:48:19 +0000 (08:18 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 30 Jul 2025 00:18:59 +0000 (09:48 +0930)
commit303045d9539d9032208b8b67f222943ff4c96b05
tree32749bd3e3596ff480483ce51186aa4c0f435808
parent9f09438f9ed44dcb270e6ddd15d21fb0e0bde495
PR 33229 nds32 gas segfaults on gcc output

Commit 1ac26e9f7ac2 replaced ISSPACE with is_whitespace, but the
former returns true on EOL while the latter does not.  Sprinkle
is_end_of_stmt tests to fix this bug.

The same segfault can be triggered by a ".relax_hint" with no
following instructions.  Fix that too.

* config/tc-nds32.c (nds32_lookup_pseudo_opcode): Use
is_end_of_stmt along with is_whitespace.
(nds32_relax_relocs, nds32_relax_hint, nds32_flag),
(ict_model: Likewise.
(nds32_elf_append_relax_relocs): Return on no opcode.
* testsuite/gas/nds32/nds32.exp: Find .d files automatically.
* testsuite/gas/nds32/pr33229.d,
* testsuite/gas/nds32/pr33229.s: New test.
gas/config/tc-nds32.c
gas/testsuite/gas/nds32/nds32.exp
gas/testsuite/gas/nds32/pr33229.d [new file with mode: 0644]
gas/testsuite/gas/nds32/pr33229.s [new file with mode: 0644]