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 c++/55137] New: [4.8 Regression] Unexpected static structure initialization


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


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