c++/10781: wrong class size and alignment with static class member

yanliu@ca.ibm.com yanliu@ca.ibm.com
Wed May 14 14:46:00 GMT 2003


>Number:         10781
>Category:       c++
>Synopsis:       wrong class size and alignment with static class member
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed May 14 14:36:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Yan Liu
>Release:        3.2
>Organization:
>Environment:

>Description:
Here is the testcase:
struct S {
    static double sval;
    double get_sval() {return sval;};
};
double S::sval=10000.0;
Using the following compiling command:
/opt/cross/bin/powerpc64-linux-g++ -fdump-class-hierarchy a.C
we get the following class layout:
Class A
   size=8 align=8
A (0x40066100) 0 empty

The testcase only fails on 64 bit mode.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list