public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c
@ 2011-06-01 19:25 jim at meyering dot net
  2011-06-01 20:37 ` [Bug c/49262] " ebotcazou at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jim at meyering dot net @ 2011-06-01 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: 3-yr-old infinite loop in dwarf2out.c
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jim@meyering.net


coverity pointed out the infinite loop below, in dwarf2out.c.
I guess it is unreachable or at least hard to reach,
or it would have been reported/fixed before now:

17605              if (index && TREE_CODE (index) == RANGE_EXPR)
17606            {
17607              int count = tree_low_cst (TREE_OPERAND (index, 1), 0)
17608                      - tree_low_cst (TREE_OPERAND (index, 0), 0);

Event loop_top:     Top of the loop.
Event loop_condition:     "0 < count" must remain true for the loop to
continue.
Also see events:     [loop_bottom]

17609              while (count > 0)
17610                {
17611                  if (val)
17612                memcpy (array + curpos, array + pos, fieldsize);

Event loop_bottom:     Bottom of the loop.
Also see events:     [loop_top][loop_condition]

17613                  curpos += fieldsize;
17614                }
17615            }


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

* [Bug c/49262] 3-yr-old infinite loop in dwarf2out.c
  2011-06-01 19:25 [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c jim at meyering dot net
@ 2011-06-01 20:37 ` ebotcazou at gcc dot gnu.org
  2011-06-06 16:17 ` [Bug debug/49262] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2011-06-01 20:37 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.06.01 20:36:56
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org, jakub at gcc dot
                   |                            |gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-06-01 20:36:56 UTC ---
Jakub, this appears to come from one of your patches.


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

* [Bug debug/49262] 3-yr-old infinite loop in dwarf2out.c
  2011-06-01 19:25 [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c jim at meyering dot net
  2011-06-01 20:37 ` [Bug c/49262] " ebotcazou at gcc dot gnu.org
@ 2011-06-06 16:17 ` jakub at gcc dot gnu.org
  2011-06-06 17:46 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-06 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-06 16:17:35 UTC ---
Created attachment 24449
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24449
gcc47-pr49262.patch

Untested fix (well, given that we don't have a testcase and nobody hit it, it
is a question if index is ever RANGE_EXPR at that spot so late).  I've tried a
few testcases but RANGE_EXPR wasn't present.  On the other side, e.g. varasm.c
also
tries to handle it in CONSTRUCTORs.


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

* [Bug debug/49262] 3-yr-old infinite loop in dwarf2out.c
  2011-06-01 19:25 [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c jim at meyering dot net
  2011-06-01 20:37 ` [Bug c/49262] " ebotcazou at gcc dot gnu.org
  2011-06-06 16:17 ` [Bug debug/49262] " jakub at gcc dot gnu.org
@ 2011-06-06 17:46 ` jakub at gcc dot gnu.org
  2011-06-06 18:03 ` jakub at gcc dot gnu.org
  2011-07-04 21:11 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-06 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-06 17:46:02 UTC ---
Author: jakub
Date: Mon Jun  6 17:46:00 2011
New Revision: 174715

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174715
Log:
    PR debug/49262
    * dwarf2out.c (native_encode_initializer): Decrement count in each
    iteration.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c


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

* [Bug debug/49262] 3-yr-old infinite loop in dwarf2out.c
  2011-06-01 19:25 [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c jim at meyering dot net
                   ` (2 preceding siblings ...)
  2011-06-06 17:46 ` jakub at gcc dot gnu.org
@ 2011-06-06 18:03 ` jakub at gcc dot gnu.org
  2011-07-04 21:11 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-06 18:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-06 18:02:33 UTC ---
Fixed.


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

* [Bug debug/49262] 3-yr-old infinite loop in dwarf2out.c
  2011-06-01 19:25 [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c jim at meyering dot net
                   ` (3 preceding siblings ...)
  2011-06-06 18:03 ` jakub at gcc dot gnu.org
@ 2011-07-04 21:11 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-04 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 21:08:00 UTC ---
Author: jakub
Date: Mon Jul  4 21:07:57 2011
New Revision: 175827

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175827
Log:
    Backported from mainline
    2011-06-06  Jakub Jelinek  <jakub@redhat.com>

    PR debug/49262
    * dwarf2out.c (native_encode_initializer): Decrement count in each
    iteration.

    2011-06-30  Jakub Jelinek  <jakub@redhat.com>

    PR fortran/49540
    * gfortran.h (gfc_constructor): Add repeat field.
    * trans-array.c (gfc_conv_array_initializer): Handle repeat > 1.
    * array.c (current_expand): Add repeat field.
    (expand_constructor): Copy repeat.
    * constructor.c (node_free, node_copy, gfc_constructor_get,
    gfc_constructor_lookup): Handle repeat field.
    (gfc_constructor_lookup_next, gfc_constructor_remove): New functions.
    * data.h (gfc_assign_data_value): Add mpz_t * argument.
    (gfc_assign_data_value_range): Removed.
    * constructor.h (gfc_constructor_advance): Removed.
    (gfc_constructor_lookup_next, gfc_constructor_remove): New prototypes.
    * data.c (gfc_assign_data_value): Add REPEAT argument, handle it and
    also handle overwriting a range with a single entry.
    (gfc_assign_data_value_range): Removed.
    * resolve.c (check_data_variable): Adjust gfc_assign_data_value
    call.  Use gfc_assign_data_value instead of
    gfc_assign_data_value_expr.

    * gfortran.dg/pr49540-1.f90: New test.
    * gfortran.dg/pr49540-2.f90: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/pr49540-1.f90
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/pr49540-2.f90
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/dwarf2out.c
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/array.c
    branches/gcc-4_6-branch/gcc/fortran/constructor.c
    branches/gcc-4_6-branch/gcc/fortran/constructor.h
    branches/gcc-4_6-branch/gcc/fortran/data.c
    branches/gcc-4_6-branch/gcc/fortran/data.h
    branches/gcc-4_6-branch/gcc/fortran/gfortran.h
    branches/gcc-4_6-branch/gcc/fortran/resolve.c
    branches/gcc-4_6-branch/gcc/fortran/trans-array.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2011-07-04 21:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 19:25 [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c jim at meyering dot net
2011-06-01 20:37 ` [Bug c/49262] " ebotcazou at gcc dot gnu.org
2011-06-06 16:17 ` [Bug debug/49262] " jakub at gcc dot gnu.org
2011-06-06 17:46 ` jakub at gcc dot gnu.org
2011-06-06 18:03 ` jakub at gcc dot gnu.org
2011-07-04 21:11 ` 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).