[Bug middle-end/54066] New: wrong-code at -O0

wbrana at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Jul 22 14:19:00 GMT 2012


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

             Bug #: 54066
           Summary: wrong-code at -O0
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wbrana@gmail.com


GCC 4.6.3
1
GCC 4.7.1
2

#include <iostream>
using namespace std;

struct c {
    char* Achit;
    c() {
        Achit = new char[1];
    }
    unsigned char uint8() {
        unsigned char lires = 1;
        Achit += 1;
        return lires;
    };
};

int main() {
        c* Lf = new c();
        char* Lc1 = Lf->Achit;
        Lf->Achit += Lf->uint8();
        cout << Lf->Achit - Lc1 << endl;

}



More information about the Gcc-bugs mailing list