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]

c++/8684: ABI Issue: gcc3.2 is not reusing tail-padding..


>Number:         8684
>Category:       c++
>Synopsis:       ABI Issue:   gcc3.2 is not reusing tail-padding..
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 22 15:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     sunil.k.davasam@intel.com
>Release:        gcc3.2
>Organization:
>Environment:
RH8.0 Beta
>Description:
I have a small testcase. I am getting different results when compiled with gcc-3.1.1 and gcc3.2 compilers.
Here are the details:
----------
cmd> cat t4.cpp
#include <stdio.h>

struct C1 {
       int i;
       char c;
};

struct C2 : C1 {
       char c;
};

int main()
{
        printf("sizeof (C1) = %d\n", sizeof (C1) );
        printf("sizeof (C2) = %d\n", sizeof (C2) );
        return 0;
}

cmd> g++-3.1.1 t4.cpp
cmd> a.out
sizeof (C1) = 8
sizeof (C2) = 8

cmd> g++-3.2 t4.cpp
cmd> a.out

sizeof (C1) = 8
sizeof (C2) = 12
--------

   I tried with Intel compilers and I am getting following output.

cmd> ecpc t4.cpp
cmd> a.out
sizeof (C1) = 8
sizeof (C2) = 8
 
   Is it a regression in gcc-3.2 compiler? Is there any standard on tail-padding reuse or is it implementation defined? 
>How-To-Repeat:
Compile the testcase with gcc-3.1.1 and gcc-3.2 compilers, run the executables.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="t4.cpp"
Content-Disposition: inline; filename="t4.cpp"

#include <stdio.h>

struct C1 {
       int i;
       char c;
};

struct C2 : C1 {
       char c;
};

int main()
{
	printf("sizeof (C1) = %d\n", sizeof (C1) );
	printf("sizeof (C2) = %d\n", sizeof (C2) );
	return 0;
}



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