public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/55011] New: GCC in an infinite loop at -O2
@ 2012-10-21 18:31 antoine.balestrat at gmail dot com
  2012-10-22  9:04 ` [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: antoine.balestrat at gmail dot com @ 2012-10-21 18:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55011

             Bug #: 55011
           Summary: GCC in an infinite loop at -O2
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: antoine.balestrat@gmail.com


GCC 4.8.0 as of 20121021 seems to be stuck in an infinite loop while compiling
the following testcase at -O2 (works at -O1 and -O3) :

$ cat infloop.c
char a;

void f(void)
{
    char b = 2;

    for(;;)
    {
        unsigned short s = 1, *p = &s, *i;

        for(*i = 0; *i < 4; ++*i)
            if(a | (*p /= (b += !!a)) <= 63739)
                return;

        if(!s)
            a = 0;

        for(;;);
    }
}

$ ulimit -t 120

$ xgcc -O2 infloop.c

... 2 minutes later :

gcc: internal compiler error: CPU time limit exceeded (program cc1)
linux-vdso.so.1: No such file or directory
0x40b937 execute
    ../../srcdir/gcc/gcc.c:2739
0x40c7be do_spec_1
    ../../srcdir/gcc/gcc.c:4534
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40cff7 do_spec_1
    ../../srcdir/gcc/gcc.c:5284
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
0x40d397 do_spec_1
    ../../srcdir/gcc/gcc.c:5179
0x40f0d5 process_brace_body
    ../../srcdir/gcc/gcc.c:5782
0x40f0d5 handle_braces
    ../../srcdir/gcc/gcc.c:5696
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Please let me know if you need more information !


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

* [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP
  2012-10-21 18:31 [Bug middle-end/55011] New: GCC in an infinite loop at -O2 antoine.balestrat at gmail dot com
@ 2012-10-22  9:04 ` rguenth at gcc dot gnu.org
  2012-10-22  9:26 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-22  9:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55011

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-10-22
          Component|middle-end                  |tree-optimization
      Known to work|                            |4.7.2
   Target Milestone|---                         |4.8.0
            Summary|GCC in an infinite loop at  |[4.8 Regression] GCC in an
                   |-O2                         |infinite loop at -O2 in VRP
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-22 09:04:42 UTC ---
Confirmed.  Iterating in VRP.


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

* [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP
  2012-10-21 18:31 [Bug middle-end/55011] New: GCC in an infinite loop at -O2 antoine.balestrat at gmail dot com
  2012-10-22  9:04 ` [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP rguenth at gcc dot gnu.org
@ 2012-10-22  9:26 ` jakub at gcc dot gnu.org
  2012-10-22  9:44 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-22  9:26 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55011

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-22 09:26:26 UTC ---
I bet this regressed with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189885
together with one of r188728, r188776 or r188780 (in between r188700 and
r188800
it started to ICE, and with r189885 it started to loop infinitely instead of
ICEing).
If you want to iterate one more time, I think it would be better to ensure you
iterate just one more time and not infinitely.
Perhaps we could abuse for that the vr_phi_edge_counts array, if
  if (edges > 0
      && gimple_phi_num_args (phi) > 1
      && lhs_vr->type == VR_UNDEFINED)
    {
      if (edges == old_edges)
        /* Iterate one more time, but ensure next time we drop to varying
           instead of looping forever.  */
        vr_phi_edge_counts[SSA_NAME_VERSION (lhs)] = -edges;
      else if (edges == -old_edges)
        goto varying;
    }

before the
  if (edges > 0
      && gimple_phi_num_args (phi) > 1
      && edges == old_edges
      && lhs_vr->type != VR_UNDEFINED)


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

* [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP
  2012-10-21 18:31 [Bug middle-end/55011] New: GCC in an infinite loop at -O2 antoine.balestrat at gmail dot com
  2012-10-22  9:04 ` [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP rguenth at gcc dot gnu.org
  2012-10-22  9:26 ` jakub at gcc dot gnu.org
@ 2012-10-22  9:44 ` rguenth at gcc dot gnu.org
  2012-10-22 10:04 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-22  9:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55011

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-22 09:44:18 UTC ---
(In reply to comment #2)
> I bet this regressed with
> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189885
> together with one of r188728, r188776 or r188780 (in between r188700 and
> r188800
> it started to ICE, and with r189885 it started to loop infinitely instead of
> ICEing).
> If you want to iterate one more time, I think it would be better to ensure you
> iterate just one more time and not infinitely.
> Perhaps we could abuse for that the vr_phi_edge_counts array, if
>   if (edges > 0
>       && gimple_phi_num_args (phi) > 1
>       && lhs_vr->type == VR_UNDEFINED)
>     {
>       if (edges == old_edges)
>         /* Iterate one more time, but ensure next time we drop to varying
>            instead of looping forever.  */
>         vr_phi_edge_counts[SSA_NAME_VERSION (lhs)] = -edges;
>       else if (edges == -old_edges)
>         goto varying;
>     }
> 
> before the
>   if (edges > 0
>       && gimple_phi_num_args (phi) > 1
>       && edges == old_edges
>       && lhs_vr->type != VR_UNDEFINED)

It was supposed to be "iterate one more time as then it will become not
VR_UNDEFINED".  I'll investigate.


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

* [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP
  2012-10-21 18:31 [Bug middle-end/55011] New: GCC in an infinite loop at -O2 antoine.balestrat at gmail dot com
                   ` (2 preceding siblings ...)
  2012-10-22  9:44 ` rguenth at gcc dot gnu.org
@ 2012-10-22 10:04 ` rguenth at gcc dot gnu.org
  2012-10-22 13:27 ` rguenth at gcc dot gnu.org
  2012-10-22 13:27 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-22 10:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55011

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-22 10:03:56 UTC ---
We are iterating between

Visiting PHI node: s_56 = PHI <_53(3), _12(12)>

    Argument #0 (3 -> 4 executable)
        _53
        Value: [63740, +INF]  EQUIVALENCES: { _19 } (1 elements)

    Argument #1 (12 -> 4 executable)
        _12
        Value: UNDEFINED
Meeting
  [63740, +INF]  EQUIVALENCES: { _19 } (1 elements)
and
  UNDEFINED
to
  [63740, +INF]  EQUIVALENCES: { } (0 elements)
Found new range for s_56: [63740, +INF]

Simulating statement (from ssa_edges): s_56 = PHI <_53(3), _12(12)>

Visiting PHI node: s_56 = PHI <_53(3), _12(12)>

    Argument #0 (3 -> 4 executable)
        _53
        Value: UNDEFINED

    Argument #1 (12 -> 4 executable)
        _12
        Value: UNDEFINED
Meeting
  UNDEFINED
and
  UNDEFINED
to
  UNDEFINED
Found new range for s_56: UNDEFINED

Simulating statement (from ssa_edges): s_56 = PHI <_53(3), _12(12)>

Visiting PHI node: s_56 = PHI <_53(3), _12(12)>

    Argument #0 (3 -> 4 executable)
        _53
        Value: [63740, +INF]  EQUIVALENCES: { _19 } (1 elements)

    Argument #1 (12 -> 4 executable)
        _12
        Value: UNDEFINED
Meeting
  [63740, +INF]  EQUIVALENCES: { _19 } (1 elements)
and
  UNDEFINED
to
  [63740, +INF]  EQUIVALENCES: { } (0 elements)
Found new range for s_56: [63740, +INF]

which means _53 has bogus transitions:

Visiting statement:
_53 = ASSERT_EXPR <_19, _19 > 63739>;

Intersecting
  [63740, +INF]  EQUIVALENCES: { _19 } (1 elements)
and
  [0, +INF]
to
  [63740, +INF]  EQUIVALENCES: { _19 } (1 elements)
Found new range for _53: [63740, +INF]

Visiting statement:
_53 = ASSERT_EXPR <_19, _19 > 63739>;

Intersecting
  [63740, +INF]  EQUIVALENCES: { _19 } (1 elements)
and
  [15935, 32767]
to
  UNDEFINED
Found new range for _53: UNDEFINED

I have a patch.


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

* [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP
  2012-10-21 18:31 [Bug middle-end/55011] New: GCC in an infinite loop at -O2 antoine.balestrat at gmail dot com
                   ` (4 preceding siblings ...)
  2012-10-22 13:27 ` rguenth at gcc dot gnu.org
@ 2012-10-22 13:27 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-22 13:27 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55011

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-22 13:26:52 UTC ---
Author: rguenth
Date: Mon Oct 22 13:26:48 2012
New Revision: 192689

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192689
Log:
2012-10-22  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/55011
    * tree-vrp.c (update_value_range): For invalid lattice transitions
    drop to VARYING.

    * gcc.dg/torture/pr55011.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr55011.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c


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

* [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP
  2012-10-21 18:31 [Bug middle-end/55011] New: GCC in an infinite loop at -O2 antoine.balestrat at gmail dot com
                   ` (3 preceding siblings ...)
  2012-10-22 10:04 ` rguenth at gcc dot gnu.org
@ 2012-10-22 13:27 ` rguenth at gcc dot gnu.org
  2012-10-22 13:27 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-22 13:27 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55011

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-22 13:27:16 UTC ---
Fixed.


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

end of thread, other threads:[~2012-10-22 13:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-21 18:31 [Bug middle-end/55011] New: GCC in an infinite loop at -O2 antoine.balestrat at gmail dot com
2012-10-22  9:04 ` [Bug tree-optimization/55011] [4.8 Regression] GCC in an infinite loop at -O2 in VRP rguenth at gcc dot gnu.org
2012-10-22  9:26 ` jakub at gcc dot gnu.org
2012-10-22  9:44 ` rguenth at gcc dot gnu.org
2012-10-22 10:04 ` rguenth at gcc dot gnu.org
2012-10-22 13:27 ` rguenth at gcc dot gnu.org
2012-10-22 13:27 ` rguenth 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).