public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57180] New: Structures with a flexible arrray member have wrong size
@ 2013-05-05 23:42 amodra at gmail dot com
  2013-05-06  8:53 ` [Bug c/57180] " mikpe at it dot uu.se
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: amodra at gmail dot com @ 2013-05-05 23:42 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 57180
           Summary: Structures with a flexible arrray member have wrong
                    size
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: amodra@gmail.com
                CC: algrant@acm.org, amodra@gmail.com,
                    fredrickprashanth@gmail.com, gcc-bugs@gcc.gnu.org,
                    lauro.venancio@gmail.com, qrczak@knm.org.pl,
                    sbsiddha@gmail.com
        Depends on: 28865


+++ This bug was initially created as a clone of Bug #28865 +++

Cloned from 28865, because the problem is more than just getting .size wrong.
The following testcase fails on all targets at all optimization levels.
The testcase was taken from glibc/nss/nss_files/files-init.c, which is
miscompiled on powerpc or any other target using -fsection-anchors.

union
{
  struct { long j; char c[]; } s;
  char pad[32];
} x[2] =
{
  { .s = { .c = "abc123" } },
  { .s = { .c = "xyz" } }
};

int
main (void)
{
  if (sizeof (x[0]) != 32)
    __builtin_abort ();
  if (x[1].s.c[0] != 'x')
    __builtin_abort ();
  return 0;
}


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-23 11:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-05 23:42 [Bug c/57180] New: Structures with a flexible arrray member have wrong size amodra at gmail dot com
2013-05-06  8:53 ` [Bug c/57180] " mikpe at it dot uu.se
2013-05-06  9:37 ` amodra at gmail dot com
2013-05-09 19:20 ` mikpe at it dot uu.se
2013-05-11  9:18 ` mikpe at it dot uu.se
2014-01-16 12:19 ` nickc at gcc dot gnu.org
2014-01-23 11:45 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).