Re: [btrfs-progs] cmds-restore.c:182:20: warning: array subscript is above array bounds [-Warray-bounds]
On Sun, Nov 09, 2014 at 03:54:56AM +, 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. -- 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
Re: [btrfs-progs] cmds-restore.c:182:20: warning: array subscript is above array bounds [-Warray-bounds]
David Sterba posted on Tue, 18 Nov 2014 18:23:23 +0100 as excerpted: On Sun, Nov 09, 2014 at 03:54:56AM +, 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
[btrfs-progs] cmds-restore.c:182:20: warning: array subscript is above array bounds [-Warray-bounds]
Updating to the latest live-git btrfs-progs (on v3.17.1 tag), I chanced across this (gentoo) warning, pointing to a gcc warning believed to be severe: * QA Notice: Package triggers severe warnings which indicate that it *may exhibit random runtime failures. * cmds-restore.c:182:20: warning: array subscript is above array bounds [-Warray-bounds] * Please do not file a Gentoo bug and instead report the above QA * issues directly to the upstream developers of this software. * Homepage: https://btrfs.wiki.kernel.org 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; ^ Not being a coder I've no idea if it's a false-alarm or not, and I generally ignore these QA warnings since I've little hope of providing much more than the basic information or help, but since I'm already active here I thought I'd post it and see what happens. FWIW, gentoo/~amd64, gcc-4.8.3. Full build log available if needed altho I expect it should be easy enough to trace without. Note that I normally build with MAKEOPTS=-j10 -l8 so if log serialization is desired, please request a -j1 build log. -- 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