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 Mon, Jul 05, 2004 at 03:13:18PM +0200, Toralf Lund wrote: > >Yes. You can't take the address of a packed structure member and then > >dereference it as a normal pointer. If the underlying hardware/ABI only > >supports aligned types then only pointers that are correctly aligned can > >be dereferenced. > > > > Fair enough. > > I guess that it's logical that it would work on the 68K, then, as 32-bit > accesses only need to be aligned to 16-bit words there, as far as I > remember. I believe that's right. I ran into the same exact same problem when porting an app from 68K to SPARC some years back. > OK. I also found out why I thought it sometimes worked; in fact I didn't > take the address of a basic type in those cases, but of the struct > itself instead. In other words, in my above example > > struct somestruct *ptr=&value; > > ptr->b=-100; > > would probably do the right thing. I'm I right in assuming that this > will always be allowed? Good question. I _think_ it will because the compiler knows that "b" is a packed field when you do foo.b or bar->b, so it will generate code appropriately. -- 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] |