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



             Bug #: 55137

           Summary: [4.8 Regression] Unexpected static structure

                    initialization

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

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

        ReportedBy: sebastian.hu...@embedded-brains.de





Created attachment 28573

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28573

Test case.



The test case:



struct S {

  int a;

  int b;

};



struct S s = {

  sizeof(int),

  (((1024 * 8) * 2) - (1024 * 8))

    + ((int)(((1024 * 8)) + (2 * sizeof(int)) + 8 - 1))

};



yields:



gcc -xc++ -g -c test.cc -o test.o && gdb test.o -ex "p s" -ex quit

[...]

$1 = {a = 0, b = 0}



Correct is (sizeof(int) == 4):



gcc -xc -g -c test.cc -o test.o && gdb test.o -ex "p s" -ex quit

[...]

$1 = {a = 4, b = 16399}

Reply via email to