[Ffmpeg-devel] Re: ffmpeg build fixes

Stanislav Brabec sbrabec
Thu Mar 22 14:14:32 CET 2007


Uoti Urpala wrote:
> On Thu, 2007-03-22 at 13:37 +0100, Stanislav Brabec wrote:
> > Diego Biurrun wrote:
> > > I cannot reproduce it.  Compiling which file?  Which compiler etc?
> > 
> > glibc-2.5
> > gcc (GCC) 4.1.3 20070302 (prerelease) (SUSE Linux)
> > CFLAGS used: -O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -I/usr/include/gsm -fno-strict-aliasing
> 
> -D_FORTIFY_SOURCE=2 is the part that changes the functions to #defines.

Yes. -D_FORTIFY_SOURCE=2 is a good flag for catching bugs in the code.
I think it's safe to call #undef before #define for each redefinition of system function.

> Why are you using -fno-strict-aliasing btw? Does that do anything with
> FFmpeg except possibly worsen performance?

There are strict-aliasing warnings. One never knows, what will compiler
do after these warnings. Some of them behave incorrectly on lines which
issue strict aliasing warnings (for example old mpg123 plays nonsenses).
These bugs are very hard to debug, because you need to analyze assembler
output to guess what happened.

Note that the list may be incomplete. There are some situations, where
strict-aliasing check is not issued, but aliasing optimization will
create bad code. On the other side most of these warnings are issued in
places, where the resulting code is correct on all platforms.

Solutions:
- Use void pointers, which are not aliased.
- Remove obsolete casts.
- Never use casts for dereferenced pointers (i. e. (Foo*)(&foo)).
- Use unions for structures.
Bad solutions:
- Use double retype. It silences compiler, but the bug remains.
- Use false declarations.

Line numbers are relative to 2007-03-21 snapshot:

i386/fdct_mmx.c: In function 'ff_fdct_mmx':
i386/fdct_mmx.c:523: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/fdct_mmx.c: In function 'ff_fdct_mmx2':
i386/fdct_mmx.c:541: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/fdct_mmx.c: In function 'ff_fdct_sse2':
i386/fdct_mmx.c:559: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/simple_idct_mmx.c: In function 'idct':
i386/simple_idct_mmx.c:213: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/dsputil_mmx.c: In function 'hadamard8_diff_mmx':
i386/dsputil_mmx.c:1564: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/dsputil_mmx.c: In function 'hadamard8_diff_mmx2':
i386/dsputil_mmx.c:1651: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc22_3dnow':
i386/h264dsp_mmx.c:1365: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc21_3dnow':
i386/h264dsp_mmx.c:1365: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc23_3dnow':
i386/h264dsp_mmx.c:1365: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc12_3dnow':
i386/h264dsp_mmx.c:1365: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc32_3dnow':
i386/h264dsp_mmx.c:1365: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc22_3dnow':
i386/h264dsp_mmx.c:1366: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc21_3dnow':
i386/h264dsp_mmx.c:1366: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc23_3dnow':
i386/h264dsp_mmx.c:1366: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc12_3dnow':
i386/h264dsp_mmx.c:1366: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc32_3dnow':
i386/h264dsp_mmx.c:1366: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc22_3dnow':
i386/h264dsp_mmx.c:1367: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc21_3dnow':
i386/h264dsp_mmx.c:1367: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc23_3dnow':
i386/h264dsp_mmx.c:1367: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc12_3dnow':
i386/h264dsp_mmx.c:1367: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc32_3dnow':
i386/h264dsp_mmx.c:1367: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc22_3dnow':
i386/h264dsp_mmx.c:1368: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc21_3dnow':
i386/h264dsp_mmx.c:1368: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc23_3dnow':
i386/h264dsp_mmx.c:1368: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc12_3dnow':
i386/h264dsp_mmx.c:1368: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc32_3dnow':
i386/h264dsp_mmx.c:1368: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc22_3dnow':
i386/h264dsp_mmx.c:1369: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc21_3dnow':
i386/h264dsp_mmx.c:1369: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc23_3dnow':
i386/h264dsp_mmx.c:1369: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc12_3dnow':
i386/h264dsp_mmx.c:1369: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc32_3dnow':
i386/h264dsp_mmx.c:1369: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc22_3dnow':
i386/h264dsp_mmx.c:1370: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc21_3dnow':
i386/h264dsp_mmx.c:1370: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc23_3dnow':
i386/h264dsp_mmx.c:1370: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc12_3dnow':
i386/h264dsp_mmx.c:1370: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc32_3dnow':
i386/h264dsp_mmx.c:1370: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc22_mmx2':
i386/h264dsp_mmx.c:1371: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc21_mmx2':
i386/h264dsp_mmx.c:1371: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc23_mmx2':
i386/h264dsp_mmx.c:1371: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc12_mmx2':
i386/h264dsp_mmx.c:1371: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel4_mc32_mmx2':
i386/h264dsp_mmx.c:1371: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc22_mmx2':
i386/h264dsp_mmx.c:1372: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc21_mmx2':
i386/h264dsp_mmx.c:1372: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc23_mmx2':
i386/h264dsp_mmx.c:1372: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc12_mmx2':
i386/h264dsp_mmx.c:1372: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel8_mc32_mmx2':
i386/h264dsp_mmx.c:1372: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc22_mmx2':
i386/h264dsp_mmx.c:1373: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc21_mmx2':
i386/h264dsp_mmx.c:1373: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc23_mmx2':
i386/h264dsp_mmx.c:1373: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc12_mmx2':
i386/h264dsp_mmx.c:1373: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'put_h264_qpel16_mc32_mmx2':
i386/h264dsp_mmx.c:1373: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc22_mmx2':
i386/h264dsp_mmx.c:1374: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc21_mmx2':
i386/h264dsp_mmx.c:1374: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc23_mmx2':
i386/h264dsp_mmx.c:1374: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc12_mmx2':
i386/h264dsp_mmx.c:1374: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel4_mc32_mmx2':
i386/h264dsp_mmx.c:1374: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc22_mmx2':
i386/h264dsp_mmx.c:1375: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc21_mmx2':
i386/h264dsp_mmx.c:1375: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc23_mmx2':
i386/h264dsp_mmx.c:1375: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc12_mmx2':
i386/h264dsp_mmx.c:1375: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel8_mc32_mmx2':
i386/h264dsp_mmx.c:1375: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc22_mmx2':
i386/h264dsp_mmx.c:1376: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc21_mmx2':
i386/h264dsp_mmx.c:1376: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc23_mmx2':
i386/h264dsp_mmx.c:1376: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc12_mmx2':
i386/h264dsp_mmx.c:1376: warning: dereferencing type-punned pointer will break strict-aliasing rules
i386/h264dsp_mmx.c: In function 'avg_h264_qpel16_mc32_mmx2':
i386/h264dsp_mmx.c:1376: warning: dereferencing type-punned pointer will break strict-aliasing rules
tscc.c: In function 'decode_rle':
tscc.c:145: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsputil.c: In function 'dct_sad8x8_c':
dsputil.c:3389: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsputil.c: In function 'dct_max8x8_c':
dsputil.c:3459: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsputil.c: In function 'quant_psnr8x8_c':
dsputil.c:3476: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsputil.c:3477: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsputil.c: In function 'rd8x8_c':
dsputil.c:3502: warning: dereferencing type-punned pointer will break strict-aliasing rules
dsputil.c: In function 'bit8x8_c':
dsputil.c:3580: warning: dereferencing type-punned pointer will break strict-aliasing rules
h264.c: In function 'filter_mb_fast':
h264.c:7067: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c: In function 'reallocBuffers':
postprocess.c:958: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:959: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:960: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:961: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:972: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:973: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:974: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:975: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c: In function 'reallocBuffers':
postprocess.c:958: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:959: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:960: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:961: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:972: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:973: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:974: warning: dereferencing type-punned pointer will break strict-aliasing rules
postprocess.c:975: warning: dereferencing type-punned pointer will break strict-aliasing rules

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec at suse.cz
Lihovarsk? 1060/12                            tel: +420 284 028 966
190 00 Praha 9                                fax: +420 284 028 951
Czech Republic                                http://www.suse.cz/





More information about the ffmpeg-devel mailing list