This is the mail archive of the gcc-prs@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]

c++/2352: inheritance on solaris



>Number:         2352
>Category:       c++
>Synopsis:       inheritance on solaris
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 22 20:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Alan Gonzalez
>Release:        gcc-2.95.2 and gcc-2.95.3 (pre-release)
>Organization:
>Environment:
solaris 2.7
>Description:
Hi, I just recently happened upon an oddity in gcc when compiling a simple
inheritance tree. 

I had been using gcc version 2.95.2 19991024 (release) and tried gcc
version 2.95.3 20010
125 (prerelease) to see if anything has changed, but same
situation occurs. 

In the attached test.cc file i get:

on solaris with sunsoft 5.0 compilers i get a size of 8.

This is what i expect.  but...

on solaris with gcc-2.95.2 i get a size of 16 ??

If i make mefoo a non inherited class, then the size on solaris with gcc-2.95.2 is 8.

For some reason the inheritance makes the size go from 8 to 16. 

Also when the double is in the base class instead of being in the inherited class, the size is 8 (what i expect). 

Can someone explain this one to me?   Thanks. 
>How-To-Repeat:
compile the attached file and run once on solaris.  Then edit file and remove inheritance of mefoo from foo, making mefoo just a class.  Re-run.  In the first run the size is 16, in the second the size is 8.  Seems strange that sunsoft 5.0 compiler can correctly make this inherited class a size 8 as expected while gcc makes it 16.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cc"

I2luY2x1ZGUgPHN0ZGlvLmg+CmNsYXNzIGZvbyB7Cn07CgpjbGFzcyBtZWZvbyA6IGZvb3sKICBk
b3VibGUgc29tZXZhbHVlOwp9OwoKaW50IG1haW4oKSB7CiAgIG1lZm9vIHRtcDsKICAgcHJpbnRm
KCIlZCIsc2l6ZW9mKHRtcCkpOwp9Cgo=


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