Work around for compiler error parsing 'aligned' attribute? (Bug 11071)?

Hi All,

I'm using Clang 3.1, and am having problems with __aligned__ attribute
as reported in (reported

Are there any workarounds that I can apply to get past my compilation problems?

$ clang --version
clang version 3.1 (branches/release_31)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Hi All,

I'm very unclear of what is going on with the GNU C/GCC attributes. It
appears they should work, but they don't. And bugs relating to them
have gone unacknowledged for years.

First, Clang claims to support GNU C/GCC 4.2.1:

$ clang -dM -E -x c /dev/null | grep -i gnuc
#define __GNUC_MINOR__ 2
#define __GNUC_PATCHLEVEL__ 1
#define __GNUC_STDC_INLINE__ 1
#define __GNUC__ 4

Second, __attribute__(align) is circa GCC 3.0. GCC 3.0 is from 2001,
while GCC 4.2.1 is from 2007

Third, the docs don't list __attribute__(align) as "Intentionally
unsupported GCC extensions" per

Fourth, __attribute__(align) is not listed as "GCC extensions not
implemented yet" per

Does anyone have any ideas to work around the compile problems when
using Clang? I really don't want to give it up because of its analysis
capabilities (especially since my copy of 3.1 it has Li and Regehr's
IOC patch).


We currently don't support that particular attribute in arbitrary type contexts —
in fact, I'm a bit surprised that GCC does. The reason why is simply that
we don't include alignment qualifiers in our formal type system; it's something
we've discussed, but we'd want to do it right, and that'd be a pretty large
amount of work. It would also be technically compatibility-breaking (GCC
also does not include explicit alignment qualifiers as part of its type system
for things like, say, template arguments), but that's not as much of an issue.

We do support "aligned" on arbitrary declarations, including typedefs (with
the major caveat that it still doesn't become part of the formal type system,
so again, it's not a different type for the purposes of things like templates).

We do have a concept of an AttributedType that we could probably use to
hack in support for this specific thing. Patches welcome.