From e5119fab4f944e9c4bf1198f9408bcd8b002e200 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Tue, 28 Mar 2017 20:55:38 +0000 Subject: [PATCH] re PR rtl-optimization/80193 (ICE on valid (but hairy) C code at -O3 on x86_64-linux-gnu: in check_allocation, at ira.c:2563) 2017-03-28 Vladimir Makarov PR rtl-optimization/80193 * ira.c (ira): Do not check allocation for LRA. 2017-03-28 Vladimir Makarov PR rtl-optimization/80193 * gcc.target/i386/pr80193.c: New. From-SVN: r246554 --- gcc/ChangeLog | 5 + gcc/ira.c | 10 +- gcc/testsuite/ChangeLog | 5 + gcc/testsuite/gcc.target/i386/pr80193.c | 196 ++++++++++++++++++++++++ 4 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr80193.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a575a8a46a..c848c715717 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-28 Vladimir Makarov + + PR rtl-optimization/80193 + * ira.c (ira): Do not check allocation for LRA. + 2017-03-28 Alexander Monakov * config/nvptx/nvptx-protos.h (nvptx_output_simt_enter): Declare. diff --git a/gcc/ira.c b/gcc/ira.c index b41c480c99d..7079573bc3a 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5334,7 +5334,6 @@ ira (FILE *f) reg_alternate_class (old_regno), reg_allocno_class (old_regno)); } - } else { @@ -5370,7 +5369,14 @@ ira (FILE *f) calculate_allocation_cost (); #ifdef ENABLE_IRA_CHECKING - if (ira_conflicts_p) + if (ira_conflicts_p && ! ira_use_lra_p) + /* Opposite to reload pass, LRA does not use any conflict info + from IRA. We don't rebuild conflict info for LRA (through + ira_flattening call) and can not use the check here. We could + rebuild this info for LRA in the check mode but there is a risk + that code generated with the check and without it will be a bit + different. Calling ira_flattening in any mode would be a + wasting CPU time. So do not check the allocation for LRA. */ check_allocation (); #endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c7c82a3e39d..654863e6be4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-28 Vladimir Makarov + + PR rtl-optimization/80193 + * gcc.target/i386/pr80193.c: New. + 2017-03-28 Janus Weil PR fortran/78661 diff --git a/gcc/testsuite/gcc.target/i386/pr80193.c b/gcc/testsuite/gcc.target/i386/pr80193.c new file mode 100644 index 00000000000..5bfc0395550 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr80193.c @@ -0,0 +1,196 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +int printf (const char *, ...); + +char a, e, h, ag, ak, am, ar, ay, az, bc, bd, k, l; +int f, i, n, o, c, ac, ad, p, ah, s, aj, al, an, b, ao, aq, at, av, be, t, u, g, q, r, ai, **aa, ap; + +int d (int v) +{ + return v + a; +} + +int j (char v, char w) +{ + return v - w; +} + +void m (int p) +{ +} + +static void bf () +{ + int bg[240], bi, bk, bl, bj, bm = -1; + const int *bh; + if (h) + { + int bn, bo; + while (1) + { + int *bp = &at; + const int **bq = &bh, **br = bq; + while (av) + while (ah) + ; + int bs = r, bt; + if (bt) + break; + bu: + for (; r; r = d (r)) + { + *bp = j (q && b, 0); + if (n) + u = b; + if (u && ak) + p = 0; + } + if (c) + { + while (a) + while (r) + { + int bw = ar, bx = an; + by: + printf ("%d\n", an); + while (ao) + while (bw) + { + a = !g || f / g; + if (i) + az = i; + l = j (q && bh, 5); + if (n != 0) + t = l / n; + if (t) + while (bo) + ; + } + while (a) + ; + if (s) + while (bx) + while (1) + { + if (r) + break; + *aa || q; + } + while (at) + ; + } + while (av) + if (b) + goto by; + while (bl) + while (1) + { + if (r) + break; + while (ag) + if (bi) + printf ("%d\n", 0); + if (bk) + { + bo = bn = bi = printf (""); + goto bz; + } + while (o) + if (a) + { + while (1) + ; + ca: + ; + } + if (ap) + while (1) + ; + while (a) + { + if (ai) + { + bz: + while (be) + if (a) + while (bn) + bl = bg[am]; + while (ac) + if (ad) + { + bj++; + while (bj) + if (c) + goto bu; + } + if (s) + { + while (ao) + while (f) + while (p) + if (e) + while (bj) + for (; bo;) + ; + if (aq) + { + while (aj) + ; + continue; + } + while (1) + ; + } + while (!bj) + { + al = 0; + for (; al < 6; al++) + { + ai = 0; + for (; ai < 60; ai = d (ai)) + { + k = !g || f / g; + if (i) + ay = 0; + bc = j (q && *bq, ay); + if (!n) + ; + else + bd = bc / n; + if (**bq) + __builtin_abort (); + *bp = !aa; + } + while (av) + for (; ai; ai++) + for (; ar; ar++) + { + int cb; + *aa = &cb; + } + m ((long) &br); + while (an) + while (1) + ; + } + } + } + o = b; + } + while (bs) + bm++; + while (bm) + ; + } + } + } + goto ca; + } +} + +int main () +{ + bf (); + return 0; +} -- 2.30.2