Bug 60902 - [4.9 Regression] ffmpeg built with gcc 4.9 RC produces incorrect flac playback code
Summary: [4.9 Regression] ffmpeg built with gcc 4.9 RC produces incorrect flac playbac...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.9.0
: P2 normal
Target Milestone: 4.9.1
Assignee: Jeffrey A. Law
URL:
Keywords: wrong-code
: 60904 60905 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-20 08:45 UTC by Arthur Marsh
Modified: 2014-05-13 20:28 UTC (History)
11 users (show)

See Also:
Host:
Target: X86_64-*-Linux-gnu
Build:
Known to work: 4.7.3, 4.8.3
Known to fail: 4.9.0
Last reconfirmed: 2014-04-20 00:00:00


Attachments
config.mak produced by ./configure --cc=gcc-4.9 --host-cc=gcc-4.9 --dep-cc=gcc-4.9 (9.60 KB, text/plain)
2014-04-20 09:34 UTC, Arthur Marsh
Details
Unreduced testcase (43.98 KB, text/plain)
2014-04-20 12:18 UTC, Markus Trippelsdorf
Details
good assembler output r205278 (62.71 KB, text/plain)
2014-04-20 13:31 UTC, Markus Trippelsdorf
Details
bad assembler output r205279 (62.50 KB, text/plain)
2014-04-20 13:31 UTC, Markus Trippelsdorf
Details
Testcase from PR60904 (43.09 KB, text/plain)
2014-04-20 17:22 UTC, Markus Trippelsdorf
Details
Testcase from PR60905 (39.33 KB, text/plain)
2014-04-20 17:32 UTC, Markus Trippelsdorf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Marsh 2014-04-20 08:45:29 UTC
Using the gcc-4.9 version 4.9-20140411-2 on Debian GNU/Linux amd64, I'm getting incorrect code for ffmpeg flac format decoding (same source code compiled with gcc-4.8 version 4.8.2-19 works fine).

The problem only affects some flac files that have nonetheless been passed as valid by flac version 1.3.0.

The error returned is similar to:

[flac @ 0x7f3b540092e0] invalid subframe paddingB sq=    0B f=0/0
[flac @ 0x7f3b540092e0] decode_frame() failed

The bug report against ffmpeg is at:

https://trac.ffmpeg.org/ticket/3559

I am *NOT* a C programmer and am not familiar with the flac format decoding process but am posting this in case anyone who is might be prepared to investigate further.

Thanks for any help or suggestions.
Comment 1 Andrew Pinski 2014-04-20 08:48:49 UTC
What options are you compiling ffmpeg with?
Comment 2 Arthur Marsh 2014-04-20 09:34:11 UTC
Created attachment 32637 [details]
config.mak produced by ./configure --cc=gcc-4.9 --host-cc=gcc-4.9 --dep-cc=gcc-4.9
Comment 3 Arthur Marsh 2014-04-20 09:39:37 UTC
I've attached the config.mak produced by ./configure --cc=gcc-4.9 --host-cc=gcc-4.9 --dep-cc=gcc-4.9

The CFLAGS from config.mak:

CFLAGS=   -std=c99 -fomit-frame-pointer -pthread -D_GNU_SOURCE=1 -D_REENTRANT -I
/usr/include/SDL -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization
-Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -missing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wno-maybe-uninitialized
Comment 4 Arthur Marsh 2014-04-20 09:42:25 UTC
I've attached the config.mak produced by ./configure --cc=gcc-4.9 --host-cc=gcc-4.9 --dep-cc=gcc-4.9

The CFLAGS from config.mak:

CFLAGS=   -std=c99 -fomit-frame-pointer -pthread -D_GNU_SOURCE=1 -D_REENTRANT -I
/usr/include/SDL -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization
-Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -missing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wno-maybe-uninitialized
Comment 5 Andrew Pinski 2014-04-20 09:43:04 UTC
Can you try adding -fno-strict-aliasing -fwrapv ?

Next is does ffmpeg have inline-asm for the flac codec?  This requires some C code knowledge though.
Comment 6 Marek Polacek 2014-04-20 09:46:21 UTC
(In reply to Andrew Pinski from comment #5)
> Can you try adding -fno-strict-aliasing -fwrapv ?

And -fno-aggressive-loop-optimizations.  I see the vectorizer is already turned off.
Comment 7 Arthur Marsh 2014-04-20 10:23:05 UTC
OK, I modified the CFLAGS statement in config.mak to what is below, re-ran make clean and make, and still experienced the same problems.

CFLAGS=   -std=c99 -fomit-frame-pointer -pthread -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -O3 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=vla -Wno-maybe-uninitialized -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations

Thanks for your interest.
Comment 8 Arthur Marsh 2014-04-20 10:24:55 UTC
PS, no assembly language in the flac decoding process as far as I could see.
Comment 9 Markus Trippelsdorf 2014-04-20 10:34:51 UTC
Compiling ffmpeg with -fsanitize=undefined shows:

 % ffplay -v 9 -loglevel 99 -i 10.innocent_starter.tiny.flac
...
Input #0, flac, from '10.innocent_starter.tiny.flac':
  Metadata:
    ARTIST          : 水樹奈々
    ALBUM           : THE MUSEUM
    TITLE           : innocent starter
    DATE            : 2007
    GENRE           : JPop
    track           : 10
    CDDB            : e111e110
  Duration: 00:04:40.64, bitrate: 59 kb/s
    Stream #0:0, 56, 1/44100: Audio: flac, 44100 Hz, stereo, s16
detected 4 logical cores
[ffplay_abuffer @ 0x7fc9940066a0] Setting 'sample_rate' to value '44100'
[ffplay_abuffer @ 0x7fc9940066a0] Setting 'sample_fmt' to value 's16'
[ffplay_abuffer @ 0x7fc9940066a0] Setting 'channels' to value '2'
[ffplay_abuffer @ 0x7fc9940066a0] Setting 'time_base' to value '1/44100'
[ffplay_abuffer @ 0x7fc9940066a0] Setting 'channel_layout' to value '0x3'
[ffplay_abuffer @ 0x7fc9940066a0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[AVFilterGraph @ 0x7fc994001790] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
Audio frame changed from rate:44100 ch:2 fmt:s16 layout:stereo serial:-1 to rate:44100 ch:2 fmt:s16 layout:stereo serial:1
[ffplay_abuffer @ 0x7fc988000f00] Setting 'sample_rate' to value '44100'
[ffplay_abuffer @ 0x7fc988000f00] Setting 'sample_fmt' to value 's16'
[ffplay_abuffer @ 0x7fc988000f00] Setting 'channels' to value '2'
[ffplay_abuffer @ 0x7fc988000f00] Setting 'time_base' to value '1/44100'
[ffplay_abuffer @ 0x7fc988000f00] Setting 'channel_layout' to value '0x3'
[ffplay_abuffer @ 0x7fc988000f00] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[AVFilterGraph @ 0x7fc988000be0] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/golomb.h:332:28: runtime error: left shift of negative value -1
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp_template.c:85:36: runtime error: left shift of negative value -4
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp_template.c:86:36: runtime error: left shift of negative value -4
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp_template.c:100:36: runtime error: left shift of negative value -5
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp_template.c:101:36: runtime error: left shift of negative value -2
[flac @ 0x7fc994003a20] invalid subframe paddingB sq=    0B f=0/0   
[flac @ 0x7fc994003a20] decode_frame() failed
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:63:16: runtime error: signed integer overflow: 1246 * -2064943 cannot be represented in type 
'int'
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:63:12: runtime error: signed integer overflow: 1722048318 + 1035287866 cannot be represented 
in type 'int'
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:58:20: runtime error: signed integer overflow: 1777 * -2064943 cannot be represented in type 
'int'
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:56:20: runtime error: signed integer overflow: -1668 * -2064943 cannot be represented in type
 'int'
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:58:16: runtime error: signed integer overflow: 1024856828 + 1571300099 cannot be represented 
in type 'int'
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:61:16: runtime error: signed integer overflow: 1246 * -3189343 cannot be represented in type 
'int'
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:56:16: runtime error: signed integer overflow: -1372495215 + -1772004530 cannot be represente
d in type 'int'
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp.c:61:12: runtime error: signed integer overflow: -1496662804 + -1546546990 cannot be represente
d in type 'int'
[flac @ 0x7fc994003a20] invalid subframe padding
[flac @ 0x7fc994003a20] decode_frame() failed
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp_template.c:71:36: runtime error: left shift of negative value -2349
/var/tmp/portage/media-video/ffmpeg-2.2.1/work/ffmpeg-2.2.1/libavcodec/flacdsp_template.c:72:36: runtime error: left shift of negative value -5961
[flac @ 0x7fc994004c20] invalid subframe paddingB sq=    0B f=0/0   
[flac @ 0x7fc994004c20] decode_frame() failed
[flac @ 0x7fc994004c20] invalid subframe paddingB sq=    0B f=0/0   
[flac @ 0x7fc994004c20] decode_frame() failed
[flac @ 0x7fc994003480] underread: 6275 orig size: 9378  0B f=0/0   
[flac @ 0x7fc9940012b0] sample/frame number mismatch in adjacent frames
    Last message repeated 1 times
[flac @ 0x7fc9940012b0] sample/frame number mismatch in adjacent frames
    Last message repeated 1 times
[flac @ 0x7fc9940012b0] sample/frame number mismatch in adjacent frames
    Last message repeated 1 times
[flac @ 0x7fc9940012b0] sample/frame number mismatch in adjacent frames
    Last message repeated 1 times
[flac @ 0x7fc9940012b0] sample/frame number mismatch in adjacent frames
    Last message repeated 1 times
[flac @ 0x7fc9940012b0] sample/frame number mismatch in adjacent frames
    Last message repeated 1 times
[flac @ 0x7fc9940012b0] sample/frame number mismatch in adjacent frames
    Last message repeated 1 times
Comment 10 Arthur Marsh 2014-04-20 11:29:56 UTC
I haven't been able to reproduce what was shown in comment 9, but appreciate the effort taken to reproduce the problem.
Comment 11 Markus Trippelsdorf 2014-04-20 11:53:54 UTC
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.
Comment 12 Markus Trippelsdorf 2014-04-20 12:18:10 UTC
Created attachment 32638 [details]
Unreduced testcase
Comment 13 Markus Trippelsdorf 2014-04-20 13:20:49 UTC
Started with r205279.
Comment 14 Markus Trippelsdorf 2014-04-20 13:31:07 UTC
Created attachment 32639 [details]
good assembler output r205278
Comment 15 Markus Trippelsdorf 2014-04-20 13:31:47 UTC
Created attachment 32640 [details]
bad assembler output r205279
Comment 16 Markus Trippelsdorf 2014-04-20 17:19:05 UTC
*** Bug 60904 has been marked as a duplicate of this bug. ***
Comment 17 Markus Trippelsdorf 2014-04-20 17:22:28 UTC
Created attachment 32641 [details]
Testcase from PR60904
Comment 18 Markus Trippelsdorf 2014-04-20 17:29:06 UTC
*** Bug 60905 has been marked as a duplicate of this bug. ***
Comment 19 Markus Trippelsdorf 2014-04-20 17:32:13 UTC
Created attachment 32642 [details]
Testcase from PR60905
Comment 20 Markus Trippelsdorf 2014-04-21 07:34:31 UTC
All three testcases use the same inline function libavcodec/golomb.h:

314 /**
315  * read unsigned golomb rice code (jpegls).
316  */
317 static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
318                                        int esc_len)
319 {
320     unsigned int buf;
321     int log;
322
323     OPEN_READER(re, gb);
324     UPDATE_CACHE(re, gb);
325     buf = GET_CACHE(re, gb);
326
327     log = av_log2(buf);
328
329     if (log - k >= 32 - MIN_CACHE_BITS + (MIN_CACHE_BITS == 32) &&
330         32 - log < limit) {
331         buf >>= log - k;
332         buf  += (30 - log) << k;
333         LAST_SKIP_BITS(re, gb, 32 + k - log);
334         CLOSE_READER(re, gb);
335
336         return buf;
337     } else {
338         int i;
339         for (i = 0; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) {
340             if (gb->size_in_bits <= re_index)
341                 return -1;
342             LAST_SKIP_BITS(re, gb, 1);
343             UPDATE_CACHE(re, gb);
344         }
345         SKIP_BITS(re, gb, 1);
346
347         if (i < limit - 1) {
348             if (k) {
349                 buf = SHOW_UBITS(re, gb, k);
350                 LAST_SKIP_BITS(re, gb, k);
351             } else {
352                 buf = 0;
353             }
354
355             CLOSE_READER(re, gb);
356             return buf + (i << k);
357         } else if (i == limit - 1) {
358             buf = SHOW_UBITS(re, gb, esc_len);
359             LAST_SKIP_BITS(re, gb, esc_len);
360             CLOSE_READER(re, gb);
361
362             return buf + 1;
363         } else
364             return -1;
365     }
366 }

And indeed adding __attribute__ ((optimize(0))) to it "fixes" all three
testcases. 
The function looks suspicious and I'm not sure if the code is valid.
Comment 21 Jeffrey A. Law 2014-04-21 19:12:02 UTC
Given c#13, likely mine.
Comment 22 Jeffrey A. Law 2014-04-22 05:10:15 UTC
I'm still working my way through the code, but it looks like we're mucking up the value for "buf" and "k".  Not really sure if that's the root cause is just a downstream effect.  Anyway, once the buf computation goes awry bad the callers start to see unexpected results and the bogus errors.
Comment 23 Jeffrey A. Law 2014-04-22 06:42:46 UTC
I think I see what's going on...  Definitely mine.
Comment 24 Jeffrey A. Law 2014-04-22 07:21:45 UTC
So the issue here is we have an ASM which feeds an eq/neq condition found inside a loop. The eq/neq condition creates an equivalency that is (mis) used when we thread through the loop backedge.

The code which records temporary equivalences for jump threading ignores GIMPLE_ASMs, so as we reprocess the block, the old equivalence isn't replaced with anything new.  ie, the old equivalence doesn't get invalidated. 

As a result we re-use the implied value from the conditional in a previous iteration of the loop to incorrectly simplify a test and all hell breaks loose.

In the past we were so conservative when traversing loop backedges that it was safe to totally ignore GIMPLE_ASMs in this code.  That's no longer the safe thing to do.
Comment 25 Jeffrey A. Law 2014-04-22 07:29:47 UTC
Patch in testing.
Comment 26 Jeffrey A. Law 2014-04-23 05:15:47 UTC
Testing is good.  Just trying to build a nice little testcase for the regression suite.
Comment 27 Markus Trippelsdorf 2014-04-23 07:04:30 UTC
(In reply to Jeffrey A. Law from comment #26)
> Testing is good.  Just trying to build a nice little testcase for the
> regression suite.

Thanks. Another thing I've noticed is that ac3 audio doesn't work
(no sound at all) when ffmpeg is compiled by gcc-4.9. I haven't figured
it out yet, but it appears to be a different issue, because it also
happens with r205279 reverted.
Comment 28 Markus Trippelsdorf 2014-04-23 09:17:12 UTC
(In reply to Markus Trippelsdorf from comment #27)
> (In reply to Jeffrey A. Law from comment #26)
> > Testing is good.  Just trying to build a nice little testcase for the
> > regression suite.
> 
> Another thing I've noticed is that ac3 audio doesn't work
> (no sound at all) when ffmpeg is compiled by gcc-4.9. I haven't figured
> it out yet, but it appears to be a different issue, because it also
> happens with r205279 reverted.

Luckily this issue is already fixed on the gcc-4.9 branch.
Comment 29 Markus Trippelsdorf 2014-04-23 09:43:58 UTC
(In reply to Markus Trippelsdorf from comment #28)
> (In reply to Markus Trippelsdorf from comment #27)
> > (In reply to Jeffrey A. Law from comment #26)
> > > Testing is good.  Just trying to build a nice little testcase for the
> > > regression suite.
> > 
> > Another thing I've noticed is that ac3 audio doesn't work
> > (no sound at all) when ffmpeg is compiled by gcc-4.9. I haven't figured
> > it out yet, but it appears to be a different issue, because it also
> > happens with r205279 reverted.
> 
> Luckily this issue is already fixed on the gcc-4.9 branch.

Ah, it only happens with r205279 reverted. It could be a latent issue.
Would be good to check if it happens with your fix, too.
Could you attach your patch?
Comment 30 Jeffrey A. Law 2014-04-23 16:33:30 UTC
Sorry.  I expect to check the fix & testcase onto the trunk today.  For various reasons my work time is limited right now.  For the 4.9.x releases, final call will be with jakub, jsm and richi as the releaes managers.
Comment 31 Jeffrey A. Law 2014-04-23 18:05:17 UTC
Author: law
Date: Wed Apr 23 18:04:46 2014
New Revision: 209716

URL: http://gcc.gnu.org/viewcvs?rev=209716&root=gcc&view=rev
Log:
	PR tree-optimization/60902
	* tree-ssa-threadedge.c
	(record_temporary_equivalences_from_stmts_at_dest): Make sure to
	invalidate outputs from statements that do not produce useful
	outputs for threading.

	PR tree-optimization/60902
	* gcc.target/i386/pr60902.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr60902.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-threadedge.c
Comment 32 James Almer 2014-04-25 19:22:47 UTC
Please, don't forget to backport the fix to the 4.9 branch.
gcc 4.9.0 is almost unusable for ffmpeg because this didn't make it on time.

Thanks.
Comment 33 Jeffrey A. Law 2014-04-25 19:51:24 UTC
James,

The whole point behind leaving the 4.9 regression marker is to ensure this BZ gets reviewed as part of the 4.9.1 process.  I'd consider this high priority for 4.9.1 and fully expect the fix will be included in 4.9.1.
Comment 34 Jeffrey A. Law 2014-04-28 13:38:51 UTC
Author: law
Date: Mon Apr 28 13:38:19 2014
New Revision: 209860

URL: http://gcc.gnu.org/viewcvs?rev=209860&root=gcc&view=rev
Log:
	PR tree-optimization/60902
	* tree-ssa-threadedge.c
	(record_temporary_equivalences_from_stmts_at_dest): Only iterate
	over real defs when invalidating outputs from statements that do not
	produce useful outputs for threading.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-threadedge.c
Comment 35 Jeffrey A. Law 2014-05-13 20:27:02 UTC
Author: law
Date: Tue May 13 20:26:30 2014
New Revision: 210398

URL: http://gcc.gnu.org/viewcvs?rev=210398&root=gcc&view=rev
Log:
	PR tree-optimization/60902
	* tree-ssa-threadedge.c
	(record_temporary_equivalences_from_stmts_at_dest): Make sure to
	invalidate outputs from statements that do not produce useful
	outputs for threading.

	PR tree-optimization/60902
	* gcc.target/i386/pr60902.c: New test.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.target/i386/pr60902.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-ssa-threadedge.c
Comment 36 Jeffrey A. Law 2014-05-13 20:27:12 UTC
Author: law
Date: Tue May 13 20:26:41 2014
New Revision: 210399

URL: http://gcc.gnu.org/viewcvs?rev=210399&root=gcc&view=rev
Log:
	PR tree-optimization/60902
	* tree-ssa-threadedge.c
	(record_temporary_equivalences_from_stmts_at_dest): Only iterate
	over real defs when invalidating outputs from statements that do not
	produce useful outputs for threading.

Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-ssa-threadedge.c
Comment 37 Jeffrey A. Law 2014-05-13 20:28:46 UTC
Fix backported to branch