ccan/rune: compile without warnings on -O3.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 4 Jul 2022 00:11:57 +0000 (09:41 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 4 Jul 2022 00:11:57 +0000 (09:41 +0930)
```
ccan/ccan/rune/rune.c: In function ‘rune_alt_single_int’:
ccan/ccan/rune/rune.c:257:5: error: ‘runeval_int’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  257 |  if (cond)
      |     ^
ccan/ccan/rune/rune.c:305:6: note: ‘runeval_int’ was declared here
  305 |  s64 runeval_int;
      |      ^~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:919: ccan-rune-rune.o] Error 1
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/rune/rune.c

index 0ff7968b4aa9b093f42bb5febdd6fb4b455b8e25..84296c66b33d8707fa7a6a162e245205f04a0daf 100644 (file)
@@ -302,7 +302,7 @@ static const char *rune_alt_single(const tal_t *ctx,
                                   const s64 *fieldval_int)
 {
        char strfield[STR_MAX_CHARS(s64) + 1];
-       s64 runeval_int;
+       s64 runeval_int = 0 /* gcc v9.4.0 gets upset with uninitiaized var at -O3 */;
        const char *err;
 
        /* Caller can't set both! */