home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sdd.hp.com!swrinde!dptspd!dscharfe
- From: dscharfe@dptspd.sat.datapoint.com (David Scharfe)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Please help me with a SAS question/problem
- Summary: Data alignment
- Message-ID: <Bu26Kr.65A@dptspd.sat.datapoint.com>
- Date: 4 Sep 92 14:50:50 GMT
- Distribution: usa
- Organization: Datapoint Corporation, San Antonio, TX
- Lines: 34
-
- I have a SAS/C 5.10b problem. Data structure similar to:
-
- typedef struct Abc {
- UBYTE xxx;
- UBYTE q,r,t,s;
- UBYTE array[13][31];
- } Abc;
-
- code modifies it ala:
-
- abc.array[8][someValue] = someOtherValue;
-
- The generated code does not work. When in CPR, I watch abc.array[7]
- it gets changed when executing the above for someValue <= 7.
-
- There is an obvious alignment problem. When I modified the code to:
-
- abc.array[value][someValue] = someOtherValue
-
- CPR "mixed" source mode showed a multiplication of 'value' by 31
- and add of 'someValue' to get the address. Unfortunately, when
- I examine the addresses of abc.array[i][0], they differ by 32.
- Evidently the compiler is forcing (long?)word alignment of EACH
- of the major array elements, but the code is not accounting for this.
-
- Is there a compiler switch I can use to fix this, or is it a bug?
-
- Please respond via email.
-
- Thanks a lot,
- Dave
-
- P.S. My apologies if this is a FAQ or RTFM; I tried the latter and
- did not find anything (I suspect its in there tho!)...
-