Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unitialized memory to allow more strict build flags #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zackees
Copy link

@zackees zackees commented Dec 1, 2021

C:\Users\niteris.platformio\packages\framework-arduinoteensy\libraries\USBHost_t36\hid.cpp: In member function 'void USBHIDParser::parse()':
C:\Users\niteris.platformio\packages\framework-arduinoteensy\libraries\USBHost_t36\hid.cpp:361:20: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
usage_page = val;
^
C:\Users\niteris.platformio\packages\framework-arduinoteensy\libraries\USBHost_t36\hid.cpp: In member function 'void USBHIDParser::parse(uint16_t, const uint8_t*, uint32_t)':
C:\Users\niteris.platformio\packages\framework-arduinoteensy\libraries\USBHost_t36\hid.cpp:524:37: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
logical_max = signedval(val, tag);

@@ -338,7 +338,7 @@ void USBHIDParser::parse()
p += *p + 3;
continue;
}
uint32_t val;
uint32_t val = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the wrong fix. Yes, I guess the compiler optimized the double val =0 away, but it's not nice to read and lazy.

There should be a default case instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants