public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10645: Incorrect 64bit double alignment in nested struct
@ 2003-05-06 19:16 jingye
  0 siblings, 0 replies; 2+ messages in thread
From: jingye @ 2003-05-06 19:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10645
>Category:       c++
>Synopsis:       Incorrect 64bit double alignment in nested struct
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 06 19:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     jingye@ca.ibm.com
>Release:        gcc version 3.2
>Organization:
>Environment:
System Type:
Linux Version 2.4.19 SuSE SLES 8 (ppc) - Kernel 2.4.19-ul1-ppc64-SMP (36).
GNU assembler version 2.12.90.0.15 (powerpc-suse-linux) using BFD version 2.12.9
0.0.15 20020717 (SuSE)

Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-
prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/us
r/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-incl
ude-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared
--enable-__cxa_atexit powerpc-suse-linux
Thread model: posix
gcc version 3.2
>Description:
in the example below, the struct A has only double as its member and is 8-byte aligned in 64bit. struct B has struct A as it's member, however, is only 4-byte aligned. When we add aother member after double in struct A, struct B becomes 8-byte aligned.

/*test case t.c*/
struct A{
         double  a1;
         /*int     a2;*/
}sa;

struct B{
         char    b1;
         struct A     b2;
}sb;

int main()
{
   printf("alignof sa=%d\n",__alignof__(sa));
   printf("sizeof  sa=%d\n",sizeof(sa));
   printf("alignof sb=%d\n",__alignof__(sb));
   printf("sizeof  sb=%d\n",sizeof(sb));
}
>How-To-Repeat:
/opt/cross/bin/powerpc64-linux-g++ t.c

a.out
>Fix:

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/10645: Incorrect 64bit double alignment in nested struct
@ 2003-05-07  5:06 Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2003-05-07  5:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/10645; it has been noted by GNATS.

From: Alan Modra <amodra@bigpond.net.au>
To: jingye@ca.ibm.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/10645: Incorrect 64bit double alignment in nested struct
Date: Wed, 7 May 2003 14:26:33 +0930

 See the comment in gcc/config/rs6000/linux64.h about ROUND_TYPE_ALIGN,
 and also ADJUST_FIELD_ALIGN.  It's a weird AIX compatibility thing.
 
 -- 
 Alan Modra
 IBM OzLabs - Linux Technology Centre


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-07  5:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-06 19:16 c++/10645: Incorrect 64bit double alignment in nested struct jingye
2003-05-07  5:06 Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).