GNU bug report logs - #78019
LTO build fails with diffutils 3.12

Previous Next

Package: diffutils;

Reported by: Christian Hesse <list <at> eworm.de>

Date: Wed, 23 Apr 2025 17:58:01 UTC

Severity: normal

To reply to this bug, email your comments to 78019 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#78019; Package diffutils. (Wed, 23 Apr 2025 17:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christian Hesse <list <at> eworm.de>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Wed, 23 Apr 2025 17:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christian Hesse <list <at> eworm.de>
To: bug-diffutils <at> gnu.org
Subject: LTO build fails with diffutils 3.12
Date: Wed, 23 Apr 2025 19:56:17 +0200
[Message part 1 (text/plain, inline)]
Hello everybody,

I am building diffutils 3.12 in a clean build environment for Arch Linux. That
fails when building with link time optimization is enabled:

In function 'diag',
    inlined from 'compareseq' at ../lib/diffseq.h:515:7:
../lib/diffseq.h:426:36: error: 'fxbest' may be used uninitialized [-Werror=maybe-uninitialized]
  426 |               part->ymid = fxybest - fxbest;
      |                                    ^
../lib/diffseq.h: In function 'compareseq':
../lib/diffseq.h:387:32: note: 'fxbest' was declared here
  387 |           OFFSET fxybest = -1, fxbest;
      |                                ^
In function 'diag',
    inlined from 'compareseq' at ../lib/diffseq.h:515:7:
../lib/diffseq.h:433:36: error: 'bxbest' may be used uninitialized [-Werror=maybe-uninitialized]
  433 |               part->ymid = bxybest - bxbest;
      |                                    ^
../lib/diffseq.h: In function 'compareseq':
../lib/diffseq.h:405:40: note: 'bxbest' was declared here
  405 |           OFFSET bxybest = OFFSET_MAX, bxbest;
      |                                        ^
sdiff.c: In function 'edit':
sdiff.c:957:11: error: 'cmd1' may be used uninitialized [-Werror=maybe-uninitialized]
  957 |           switch (cmd1)
      |           ^
sdiff.c:861:11: note: 'cmd1' was declared here
  861 |       int cmd1;
      |           ^
lto1: all warnings being treated as errors

The build succeed as soon as I disable link time optimization. Would be nice
to have a fix for this to reenable lto. Let me know if I can provide more
information on this. Thanks!
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#78019; Package diffutils. (Wed, 23 Apr 2025 18:58:04 GMT) Full text and rfc822 format available.

Message #8 received at 78019 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Christian Hesse <list <at> eworm.de>
Cc: 78019 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#78019: LTO build fails with diffutils 3.12
Date: Wed, 23 Apr 2025 11:56:54 -0700
These are false positives from GCC. I worked around the last one by 
installing the attached patch. The others are due to GCC bug 80922 
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80922>.

How are you invoking 'configure' and 'make', to enable -flto? Perhaps 
diffutils can work around the other GCC bugs by looking at the arguments 
to 'configure' and 'make' and disabling -Wmaybe-uninitialized if you're 
using -flto.




Information forwarded to bug-diffutils <at> gnu.org:
bug#78019; Package diffutils. (Fri, 25 Apr 2025 09:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 78019 <at> debbugs.gnu.org (full text, mbox):

From: Christian Hesse <list <at> eworm.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 78019 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#78019: LTO build fails with diffutils 3.12
Date: Fri, 25 Apr 2025 11:43:46 +0200
[Message part 1 (text/plain, inline)]
Paul Eggert <eggert <at> cs.ucla.edu> on Wed, 2025/04/23 11:56:
> These are false positives from GCC. I worked around the last one by 
> installing the attached patch.

Which attached patch? Do you refer the grep issue here?

> The others are due to GCC bug 80922 
> <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80922>.
> 
> How are you invoking 'configure' and 'make', to enable -flto? Perhaps 
> diffutils can work around the other GCC bugs by looking at the arguments 
> to 'configure' and 'make' and disabling -Wmaybe-uninitialized if you're 
> using -flto.

This is the PKGBUILD file we use to build the Arch Linux package:

https://gitlab.archlinux.org/archlinux/packaging/packages/diffutils/-/blob/main/PKGBUILD

Note that we have set `options=('!lto')` to make the build tools disable lto.

According to our build tools (devtools) we set `LTOFLAGS="-flto=auto"` when
building with lto:

https://gitlab.archlinux.org/archlinux/devtools/-/blob/master/config/makepkg/x86_64.conf#L50

We are suffering these build issues with lots of gnu tools (including grep,
which you fix already; and gzip) since switching to building from git. This
now includes running `bootstrap`. Probably this is caused because newer
autotools generating a different configure script.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#78019; Package diffutils. (Sat, 26 Apr 2025 06:42:02 GMT) Full text and rfc822 format available.

Message #14 received at 78019 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Christian Hesse <list <at> eworm.de>
Cc: 78019 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#78019: LTO build fails with diffutils 3.12
Date: Fri, 25 Apr 2025 23:41:30 -0700
[Message part 1 (text/plain, inline)]
On 2025-04-25 02:43, Christian Hesse wrote:
> Paul Eggert <eggert <at> cs.ucla.edu> on Wed, 2025/04/23 11:56:
>> These are false positives from GCC. I worked around the last one by
>> installing the attached patch.
> 
> Which attached patch? Do you refer the grep issue here?

Sorry, I forgot to attach it in my previous email. Attaching it now.


> This is the PKGBUILD file we use to build the Arch Linux package:
> 
> https://gitlab.archlinux.org/archlinux/packaging/packages/diffutils/-/blob/main/PKGBUILD

Unfortunately, as I don't use Arch I don't know how to decode that file.

What arguments are being passed to './bootstrap', './configure' and 'make'?


> Probably this is caused because newer
> autotools generating a different configure script.

It isn't connected to autotools version. It's because if you have a .git 
subdirectory, './configure' assumes you're a developer and can deal with 
glitches like these.

One workaround is to tell './configure' that you're not interested in 
these warnings, by using './configure --disable-gcc-warnings'.
[0001-sdiff-pacify-gcc-flto-Wmaybe-uninitialized.patch (text/x-patch, attachment)]

This bug report was last modified 19 days ago.

Previous Next


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