This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix powerpc 64 alignment problem for lwa instruction



On Nov 7, 2006, at 3:10 PM, Andrew Pinski wrote:



What about rejecting all low_sum instead? The alignment is still the correct
									^^^^^^
									incorrect
check. Because we can have alignment of 16 and still have an offset which is
a multiple of 4.
Hmm, the other thing is that constraint m seems wrong for the lwa instruction,
I think it should be changed to Y like the load doubleword case.

The reason why I said this patch is incorrect is because the following:
#pragma pack(push, 2)
struct FixedRectangle {
int left;
int top;
int right;
int bottom;
};
#pragma pack(pop)


long getLeft (struct FixedRectangle *a)
{
  return ((struct FixedRectangle*)(((char*)a)+4))->top;
}

Compile at -Os -m64, we should still get a lwa

I don't agree. The original object is (can be) misaligned, however you access it.
(You can't always tell that, e.g. if you put the cast in the caller instead of the
callee, but here you can.)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]