[FFmpeg-devel] misuse of gcc's __attribue__ align?

Andrew Penner ampenner
Mon May 5 22:36:39 CEST 2008


Hi, I was running into the "compiler didn't align stack variables"
warning and came across a potential problem in the code...

The DECLARE_ALIGNED macro in libavcodec/mem.h is used in several
places where local variables are being declared, particularly in
ff_check_alignment function of libavcodec/dsputil.c. The only thing
is, gcc does not obey the "attribute aligned" declaration for local
variables.

When I compile with gcc 4.2 (as recommended) the warning goes away,
but believe this is only a conincidence. According to the gcc manual
(and a simple test program) using the aligned attribute on local
variables is not supported.

So the questions is: does anyone care about this? This is problem for
compilers which have a mechanism for aligment similar to the aligned
attribute in gcc (i.e. doesn't work on local variables).

Am I missing something obvious? I'm trying to help make the code more
friendly to other platforms, so please don't just say "use gcc >=
4.2".

Thanks,
Andrew




More information about the ffmpeg-devel mailing list