mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Bjorn Helgaas'" <bhelgaas@google.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Florian Fainelli" <f.fainelli@gmail.com>
Subject: RE: [PATCH] phy: fix compiler array bounds warning on settings[]
Date: Thu, 6 Mar 2014 09:13:09 +0000	[thread overview]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6D38E1@AcuExch.aculab.com> (raw)
In-Reply-To: <CAErSpo6hUVc_2MP85CM3-qvOmdSBUJ1bxn+RiXqymJpTwQLzfg@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1098 bytes --]

From: Bjorn Helgaas
> I'm stumped.  phy_find_valid() is static and only called from one
> place.  The 'idx' argument is always the result of phy_find_setting(),
> which should always return something between 0 and
> ARRAY_SIZE(settings), so I don't see any way idx can be < 0.
> 
> I stripped this down as far as I could; the resulting test code is at
> http://pastebin.com/pp1zMEWu if anybody else wants to look at it.  I'm
> using gcc 4.8.x 20131105 (prerelease), with "-Warray-bounds -O2"
> flags.
> 
> I hesitate to suspect a compiler bug, but it is very strange.  For
> example, in my test code, replacing "MAX_NUM_SETTINGS" with "2" gets
> rid of the warnings.  MAX_NUM_SETTINGS is known to be 2 at
> compile-time, so I don't know why this should make a difference.

I can't get an array bounds error from the gcc 4.8.1-10ubuntu9 at all.
Not even when I index the array with a constant 3.
I wonder if they compiled it out!

	David

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2014-03-06  9:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05  0:35 Bjorn Helgaas
2014-03-05  0:43 ` Florian Fainelli
2014-03-05  9:10 ` David Laight
2014-03-05 14:54   ` Bjorn Helgaas
2014-03-05 15:10     ` David Laight
2014-03-05 20:54   ` Bjorn Helgaas
2014-03-06  9:13     ` David Laight [this message]
2014-03-06 21:07 ` David Miller

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=063D6719AE5E284EB5DD2968C1650D6D0F6D38E1@AcuExch.aculab.com \
    --to=david.laight@aculab.com \
    --cc=bhelgaas@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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

all inboxes | Powered by JetHome®