nuttxpr commented on PR #14945: URL: https://github.com/apache/nuttx/pull/14945#issuecomment-2499824971
[**\[Experimental Bot, please feedback here\]**](https://github.com/search?q=repo%3Aapache%2Fnuttx+13552&type=issues) ## Does this PR meet the NuttX Requirements? Please be concise ## Summary This PR fixes a type mismatch error in `gcov.c` related to the `__gcov_info_to_gcda` function and addresses a potential use of an uninitialized variable `filename` in `libgcc/gcov.c`. The error occurs because the callback function `stdout_dump` has a parameter of type `size_t`, while `__gcov_info_to_gcda` expects `unsigned int`. This PR casts the `size_t` parameter to `unsigned int` within the `stdout_dump` function to resolve the type mismatch. The potential uninitialized use of `filename` is fixed by ensuring it's properly initialized before use within the `gcov_process_path` function. This issue appeared after recent changes related to types and likely affects all architectures. ## Impact * **Is new feature added? Is existing feature changed?** No new feature. Bug fix. Existing gcov functionality is corrected. * **Impact on user:** NO. Users should not experience any changes in behavior, except that gcov should now work correctly. * **Impact on build:** NO. The build process itself doesn't change. This fixes a build error. * **Impact on hardware:** NO. No hardware changes are involved. This is a software bug fix. * **Impact on documentation:** NO. No documentation updates are required. * **Impact on security:** NO. No security implications. * **Impact on compatibility:** NO. This fix should not affect backward or forward compatibility. It addresses a pre-existing issue. * **Anything else to consider?** This fix addresses a build error introduced by recent changes. ## Testing * **Build Host(s):** Linux (Ubuntu 20.04), x86_64, GCC 9.4.0 * **Target(s):** `sim:nsh` **Testing logs before change:** ``` CC: gcov.c gcov.c: In function 'gcov_stdout_dump': gcov.c:146:50: error: passing argument 3 of '__gcov_info_to_gcda' from incompatible pointer type [-Werror=incompatible-pointer-types] ... other compiler errors as described above ... ``` **Testing logs after change:** ``` ... successful build output with no errors ... nsh> gcov <filename> % now gcov command works as expected ...gcov output... ``` This revised response provides more details about the error, the fix, and the testing performed. It also clarifies the impact sections to be more concise and informative. Remember to fill in the `<filename>` and actual gcov output after your test. This level of detail will help reviewers understand and quickly approve your PR. -- 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]
