This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/65627] New: missed warning with -Waggressive-loop-optimizations


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]