waf: compiler flags, uninitalized variable
Hal Murray
halmurray at sonic.net
Thu Jul 31 10:47:21 UTC 2025
Thanks. I was hoping that somebody would be familiar with this area and
just recognize what was going on.
> Usually, you won't get that type of warning unless you enable it. And
> usually, you only get that type of warning in an optimized compile, since
> the dataflow analysis needed to detect it is part of the optimization
> code.
gcc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2)
No error or warning.
Here is output from waf build -v
00:12:34 runner ['/usr/sbin/gcc', '-DUNITY_EXCLUDE_FLOAT_PRINT',
'-Wshadow', '-Wpacked', '-Wcast-qual', '-Wmissing-declarations',
'-Wdisabled-optimization', '-Wimplicit-function-declaration',
'-Winvalid-pch', '-Wpointer-arith', '-Wwrite-strings', '-Winit-self',
'-Wfloat-equal', '-Wformat', '-Wformat-signedness', '-Wformat-security',
'-Wsuggest-attribute=noreturn', '-Wimplicit-fallthrough=3', '-fPIC',
'-O1', '-Wall', '-Wextra', '-Wmissing-prototypes', '-Wstrict-prototypes',
'-Wundef', '-Wunused', '-Winline', '-Wswitch-default', '-Wswitch-enum',
'-g', '-std=c99', '-D_GNU_SOURCE', '-I..', '-Iinclude', '-I../../include',
'-Ilibaes_siv', '-I../../libaes_siv', '-I/usr/local/ssl/include',
'-DPYTHONDIR="/usr/local/lib/python3.13/site-packages"',
'-DPYTHONARCHDIR="/usr/local/lib/python3.13/site-packages"',
'../../attic/tls-tester.c', '-c', '-o/home/murray/ntpsec/play/hgm/main/atti
c/tls-tester.c.14.o']
The man page says -Wuninitialized and -Wmaybe-uninitialized are both
enabled by -Wall and also -Wextra
--------
cc (Debian 12.2.0-14+deb12u1) 12.2.0
../../attic/tls-tester.c:165:10: warning: \u2018sent\u2019 may be used
uninitialized [-Wmaybe-uninitialized]
cc (Debian 8.3.0-6) 8.3.0
../../attic/tls-tester.c:165:10: warning: \u2018sent\u2019 may be used
uninitialized in this function [-Wmaybe-uninitialized]
cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
../../attic/tls-tester.c:165:10: warning: \u2018sent\u2019 may be used
uninitialized in this function [-Wmaybe-uninitialized]
cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
../../attic/tls-tester.c:165:10: warning: \u2018sent\u2019 may be used
uninitialized in this function [-Wmaybe-uninitialized]
cc (Ubuntu 14.2.0-19ubuntu2) 14.2.0
no error or warning
NetBSD:
cc (nb3 20231008) 10.5.0
../../attic/tls-tester.c:165:8: warning: \u2018sent\u2019 may be used
uninitialized in this function [-Wmaybe-uninitialized]
cc (nb4 20200810) 7.5.0
../../attic/tls-tester.c:165:8: warning: \u2018sent\u2019 may be used
uninitialized in this function [-Wmaybe-uninitialized]
FreeBSD clang version 19.1.7
../../attic/tls-tester.c:165:12: warning: variable 'sent' is uninitialized
when used here [-Wuninitialized]
cc (Raspbian 12.2.0-14+rpi1) 12.2.0
../../attic/tls-tester.c:165:10: warning: \u2018sent\u2019 may be used
uninitialized [-Wmaybe-uninitialized]
If anybody wants to play, here is the edit to put the bug back in:
diff --git a/attic/tls-tester.c b/attic/tls-tester.c
index adbce9a84..3c57fdc0e 100644
--- a/attic/tls-tester.c
+++ b/attic/tls-tester.c
@@ -162,7 +162,7 @@ static int chunkify(SSL *ssl, uint8_t *buff, int
bytes) {
while (0<bytes) {
int to_send, sent;
to_send = random() % (bytes+1);
- if (0==total && to_send==bytes) {
+ if (0==sent && to_send==bytes) {
/* avoid all in one chunk */
continue;
}
--
These are my opinions. I hate spam.
More information about the devel
mailing list