Logo Search packages:      
Sourcecode: gcc-2.96 version File versions


From: <herbert@gondor.apana.org.au>
To: submit@bugs.debian.org
Subject: Bug#85445: gcc: __alignof__ not working correctly
Date: Sat, 10 Feb 2001 11:43:39 +1100

Package: gcc
Version: 1:2.95.2-20
Severity: normal

According to the documentation,

: When the operand of `__alignof__' is an lvalue rather than a type,
: the value is the largest alignment that the lvalue is known to have.
: It may have this alignment as a result of its data type, or because it
: is part of a structure and inherits alignment from that structure.  For
: example, after this declaration:
:      struct foo { int x; char y; } foo1;
: the value of `__alignof__ (foo1.y)' is probably 2 or 4, the same as
: `__alignof__ (int)', even though the data type of `foo1.y' does not
: itself demand any alignment.


$ cat a.c
#include <stdio.h>
#include <netinet/ip_icmp.h>

int main() {
      struct icmp foo;

      printf("%d\n", __alignof__(foo.icmp_dun));
      printf("%d\n", __alignof__(foo.icmp_data));

      return 0;
$ make a
cc     a.c   -o a
$ ./a

Generated by  Doxygen 1.6.0   Back to index