https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65178
--- Comment #12 from Leon Winter <[email protected]> --- > Are you saying that GCC 4.9 does not warn? That would be surprising and a > regression. If you could find the revision that started warning, that would > be helpful. Funny you would ask, it turns out that only in -O2 it does warn. However my test case is a simplified version of real project for which no warning is generated (even in -O2) which fails to build with GCC 5 (due to -Werror). I will try to come up with a test case more like the actual code and which would then also compile just fine (without warnings) using gcc-4.9. Your minimal testcase triggers the warning also for gcc-4.9 on every optimization level.
