Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 877709

Summary: media-libs/libdv-1.0.0-r4: undefined behavior with aggressive loop optimizations
Product: Gentoo Linux Reporter: Jocelyn Mayer <l_indien>
Component: Current packagesAssignee: Gentoo Media-video project <media-video>
Status: UNCONFIRMED ---    
Severity: normal CC: l_indien
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also:
Package list:
Runtime testing required: ---
Attachments: output from emerge --info =media-libs/libdv-1.0.0-r4
Log file for failing merge

Description Jocelyn Mayer 2022-10-20 04:59:12 UTC
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"
Comment 1 Jocelyn Mayer 2022-10-20 05:00:03 UTC
Created attachment 824819 [details]
output from emerge --info =media-libs/libdv-1.0.0-r4
Comment 2 Jocelyn Mayer 2022-10-20 05:01:51 UTC
Created attachment 824821 [details]
Log file for failing merge