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] |
On Thu, 2004-04-29 at 15:17, Grant Edwards wrote: > 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. > None of them. I was referring to the statement: > Actually, I'm pretty sure it is guaranteed to work as long as the > compiler can see the "packed" attribute during compilation (if it > couldn't, that would be a serious structural problem in your source code!). Which claimed it should work. It doesn't, and isn't intended to. > 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. > No, even that isn't guaranteed, since the compiler is entitled to "know" the implementation of memcpy, and therefore to implement it inline. If you assign a pointer to a 'short *' and then try to dereference it, then the compiler is entitled to assume that the value really is a legal short * and has all the properties required of such a pointer. > > Normal pointers can't handle unaligned objects. > > What do you mean by "handle"? Dereference. R. ------ 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] |