The following patch fixes the PR. The details can be found on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61360
The patch was bootstrapped and tested on x86/x86-64. Committed as rev. 215358. 2014-09-18 Vladimir Makarov <vmaka...@redhat.com> PR target/61360 * lra.c (lra): Call recog_init. 2014-09-18 Vladimir Makarov <vmaka...@redhat.com> PR target/61360 * gcc.target/i386/pr61360.c: New.
Index: lra.c =================================================================== --- lra.c (revision 215337) +++ lra.c (working copy) @@ -2135,6 +2135,11 @@ lra (FILE *f) lra_in_progress = 1; + /* The enable attributes can change their values as LRA starts + although it is a bad practice. To prevent reuse of the outdated + values, clear them. */ + recog_init (); + lra_live_range_iter = lra_coalesce_iter = 0; lra_constraint_iter = lra_constraint_iter_after_spill = 0; lra_inheritance_iter = lra_undo_inheritance_iter = 0; Index: testsuite/gcc.target/i386/pr61360.c =================================================================== --- testsuite/gcc.target/i386/pr61360.c (revision 0) +++ testsuite/gcc.target/i386/pr61360.c (working copy) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=amdfam10 -O2" } */ +int a, b, c, e, f, g, h; +long *d; +__attribute__((cold)) void fn1() { + int i = g | 1; + for (; g; h++) { + for (; a; e++) d[0] = c; + if (0.002 * i) break; + for (; b; f++) d[h] = 0; + } +}