[comp.unix.ultrix] Ultrix RISC internal compiler bug

meissner@osf.org (Michael Meissner) (02/27/90)

I tried to compile the latest nethack (patch level 7) that I got from
uunet, and ran into the following internal errors when compiling
apply.c, vault.c, and zap.c.  I tried various levels of optimization,
and debugging to no avail.  I compiled the modules with GCC 1.37 (with
-O, no -g), and it seems to work, but I thought you guys might be
interested.

cc -O1 -g -I../include   -c apply.c 
ugen: internal  : line 538 : eval.p, line 635
                illegal size in load/store
make: *** [apply.o] Error 1
	...
cc -O1 -g -I../include   -c vault.c 
ugen: internal  : line 328 : eval.p, line 635
                illegal size in load/store
make: *** [vault.o] Error 1
	...
cc -O1 -g -I../include   -c zap.c 
ugen: internal  : line 1433 : eval.p, line 635
                illegal size in load/store
make: *** [zap.o] Error 1


==================== config.h ====================
/*	SCCS Id: @(#)config.h	3.0	89/06/23
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed.  See license for details. */

#ifndef CONFIG_H /* make sure the compiler does not see the typedefs twice */
#define	CONFIG_H


/*
 * Section 1:	OS selection.
 *		Select the version of the OS you are using.
 *		For "UNIX" select either SYSV or BSD in unixconf.h.
 *		A "VMS" option is not needed since the VMS C-compiler
 *		provides it (comment out the default OS option here).
 */

#define UNIX		/* delete if no fork(), exec() available */

#ifdef __MSDOS__	/* Turbo C auto-defines __MSDOS__, MSC defines MSDOS */
#define MSDOS		/* define for MS-DOS (in case compiler doesn't) */
#else
/* #define MSDOS	/* define for MS-DOS and most other micros */
			/* DO NOT define for AMIGA - MSDOS will be
			 * automatically defined at the right place. */
# ifdef AZTEC_C 	/* Manx 3.6 auto-defines this */
#  ifdef MCH_AMIGA	/* Manx 3.6 auto-defines this for AMIGA */
#   ifndef AMIGA
#define AMIGA		/* define for Commodore-Amiga */
#   endif		/* (Lattice auto-defines AMIGA) */
#  endif
# endif
/* #define TOS		/* define for Atari 1040ST */

/* #define STUPID	/* avoid some complicated expressions if
			   your C compiler chokes on them */
/* #define STUPID_CPP	/* use many small functions instead of macros to
			   avoid overloading limited preprocessors */
/* #define TERMINFO	/* uses terminfo rather than termcap */
			/* should be defined for most, but not all, SYSV */
			/* in particular, it should NOT be defined for the
			 * UNIXPC unless you remove the use of the shared
			 * library in the makefile */
/* #define MINIMAL_TERM	/* if a terminal handles highlighting or tabs poorly,
			   try this define, used in pager.c and termcap.c */
/* #define MACOS 	/* define for Apple Macintosh */
#endif

#ifdef AMIGA
#define NEED_VARARGS
# ifdef AZTEC_C
#  define KR1ED		/* Aztec 3.6 needs extra help for defined() */
# endif
#endif

#ifdef MACOS
/* #define KR1ED	/* for compilers which can't handle defined() */
			/* Lightspeed & Aztec can't handle defined() yet */
/* #define LSC		/* for the Lightspeed 3.01p4 C compiler on the Mac */
/* #define AZTEC	/* for the Manx Aztec C 3.6c compiler */
#define THINKC4	/* for the Think C 4 compiler */
/* #define MAKEDEFS_C	/* uncomment this ONLY while compiling makedefs */
/* #define CUSTOM_IO	/* uncomment only while compiling Nethack */
# ifndef MAKEDEFS_C
#  ifndef NEED_VARARGS
#define NEED_VARARGS	/* if you're using precompiled headers */
#  endif
# endif
#define SMALLDATA	/* for Mac compilers with 32K global data limit */
#endif


#ifdef KR1ED		/* For compilers which cannot handle defined() */
#define defined(x) (-x-1 != -1)
/* Because:
 * #define FOO => FOO={} => defined( ) => (-1 != - - 1) => 1
 * #define FOO 1 or on command-line -DFOO
 *      => defined(1) => (-1 != - 1 - 1) => 1
 * if FOO isn't defined, FOO=0. But some compilers default to 0 instead of 1
 * for -DFOO, oh well.
 *      => defined(0) => (-1 != - 0 - 1) => 0
 *
 * But:
 * defined("") => (-1 != - "" - 1)
 *   [which is an unavoidable catastrophe.]
 */
#endif



/*
 * Section 2:	Some global parameters and filenames.
 *		Commenting out WIZARD, LOGFILE, or NEWS removes that feature
 *		from the game; otherwise set the appropriate wizard name.
 *		LOGFILE and NEWS refer to files in the playground.
 */

#ifndef WIZARD		/* allow for compile-time or Makefile changes */
# ifndef KR1ED
#define WIZARD  "meissner" /* the person allowed to use the -D option */
# else
#define WIZARD
#define WIZARD_NAME "meissner"
# endif
#endif

#define LOGFILE "logfile"	/* larger file for debugging purposes */
#define NEWS "news"		/* the file containing the latest hack news */

/*
 *	If COMPRESS is defined, it should contain the full path name of your
 *	'compress' program.  Defining ZEROCOMP causes NetHack to do simpler
 *	zero-run compression internally.  Both COMPRESS and ZEROCOMP create
 *	smaller bones/level/save files, but require additional code and time.
 */

#ifndef MACOS
#define COMPRESS "/usr/ucb/compress"  /* path name for 'compress' */
# ifndef COMPRESS
#define ZEROCOMP	/* Use only if COMPRESS is not used -- Olaf Seibert */
# endif
#endif

#ifndef MACOS
#define CHDIR		/* delete if no chdir() available */
#endif

#ifdef CHDIR
/*
 * If you define HACKDIR, then this will be the default playground;
 * otherwise it will be the current directory.
 */
#define HACKDIR "/usr/games/lib/nethackdir" 	/* nethack directory */

/*
 * Some system administrators are stupid enough to make Hack suid root
 * or suid daemon, where daemon has other powers besides that of reading or
 * writing Hack files.  In such cases one should be careful with chdir's
 * since the user might create files in a directory of his choice.
 * Of course SECURE is meaningful only if HACKDIR is defined.
 */
/* #define SECURE	/* do setuid(getuid()) after chdir() */

/*
 * If it is desirable to limit the number of people that can play Hack
 * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
 * #define MAX_NR_OF_PLAYERS 6
 */
#endif /* CHDIR /**/



/*
 * Section 3:	Definitions that may vary with system type.
 *		For example, both schar and uchar should be short ints on
 *		the AT&T 3B2/3B5/etc. family.
 */

/*
 * Uncomment the following line if your compiler doesn't understand the
 * 'void' type (and thus would give all sorts of compile errors without
 * this definition).
 */
/* #define void int			/* define if no "void" data type. */

#include "tradstdc.h"

/*
 * type schar: small signed integers (8 bits suffice) (eg. TOS)
 *
 *	typedef char	schar;
 *
 *      will do when you have signed characters; otherwise use
 *
 *	typedef short int schar;
 */
#ifdef AZTEC
#define schar	char
#else
typedef signed char	schar;
#endif

/*
 * type uchar: small unsigned integers (8 bits suffice - but 7 bits do not)
 *
 *	typedef unsigned char	uchar;
 *
 *	will be satisfactory if you have an "unsigned char" type;
 *	otherwise use
 *
 *	typedef unsigned short int uchar;
 */
typedef unsigned char	uchar;

/*
 * Various structures have the option of using bitfields to save space.
 * If your C compiler handles bitfields well (e.g., it can initialize structs
 * containing bitfields), you can define BITFIELDS.  Otherwise, the game will
 * allocate a separate character for each bitfield.  (The bitfields used never
 * have more than 7 bits, and most are only 1 bit.)
 */
#define BITFIELDS	/* Good bitfield handling */



/*
 * Section 4:  THE FUN STUFF!!!
 *
 * Conditional compilation of special options are controlled here.
 * If you define the following flags, you will add not only to the
 * complexity of the game but also to the size of the load module.
 */ 

/* game features */
#define POLYSELF      /* Polymorph self code by Ken Arromdee */
#define THEOLOGY      /* Smarter gods - The Unknown Hacker */
#define SOUNDS        /* Add more life to the dungeon */
#define KICK          /* Allow kicking things besides doors -Izchak Miller */
/* dungeon features */
#define THRONES       /* Thrones and Courts by M. Stephenson */
#define FOUNTAINS     /* Fountain code by SRT (+ GAN + EB) */
#define SINKS         /* Kitchen sinks - Janet Walz */
#define ALTARS        /* Sacrifice sites - Jean-Christophe Collet */
/* dungeon levels */
#define WALLIFIED_MAZE /* Fancy mazes - Jean-Christophe Collet */
#define REINCARNATION /* Rogue-like levels */
#define STRONGHOLD    /* Challenging special levels - Jean-Christophe Collet*/
/* monsters & objects */
#define ORACLE        /* Include another source of information */
#define MEDUSA        /* Mirrors and the Medusa by Richard P. Hughey */
#define KOPS          /* Keystone Kops by Scott R. Turner */
#define ARMY          /* Soldiers, barracks by Steve Creps */
#define WORM          /* Long worms */
#define GOLEMS        /* Golems, by KAA */
#define INFERNO       /* Demons & Demonlords */
#ifdef INFERNO
#define SEDUCE        /* Succubi/incubi additions, by KAA, suggested by IM */
#endif
#define TOLKIEN       /* More varieties of objects and monsters */
#define PROBING       /* Wand of probing code by Gil Neiger */
#define WALKIES       /* Leash code by M. Stephenson */
#define SHIRT         /* Hawaiian shirt code by Steve Linhart */
#define MUSIC         /* Musical instruments - Jean-Christophe Collet */
#define TUTTI_FRUTTI  /* Fruits as in Rogue, but which work... -KAA */
#define SPELLS        /* Spell casting by M. Stephenson */
#define NAMED_ITEMS   /* Special named items handling */
/* difficulty */
#define ELBERETH      /* Allow for disabling the E word - Mike 3point */
#define EXPLORE_MODE  /* Allow non-scoring play with additional powers */
#define HARD          /* Enhanced wizard code by M. Stephenson */
/* I/O */
#define REDO          /* support for redoing last command - DGK */
#define COM_COMPL     /* Command line completion by John S. Bien */
#ifndef AMIGA
#define CLIPPING      /* allow smaller screens -- ERS */
#endif

#ifdef REDO
#define DOAGAIN '\001'		/* The "redo" key used in tty.c and cmd.c */
#endif

#define EXP_ON_BOTL	/* Show experience on bottom line */
#define SCORE_ON_BOTL	/* added by Gary Erickson (erickson@ucivax) */



#include "global.h"	/* Define everything else according to choices above */

#endif /* CONFIG_H /**/

==================== unixconf.h ====================
/*	SCCS Id: @(#)unixconf.h	3.0	88/07/21
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed.  See license for details. */

#ifdef UNIX
#ifndef UNIXCONF_H
#define UNIXCONF_H

/*
 * Some include files are in a different place under SYSV
 * 	BSD		   SYSV
 * <sys/time.h>		<time.h>
 * <sgtty.h>		<termio.h>
 *
 * Some routines are called differently
 * index		strchr
 * rindex		strrchr
 *
 */

/* define one of the following */
/* #define BSD		/* define for 4.n BSD  */
			/* also for relatives like SunOS and DG/UX */
#define ULTRIX		/* define for Ultrix v3.0 or higher (but not lower) */
			/* Use BSD for < v3.0 */
			/* "ULTRIX" not to be confused with "ultrix" */
/* #define SYSV		/* define for System V */
/* #define HPUX		/* Hewlett-Packard's Unix, version 6.5 or higher */
			/* use SYSV for < v6.5 */


/* define any of the following that are appropriate */
#define NETWORK		/* if running on a networked system */
			/* e.g. Suns sharing a playground through NFS */
/* #define GENIX	/* Yet Another Unix Clone */
/* #define HISX		/* Bull Unix for XPS Machines */
/* #define UNIXPC	/* use in addition to SYSV for AT&T 7300/3B1 */
			/* also note that the stock cpp qualifies as a
			   STUPID_CPP for config.h */

/* #define PYRAMID_BUG 	/* avoid a bug on the Pyramid */
/* #define APOLLO	/* same for the Apollo */
/* #define BSD_43_BUG	/* for real 4.3BSD cc's without schain botch fix */
/* #define MICROPORT_BUG /* problems with large arrays in structs */
/* #define MICROPORT_286_BUG /* Changes needed in termcap.c to get it to
			   run with Microport Sys V/AT version 2.4.
			   By Jay Maynard */

/* #define RANDOM	/* if neither random/srandom nor lrand48/srand48
			   is available from your system */
/* #define TEXTCOLOR	/* Use System V r3.2 terminfo color support */


/*
 * The next two defines are intended mainly for the Andrew File System,
 * which does not allow hard links.  If NO_FILE_LINKS is defined, lock files
 * will be created in LOCKDIR using open() instead of in the playground using
 * link().
 *		Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
 */

/* #define NO_FILE_LINKS	/* if no hard links */
/* #define LOCKDIR "/usr/games/lib/nethackdir"	/* where to put locks */


/*
 * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
 * If defined, it can be overridden by the environment variable PAGER.
 * Hack will use its internal pager if DEF_PAGER is not defined.
 * (This might be preferable for security reasons.)
 * #define DEF_PAGER	".../mydir/mypager"
 */



/*
 * If you define MAIL, then the player will be notified of new mail
 * when it arrives.  If you also define DEF_MAILREADER then this will
 * be the default mail reader, and can be overridden by the environment
 * variable MAILREADER; otherwise an internal pager will be used.
 * A stat system call is done on the mailbox every MAILCKFREQ moves.
 */

#define MAIL			/* Deliver mail during the game */

/* The Andrew Message System does mail a little differently from normal
 * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox 
 * (another directory).  MAILBOX is the element that will be added on to 
 * the user's home directory path to generate the Mailbox path - just in 
 * case other Andrew sites do it differently from CMU.
 *
 *		dan lovinger
 *		dl2n+@andrew.cmu.edu (dec 19 1989)
 */

/* #define AMS			/* use Andrew message system for mail */

/* NO_MAILREADER is for kerberos authentcating filesystems where it is
 * essentially impossible to securely exec child proccesses, like mail
 * readers, when the game is running under a special token.
 *
 *             dan
 */

/* #define NO_MAILREADER 	/* have mail daemon just tell player of mail */

#ifdef	MAIL
# if defined(BSD) || defined(ULTRIX)
#  ifdef AMS
#define AMS_MAILBOX	"/Mailbox"
#  else
#define	DEF_MAILREADER	"/usr/ucb/Mail"
#  endif
#else
# if defined(SYSV) || defined(DGUX) || defined(HPUX)
#  ifdef M_XENIX
#define	DEF_MAILREADER	"/usr/bin/mail"
#  else
#define	DEF_MAILREADER	"/usr/bin/mailx"
#  endif
# else
#define	DEF_MAILREADER	"/bin/mail"
# endif
#endif

#define	MAILCKFREQ	50
#endif	/* MAIL */



#ifdef COMPRESS
/* Some implementations of compress need a 'quiet' option.
 * If you've got one of these versions, put -q here.
 * You can also include any other strange options your compress needs.
 * If you have a normal compress, just leave it commented out.
 */
/* #define COMPRESS_OPTIONS	"-q"	/* */
#endif

#define	FCMASK	0660	/* file creation mask */


/*
 * The remainder of the file should not need to be changed.
 */

/*
 * BSD/ULTRIX systems are normally the only ones that can suspend processes.
 * Suspending NetHack processes cleanly should be easy to add to other systems
 * that have SIGTSTP.  Currently the only such system known to work is HPUX;
 * other systems will probably require tweaks to unixtty.c and ioctl.c.
 */
#if defined(BSD) || defined(ULTRIX) || defined (HPUX)
#define	SUSPEND		/* let ^Z suspend the game */
#endif


#if defined(BSD) || defined(ULTRIX)
#include	<sys/time.h>
#else
#include	<time.h>
#endif

#define	HLOCK	"perm"	/* an empty file used for locking purposes */
#define LLOCK	"safelock"	/* link to previous */

#ifndef REDO
#define Getchar getchar
#else
#define tgetch getchar
#endif

#define SHELL		/* do not delete the '!' command */

#include "system.h"

#if defined(BSD) || defined(ULTRIX)
# ifndef DGUX
#define memcpy(d, s, n)		bcopy(s, d, n)
#define memcmp(s1, s2, n)	bcmp(s2, s1, n)
# endif
#else	/* therefore SYSV */
#define index	strchr
#define rindex	strrchr
#endif

/* Use the high quality random number routines. */
#if defined(BSD) || defined(ULTRIX) || defined(RANDOM)
#define Rand()	random()
#define Srand(seed) srandom(seed)
#else
#define Rand()	lrand48()
#define Srand(seed) srand48(seed)
#endif

#ifdef hc	/* older versions of the MetaWare High-C compiler define this */
# ifdef __HC__
#  undef __HC__
# endif
# define __HC__ hc
# undef hc
#endif

#endif /* UNIXCONF_H /* */
#endif /* UNIX /* */
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Catproof is an oxymoron, Childproof is nearly so