Subject: Compile error due to lto warning on Arch Linux -Werror=maybe-uninitialized

From: Tobias Powalowski <[email-masked]>
Date: Tue, 27 Aug 2024 20:51:20 +0200

Hi,

In function 'canonicalize_filename_mode_stk',
     inlined from 'canonicalize_filename_mode' at lib/canonicalize.c:464:18,
     inlined from 'get_dev' at src/df.c:1111:26:
lib/canonicalize.c:383:33: error: 'end_idx' may be used uninitialized 
[-Werror=maybe-uninitialized]
   383 |                 end = extra_buf + end_idx;
       |                                 ^
lib/canonicalize.c: In function 'get_dev':
lib/canonicalize.c:370:21: note: 'end_idx' was declared here
   370 |               idx_t end_idx;
       |                     ^
lto1: all warnings being treated as errors
make[3]: *** [/tmp/ccPldcTP.mk:2: /tmp/cc83dm7m.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:11281: src/df] Error 1
make[2]: Leaving directory '/build/coreutils/src/coreutils'
make[1]: *** [Makefile:22568: all-recursive] Error 1
make[1]: Leaving directory '/build/coreutils

I get this while compiling v9.5 git tag after bootstrap.

Using:  make CFLAGS="$CFLAGS -Wno-maybe-uninitialized"
is a workaround at the moment.

Best regards

tpowa

-- 
Tobias Powalowski
Arch Linux Developer (tpowa)
https://www.archlinux.org
[email-masked]

Archboot Developer
https://archboot.com

St. Martin-Apotheke
Herzog-Georg-Str. 25
89415 Lauingen
https://www.st-martin-apo.de
[email-masked]