git: 82a3337952b9 - main - pmc: Use isascii(3) to check if a character is ASCII
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 21 Aug 2026 21:41:54 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=82a3337952b922c48c55d1359ab0472f1d116c7a
commit 82a3337952b922c48c55d1359ab0472f1d116c7a
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-08-21 20:19:56 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-08-21 20:56:05 +0000
pmc: Use isascii(3) to check if a character is ASCII
The previous check did not work on architectures where `char` is
unsigned as noted by GCC on aarch64:
usr.sbin/pmc/view.cc: In member function 'void pmcview::loadsymboltable(image*, Elf*, Elf_Scn*, GElf_Shdr*)':
usr.sbin/pmc/view.cc:627:38: error: comparison is always false due to limited range of data type [-Werror=type-limits]
627 | if (fname[i] < 0) {
| ~~~~~~~~~^~~
Reported by: GCC 15
---
usr.sbin/pmc/view.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr.sbin/pmc/view.cc b/usr.sbin/pmc/view.cc
index a678c061d490..f3585ac75043 100644
--- a/usr.sbin/pmc/view.cc
+++ b/usr.sbin/pmc/view.cc
@@ -624,7 +624,7 @@ pmcview::loadsymboltable(image *im, Elf *e, Elf_Scn *scn, GElf_Shdr *sh)
// XXX: Extra checks to make sure we don't get corrupted
for (int i = 0; fname[i] != 0 && i < 32; i++) {
- if (fname[i] < 0) {
+ if (!isascii(fname[i])) {
printf("EEEK SYMBOL\n");
printf("%s\n", fname);
assert(false);