hujun260 opened a new pull request, #3377:
URL: https://github.com/apache/nuttx-apps/pull/3377

   ## Summary
   
   Fix compiler warning about uninitialized variable in the watchdog test. The 
`flags` variable in `wdtest_rand()` was not initialized and could trigger 
`-Werror=maybe-uninitialized` error on certain architectures (e.g., 
x86_64/intel64) where the compiler detects potential use before assignment.
   
   ## Changes
   
   **File: testing/ostest/wdog.c**
   - Initialize `flags` variable to 0 at declaration
   - Fixes build error on qemu-intel64/nsh_pci_smp configuration
   
   **Root cause:**
   The `flags` variable is conditionally assigned only when `cnt % 2` is true, 
but the compiler cannot determine at compile time that the corresponding 
`leave_critical_section(flags)` will only be called when the variable was 
actually assigned.
   
   ```c
   // Before: uninitialized
   irqstate_t flags;
   
   // After: initialized
   irqstate_t flags = 0;


-- 
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