From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QcRLQ-00023b-Vm for garchives@archives.gentoo.org; Fri, 01 Jul 2011 00:12:29 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9E5411C0D6; Fri, 1 Jul 2011 00:10:53 +0000 (UTC) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by pigeon.gentoo.org (Postfix) with ESMTP id 5A6681C0D6 for ; Fri, 1 Jul 2011 00:10:53 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QcRJs-0002dg-70 for gentoo-amd64@lists.gentoo.org; Fri, 01 Jul 2011 02:10:52 +0200 Received: from athedsl-375737.home.otenet.gr ([79.131.19.183]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Jul 2011 02:10:52 +0200 Received: from realnc by athedsl-375737.home.otenet.gr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Jul 2011 02:10:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-amd64@lists.gentoo.org From: Nikos Chantziaras Subject: [gentoo-amd64] Re: GCC-4.5.2 Has Serious Problems Date: Fri, 01 Jul 2011 03:11:09 +0300 Organization: Lucas Barks Message-ID: References: <20110630174530.9bcbcd47.frank.peters@comcast.net> <20110630200424.0d6d49ef.frank.peters@comcast.net> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-amd64@lists.gentoo.org Reply-to: gentoo-amd64@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: athedsl-375737.home.otenet.gr User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110624 Thunderbird/3.1.11 In-Reply-To: <20110630200424.0d6d49ef.frank.peters@comcast.net> X-Archives-Salt: X-Archives-Hash: ba4a1be2b1ad672e7fa3ec9c7a0b31be On 07/01/2011 03:04 AM, Frank Peters wrote: > On Fri, 01 Jul 2011 02:44:36 +0300 > Nikos Chantziaras wrote: > >>> >>> Your code is buggy, because you're breaking C's aliasing rules. You are >>> not allowed to use a different pointer type to dereference a variable of >>> a different type. Doing so results in undefined behavior. >> > > Well, the error occurs only within the loop structure. If > I manually "unroll" the loop using the same pointers there > is no error when compiled with "O2." > > IOW, the problem is how the loop is optimized under -O2. When there's "undefined behavior", it really means just that: you cannot make any assumptions about when the result is going to be correct and when not. It might as well depend on whether it was raining yesterday.