Bug 64535
Summary: | Base class layout violation (loss of member`s alignment) | ||||||
---|---|---|---|---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Eugeny Belov <johnb> | ||||
Component: | gcc3 | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | |||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 7.2 | CC: | grigory_zagorodnev | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | ia64 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2004-10-02 20:05:56 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Eugeny Belov
2002-05-07 15:35:55 UTC
Created attachment 56524 [details]
Testcase
As I can see, the actuall reason of this failure is that the G++ does not perform finalization step when processing class C2. As a result we see the wrong class layout. --- C++ ABI ----------------- Chapter 2: Data Layout 2.4 Non-POD Class Types ... IV. Finalization Round sizeof(C) up to a non-zero multiple of align(C). ----------------------------- This happens for base classes only. If you make D's data member of type C2 you'll see it correctly finalized and paded. 3.2 g++ correctly warns about the pointer abuse vp1test.cpp: In function `int main()': vp1test.cpp:46: warning: invalid offsetof from non-POD type `class D'; use pointer to member instead True that the offsetof abuse is incorrect, but it's also true that the layout problem has been fixed in gcc 3.2. The test case does run Part 0 - Passed Part 1 - Passed Part 2 - Passed and gdb confirms that the layout of a variable of type D (gdb) p d $1 = {<C2> = {a = 0, b = 0}, _vptr.D = 0x0, x_ = 0} (gdb) p sizeof(d) $2 = 32 |