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/56920] New: another static initialization of an array miscompiled


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: unassigned@gcc.gnu.org
        ReportedBy: kretz@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.


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