2009/3/5 Dave Korn <dave.korn.cyg...@googlemail.com>: > > of an array that only has size[4] is going one past the end. So the bug is > the missing warning for the simplified testcase, not that the warning is > somehow incorrect in the more complex one.
No. The array is unused so it gets removed quite early. If you *do* return the array, then the warning appears. There is no bug here (except we could warn for unused array, that would be nice... if you wish to open a PR for that). > I would hope that in the simpler case the entire unused local array gets > optimised away, and the loop and 'a' go with it. That might explain why > there's no sign of an error. But your testcase invokes invalid behaviour, so > there's no reason why the compiler shouldn't handle it in differing and > inconsistent ways at different optimisation levels. In fact the simple local array gets removed by the moment we reach 034t.sdse. Cheers, Manuel.