casaroli commented on code in PR #20996:
URL: https://github.com/apache/nuttx/pull/20996#discussion_r4398263475


##########
libs/libc/stream/lib_ultoa_invert.c:
##########
@@ -57,8 +60,30 @@ FAR char *__ultoa_invert(unsigned long long val, FAR char 
*str, int base)
     {
       int v;
 
+#if !defined(CONFIG_ARCH_64BIT) && defined(CONFIG_HAVE_EXPRESSION_STATEMENT)
+      unsigned long long q;
+
+      switch (base)
+        {
+          case 8:
+            q = div64_const(val, 8);
+            break;
+          case 10:
+            q = div64_const(val, 10);
+            break;
+          case 16:
+            q = div64_const(val, 16);
+            break;
+          default:
+            DEBUGASSERT(0);
+        }
+
+      v = (int)(val - q * base);

Review Comment:
   `q` is not set in the `default:` case, so GCC fails with `'q' may be used 
uninitialized [-Werror=maybe-uninitialized]` here (CI risc-v-01, run 
40650699080).
   
   Fix: use `case 16: default:` for the base 16 branch.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to