Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 226647 - >=media-video/ffmpeg-20070616-r2 does not build with gcc-4.3.1 -O2 -ftracer
Summary: >=media-video/ffmpeg-20070616-r2 does not build with gcc-4.3.1 -O2 -ftracer
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High normal
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords:
: 236697 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-14 13:49 UTC by gent_bz
Modified: 2008-10-14 08:59 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
testcase (testcase-min.i,1.01 KB, text/plain)
2008-08-17 19:24 UTC, Alexis Ballier
Details
smaller manually reduced testcase (minimal2.i,650 bytes, text/plain)
2008-08-17 20:01 UTC, Alexis Ballier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gent_bz 2008-06-14 13:49:49 UTC
Tail end of output of CFLAGS="-O2 -ftracer" emerge =ffmpeg-20080206 or =ffmpeg-20080326 

x86_64-pc-linux-gnu-gcc -O2 -ftracer -DBROKEN_RELOCATIONS -pthread -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -fno-math-errno -fno-signed-zeros -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavutil -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavcodec -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavformat -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libswscale -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavdevice -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavfilter -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -DHAVE_AV_CONFIG_H  -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg" -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavcodec -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavdevice -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavfilter -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavformat -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libavutil -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libpostproc -I"/var/tmp/portage/media-video/ffmpeg-0.4.9_p20080326/work/ffmpeg"/libswscale -O2 -ftracer -DBROKEN_RELOCATIONS -pthread -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -fno-math-errno -fno-signed-zeros -fPIC -DPIC -c -o i386/mpegvideo_mmx.o i386/mpegvideo_mmx.c
i386/mpegvideo_mmx.c: Assembler messages:
i386/mpegvideo_mmx.c:61: Error: suffix or operands invalid for `movd'
Comment 1 gent_bz 2008-06-16 02:11:23 UTC
Fails in the same way for unmasked ebuild, so changed summary.

Maybe this should block bug 198121?
Comment 2 Ben de Groot (RETIRED) gentoo-dev 2008-06-16 22:05:44 UTC
-ftracer is not among the officially supported c(xx)flags on Gentoo, so if it breaks something, you get to keep the pieces ;-)
Comment 3 Jory A. Pratt gentoo-dev 2008-06-21 03:32:38 UTC
(In reply to comment #2)
> -ftracer is not among the officially supported c(xx)flags on Gentoo, so if it
> breaks something, you get to keep the pieces ;-)
> 

Gentoo has always used this excuse they refuse to support it if they do not use it on there systems. If a package is known to have an issue like ffmpeg it should be filters but they rather close as wontfix. 
Comment 4 Jory A. Pratt gentoo-dev 2008-06-21 03:37:26 UTC
I should also not from flag-o-matic eclass


# Remove particular <flags> from {C,CPP,CXX}FLAGS.  Accepts shell globs.
filter-flags() {
	_filter-hardened "$@"
	_filter-var CFLAGS "$@"
	_filter-var CPPFLAGS "$@"
	_filter-var CXXFLAGS "$@"
	return 0
}
Comment 5 Eric Smith 2008-06-24 15:54:12 UTC
I have the same problem. Why can't you add ftracer to the filtered list?  Isn't that what it's for?
Comment 6 Alexis Ballier gentoo-dev 2008-06-24 16:09:55 UTC
does it fail with gcc 4.2 ? are we trying to hide a gcc bug or is ffmpeg at fault ?

imho flag filtering should be used for extreme cases since it often gets forgotten when the real bug is fixed.
Comment 7 Alexis Ballier gentoo-dev 2008-08-17 19:21:58 UTC
reopening as I've been able to reproduce it so we can keep track of this
Comment 8 Alexis Ballier gentoo-dev 2008-08-17 19:22:37 UTC
reassigning as this seems a gcc 4.3 bug
Comment 9 Alexis Ballier gentoo-dev 2008-08-17 19:24:48 UTC
Created attachment 163132 [details]
testcase

$ gcc -c -O2 testcase-min.i 
testcase-min.i:18: warning: ‘struct MpegEncContext’ declared inside parameter list
testcase-min.i:18: warning: its scope is only this definition or declaration, which is probably not what you want
testcase-min.i: In function ‘MPV_common_init_mmx’:
testcase-min.i:35: warning: assignment from incompatible pointer type

-> works

$ gcc -c -O2 -ftracer testcase-min.i 
testcase-min.i:18: warning: ‘struct MpegEncContext’ declared inside parameter list
testcase-min.i:18: warning: its scope is only this definition or declaration, which is probably not what you want
testcase-min.i: In function ‘MPV_common_init_mmx’:
testcase-min.i:35: warning: assignment from incompatible pointer type
testcase-min.i: Assembler messages:
testcase-min.i:27: Error: suffix or operands invalid for `movd'

-> fail

$ gcc -c -O1 -ftracer testcase-min.i 
testcase-min.i:18: warning: ‘struct MpegEncContext’ declared inside parameter list
testcase-min.i:18: warning: its scope is only this definition or declaration, which is probably not what you want
testcase-min.i: In function ‘MPV_common_init_mmx’:
testcase-min.i:35: warning: assignment from incompatible pointer type

-> works


this is probably worth reporting to gcc upstream but toolchain people will have to teach me how first :p


I obtained this testcase by playing with the delta tool and following instructions from: http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction
Comment 10 Alexis Ballier gentoo-dev 2008-08-17 20:01:21 UTC
Created attachment 163134 [details]
smaller manually reduced testcase

previous logs were with gcc 4.3.1:
gcc (Gentoo 4.3.1-r1 p1.1) 4.3.1

now trying with debian's gcc:
gcc-4.3 (Debian 4.3.1-9) 4.3.1 fails the same way
gcc-4.2 (GCC) 4.2.4 (Debian 4.2.4-3) does not fail
Comment 11 SpanKY gentoo-dev 2008-08-20 06:42:15 UTC
ffmpeg is broken

the asm you posted was:
asm volatile(
  "movd %2, %%mm5\n"
  : :"r" (nCoeffs), "g"(qmul), "g" (qadd), "r" (2*(-nCoeffs))
);

the "g" constraint says:
Any register, memory or immediate integer operand is allowed, except for registers that are not general registers.

clearly an immediate integer is not allowed with a movd instruction
Comment 12 Alexis Ballier gentoo-dev 2008-08-22 11:18:24 UTC
(In reply to comment #11)
> ffmpeg is broken
> 
> the asm you posted was:
> asm volatile(
>   "movd %2, %%mm5\n"
>   : :"r" (nCoeffs), "g"(qmul), "g" (qadd), "r" (2*(-nCoeffs))
> );
> 
> the "g" constraint says:
> Any register, memory or immediate integer operand is allowed, except for
> registers that are not general registers.
> 
> clearly an immediate integer is not allowed with a movd instruction

Doh! Stupid me, I didn't even check the validity of the constraints :/ Thanks.
Sent a patch upstream for that, let's wait for their opinions.
Comment 13 Alexis Ballier gentoo-dev 2008-09-04 18:23:49 UTC
*** Bug 236697 has been marked as a duplicate of this bug. ***
Comment 14 Alexis Ballier gentoo-dev 2008-09-04 18:24:52 UTC
please try with that patch: 
http://svn.mplayerhq.hu/ffmpeg/trunk/libavcodec/i386/mpegvideo_mmx.c?r1=13098&r2=14941
it should make the problems go away

still needs to be backported though
Comment 15 Seemant Kulleen 2008-09-04 18:57:03 UTC
so that patch works for me to make a successful compile.  thanks!
Comment 16 Alexis Ballier gentoo-dev 2008-10-14 08:59:27 UTC
fixed in 0.4.9_p20081014 (still masked though)