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 */
```
diff --git a/libntp/authreadkeys.c b/libntp/authreadkeys.c
index c249cacd9..e8c758b08 100644
--- a/libntp/authreadkeys.c
+++ b/libntp/authreadkeys.c
@@ -298,7 +298,7 @@ authreadkeys(
 	FILE	*fp;
 	char	*line;
 	keyid_t	keyno;
-	AUTH_Type type;
+	AUTH_Type type = AUTH_NONE;
 	char	buf[512];		/* lots of room for line */
 	uint8_t	keystr[32];		/* Bug 2537 */
 	char *	name;
diff --git a/ntpfrob/precision.c b/ntpfrob/precision.c
index f28b6539c..ae35eb8b4 100644
--- a/ntpfrob/precision.c
+++ b/ntpfrob/precision.c
@@ -73,7 +73,7 @@ default_get_resolution(void)
 	struct timespec tp = {0, 0};
 	long last;
 	int i;
-	long diff;
+	long diff = 0;
 	long val;
 	int minsteps = MINLOOPS;	/* need at least this many steps */
 
_______________________________________________
devel mailing list
devel@ntpsec.org
https://lists.ntpsec.org/mailman/listinfo/devel

Reply via email to