From: Christian Hesse <mail@eworm.de>
To: David Sterba <dsterba@suse.cz>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/1] btrfs-progs: fix compiler warning
Date: Tue, 3 Jun 2014 20:04:11 +0200 [thread overview]
Message-ID: <20140603200411.6202ee70@leda.localdomain> (raw)
In-Reply-To: <20140603165225.GR22324@twin.jikos.cz>
[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]
David Sterba <dsterba@suse.cz> on Tue, 2014/06/03 18:52:
> On Tue, Jun 03, 2014 at 01:29:19PM +0200, Christian Hesse wrote:
> > gcc 4.9.0 gives a warning: array subscript is above array bounds
> >
> > Checking for "greater or equal" instead of just "equal" fixes this.
>
> That fixes the warning, but I don't see the code path that leads to
> level >= BTRFS_MAX_LEVEL
>
> On the first pass, when level = 1 and the first while() reaches at most
> BTRFS_MAX_LEVEL, the equality test is enough. So it has to go through
> the second while() where level is decremented and in the range
> [1..BTRFS_MAX_LEVEL-1] before 'goto again' jumps to the first while
> again.
I suppose gcc does not know how much level can be increased within
function next_leaf(). level > BTRFS_MAX_LEVEL is never met at runtime, but
this way gcc knows that level can never be bigger than BTRFS_MAX_LEVEL.
Any better way to fix this?
--
Schoene Gruesse
Chris
O< ascii ribbon campaign
stop html mail - www.asciiribbon.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-06-03 18:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 11:29 [PATCH 1/1] btrfs-progs: fix compiler warning Christian Hesse
2014-06-03 16:52 ` David Sterba
2014-06-03 18:04 ` Christian Hesse [this message]
2014-06-04 6:48 ` Qu Wenruo
2014-06-04 7:19 ` Christian Hesse
2014-06-04 16:44 ` David Sterba
2014-06-05 8:59 ` Christian Hesse
2014-06-10 11:05 ` David Sterba
-- strict thread matches above, loose matches on Subject: below --
2014-06-03 11:37 Christian Hesse
2014-06-05 8:13 Christian Hesse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140603200411.6202ee70@leda.localdomain \
--to=mail@eworm.de \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).