https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116151
Bug ID: 116151 Summary: [7.1 Regression] G++ fails to diagnose -Waggressive-loop-optimizations when going past the end of an array Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: arsen at gcc dot gnu.org Target Milestone: --- The following code, in C++ mode since GCC 7.1 (works on 6.5), at -O3 creates an infinite loop and fails to produce a diagnostic: void f () { int arr[48]; extern int g (int); for (int i = 0; i < 55; i++) arr[i] = g (arr[i]); } ... however, in C, the above produces a correct diagnostic (and a non-infinite loop). (reduced from https://bugs.gentoo.org/936237 )