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

Compile error with gcc 15-20241117 -Wunterminated-string-initialization #194

Closed
heitbaum opened this issue Nov 20, 2024 · 7 comments
Closed
Assignees

Comments

@heitbaum
Copy link

heitbaum commented Nov 20, 2024

const unsigned char ascii64[65] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
/* 0000000000111111111122222222223333333333444444444455555555556666 */
/* 0123456789012345678901234567890123456789012345678901234567890123 */
"\x00";

/bin/dash ./libtool  --tag=CC   --mode=compile /var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/toolchain/bin/x86_64-libreelec-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/libxcrypt-4.4.36  -I/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/libxcrypt-4.4.36/lib -DIN_LIBCRYPT  -Wall -Wextra -Walloc-zero -Walloca -Wbad-function-cast -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation=1 -Wlogical-op -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wnull-dereference -Wold-style-definition -Wpointer-arith -Wrestrict -Wshadow -Wstrict-overflow=2 -Wstrict-prototypes -Wundef -Wvla -Wwrite-strings -Wpedantic -Werror -fno-plt -march=x86-64-v3 -Wall -pipe  -O2 -fomit-frame-pointer -DNDEBUG -MT lib/libcrypt_la-util-xbzero.lo -MD -MP -MF lib/.deps/libcrypt_la-util-xbzero.Tpo -c -o lib/libcrypt_la-util-xbzero.lo `test -f 'lib/util-xbzero.c' || echo '/var/media/DATA/home-rudi/LibreELEC.tv/build.LibreELEC-Generic.x86_64-13.0-devel/build/libxcrypt-4.4.36/'`lib/util-xbzero.c
../lib/util-base64.c:24:3: error: initializer-string for array of 'unsigned char' is too long [-Werror=unterminated-string-initialization]
   24 |   "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
@WentsingNee
Copy link

me too

microsoft/vcpkg#41695

besser82 added a commit that referenced this issue Dec 31, 2024
This fixes GCC 15 to complain about "unterminated-string-initialization".

Fixes #194.
@besser82
Copy link
Owner

@heitbaum and @WentsingNee Can you please confirm the referenced commit does fix your issue?

@besser82 besser82 self-assigned this Dec 31, 2024
@WentsingNee
Copy link

@heitbaum and @WentsingNee Can you please confirm the referenced commit does fix your issue?

yes, adjusting array size can fix my issue

@besser82
Copy link
Owner

Can you please re-check with the updated commit?

@heitbaum
Copy link
Author

heitbaum commented Jan 1, 2025

55bc82b Builds fine
05814bd Does not

../lib/util-base64.c:24:3: error: initializer-string for array of 'unsigned char' is too long [-Werror=unterminated-string-initialization]
   24 |   "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\0";
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@heitbaum
Copy link
Author

heitbaum commented Jan 1, 2025

It does build with the \0 removed

--- a/lib/util-base64.c
+++ b/lib/util-base64.c
@@ -21,7 +21,6 @@
 #include "crypt-port.h"
 
 const unsigned char ascii64[65] =
-  "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-/* 0000000000111111111122222222223333333333444444444455555555556666 */
-/* 0123456789012345678901234567890123456789012345678901234567890123 */
-  "\x00";
+  "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+/* 0000000000111111111122222222223333333333444444444455555555556666\0 */
+/* 0123456789012345678901234567890123456789012345678901234567890123\0 */

@besser82
Copy link
Owner

besser82 commented Jan 1, 2025

It does build with the \0 removed

--- a/lib/util-base64.c
+++ b/lib/util-base64.c
@@ -21,7 +21,6 @@
 #include "crypt-port.h"
 
 const unsigned char ascii64[65] =
-  "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-/* 0000000000111111111122222222223333333333444444444455555555556666 */
-/* 0123456789012345678901234567890123456789012345678901234567890123 */
-  "\x00";
+  "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+/* 0000000000111111111122222222223333333333444444444455555555556666\0 */
+/* 0123456789012345678901234567890123456789012345678901234567890123\0 */

Fixed that way in 819352f.

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

No branches or pull requests

3 participants