This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 6212
On Mon, May 06, 2002 at 02:56:09PM -0700, Mark Mitchell wrote:
> I can verify the patch on GNU/Linux, too. Is there someone who would
> care to try this on a MIPS or Alpha box to confirm that it works OK
> there? (Alpha was also affected by this problem.)
I'll test Alpha, but I'm pretty sure this patch is incorrect.
Consider
int foo(int *p)
{
return *((char *)p);
}
char c[2] __attribute__((aligned));
int bar()
{
return foo((int *)&c[1]);
}
Since we recurse all the way down to the PARM_DECL, we decide that P
is 4-byte aligned. We already discussed cases with pointers having
strange values (so long as they weren't dereferenced) and declared
them acceptable in gcc.
No, I think a proper solution is to let highest_pow2_factor increase
the alignment, but not decrease it. Assuming the alignment of the
type *that we dereference* would match the behaviour of previous
gcc versions.
r~