Bug 63448 - [4.9/5 Regression] ICE when compiling atlas 3.10.2
Summary: [4.9/5 Regression] ICE when compiling atlas 3.10.2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.9.1
: P1 normal
Target Milestone: 4.9.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ra
Depends on:
Blocks:
 
Reported: 2014-10-03 06:42 UTC by Svante Signell
Modified: 2014-10-23 10:26 UTC (History)
3 users (show)

See Also:
Host:
Target: i?86-gnu
Build:
Known to work:
Known to fail: 4.9.2, 5.0
Last reconfirmed: 2014-10-06 00:00:00


Attachments
Preprocessed source stored into /tmp/ccejGHdk.out file (3.11 KB, text/x-csrc)
2014-10-03 06:48 UTC, Svante Signell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Svante Signell 2014-10-03 06:42:02 UTC

    
Comment 1 Svante Signell 2014-10-03 06:48:08 UTC
Created attachment 33642 [details]
Preprocessed source stored into /tmp/ccejGHdk.out file
Comment 2 Svante Signell 2014-10-03 06:56:08 UTC
Hi, when compiling ./build/atlas-base/src/blas/gemm/KERNEL/ATL_cNCCUmmNN.c from Debian atlas 3.10.2-3 on GNU/Hurd the ICE happens (twice):
ATL_cNCCUmmNN.c:3856:1: internal compiler error: Maximum number of LRA constraint passes is achieved (30)

 }
 ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.

gcc version is Debian 4.9.1-15.

It might be so that the input data for this generated file is non-sensical, the CPU speed detection does not work on Hurd. Nevertheless, the compiler should not error out with an ICE?

Thanks!
Comment 3 Markus Trippelsdorf 2014-10-03 07:00:05 UTC
Please post the complete command line that triggers the bug.
Comment 4 Andrew Pinski 2014-10-03 07:02:09 UTC
(In reply to Markus Trippelsdorf from comment #3)
> Please post the complete command line that triggers the bug.

It is included in the preprocessed source :).
Comment 5 Svante Signell 2014-10-03 12:06:26 UTC
FYI: atlas builds fine with gcc-4.8.3-11 (and gfortran-4.9-15)
Comment 6 Richard Biener 2014-10-06 14:57:37 UTC
From the attachment:

/usr/lib/gcc/i586-gnu/4.9/cc1 -quiet -I /home/srs/DEBs/atlas/atlas-3.10.2/build/atlas-base/include -I /home/srs/DEBs/atlas/atlas-3.10.2/build/atlas-base/../..//include -I /home/srs/DEBs/atlas/atlas-3.10.2/build/atlas-base/../..//include/contrib -imultilib . -imultiarch i386-gnu -D L2SIZE=4194304 -D Add_ -D F77_INTEGER=int -D StringSunStyle -D ATL_OS_Linux -D ATL_ARCH_x86x87 -D ATL_GAS_x8632 -D WALL ATL_cNCCUmmNN.c -quiet -dumpbase ATL_cNCCUmmNN.c -mfpmath=387 -m32 -mtune=generic -march=i586 -auxbase ATL_cNCCUmmNN -O2 -std=c99 -fomit-frame-pointer -falign-loops=4 -fPIC -o - -frandom-seed=0


Reproducible with just -std=c99 -m32 -O on x86_64-linux.  Confirmed on 4.9 branch and trunk.
Comment 7 Jakub Jelinek 2014-10-06 18:52:03 UTC
int a, d, e, g, h, j;
float b, c, k, l, m, n;
int *__restrict i;
void
foo (void)
{
  int o = e;
  int *p;
  float *q, *r = (float *) 0x1234000;
  float s, t, u, v, w, x;
  do
    {
      for (a = o; a; a--)
	{
	  s += m;
	  t += n;
	  u += m;
	  v += n;
	  w += d;
	  x += d;
	  n = l;
	  s += r[1];
	  t += n;
	  v += r[1];
	  m = k * r[4];
	  n = q[0] * r[4];
	  s += m;
	  m = q[1] * r[4];
	  t += n;
	  q += g;
	  k = *q;
	  n = q[1] * r[4];
	  s += m;
	  t += n;
	  u += r[4];
	  m = q[8] * r[4];
	  q += 1;
	  n = q[1] * r[4];
	  s += m;
	  m = q[4];
	  t += n;
	  q += g;
	  w += m;
	  m = k * r[4];
	  s += m;
	  t += q[0];
	  m = q[1] * r[4];
	  v += q[0];
	  n = q[10] * r[4];
	  s += m;
	  t += n;
	  u += b;
	  m = q[8] * r[4];
	  n = q[2] * r[4];
	  s += m;
	  m = q[4] * r[4];
	  t += n;
	  q++;
	  n = q[2] * r[16];
	  s += m;
	  m = q[4];
	  t += n;
	  s += m;
	  t += r[6];
	  q += g;
	  k = *q;
	  w += m;
	  m = k * r[20];
	  x += r[16];
	  n = q[1] * r[20];
	  s += m;
	  t += n;
	  q += g;
	  k = *q;
	  w += m;
	  m = k * r[2];
	  n = q[1] * r[22];
	  s += m;
	  m = q[4];
	  t += n;
	  q += g;
	  s += m;
	  t += q[0];
	  s += m;
	  u += m;
	  n = q[1] * r[22];
	  s += m;
	  m = q[4] * r[22];
	  t += n;
	  q += g;
	  k = 1;
	  w += m;
	  c = q[10];
	  x += r[22];
	  s += m;
	  t += r[22];
	  u += m;
	  v += r[22];
	  n = q[10] * r[30];
	  d = r[32];
	  l = q[1];
	  b = 0;
	  w += m;
	  m = r[32];
	  x += n;
	  r = 0;
	}
      *i = s;
      p[0] = t;
      p[1] = u;
      p[6] = v;
      p[8] = w;
      p[10] = x;
    }
  while (j);
}

at -O -m32 -std=c99 ICE started at r210824 aka PR60969 fix.
Comment 8 Vladimir Makarov 2014-10-15 15:15:27 UTC
I already saw such problem.  It is chain of spills and reassignment of non-reload pseudos.  Each pass considers only 1-2 pseudos and very few insns.  We just need 2 more passes to finish RA for the test.  The current code of LRA looping prevention is too conservative for the case.

Finally I have an idea how to solve this kind of problems.  The patch is on the way.
Comment 9 Vladimir Makarov 2014-10-15 15:49:04 UTC
Author: vmakarov
Date: Wed Oct 15 15:48:33 2014
New Revision: 216270

URL: https://gcc.gnu.org/viewcvs?rev=216270&root=gcc&view=rev
Log:
2014-10-15  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/63448
	* lra-int.h (LRA_MAX_CONSTRAINT_ITERATION_NUMBER): Remove.
	(LRA_MAX_ASSIGNMENT_ITERATION_NUMBER): New.
	(LRA_MAX_INHERITANCE_PASSES): Use it.
	(lra_constraint_iter_after_spill): Remove.
	(lra_assignment_iter): New.
	(lra_assignment_iter_after_spill): New.
	* lra-assigns.c (lra_assignment_iter): New.
	(lra_assignment_iter_after_spill): New.
	(former_reload_pseudo_spill_p): New.
	(spill_for): Set up former_reload_pseudo_spill_p.
	(setup_live_pseudos_and_spill_after_risky): Ditto.
	(assign_by_spills): Ditto.
	(lra_assign): Increment lra_assignment_iter.  Print the iteration
	number.  Reset former_reload_pseudo_spill_p.  Check
	lra_assignment_iter_after_spill.
	* lra.c (lra): Remove lra_constraint_iter_after_spill.  Initialize
	lra_assignment_iter and lra_assignment_iter_after_spill.
	* lra-constraints.c (lra_constraint_iter_after_spill): Remove.
	(lra_constraints): Remove code with
	lra_assignment_iter_after_spill.

2014-10-15  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/63448
	* gcc.target/i386/pr63448.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr63448.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lra-assigns.c
    trunk/gcc/lra-constraints.c
    trunk/gcc/lra-int.h
    trunk/gcc/lra.c
    trunk/gcc/testsuite/ChangeLog
Comment 10 Vladimir Makarov 2014-10-15 15:51:38 UTC
Author: vmakarov
Date: Wed Oct 15 15:51:07 2014
New Revision: 216271

URL: https://gcc.gnu.org/viewcvs?rev=216271&root=gcc&view=rev
Log:
2014-10-15  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/63448
	* lra-int.h (LRA_MAX_CONSTRAINT_ITERATION_NUMBER): Remove.
	(LRA_MAX_ASSIGNMENT_ITERATION_NUMBER): New.
	(LRA_MAX_INHERITANCE_PASSES): Use it.
	(lra_constraint_iter_after_spill): Remove.
	(lra_assignment_iter): New.
	(lra_assignment_iter_after_spill): New.
	* lra-assigns.c (lra_assignment_iter): New.
	(lra_assignment_iter_after_spill): New.
	(former_reload_pseudo_spill_p): New.
	(spill_for): Set up former_reload_pseudo_spill_p.
	(setup_live_pseudos_and_spill_after_risky): Ditto.
	(assign_by_spills): Ditto.
	(lra_assign): Increment lra_assignment_iter.  Print the iteration
	number.  Reset former_reload_pseudo_spill_p.  Check
	lra_assignment_iter_after_spill.
	* lra.c (lra): Remove lra_constraint_iter_after_spill.  Initialize
	lra_assignment_iter and lra_assignment_iter_after_spill.
	* lra-constraints.c (lra_constraint_iter_after_spill): Remove.
	(lra_constraints): Remove code with
	lra_assignment_iter_after_spill.

2014-10-15  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/63448
	* gcc.target/i386/pr63448.c: New test.


Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.target/i386/pr63448.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/lra-assigns.c
    branches/gcc-4_9-branch/gcc/lra-constraints.c
    branches/gcc-4_9-branch/gcc/lra-int.h
    branches/gcc-4_9-branch/gcc/lra.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Comment 11 Jakub Jelinek 2014-10-23 10:26:07 UTC
Should be fixed now.