http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28865



--- Comment #9 from Alan Modra <amodra at gmail dot com> 2013-05-04 14:34:39 
UTC ---

>From what I see on current mainline for a testcase based on

glibc/nss/nss_files/files-init.c the var_decl size and the type size agree and

are correct.  What causes a problem with -fsection-anchors is that the actual

data emitted by output_constant() is wrong.



struct traced_file

{

  long pad;

  char fname[];

};



#define TF(id, filename, ...)                    \

union                                \

{                                \

  struct traced_file file;                    \

  char buf[sizeof (struct traced_file) + sizeof (filename)];    \

} id##_traced_file =                        \

  {                                \

    .file =                            \

    {                                \

      .fname = filename                        \

    }                                \

  }



TF (pwd, "/etc/passwd");

TF (grp, "/etc/group");



Gives me



    .file    "unioninit.c"

    .globl grp_traced_file

    .globl pwd_traced_file

    .section    ".data"

    .align 2

.LANCB0:

    .org .LANCB0+0

    .type    grp_traced_file, @object

    .size    grp_traced_file, 16

grp_traced_file:

    .zero    4

    .string    "/etc/group"

    .zero    12

    .org .LANCB0+16

    .type    pwd_traced_file, @object

    .size    pwd_traced_file, 16

pwd_traced_file:

    .zero    4

    .string    "/etc/passwd"

    .zero    12

    .ident    "GCC: (GNU) 4.9.0 20130502 (experimental)"

    .section    .note.GNU-stack,"",@progbits



Those ".zero 12" lines shouldn't be there.

Reply via email to