This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/65627] New: missed warning with -Waggressive-loop-optimizations
- From: "bonzini at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 30 Mar 2015 12:19:13 +0000
- Subject: [Bug tree-optimization/65627] New: missed warning with -Waggressive-loop-optimizations
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65627
Bug ID: 65627
Summary: missed warning with -Waggressive-loop-optimizations
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: bonzini at gnu dot org
Version: gcc (GCC) 5.0.0 20150319 (Red Hat 5.0.0-0.21)
The following program does not warn with -Waggressive-loop-optimizations:
int a[4] = {1, 2, 3, 4};
int main()
{
int i, j = 1234;
for (i = 0; i < 4; j = a[++i]) {
if (j == 6)
return 1;
}
return 0;
}
The testcase returns 0 with -O0 or -O2 -fno-aggressive-loop-optimizations.
It returns 1 (in fact it's compiled to "return 1;" with -O2.
Expected: "iteration 4 invokes undefined behavior".
The optimization happens in cunrolli.