Patchy was Re: waf: compiler flags, uninitialized variable
James Browning
jamesb192 at jamesb192.com
Wed Jul 30 18:57:06 UTC 2025
On Wednesday, July 30, 2025 12:04:52 AM Pacific Daylight Time Matt Selsky via
devel wrote:
> On Tue, Jul 29, 2025 at 11:22:18PM -0700, Hal Murray via devel wrote:
> > Are we missing one?
> >
> > I had a typo. I was using an uninitialized variable. Modern compilers
> > didn't complain. Old ones did. (I don't set any compiler or loader
> > flags.)
>
> Hi Hal,
>
> What compiler flag did you want to pass? Can you check config.log for what
> flags are passed to the compiler on your various platforms?
TLDR: I found two hits and attached a diff to resolve them, after running
something like the following. clang is 20.1.8 on Asahi 42
```console
ntpsec $ CC=clang CFLAGS="-Weverything -O0" ./waf configure build --refclock
all -pj12 --enable-{attic,mssntp,leap-{smear,testing},seccomp,early-
droproot,debug} 2>&1 > foob
ntpsec $ cat foob|sed -rn "s|.*\[(-W.*)\]$|\1|gp"|sort|uniq -c|sort -nr
2873 -Wunsafe-buffer-usage
1368 -Wpadded
396 -Wextra-semi-stmt
222 -Wsign-conversion
168 -Wdouble-promotion
129 -Wshorten-64-to-32
115 -Wmissing-variable-declarations
87 -Wimplicit-int-float-conversion
75 -Wimplicit-int-conversion
72 -Wunused-macros
63 -Wdeclaration-after-statement
46 -Wcast-align
31 -Wcovered-switch-default
21 -Wimplicit-float-conversion
20 -Wfloat-conversion
20 -Wdisabled-macro-expansion
17 -Wunreachable-code
17 -Wformat-nonliteral
16 -Wunreachable-code-break
12 -Wimplicit-fallthrough
6 -Wused-but-marked-unused
5 -Wcast-function-type-strict
5 -Wbad-function-cast
4 -Wreserved-identifier
4 -Wformat-pedantic
2 -Wpedantic
2 -Wextra-semi
2 -Wconditional-uninitialized
2 -Wcomma
1 -Wunreachable-code-return
1 -Wstring-conversion
1 -Wreserved-macro-identifier
1 -Wmissing-noreturn
1 -Wformat
ntpsec $ cat foob|grep uninit -A 1
../../libntp/authreadkeys.c:424:34: warning: variable 'type' may be
uninitialized when used here [-Wconditional-uninitialized]
424 | len = check_key_length(keyno, type, name,
upcased, len);
--
../../ntpfrob/precision.c:92:2: warning: variable 'diff' may be uninitialized
when used here [-Wconditional-uninitialized]
92 | diff /= 1000; /* step down to milliseconds */
```
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-uninitialized.diff
Type: text/x-patch
Size: 721 bytes
Desc: not available
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20250730/cbd1d468/attachment.bin>
More information about the devel
mailing list