David Sterba posted on Tue, 18 Nov 2014 18:23:23 +0100 as excerpted: > On Sun, Nov 09, 2014 at 03:54:56AM +0000, Duncan wrote: >> A bit more context: >> >> cmds-restore.c: In function 'next_leaf': >> cmds-restore.c:182:20: warning: array subscript is above array bounds >> [-Warray-bounds] >> slot = path->slots[level] + 1; >> ^ > > Thanks. We've seen that before and were not able to find why the > compiler thinks it could overflow, see the dicussion here: > > http://www.mail-archive.com/linux-btrfs%40vger.kernel.org/msg34338.html > > I'll probably merge Christian's patch so the warning goes away.
Thanks. I don't claim to be a coder but I surely can't see where/how the code as written could go out of array bounds either. The bit the worries me is that -Warray-bounds says it warns where subscripts are *ALWAYS* out of bounds. Couple that with the "unintuitive" optimizations that I've seen gcc reported as doing from time to time, and admittedly not understanding all the implications involved, and "optimized to always out of bounds" seems uncomfortably within the realm of possibility, given the warning. The next step if I were to go from there would be to CC or file a bug with the gentoo QA team, who after all consider this gcc warning serious enough to point it out in (colored!) QA warnings before a package is installed. As such, perhaps they know enough about gcc optimizations specific to this warning to explain what gcc's actually warning about here, since "upstream" can't see a problem and neither can I. I just gotta decide whether it's worth bothering them with or not. -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html