bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 3/4] builtins/printf.def: fix type mismatch in tescape call


From: Shubham Chakraborty
Subject: [PATCH v2 3/4] builtins/printf.def: fix type mismatch in tescape call
Date: Tue, 14 Jul 2026 16:01:46 +0530

When HANDLE_MULTIBYTE is disabled, the 'c' variable is an int, but
tescape expects a char * as its second argument. This causes a type
mismatch error.

This fixes the following failure seen with br-arm-basic toolchain:

./printf.def:1230:26: error: passing argument 2 of 'tescape' from incompatible 
pointer type [-Werror=incompatible-pointer-types]
 1230 |       s += tescape (s, &c, (int *)NULL, &temp);
      |                        ^~
      |                        |
      |                        int *
./printf.def:1068:30: note: expected 'char *' but argument is of type 'int *'
 1068 | tescape (char *estart, char *cp, int *lenp, int *sawc)
      |                        ~~~~~~^~

Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
---
 builtins/printf.def | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/builtins/printf.def b/builtins/printf.def
index f7abf53d..7332736c 100644
--- a/builtins/printf.def
+++ b/builtins/printf.def
@@ -1227,7 +1227,11 @@ bexpand (char *string, size_t len, int *sawc, size_t 
*lenp)
       memset (mbch, '\0', sizeof (mbch));
       s += tescape (s, mbch, &mblen, &temp);
 #else
-      s += tescape (s, &c, (int *)NULL, &temp);
+      {
+       char cc;
+       s += tescape (s, &cc, (int *)NULL, &temp);
+       c = cc;
+      }
 #endif
       if (temp)
        {
-- 
2.55.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]