[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6D38E1@AcuExch.aculab.com>
Date: Thu, 6 Mar 2014 09:13:09 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Bjorn Helgaas' <bhelgaas@...gle.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Florian Fainelli" <f.fainelli@...il.com>
Subject: RE: [PATCH] phy: fix compiler array bounds warning on settings[]
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
Powered by blists - more mailing lists