This is the mail archive of the gcc@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]

Resend: -fpack-struct again


Hi,

as I didn't get an answer to my previous post, and this previous
post was a bit incomplete, I explain the problem again:

On i686-pc-linux-gnu target (maybe others) gcc-2.95.2
doesn't honor the -fpack-struct command line switch.

Assume the following c "program":
typedef struct {
  char    *ptr;
  short   s1;
  char    *ptr2;
  short   s2;
  int     flags;
} ST;
ST st = { "Hello", 1, "You", 2, 123456 };

then
"gcc -S -fpack-struct pack.c" produces the following with gcc-2.95.2:

        .file   "pack.c"
        .version        "01.01"
gcc2_compiled.:
.globl st
.data
        .align 4
        .type    st,@object
        .size    st,20
st:
        .long .LC0
        .value 1
        .zero   2                     <------- padding
        .long .LC1
        .value 2
        .zero   2                     <------- padding
        .long 123456
.section        .rodata
.LC1:
        .string "You"
.LC0:
        .string "Hello"
        .ident  "GCC: (GNU) 2.95.2 19991024 (release)"

whereas egcs-1.1.2 produced this

        .file   "pack.c"
        .version        "01.01"
gcc2_compiled.:
.globl st
.data
        .type    st,@object
        .size    st,16
st:
        .long .LC0
        .value 1
        .long .LC1
        .value 2
        .long 123456
.section        .rodata
.LC1:
        .string "You"
.LC0:
        .string "Hello"
        .ident  "GCC: (GNU) egcs-2.91.66 19990314 (egcs-1.1.2 release)"


So somehow the -fpack-struct parameter is difunctional. I assume a bug
or is there another reason for this?

thanks for any clarification
chris


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