From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25497 invoked by alias); 28 Feb 2013 17:19:52 -0000 Received: (qmail 24835 invoked by uid 48); 28 Feb 2013 17:19:15 -0000 From: "jasonwucj at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/56465] Strange warning about variable modified range Date: Thu, 28 Feb 2013 17:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jasonwucj at gmail dot com 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: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2013-02/txt/msg02706.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56465 Chung-Ju Wu changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jasonwucj at gmail dot com --- Comment #3 from Chung-Ju Wu 2013-02-28 17:19:13 UTC --- (In reply to comment #2) > (In reply to comment #1) > > >it is actual a constant. > > > > I don't think it is a integer constant expression though as it contains a cast > > from a pointer type to an integer type. > > Well, it isn't a integer scalar, but still a constant. To my understanding, it is not a constant. For example, int i; i = (int) ((int*)0 + 1); Could you tell the value of i from C language point of view? According to C99 6.5.6 Point 8, "When an expression that has integer type is added to or subtracted from a pointer, the result has the type of the pointer operand." Hence, the result of "(int*)0 + 1" is a 'pointer to type T'. So, no, you can't tell the value. It depends on integer size of target machine.