[FFmpeg-devel] [RFC] current compilation status when no optimizations enabled

Måns Rullgård mans
Sat Jun 21 12:47:19 CEST 2008


Baptiste Coudurier <baptiste.coudurier at smartjog.com> writes:

> Hi guys
>
> While I was compiling ffmpeg with --enable-debug, I noticed the option did
> not have much effect on CFLAGS.
>
> I edited config.mak and removed "-fomit-frame-pointer -O3", and added
> "-ggdb3"

FYI, the same effect can be achieved with --disable-optimizations
--enable-debug=gdb3.

> gcc (Debian 4.3.1-2) 4.3.1

FWIW, GCC 4.3.1 still miscompiles the Linux kernel, at least on ARM.
I wouldn't trust it.

> libavcodec/i386/dsputil_mmx.c:617: error: can't find a register in class 'GENERAL_REGS' while
> reloading 'asm'
> libavcodec/i386/dsputil_mmx.c:617: error: 'asm' operand has impossible constraints
> make: *** [libavcodec/i386/dsputil_mmx.o] Error 1

This is a result of disabled optimisations.

> Compilation pass adding -O1
>
> libavcodec/cabac.h: In function 'get_cabac_noinline':
> libavcodec/cabac.h:529: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
> libavcodec/cabac.h:529: error: 'asm' operand has impossible constraints
> In file included from libavcodec/h264.c:8106:
> libavcodec/svq3.c: In function 'svq3_decode_slice_header':
> libavcodec/svq3.c:707: warning: cast discards qualifiers from pointer target type
> make: *** [libavcodec/h264.o] Error 1

Apparently, -O1 isn't enough.

> Compilation pass adding -fomit-frame-pointer (no -On needed)
>
> gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I.
> -I"/home/bcouduri/src/ffmpeg/svn2" -pthread -ggdb3 -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       -c -o libavcodec/h264_parser.o
> libavcodec/h264_parser.c
> cc1: warning: -funit-at-a-time is required for inlining of functions that are only called once
> In file included from libavcodec/h264.h:32,
>                  from libavcodec/h264_parser.h:31,
>                  from libavcodec/h264_parser.c:29:
> libavcodec/cabac.h: In function 'get_cabac_noinline':
> libavcodec/cabac.h:529: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
> libavcodec/cabac.h:529: error: 'asm' operand has impossible constraints
> make: *** [libavcodec/h264_parser.o] Error 1
>
> First this is weird, same error from cabac.h but from another file ?
> Double inclusion problem ?

Most likely, adding -fomit-frame-pointer frees up a register, allowing
compilation to progress a little further, before failing here due to
lack of -O3.  GCC is *really* stupid without at least -O2.

[...]

> Is the 7REGS define broken or am I crazy ?

Not really.  The problem is that gcc likes to waste registers (and
everything else) at -O1 or lower.  A simple check, like the ones done
in configure, will probably not run out of registers, even though some
real code will.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list