[FFmpeg-devel] Stack variables alignment check in libavcodec/dsputil.c

Roman Shaposhnick rvs
Mon Jul 30 19:51:15 CEST 2007


Guys,

does the following code really belong to libavcodec/dsputil.c? Shouldn't
it be moved to configure? Or at least duplicated there as well.

int ff_check_alignment(void){
    static int did_fail=0;
    DECLARE_ALIGNED_16(int, aligned);

    if((long)&aligned & 15){
        if(!did_fail){
#if defined(HAVE_MMX) || defined(HAVE_ALTIVEC)
            av_log(NULL, AV_LOG_ERROR,
                "Compiler did not align stack variables. Libavcodec has
been miscompiled\n"
                "and may be very slow or crash. This is not a bug in
libavcodec,\n"
                "but in the compiler. Do not report crashes to FFmpeg
developers.\n");
#endif
            did_fail=1;
        }
        return -1;
    }
    return 0;
}

void dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
    int i;

    ff_check_alignment();
    .....

Thanks,
Roman.

P.S. And yes, gcc 3.4.5 on RedHat 4 64bit seems to trigger this message.





More information about the ffmpeg-devel mailing list