From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31369 invoked by alias); 28 May 2010 16:40:41 -0000 Received: (qmail 31315 invoked by uid 48); 28 May 2010 16:40:30 -0000 Date: Fri, 28 May 2010 16:40:00 -0000 Message-ID: <20100528164030.31314.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/44300] Spurious array subscript warning In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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: 2010-05/txt/msg03160.txt.bz2 ------- Comment #8 from rguenth at gcc dot gnu dot org 2010-05-28 16:40 ------- (In reply to comment #7) > So, you are saying that given an arbitrary pointer p, it is impossible to > determine whether or not p points to an element of array a[], because comparing > pointers to different objects is undefined? I find that hard to believe, but > I'm no standards lawyer. 6.5.8/5 says that (note it only applies to relational operators, not equality operators). > Your suggested rewrite results in the same error. That's unfortunate. The following doesn't warn for me (but make sure it's an identity transform): if (p > a && p < a + 10) { a[p - a - 1] = 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44300