[Bug c/89968] attribute packed fails to reduce char vector member alignment

2019-04-05 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89968

--- Comment #4 from Martin Sebor  ---
The alignment is respected for members of other types than char so the order of
the attributes doesn't seem to matter here (it does matter in pr89950):

$ cat pr89968-2.c && gcc -S -O2 -Wall -fdump-tree-optimized=/dev/stdout
pr89968-2.c 
struct S
{
  char c;
  __attribute__ ((aligned (64), packed, vector_size (1024))) int v;   // okay
};

int f (void) { return sizeof (struct S); }// 1088
int g (void) { return __alignof__ (struct S); }   // 64

__attribute__ ((aligned (64), vector_size (1024))) int v1;
int h1 (void) { return __alignof__ (v1); }// 1024

__attribute__ ((vector_size (1024), aligned (64))) int v2;
int h2 (void) { return __alignof__ (v2); }// 64




;; Function f (f, funcdef_no=0, decl_uid=1909, cgraph_uid=1, symbol_order=0)

f ()
{
   [local count: 1073741824]:
  return 1088;

}



;; Function g (g, funcdef_no=1, decl_uid=1912, cgraph_uid=2, symbol_order=1)

g ()
{
   [local count: 1073741824]:
  return 64;

}



;; Function h1 (h1, funcdef_no=2, decl_uid=1916, cgraph_uid=3, symbol_order=3)

h1 ()
{
   [local count: 1073741824]:
  return 1024;

}



;; Function h2 (h2, funcdef_no=5, decl_uid=1920, cgraph_uid=4, symbol_order=5)

h2 ()
{
   [local count: 1073741824]:
  return 64;

}

[Bug c/89968] attribute packed fails to reduce char vector member alignment

2019-04-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89968

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-04-05
 Ever confirmed|0   |1

--- Comment #3 from Richard Biener  ---
vector_size needs to honor user-alignment I guess.

[Bug c/89968] attribute packed fails to reduce char vector member alignment

2019-04-04 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89968

--- Comment #2 from Andrew Pinski  ---
One problem is the order of the attributes applying here. vector_size applies
after all the others as that is the order in the program.

[Bug c/89968] attribute packed fails to reduce char vector member alignment

2019-04-04 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89968

Martin Sebor  changed:

   What|Removed |Added

   Keywords||ABI, diagnostic
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=59220

--- Comment #1 from Martin Sebor  ---
See also pr59220 for a related bug.