This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: ARM compiler misbehaves ?


On Thu, Apr 29, 2004 at 10:44:14AM +0100, Richard Earnshaw wrote:

> > >test_pointer now points to an odd address. Dereferencing it
> > >will almost certainly not work right, since the compiler
> > >doesn't generate run-time checks for misaligned pointers.
> 
> Wrong.

OK, which are you claiming?

 a) test_pointer points to an even address.

 b) Dereferencing the pointer works right.

or 

 c) The compiler generates run-time checks for misaligned
    pointers.

Can you provide any evidence for any of the three?  I know for
a fact that none of the three claims is true for 2.9x and 3.x
versions of gcc targetted for ARM or H8 architectures.  Which
target architecture are you talking about?
    
> You can't take the address of a packed element and store it in a
> normal pointer.

Last time I checked (with the ARM and H8 gcc's) you could. It's
just that dereferencing the pointer won't work right. Copying
to/from the value of the pointer with memcpy() works fine.

> Normal pointers can't handle unaligned objects.

What do you mean by "handle"?

> You'd need to create a structure containing only a packed
> short and then play games using that.
> 
> It's sometimes a real shame that gcc doesn't have 
> 
> short attribute((packed)) *f;

Yes, that would be handy.

-- 
Grant Edwards
grante@visi.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


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