missing 'packed' warning?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

missing 'packed' warning?



Hi,

While experimenting with packed structures, I've encountered a possible problem. With the following code, the declaration of test2 does not cause a compiler warning, but the structure is not packed. Is this a bug, or am I misinterpreting something?

thanks,
Galen


struct foo {
  char a;
  int b;
};

struct __attribute__ ((packed)) bar {
  char a;
  int b;
};

struct foo normal;
struct bar packed;

__attribute__ ((packed)) struct foo test1;
struct __attribute__ ((packed)) foo test2; /* No warning, but not packed. */
struct foo __attribute__ ((packed)) test3;
struct foo test4 __attribute__ ((packed));


$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (CodeSourcery Sourcery G++ 2006q3-27) 4.1.1

$ arm-none-eabi-gcc -S -Wall foo.c
foo.c:14: warning: 'packed' attribute ignored
foo.c:16: warning: 'packed' attribute ignored
foo.c:17: warning: 'packed' attribute ignored

$ cat foo.s
        .cpu arm7tdmi
        .fpu softvfp
        .eabi_attribute 18, 4
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 1
        .eabi_attribute 30, 6
        .file   "foo.c"
        .comm   normal,8,4
        .comm   packed,5,1
        .comm   test1,8,4
        .comm   test2,8,4
        .comm   test3,8,4
        .comm   test4,8,4
        .ident  "GCC: (CodeSourcery Sourcery G++ 2006q3-27) 4.1.1"