While building libdv using gcc (clang untested) with -faggressive-loop-optimizations CFLAG set, I get this kind of message: iteration 11 invokes undefined behavior in libdv/encode.c Then, forcing adding -fno-aggressive-loop-optimizations and -fno--unsafe-loop-optimizations too all flags (for safety) solves the issue. Reproducible: Always Steps to Reproduce: 1. Put -faggressive-loop-optimizations -Wno-aggressive-loop-optimizations in compilation flags 2. Emerge libdv 3. See the output Actual Results: I got the 'undefined behavior' warning message Expected Results: It seems better not to have undefined behavior. The way I did is create a file in /etc/portage/env with the following and use it for libdv adding a reference in /etc/portage/package.env ADD_FLAGS="-fno-aggressive-loop-optimizations -fno-unsafe-loop-optimizations" CFLAGS="${CFLAGS} ${ADD_FLAGS} " CXXFLAGS="${CXXFLAGS} ${ADD_FLAGS}" FCFLAGS="${FCFLAGS} ${ADD_FLAGS}" FFLAGS="${FFLAGS} ${ADD_FLAGS}" LDFLAGS="${LDFLAGS} ${ADD_FLAGS}"
Created attachment 824819 [details] output from emerge --info =media-libs/libdv-1.0.0-r4
Created attachment 824821 [details] Log file for failing merge
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7deee8cade4462ff88a83acfe0a996c158af32a commit b7deee8cade4462ff88a83acfe0a996c158af32a Author: Sam James <sam@gentoo.org> AuthorDate: 2025-01-04 15:53:08 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-01-04 15:54:59 +0000 media-libs/libdv: misc fixes * Build with -std=gnu89 (bug #927212) I'm going to take a look at the patches attached there and may apply them in a new revision, but I wanted to get this out with the various fixes so far in stable first. * Force bfd (bug #910291) * Build with -fno-strict-aliasing -fno-aggressive-loop-optimizations (bug #877709) Bug: https://bugs.gentoo.org/877709 Bug: https://bugs.gentoo.org/927212 Closes: https://bugs.gentoo.org/910291 Signed-off-by: Sam James <sam@gentoo.org> .../libdv/{libdv-1.0.0-r4.ebuild => libdv-1.0.0-r5.ebuild} | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)