This is a temporary band-aid until Bison gets proper alignment handling.
We need it on ARM.
* data/lalr1.cc (variant): Declare the buffer as a union to force
the same alignment as "long double".
{]b4_assert_if([
assert(!built);
built = true;])[
{]b4_assert_if([
assert(!built);
built = true;])[
- return *new (buffer) T;
+ return *new (buffer.raw) T;
}
/// Instantiate a \a T in here from \a t.
}
/// Instantiate a \a T in here from \a t.
{]b4_assert_if([
assert(!built);
built = true;])[
{]b4_assert_if([
assert(!built);
built = true;])[
- return *new (buffer) T(t);
+ return *new (buffer.raw) T(t);
}
/// Construct and fill.
}
/// Construct and fill.
variant (const T& t)]b4_assert_if([
: built(true)])[
{
variant (const T& t)]b4_assert_if([
: built(true)])[
{
}
/// Accessor to a built \a T.
}
/// Accessor to a built \a T.
as()
{]b4_assert_if([
assert(built);])[
as()
{]b4_assert_if([
assert(built);])[
- return reinterpret_cast<T&>(buffer);
+ return reinterpret_cast<T&>(buffer.raw);
}
/// Const accessor to a built \a T (for %printer).
}
/// Const accessor to a built \a T (for %printer).
as() const
{]b4_assert_if([
assert(built);])[
as() const
{]b4_assert_if([
assert(built);])[
- return reinterpret_cast<const T&>(buffer);
+ return reinterpret_cast<const T&>(buffer.raw);
}
/// Swap the content with \a other.
}
/// Swap the content with \a other.
}
/// A buffer large enough to store any of the semantic values.
}
/// A buffer large enough to store any of the semantic values.
+ /// Long double is chosen as it has the strongest alignment
+ /// constraints.
+ union {
+ long double align_me;
+ char raw[S];
+ } buffer;
};
]])[
]b4_namespace_close[
};
]])[
]b4_namespace_close[