From patchwork Thu Feb 7 13:31:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 218927 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8A9872C0293 for ; Fri, 8 Feb 2013 00:31:37 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1360848698; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=qZcPlHU eecrMBj7I9qVWsKIXUm8=; b=Ikg/tAvnDXUQ+mcfl9z4VFxRw+wEgPq4Tov8mA3 YHJToMTPoHt+wxfyHfpPI+8rDmAPqgbKJuSpSQ0cSNHWz9kRIVI2YhxVh8ZQl6qI VsvIe6/BEKxZKKdHoehVUILDbLa9yqt3rAPQ3kWyGH7Yb3Jupq5rwfU6BlqxyhEO lALY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Melqmku+CSVuWmxTRab0soo3Yo8oTYBcAsFDvSPgnL99uZq9lMtCwLa0VL0HuM Epao/8d0zrOjr6z+n4YVc0a0F13PlbMK3zEj7VNQIWhpvZj3PnjXsb9rCkxlKW/o +nKR3L95CxgNpFU1LVGcrIDGAyBQYgOM5w9N4Aotpumsw=; Received: (qmail 1672 invoked by alias); 7 Feb 2013 13:31:20 -0000 Received: (qmail 1615 invoked by uid 22791); 7 Feb 2013 13:31:19 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Feb 2013 13:31:08 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 2048CA3E1C; Thu, 7 Feb 2013 14:31:07 +0100 (CET) Date: Thu, 7 Feb 2013 14:31:07 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Cc: Jakub Jelinek Subject: [PATCH][www] Add loop case to non-bugs in bugs.html Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org As promised, a bugs.html entry. Ok? Thanks, Richard. 2013-02-07 Richard Biener * bugs/index.html: Add "Loops do not terminate" case to non-bugs. Index: index.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/bugs/index.html,v retrieving revision 1.109 diff -u -r1.109 index.html --- index.html 10 Oct 2012 15:52:29 -0000 1.109 +++ index.html 7 Feb 2013 13:29:39 -0000 @@ -429,6 +429,32 @@ article.

+
Loops do not terminate
+

This is often caused by out-of-bound array accesses or by signed integer +overflow which both result in undefined behavior according to the ISO +C standard. For example

+ +
+int
+SATD (int* diff, int use_hadamard)
+{
+  int k, satd = 0, m[16], dd, d[16];
+  ...
+    for (dd=d[k=0]; k<16; dd=d[++k])
+      satd += (dd < 0 ? -dd : dd);
+
+ +

accesses d[16] before the loop is exited with +the k<16 check. This causes the compiler to +optimize away the exit test because the new value of k +must be in the range [0, 15] according to ISO C.

+ +

GCC starting with version 4.8 has a new option +-fno-aggressive-loop-optimizations that may help here. +If it does, then this is a clear sign that your code is not conforming +to ISO C and it is not a GCC bug.

+ +
Cannot use preprocessor directive in macro arguments.

Let me guess... you used an older version of GCC to compile code that looks something like this: