From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15128 invoked by alias); 7 Jan 2013 08:01:52 -0000 Received: (qmail 15011 invoked by uid 48); 7 Jan 2013 08:01:37 -0000 From: "sworddragon2 at aol dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/55892] Bogus compiler warning Date: Mon, 07 Jan 2013 08:01: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: sworddragon2 at aol 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: Status Resolution 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-01/txt/msg00440.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55892 sworddragon2 at aol dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | --- Comment #2 from sworddragon2 at aol dot com 2013-01-07 08:01:36 UTC --- > Take a line which is 16 characters long. > The first time at beginning of the loop, limit: 8; readlimit: 8. > > The next time, limit:0 readlimit: 0. > The next time limit: (unsigned long)(-8) readlimit: INT32_MAX > Warn because readlimit > 1024. You are right, limit -= read_limit; makes anyway no sense there so I removed it (and the compiler wanring is gone too). But there is still something strange on the old example: Why does line 33 trigger the warning but line 34 not? The only difference between them is that line 33 uses a stack variable and line 34 a heap variable. Both have the same size so shouldn't this warning trigger on both lines?