[FFmpeg-devel] [PATCH 0/2] Fix strict aliasing violations in AAC and AC3 parsers

Måns Rullgård mans
Mon Dec 15 00:07:46 CET 2008

Michael Niedermayer <michaelni at gmx.at> writes:

> On Sun, Dec 14, 2008 at 08:53:16PM +0000, Mans Rullgard wrote:
>> The AAC and AC3 parsers both violate strict aliasing rules when using
>> a uint64_t variable as buffer for the bitstream reader.  Although I am
>> not entirely certain of the strict validity of these patches, they are
>> sufficient to make gcc do the right thing, and they can't make things
>> any worse.
>> Please comment.
> ive no objections to these patches, though personally id rather add
> -fno-strict-aliasing to the flags of these 2 files ...

I'd rather have correct code than rely on compiler flags altering the
semantics of the language.

> not because of these 2, but because more than half of the code in
> ffmpeg violates the aliasing rules and would we replace all that by
> unions readability would suffer very significantly.

Are you suggesting we add -fno-strict-aliasing to the global flags?
Has anyone benchmarked this?  That would also only help with gcc and
other compilers accepting that flag.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list