[gnu.utils.bug] Gawk-2.10 and Alliant

zjat02@apctrc.trc.amoco.com (Jon A. Tankersley) (09/14/89)

I just finished trying to get a fully compliant awk on our Alliant.  The one
distributed by Alliant doesn't handle changes to $n when printing $0.

I tried to port gawk and ran into a couple of problems:  gcc won't compile
it (awk2.c fsne [d0|d1], Invalid op-code)!  cc won't compile it! 
pcc will, but....  Even tried bison for the yacc/bison segment.

no vprintf, but the old code had to have HASDOPRNT and NOVPRINTF defined which
enabled a macro in awk.h.  Here is a patch to awk5.c to fix this problem.
*** awk5.c	Wed Sep  6 00:13:17 1989
--- awk5.c.old	Wed Sep 13 23:11:43 1989
***************
*** 134,144
  	abort();
  #endif
  	exit(1);
  }
  
! #if defined(NOVPRINTF) && !defined(HASDOPRNT)
  int
  vsprintf(str, fmt, ap)
  	char *str, *fmt;
  	va_list ap;
  {

--- 134,144 -----
  	abort();
  #endif
  	exit(1);
  }
  
! #if defined (HASDOPRNT) && defined(NOVPRINTF)
  int
  vsprintf(str, fmt, ap)
  	char *str, *fmt;
  	va_list ap;
  {

gawk builds properly, but doesn't act properly.
gawk -F: '{$3=$3*2;print}' /etc/passwd
will core dump.   It does, however, start printing properly and then die.
This does not print a doubled UID number under Alliant's awk.
Also other simple awk programs with math functions appear to self-destruct. 
Arithmetic execptions when none seems to occur with Alliant's awk.

Current defs:

OPTIMIZE=-O
DEBUG=-DDEBUG -DFUNC_TRACE -DMEMDEBUG
DEBUGGER=-g
PROFILE=#-pg
SYSV=
#BSD=-DHASDOPRNT
MEMCMP=-DNOMEMCMP
VPRINTF=-DNOVPRINTF
  
FLAGS= $(OPTIMIZE) $(SYSV) $(DEBUG) $(BSD) $(MEMCMP) $(VPRINTF)
CFLAGS= $(FLAGS) $(DEBUGGER) $(PROFILE) 
LDFLAGS= #-Bstatic

SRC =	awk1.c awk2.c awk3.c awk4.c awk5.c \
	awk6.c awk7.c awk8.c awk9.c version.c do_free.c awka.c

PCSTUFF= makefile.pc names.lnk random.c

AWKOBJS = awk1.o awk2.o awk3.o awk4.o awk5.o awk6.o awk7.o awk8.o awk9.o \
		version.o awka.o do_free.o # used for MEMDEBUG
ALLOBJS = $(AWKOBJS) awk.tab.o

# Parser to use on grammar -- if you don't have bison use the first one
#PARSER = yacc
PARSER = bison

# S5OBJS
#	Set equal to alloca.o if your system is S5 and you don't have
#	alloca. Uncomment the rule below to actually make alloca.o.
S5OBJS=

# GETOPT
#	Set equal to getopt.o if you have a generic BSD system. The
#	generic BSD getopt is reported to not work with gawk. The
#	gnu getopt is supplied in gnu.getopt.c. The Public Domain
#	getopt from AT&T is in att.getopt.c. Choose one of these,
#	and rename it getopt.c.
GETOPT=getopt.o

# LIBOBJS
#	Stuff that awk uses as library routines, but not in /lib/libc.a.
LIBOBJS= regex.o $(S5OBJS) $(GETOPT)

UPDATES = Makefile awk.h awk.y \
	$(SRC) regex.c regex.h

Anybody got any ideas?  No problems on Sun that I've seen so it appears to
be somewhat Alliant specific.
-tank-
#include <std/disclaimer.h>		/* nobody knows the trouble I .... */
tank@apctrc.trc.amoco.com    ..!uunet!apctrc!tank