public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
@ 2015-01-27  7:04 su at cs dot ucdavis.edu
  2015-01-27  8:56 ` [Bug debug/64817] [5 Regression] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: su at cs dot ucdavis.edu @ 2015-01-27  7:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

            Bug ID: 64817
           Summary: compilation hangs at -O3 with -g enabled on
                    x86_64-linux-gnu
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code causes the current gcc trunk to hang at -O3 with -g enabled. 

This is a regression from 4.9.x. 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 5.0.0 20150126 (experimental) [trunk revision 220102] (GCC) 
$ 
$ gcc-trunk -O3 -c small.c
$ gcc-trunk -O2 -g -c small.c
$ gcc-4.9 -O3 -g -c small.c
$ 
$ timeout -s 9 30 gcc-trunk -O3 -g -c small.c
Killed
$ 


------------------------------


int a, b, d;

void
fn1 ()
{
  for (b = 0; b < 9; b++)
    {
      int e;
      for (d = 0; d < 5; d++)
    {
      a &= 231;
      a ^= 14;
    }
      e = (a ^= 1) < 0;
    }
}


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2015-01-27  8:56 ` jakub at gcc dot gnu.org
  2015-01-27 11:10 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-27  8:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-27
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |5.0
            Summary|compilation hangs at -O3    |[5 Regression] compilation
                   |with -g enabled on          |hangs at -O3 with -g
                   |x86_64-linux-gnu            |enabled on x86_64-linux-gnu
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Startred with r211725, but seems to be yet another case of too costly
simplify-rtx.c or too large RTL expression created, not sure which one it is
yet.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
  2015-01-27  8:56 ` [Bug debug/64817] [5 Regression] " jakub at gcc dot gnu.org
@ 2015-01-27 11:10 ` rguenth at gcc dot gnu.org
  2015-01-27 12:02 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-27 11:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
  2015-01-27  8:56 ` [Bug debug/64817] [5 Regression] " jakub at gcc dot gnu.org
  2015-01-27 11:10 ` rguenth at gcc dot gnu.org
@ 2015-01-27 12:02 ` jakub at gcc dot gnu.org
  2015-01-30 10:10 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-27 12:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is that expand_debug_expr follows all TER definitions for
SSA_NAMEs, and in this testcase it just creates really huge expression that we
then try to simplify, and nonzero_bits have bad time complexity for such large
expressions.
  pretmp_33 = a;
  a.1_6 = pretmp_33 & 231;
  a.2_21 = a.1_6 ^ 14;
  a.1_22 = a.2_21 & 231;
  a.2_17 = a.1_22 ^ 14;
  a.1_19 = a.2_17 & 231;
  a.2_37 = a.1_19 ^ 14;
  a.1_28 = a.2_37 & 231;
  a.2_29 = a.1_28 ^ 14;
  a.1_42 = a.2_29 & 231;
  a.5_41 = a.1_42 ^ 15;
  # DEBUG D#1 => a.5_41 < 0
  # DEBUG e => (int) D#1
  a.1_14 = a.5_41 & 231;
  a.2_25 = a.1_14 ^ 14;
  a.1_13 = a.2_25 & 231;
  a.2_44 = a.1_13 ^ 14;
  a.1_45 = a.2_44 & 231;
  a.2_46 = a.1_45 ^ 14;
  a.1_47 = a.2_46 & 231;
  a.2_48 = a.1_47 ^ 14;
  a.1_49 = a.2_48 & 231;
  a.5_51 = a.1_49 ^ 15;
  # DEBUG D#1 => a.5_51 < 0
  # DEBUG e => (int) D#1
  a.1_56 = a.5_51 & 231;
  a.2_57 = a.1_56 ^ 14;
  a.1_58 = a.2_57 & 231;
  a.2_59 = a.1_58 ^ 14;
  a.1_60 = a.2_59 & 231;
  a.2_61 = a.1_60 ^ 14;
  a.1_62 = a.2_61 & 231;
  a.2_63 = a.1_62 ^ 14;
  a.1_64 = a.2_63 & 231;
  a.5_66 = a.1_64 ^ 15;
  # DEBUG D#1 => a.5_66 < 0
  # DEBUG e => (int) D#1
...

Best would be to limit somehow the number of nested:
    case SSA_NAME:
      {
        gimple g = get_gimple_for_ssa_name (exp);
        if (g)
          {
            op0 = expand_debug_expr (gimple_assign_rhs_to_tree (g));
            if (!op0)
              return NULL;
          }
levels, perhaps by adding DEBUG_EXPR_DECLs to break too deep chains. 
Supposedly it would need to be done at the end of TER or so,
simply for all debug stmts, look at the nesting depth of
get_gimple_for_ssa_name links from their expressions, and if it goes over say 5
or 10,
add some DEBUG_EXPR_DECLs and debug stmts for them right after the
corresponding SSA_NAME definitions and replace all debug uses of the SSA_NAME
with that DEBUG_EXPR_DECL.

Alex, what do you think about that?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (2 preceding siblings ...)
  2015-01-27 12:02 ` jakub at gcc dot gnu.org
@ 2015-01-30 10:10 ` jakub at gcc dot gnu.org
  2015-01-30 12:51 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-30 10:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Alex mentioned this is related to PR48866 and it is also related to PR56510. 
Since the latter, we actually break too complex debug insn expressions into
simpler ones (with maximum depth of 4), and it would do its job in this case
too, but the problem is that already the simplify_gen_* has the undesirable
complexity on the expressions.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (3 preceding siblings ...)
  2015-01-30 10:10 ` jakub at gcc dot gnu.org
@ 2015-01-30 12:51 ` jakub at gcc dot gnu.org
  2015-02-01 17:26 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-01-30 12:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 34626
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34626&action=edit
gcc5-pr64817.patch

Untested fix.  This inserts debug temporaries into too deep TER chains from
debug stmts, so that there is better sharing of the debug temporaries and the
depths for the simplifications aren't that deep.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (4 preceding siblings ...)
  2015-01-30 12:51 ` jakub at gcc dot gnu.org
@ 2015-02-01 17:26 ` jakub at gcc dot gnu.org
  2015-02-01 22:02 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-01 17:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Sun Feb  1 17:26:17 2015
New Revision: 220320

URL: https://gcc.gnu.org/viewcvs?rev=220320&root=gcc&view=rev
Log:
    PR debug/64817
    * cfgexpand.c (deep_ter_debug_map): New variable.
    (avoid_deep_ter_for_debug): New function.
    (expand_debug_expr): If TERed SSA_NAME is in
    deep_ter_debug_map, use the corresponding DEBUG_EXPR_DECL
    instead of trying to expand SSA_NAME's def stmt.
    (expand_debug_locations): When expanding debug bind
    of a DEBUG_EXPR_DECL to corresponding SSA_NAME,
    temporarily remove the DEBUG_EXPR_DECL from deep_ter_debug_map's
    value.
    (pass_expand::execute): Call avoid_deep_ter_for_debug on
    all debug bind stmts.  Delete deep_ter_debug_map after
    expand_debug_location if non-NULL and clear it.

    * gcc.dg/pr64817-1.c: New test.
    * gcc.dg/pr64817-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr64817-1.c
    trunk/gcc/testsuite/gcc.dg/pr64817-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (5 preceding siblings ...)
  2015-02-01 17:26 ` jakub at gcc dot gnu.org
@ 2015-02-01 22:02 ` jakub at gcc dot gnu.org
  2015-02-04 14:24 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-01 22:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Expansion bug fixed.  Rest tracked in PR64511.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (7 preceding siblings ...)
  2015-02-04 14:24 ` aoliva at gcc dot gnu.org
@ 2015-02-04 14:24 ` aoliva at gcc dot gnu.org
  2015-02-06 11:37 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu.org @ 2015-02-04 14:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

--- Comment #9 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Author: aoliva
Date: Wed Feb  4 14:24:00 2015
New Revision: 220406

URL: https://gcc.gnu.org/viewcvs?rev=220406&root=gcc&view=rev
Log:
Fix signedness of compares expanding debug exprs.

for  gcc/ChangeLog

    PR debug/64817
    * cfgexpand.c (expand_debug_expr): Compute unsignedp from
    operands for tcc_comparison exprs.  Fix typos.

for  gcc/testsuite/ChangeLog

    PR debug/64817
    * gcc.dg/pr64817-3.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/pr64817-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (6 preceding siblings ...)
  2015-02-01 22:02 ` jakub at gcc dot gnu.org
@ 2015-02-04 14:24 ` aoliva at gcc dot gnu.org
  2015-02-04 14:24 ` aoliva at gcc dot gnu.org
  2015-02-06 11:37 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: aoliva at gcc dot gnu.org @ 2015-02-04 14:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

--- Comment #8 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Author: aoliva
Date: Wed Feb  4 14:23:47 2015
New Revision: 220405

URL: https://gcc.gnu.org/viewcvs?rev=220405&root=gcc&view=rev
Log:
Simplify XOR of (AND or IOR) of XOR.

for  gcc/ChangeLog

    PR debug/64817
    * simplify-rtx.c (simplify_binary_operation_1): Simplify one
    of two XORs that have an intervening AND or IOR.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug debug/64817] [5 Regression] compilation hangs at -O3 with -g enabled on x86_64-linux-gnu
  2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
                   ` (8 preceding siblings ...)
  2015-02-04 14:24 ` aoliva at gcc dot gnu.org
@ 2015-02-06 11:37 ` jakub at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-06 11:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64817

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Feb  6 11:36:34 2015
New Revision: 220475

URL: https://gcc.gnu.org/viewcvs?rev=220475&root=gcc&view=rev
Log:
    PR rtl-optimization/64957
    PR debug/64817
    * simplify-rtx.c (simplify_binary_operation_1): Use ~cval for
    IOR rather than for AND.

    * gcc.c-torture/execute/pr64957.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr64957.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-02-06 11:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27  7:04 [Bug debug/64817] New: compilation hangs at -O3 with -g enabled on x86_64-linux-gnu su at cs dot ucdavis.edu
2015-01-27  8:56 ` [Bug debug/64817] [5 Regression] " jakub at gcc dot gnu.org
2015-01-27 11:10 ` rguenth at gcc dot gnu.org
2015-01-27 12:02 ` jakub at gcc dot gnu.org
2015-01-30 10:10 ` jakub at gcc dot gnu.org
2015-01-30 12:51 ` jakub at gcc dot gnu.org
2015-02-01 17:26 ` jakub at gcc dot gnu.org
2015-02-01 22:02 ` jakub at gcc dot gnu.org
2015-02-04 14:24 ` aoliva at gcc dot gnu.org
2015-02-04 14:24 ` aoliva at gcc dot gnu.org
2015-02-06 11:37 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).