This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 7bc61fbaa baselibc: Fix memset compilation error on gcc15
7bc61fbaa is described below

commit 7bc61fbaa2d6fe8df30fbb67be7c329c1cd5ccd1
Author: Mariusz Skamra <[email protected]>
AuthorDate: Wed Aug 20 09:57:27 2025 +0200

    baselibc: Fix memset compilation error on gcc15
    
    This fixes the memset compilation error seen on gcc 15.
    
    /tmp/cccS6DLj.s:50: Error: cannot honor width suffix -- `adds r3,ip,r2'
    /tmp/cccS6DLj.s:57: Error: cannot honor width suffix -- `strb r1,[ip,r2]'
    /tmp/cccS6DLj.s:61: Error: cannot honor width suffix -- `str r1,[ip,r2]'
    /tmp/cccS6DLj.s:66: Error: cannot honor width suffix -- `strb r1,[ip,r2]'
    
    caused by complier placing parameters (dst in this case) into high
    registers. Since the memset implementation uses instructions that
    update the CPSR, the use of high registers will cause errors as above.
    
    This fixes this issue by forcing compiler to use low registers.
    'c' aka 'val' operand constraint as not changed by function is changed
    to "r" meaning it is read-only operand.
---
 libc/baselibc/src/memset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/baselibc/src/memset.c b/libc/baselibc/src/memset.c
index 215a6b6d9..0cdaa6b2f 100644
--- a/libc/baselibc/src/memset.c
+++ b/libc/baselibc/src/memset.c
@@ -62,8 +62,8 @@ void *memset(void *dst, int c, size_t n)
                   "1: strb %[val], [%[buf], %[len]]         \n"
                   "3: subs %[len], #1                       \n"
                   "   bpl  1b                               \n"
-                  : [buf] "+r" (q), [val] "+r" (c), [len] "+r" (n)
-                  :
+                  : [buf] "+l" (q), [len] "+l" (n)
+                  : [val] "l" (c)
                   : "r3", "r4", "memory"
                  );
 #elif defined(__riscv)

Reply via email to