Structure tag alignment problem

jgg@pdn.paradyne.com (Joe Gabriel)
Fri, 13 Dec 91 09:59 EST

          From comp.compilers

Related articles
Structure tag alignment problem jgg@pdn.paradyne.com (1991-12-15)
Re: Structure tag alignment problem alex@vmars.tuwien.ac.at (1991-12-15)
Re: Structure tag alignment problem megatest!djones@decwrl.dec.com (1991-12-16)
| List of all articles for this month |

Newsgroups: comp.compilers
From: jgg@pdn.paradyne.com (Joe Gabriel)
Keywords: C, GCC, question
Organization: Compilers Central
Date: Fri, 13 Dec 91 09:59 EST

Here is our problem. Our organization is developing a product which has 2
different types of 32-bit processors who interface with each other, an
Intel 960 and a 486. The Intel Compiler used for the 960 aligns structure
tags on 4-byte boundaries. The gnu386 compiler we are using for the 486 is
able to align on byte boundaries where called for. This causes
size/alignment problems when our 486 sends 386 compiled structures to the
960 for use by 960 compiled code. Any ideas on how to solve this problem,
ie. knowledge of a 386 compiler which aligns structure tags on 4 byte
boundaries, OR preprocessor for 486 code structures which pads the
structures destined for the 960.


Thanks,
Joe G.


---------------- ------------------
| | | |
| 486 |--------------------------->>>>| 960 |
| | Compiled Structures | |
|_______________| |_______________ |


struct xyz { /*gnu386 size=8 bytes*/ struct xyz { /*Intel960 size=12 bytes*/
            char x; char x;
            short y; short y;
            int z; int z;
} }


Joseph G. Gabriel AT&T Paradyne
Contract Software Engineer Mail stop LG-132
jgg@pdn.paradyne.com P.O. Box 2826
Phone: (813) 530-8512 Largo, FL 34649-2826
[It shouldn't be too hard to change GCC to align everything on a word
boundary -- look at the source file stor-layout.c. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.