Bug 65715 - Aligned attribute C++ issues
Summary: Aligned attribute C++ issues
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on: 65690
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-09 15:11 UTC by Jakub Jelinek
Modified: 2015-04-10 07:39 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-04-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2015-04-09 15:11:47 UTC
+++ This bug was initially created as a clone of Bug #65690 +++

typedef double T[4][4] __attribute__((aligned (16)));
void foo (const T);
struct S { T s; };

int
main ()
{
  if (__alignof__ (struct S) < 16 || __alignof__ (T) < 16)
    __builtin_abort ();
  return 0;
}

(distilled from WebKit) fails with C++ starting with r219705 (but keeps working with C).  Without the const T in the argument list of foo (or with just T in there) it works.
Comment 1 Jakub Jelinek 2015-04-09 15:14:40 UTC
Tracking the rest from PR65690:
/* PR c++/65715 */
/* { dg-do run } */

typedef double T[4][4] __attribute__((aligned (2 * __alignof__ (double))));
void foo (const T);
struct S { T s; };

int
main ()
{
  if (__alignof__ (const T) != 2 * __alignof__ (double))
    __builtin_abort ();
  return 0;
}

#if defined(__cplusplus) && __cplusplus >= 201103L
static_assert (alignof (const T) == 2 * alignof (double), "alignment of const T");
#endif
Comment 2 Richard Biener 2015-04-10 07:37:41 UTC
Confirmed.
Comment 3 Jakub Jelinek 2015-04-10 07:39:08 UTC
Well, Jason has already committed the fix for this in PR65690.