TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Michael Stapleton
date: 1995-07-14 21:50:00
subject: SAS/C bug!!!

-=> On 07-02-95  11:38 you wrote to me <=-

Hi Paul,

MS> All data must be aligned on the Motorola 68000, but the 68020 &
MS> above are more forgiving.

PE> I have written a program that demonstrates this, and in the
PE> process I discovered a bug in SAS/C 6.5.  Does anyone have
PE> any info on whether SAS/C 6.5 is the latest version and/or
PE> supported and/or there is a patch available for it?
PE> Thanks + bye.  Paul.

I tried it under 5.10a & the compiler claims "Too many
initializers", yet the standard specifically allows this
form of array initialization. The Lattice manual says nothing.

I don't know if a patch is available.  I've only encountered this
bug a few times, however it did bite me only a month or so ago.
I've never been particularly bothered by it, but I can see how it
could cause difficulties porting ANSI code to what is supposed to be
a highly ANSI/ISO compliant compiler.

PE> /* on BC++ 1.5 for OS/2 on a 386 machine, this prints 5040302 */
PE> /* On SAS/C 6.5 (after changing buf[5] to buf[6]) running on an
PE>    Amiga 2000, it traps */
PE> /* This demonstrates that the 68000 cannot access long integers
PE>    that aren't properly aligned */

PE> #include 
PE> #include 

PE> int main(void)
PE> {
PE>     char *cp;
PE>     long *ip;
PE>     char buf[5] = "\x01\x02\x03\x04\x05";
PE>     long x;
PE>
PE>     cp = buf + 1;
PE>     memcpy(&ip, &cp, sizeof(char *));
PE>     x = *ip;
PE>     printf("x is %lx\n", x);
PE>     return (0);
PE> }

Does anybody have any suggestions?

Michael Stapleton of Graphic Bits.

 * AmyBW v2.10 *
... This tagline is encrypted
--- Blue Wave/RA v2.10 AmyBW
* Origin: The Three Amigas - better than two (3:713/615.0)
SEEN-BY: 50/99 620/243 623/630 711/401 409 410 430 510 807 808 809 932 934
SEEN-BY: 712/508 515 713/111 317 601 611 615 618 700 826 888 906 914 714/906
SEEN-BY: 800/1 7877/2809
@PATH: 713/615 888 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.