Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uwm.edu!linac!att!cbnewsm!cbnewsk!cbnewsj!vrr From: vrr@cbnewsj.att.com (veenu.r.rashid) Newsgroups: comp.sys.amiga.programmer Subject: Re: Bug in GNU AWK 2.10 Beta Keywords: awk, A3000, bug Message-ID: <1991May1.034342.27767@cbnewsj.att.com> Date: 1 May 91 03:43:42 GMT References: <1991May1.033700.27346@cbnewsj.att.com> Distribution: na Organization: AT&T Bell Laboratories Lines: 85 In article <1991May1.033700.27346@cbnewsj.att.com> vrr@cbnewsj.att.com (veenu.r.rashid) writes: > Eh, part of the code got garbled in transit.. > >I am trying to recompile the GNU AWK program to run on my Amiga 3000. >This is version 2.10 Beta and it was crashing on my system. It recompiled >fine after I set a few #includes and reworked a couple #defines >(yes, the lmkfile was included). However, this version still causes >crashes. So, I set the debug options and ran it under CPR. > >Apparently the program has problems with the Level 1 file open command. >The code in which this occurs follows: > >/* devopen --- handle /dev/std{in,out,err}, /dev/fd/N, regular files */ > >1082: int >1083: devopen (name, mode) >1084: char *name, *mode; >1085: { >1086: int openfd = -1; >1087: FILE *fdopen (); >1088: char *cp; switch (mode[0]) { case 'r': flag = O_RDONLY; open(name, flag); <- no mode needed break; >1099: >1100: case 'a': flag = O_WRONLY | O_APPEND | O_CREAT; >1101: file = open(name, flag, 0666); >1102: break; >1103: } >1104: >1105: return file >1106: } > The case which gets executed is when mode[0] = 'r' and flag = O_RDONLY. The rest of the code is fine - sorry. >From cpr, the value of name is "T:gawk.225169" and T: is assigned to ram:t > >The disassembly shows: > >00FEB5C8: MOVE.L D1,D0 >00FEB5CA: SWAP D1 >00FEB5CC: MOVE.W A1,D0 >00FEB5CE: DIVU.W D2,D0 > >The program is currently at 0x00FEB5C8 (move.l) >When it gets to 0x00FEB5CE (divu.w), *wham* it crashes the system >with a nice large GURU. The message is "Exception - divide by 0" >and the value of D0 is 0. > >I am using SAS/C 5.10c (latest version) along with the code from >ab20.larc.nasa.gov. The compile flags are: > >CFLAGS = -cc -m3 -dUSG -dAMIGA -dNOVPRINTF -d5 -DDEBUG > > >Does anyone have any clues on this? Can anyone duplicate the problem or >detect any errors? I really need this AWK program. Can anyone tell >me where I can find a *WORKING* version for the A3000? > > >BTW: I compiled a test program with the couple lines: > >main() >{ > int flag, file; > > flag = O_RDONLY; > file = open("T:gawk.xxx", flag); > printf("file = %s\n", file); >} > >and this worked fine! It returns 3. > > >Thanks very much for any suggestions, tips pointers, or source for a >newer version, >Veenu > >vrr@cbnewsj.att.com >