[Ffmpeg-devel] GCC optimizations
Sun May 28 23:54:28 CEST 2006
Guillaume POIRIER wrote:
> On 5/28/06, Justin Ruggles <jruggle at earthlink.net> wrote:
>>Guillaume POIRIER wrote:
>>>On 5/28/06, Justin Ruggles <jruggle at earthlink.net> wrote:
>>>>While working on the FLAC encoder, I have come across a problem I've
>>>>never encountered. I am getting completely different results using gcc
>>>>with optimization vs. without optimization. Using -O0 gives me good
>>>>results, but using -O1 to -O3 gives bad (but still valid) results.
>>>You mean that the performance of you code decrease as you increase the
>>>optimization level? This seems odd. -O1, -O2, -Os should always be
>>>better than -O0 (which is pretty much like macro-expand).
>>Actually, it's not the performance that's the issue. I get different
>>output from the encoder. File sizes and contents are different.
> I imagine that it's quite possible. The C norm is very complex,
> therefore when you get into some corner cases, you can have the
> compiler do what you meant with -O0 and do what you wrote with
> -O1/2/3. So I'd say the bug _may_ be in your code.
> The best way to find out is obviously to test with other versions of
> gcc, and/or compile each file with/without optimizations and test...
I did an upgrade to gcc-3.4 and the problem persisted. Then I did some
more bug hunting and I think I found the bug...in my code. I don't know
how it ended up working w/o optimization though. It seems to have been
a data type overflow error.
Thanks for the help.
More information about the ffmpeg-devel