diff options
| author | Mattias Andrée <m@maandree.se> | 2026-10-17 04:13:10 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-10-17 04:13:10 +0200 |
| commit | ad6c59e3ea003aab543b39a41d6acc60aaf67913 (patch) | |
| tree | 7224ebb8fd853f8d44d10cc28adda4615c6d29b2 | |
| parent | Add character data (diff) | |
| download | libcmap-ad6c59e3ea003aab543b39a41d6acc60aaf67913.tar.gz libcmap-ad6c59e3ea003aab543b39a41d6acc60aaf67913.tar.bz2 libcmap-ad6c59e3ea003aab543b39a41d6acc60aaf67913.tar.xz | |
Work around miscompilation bug with clang(1) 22.1.8
Original code works with '-Weverything' but crashes with '-Weverything -Og -g'
Assembly difference:
@@ -1752,7 +1752,7 @@
.Ltmp210:
#DEBUG_VALUE: parse_line:i <- 1
.loc 0 58 23 is_stmt 1 # Blocks.parse.c:58:23 @[ ./parse-common.c:87:2 ]
- movsbq -1, %rdx
+ movsbq -1(%rbp), %rdx
.Ltmp211:
.loc 0 58 2 is_stmt 0 # Blocks.parse.c:58:2 @[ ./parse-common.c:87:2 ]
testb $32, 1(%rax,%rdx,2)
@@ -1772,7 +1772,7 @@
#DEBUG_VALUE: parse_line:low <- $r13
#DEBUG_VALUE: parse_line:high <- $rsi
#DEBUG_VALUE: parse_line:i <- undef
- .loc 0 59 12 is_stmt 1 # Blocks.parse.c:59:12 @[ ./parse-common.c:87:2 ]
+ .loc 0 59 15 is_stmt 1 # Blocks.parse.c:59:15 @[ ./parse-common.c:87:2 ]
movb $0, (%rcx)
.loc 0 58 15 # Blocks.parse.c:58:15 @[ ./parse-common.c:87:2 ]
movq (%r12), %rax
Signed-off-by: Mattias Andrée <m@maandree.se>
| -rw-r--r-- | Blocks.parse.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Blocks.parse.c b/Blocks.parse.c index d167b66..1ae9fa9 100644 --- a/Blocks.parse.c +++ b/Blocks.parse.c @@ -55,8 +55,8 @@ parse_line(char *text, size_t lineno) name = text; while (*text && *text != ';') text++; - for (i = 1u; isspace(text[-i]); i++) - text[-i] = '\0'; + for (i = 1u; isspace(*(text - i)); i++) + *(text - i) = '\0'; if (*text == ';') { static int warned = 0; |
