http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56920



             Bug #: 56920

           Summary: another static initialization of an array miscompiled

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: tree-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: kr...@kde.org





compile the following testcase with "gcc -O3 -msse2":



int main() {

    unsigned int indexes[15];

    for (unsigned int i = 0; i < 15; ++i) {

        indexes[i] = (i * 2) % 15;

    }

    for (unsigned int i = 0; i < 15; ++i) {

        if (indexes[i] != (i * 2) % 15) {

            __builtin_abort();

        }

    }

}



GCC initializes the stack with the values 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,

20, 22. The last three values of indexes apparently are not initialized at all.

Expected is: 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13



This might be related to #56918, but -fdisable-tree-vrp2 does not fix the

issue.

Reply via email to