From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23937 invoked by alias); 1 Jun 2011 19:25:35 -0000 Received: (qmail 23922 invoked by uid 22791); 1 Jun 2011 19:25:35 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CP X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Jun 2011 19:25:20 +0000 From: "jim at meyering dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/49262] New: 3-yr-old infinite loop in dwarf2out.c X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jim at meyering dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 01 Jun 2011 19:25:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00059.txt.bz2 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 }