[comp.sys.amiga.programmer] Bug in GNU AWK 2.10 Beta

ben@epmooch.UUCP (Rev. Ben A. Mesander) (04/30/91)

>In article <1991May1.033700.27346@cbnewsj.att.com> vrr@cbnewsj.att.com (veenu.r.rashid) writes:

[...]

>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

I think SAS/C 5.10 has a vprintf() in its library - it was documented in
the 5.05 upgrade files or something. Also, when you compile with -d5,
the symbol "DEBUG" is automagically defined for you.

5.10c? I haven't heard from SAS - I have 5.10a. What are the differences?

>vrr@cbnewsj.att.com

A person from AT&T messing with GNU source?? :-) :-) :-)

--
| ben@epmooch.UUCP   (Ben Mesander)       | "Cash is more important than |
| ben%servalan.UUCP@uokmax.ecn.uoknor.edu |  your mother." - Al Shugart, |
| !chinet!uokmax!servalan!epmooch!ben     |  CEO, Seagate Technologies   |

vrr@cbnewsj.att.com (veenu.r.rashid) (05/01/91)

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;
1089:         open(name, flag, 0666);
1098:                         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: }

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

vrr@cbnewsj.att.com (veenu.r.rashid) (05/01/91)

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
>