This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 17949 (unaligned memory accesses due to ivopts) question
- From: Daniel Jacobowitz <drow at false dot org>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 16 Oct 2004 16:37:41 -0400
- Subject: Re: PR 17949 (unaligned memory accesses due to ivopts) question
- References: <20041016193534.GA15855@atrey.karlin.mff.cuni.cz>
On Sat, Oct 16, 2004 at 09:35:34PM +0200, Zdenek Dvorak wrote:
> This problem however does not seem to be limited to ivopts. For example
> the testcase below probably (I do not have access to the hardware
> just now, so I have checked only assembler, and I cannot read ia64 asm
> very well, so I am not entirely sure) fails in the same way.
>
> It seems to me that fixing this in ivopts is not the right place.
> Maybe setting DECL_NONADDRESSABLE_P for unaligned fields of structures
> when STRICT_ALIGNMENT = 1 would be more correct?
> typedef struct
> {
> short i __attribute__ ((packed));
> int f[2] __attribute__ ((packed));
> } A;
>
> A a;
>
> void foo(int *);
>
> int main(void)
> {
> foo (a.f);
> return 0;
> }
>
> void foo(int *x)
> {
> *x = 0;
> }
Well, a.f ought to be a pointer to unaligned integer. Don't you get
some kind of warning for this?
--
Daniel Jacobowitz