This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: g++ 3.1 EH broken for irix6.5
- To: r dot sandiford at redhat dot com
- Subject: Re: g++ 3.1 EH broken for irix6.5
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Thu, 28 Jun 01 12:39:15 EDT
- Cc: gcc-patches at gcc dot gnu dot org
The unwinder uses the following union:
union unaligned
{
void *p;
unsigned u2 __attribute__ ((mode (HI)));
unsigned u4 __attribute__ ((mode (SI)));
unsigned u8 __attribute__ ((mode (DI)));
signed s2 __attribute__ ((mode (HI)));
signed s4 __attribute__ ((mode (SI)));
signed s8 __attribute__ ((mode (DI)));
} __attribute__ ((packed));
The fields with mode attributes get a default alignment that matches
their mode (16 for HImode, etc.). It used to be code in the else-if
clause below that set the alignment of mode-annotated fields to the
required BITS_PER_UNIT. But since union fields are set up with a
known_align of 0, that code is no longer triggered.
I'm confused as to why known_align is being used for packed decls.
Doesn't the fact that something is packed mean that nothing is known
about its alignment?
No. "packed" means "pack this as tightly as possible" meaning to not leave
any padding between fields. It also means not to leave any padding at the
end of the object. But that leaves totally open what alignment to assign
to the object, so one might as well assign the most efficient alignment
consistent with not having any padding, which in this case is the maximum
alignment.
You really don't want to pessimize struct layout so that every packed
record has only byte-alignment since that's unnecessary.
What exactly is the unwinder depending on here?
Have you tried specifying an alignment for the union explicitly?