-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Compilation with GCC 11 fails #1077
Comments
May be |
You may fix static char serialnumber[28] = {0}; to static char serialnumber[STLINK_SERIAL_MAX_SIZE] = {0}; |
I prefer see fix in upstream. |
@Vascom I too. But to fix it in upstream, you need to check works of it. ps You have created a issue description not in accordance with a template. @Nightwalker-87 may delete it. See #906 |
Yes, it works. Template not care about compiling problems. |
The template is meant to be used and to be filled with content which also includes a description. So please consider this next time. |
I nearly suggested that (I originally found the issue testing gcc-11 with Fedora). My concern with that was this loop in gdb-server.c: Which would be affected by changing the size of "serialnumber". Without knowing the intent or the code in general I didn't feel comfortable recommending changing the size of "serialnumber". And to give folks a bit of background. gcc-11 has added diagnostics to detect out of bounds accesses for array arguments. In simplest terms if a function declares an argument as an array with a fixed length, then GCC assumes the entire array could potentially be referenced. stlink_open_usb declares its 3rd argument as a 64 byte character array, yet "serialnumber" is just 28 bytes and GCC naturally warns because it thinks there's a potential out-of-bounds of the "serialnumber" argument by stlink_open_usb. |
I can't build stlink 1.6.1 with GCC 11 compiler. Fedora GNU/Linux Rawhide.
Errors are:
Please help me correct it.
The text was updated successfully, but these errors were encountered: