rhill 14/05/04 18:56:03 Modified: README.history Added: 94_all_pr60902-ffmpeg-miscompile.patch Log: Add patch for PR60902.
Revision Changes Path 1.2 src/patchsets/gcc/4.9.0/gentoo/README.history file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history?rev=1.2&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history?rev=1.2&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history?r1=1.1&r2=1.2 Index: README.history =================================================================== RCS file: /var/cvsroot/gentoo/src/patchsets/gcc/4.9.0/gentoo/README.history,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- README.history 1 May 2014 05:14:25 -0000 1.1 +++ README.history 4 May 2014 18:56:03 -0000 1.2 @@ -21,3 +21,4 @@ + 74_all_gcc49_cloog-dl.patch + 90_all_pr55930-dependency-tracking.patch + 92_all_freebsd-pie.patch + + 94_all_pr60902-ffmpeg-miscompile.patch 1.1 src/patchsets/gcc/4.9.0/gentoo/94_all_pr60902-ffmpeg-miscompile.patch file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/94_all_pr60902-ffmpeg-miscompile.patch?rev=1.1&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/gcc/4.9.0/gentoo/94_all_pr60902-ffmpeg-miscompile.patch?rev=1.1&content-type=text/plain Index: 94_all_pr60902-ffmpeg-miscompile.patch =================================================================== http://gcc.gnu.org/PR60902 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -387,7 +387,34 @@ record_temporary_equivalences_from_stmts_at_dest (edge e, && (gimple_code (stmt) != GIMPLE_CALL || gimple_call_lhs (stmt) == NULL_TREE || TREE_CODE (gimple_call_lhs (stmt)) != SSA_NAME)) + { + /* STMT might still have DEFS and we need to invalidate any known + equivalences for them. + + Consider if STMT is a GIMPLE_ASM with one or more outputs that + feeds a conditional inside a loop. We might derive an equivalence + due to the conditional. */ + tree op; + ssa_op_iter iter; + + if (backedge_seen) + FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF) + { + /* This call only invalidates equivalences created by + PHI nodes. This is by design to keep the cost of + of invalidation reasonable. */ + invalidate_equivalences (op, stack, src_map, dst_map); + + /* However, conditionals can imply values for real + operands as well. And those won't be recorded in the + maps. In fact, those equivalences may be recorded totally + outside the threading code. We can just create a new + temporary NULL equivalence here. */ + record_temporary_equivalence (op, NULL_TREE, stack); + } + continue; + } /* The result of __builtin_object_size depends on all the arguments of a phi node. Temporarily using only one edge produces invalid --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr60902.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +extern void abort (); +extern void exit (int); + +int x; + +foo() +{ + static int count; + count++; + if (count > 1) + abort (); +} + +static inline int +frob () +{ + int a; + __asm__ ("mov %1, %0\n\t" : "=r" (a) : "m" (x)); + x++; + return a; +} + +int +main () +{ + int i; + for (i = 0; i < 10 && frob () == 0; i++) + foo(); + exit (0); +}