From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28558 invoked by alias); 20 Apr 2014 11:53:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28521 invoked by uid 48); 20 Apr 2014 11:53:55 -0000 From: "trippels at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/60902] ffmpeg built with gcc 4.9 RC produces incorrect flac playback code Date: Sun, 20 Apr 2014 11:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: trippels at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg01393.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60902 --- Comment #11 from Markus Trippelsdorf --- OK I'm down to one function from ./libavcodec/flacdec.c: 208 __attribute__ ((optimize(0))) 209 static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order) 210 { 211 int i, tmp, partition, method_type, rice_order; 212 int rice_bits, rice_esc; 213 int samples; 214 215 method_type = get_bits(&s->gb, 2); 216 if (method_type > 1) { 217 av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n", 218 method_type); 219 return AVERROR_INVALIDDATA; 220 } 221 222 rice_order = get_bits(&s->gb, 4); 223 224 samples= s->blocksize >> rice_order; 225 if (samples << rice_order != s->blocksize) { 226 av_log(s->avctx, AV_LOG_ERROR, "invalid rice order: %i blocksize %i\n", 227 rice_order, s->blocksize); 228 return AVERROR_INVALIDDATA; 229 } 230 231 if (pred_order > samples) { 232 av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n", 233 pred_order, samples); 234 return AVERROR_INVALIDDATA; 235 } 236 237 rice_bits = 4 + method_type; 238 rice_esc = (1 << rice_bits) - 1; 239 240 decoded += pred_order; 241 i= pred_order; 242 for (partition = 0; partition < (1 << rice_order); partition++) { 243 tmp = get_bits(&s->gb, rice_bits); 244 if (tmp == rice_esc) { 245 tmp = get_bits(&s->gb, 5); 246 for (; i < samples; i++) 247 *decoded++ = get_sbits_long(&s->gb, tmp); 248 } else { 249 for (; i < samples; i++) { 250 *decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0); 251 } 252 } 253 i= 0; 254 } 255 256 return 0; 257 } 258 Without __attribute__ ((optimize(0))) it gets miscompiled.