GNU bug report logs - #72842
Compile error due to lto warning on Arch Linux -Werror=maybe-uninitialized

Previous Next

Package: coreutils;

Reported by: Tobias Powalowski <tobias.powalowski <at> googlemail.com>

Date: Tue, 27 Aug 2024 21:00:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Tobias Powalowski <tobias.powalowski <at> googlemail.com>
Subject: bug#72842: closed (Re: bug#72842: Compile error due to lto
 warning on Arch Linux -Werror=maybe-uninitialized)
Date: Wed, 28 Aug 2024 11:40:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 72842 <at> debbugs.gnu.org.

-- 
72842: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72842
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>,
 Tobias Powalowski <tobias.powalowski <at> googlemail.com>
Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 72842-done <at> debbugs.gnu.org
Subject: Re: bug#72842: Compile error due to lto warning on Arch Linux
 -Werror=maybe-uninitialized
Date: Wed, 28 Aug 2024 12:37:15 +0100
[Message part 3 (text/plain, inline)]
On 27/08/2024 22:34, Paul Eggert wrote:
> I'm not seeing that false alarm when building coreutils v9.5 on Ubuntu
> 24.04 LTS with "./configure --enable-gcc-warnings CC=gcc-14".
> 
> What GCC version are you using? If it's not GCC 14, try upgrading. I'm
> using gcc-14 (Ubuntu 14-20240412-0ubuntu1) 14.0.1 20240412
> (experimental) [master r14-9935-g67e1433a94f].

I think LTO is key here, as GCC has more context then to produce warnings.
With `-march=native -O3 -flto` on GCC 14.2.1 I see,
2 false warnings in gnulib (patch attached).
1 correct warning in coreutils (patch attached).

Marking this as done.
I'll apply the patches later today.

cheers,
Pádraig.
[gnulib-lto.patch (text/x-patch, attachment)]
[coreutils-xdectoint-lto.patch (text/x-patch, attachment)]
[Message part 6 (message/rfc822, inline)]
From: Tobias Powalowski <tobias.powalowski <at> googlemail.com>
To: bug-coreutils <at> gnu.org
Subject: Compile error due to lto warning on Arch Linux
 -Werror=maybe-uninitialized
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
tpowa <at> archlinux.org

Archboot Developer
https://archboot.com

St. Martin-Apotheke
Herzog-Georg-Str. 25
89415 Lauingen
https://www.st-martin-apo.de
info <at> st-martin-apo.de




This bug report was last modified 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.