This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c/25246] New: [gomp] #pragma pack() inside of structure


#pragma pack(1)
struct S
{
  char h;
  int i;
#pragma pack()
  int j;
};
struct S s;
void *i = &s.i, *j = &s.j;

(distilled from Linux kernel) used to compile in 4.0.x, though the whole struct
wasn't really packed at all (i at offset 4, j at offset 8).
gomp #pragma handling rejects this.

Another testcase is:
#pragma pack(1)
struct S
{
  char h;
  struct T { int h1; char h2[3]; } t;
  int i;
#pragma pack()
  int j;
};
struct S s;
void *i = &s.i, *j = &s.j;
void *h1 = &s.t.h1, *h2 = &s.t.h2[0];

Here, h1 was s+1, h2 s+5, i s+8 and j s+12, i.e. struct T used to be packed
and struct S wasn't packed.


-- 
           Summary: [gomp] #pragma pack() inside of structure
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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