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 middle-end/54066] New: wrong-code at -O0


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;

}


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