c/10360: __alignof__(double) answer 8

thoran@free.fr thoran@free.fr
Wed Apr 9 09:06:00 GMT 2003


>Number:         10360
>Category:       c
>Synopsis:       __alignof__(double) answer 8
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 09 09:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Frederic De Jaeger
>Release:        gcc 3.2.3
>Organization:
>Environment:
Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.3 20030309 (Debian prerelease)

Linux thc 2.4.20-k7 #1 Tue Jan 14 00:29:06 EST 2003 i686 unknown unknown GNU/Linux
>Description:
__alignof__(double) answer 8.  But actually, it is 4 (that's what gcc generates for record).

Apparently the problem happened in gcc 3.0
>How-To-Repeat:
#include <stdio.h>

struct bla
{
  char c;
  double v;
};

void main (void)
{
  struct bla b;
  printf("align double %d\neffective alignement %d\n", __alignof__(double),
	 ((char *)(&b.v)) - ((char *)(&b.c)));
}
>Fix:

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



More information about the Gcc-prs mailing list