🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2334

Gnu gcc 1.33 (plus two fixes from rms) can dump core

#2334
From: Arthur David Olson
Date: Sun, 19 Feb 1989 23:14
303 lines
8602 bytes
Index:	...

(We're running SunOS 4.0 on a Sun 3/280.)

Description:
	Gnu gcc 1.33's cc1 can dump core.

Repeat-By:

Script started on Sun Feb 19 18:12:48 1989
elsie$ cat try.c
static char	a[] = "xxxxxxxxxxxxxxxx";
static char	b[] = "xxxxxxxxxxxxxx";
static char	c[] = "xxxxxxxxxxxxxxxx";
static char	d[] = "xxxxxxxxxxxxx";
static char	e[] = "xxxxxxxxxxxxxxxx";
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <sys/param.h>
#include <math.h>
#include <sys/stat.h>
extern char *	calloc();
extern char *	malloc();
extern char *	realloc();
extern void	free();
extern char *	getenv();
extern void	exit();
extern void	qsort();
extern int	emkdir(const char * name, int mode);
extern int	getopt(int argc, char * argv[], const char * options);
extern char *	icatalloc(char * old, const char * new);
extern char *	icpyalloc(const char * string);
extern void	ifree(char * p);
extern char *	imalloc(int n);
extern char *	irealloc(char * old, int n);
extern int	link(const char * fromname, const char * toname);
extern char *	optarg;
extern int	optind;
extern void	perror(const char * string);
extern char *	scheck(const char * string, const char * format);
static void	addtt(time_t starttime, int type);
static int	addtype(long gmtoff, const char * abbr, int isdst);
static void	addleap(time_t t, int positive, int rolling);
static void	adjleap(void);
static void	associate(void);
static int	ciequal(const char * ap, const char * bp);
static void	convert(long val, char * buf);
static void	dolink(const char * fromfile, const char * tofile);
static void	eat(const char * name, int num);
static void	eats(const char * name, int num, const char * rname, int rnum);
static long	eitol(int i);
static void	error(const char * message);
static char **	getfields(char * buf);
static long	gethms(char * string, char * errstrng, int signable);
static void	infile(const char * filename);
static void	inleap(char ** fields, int nfields);
static void	inlink(char ** fields, int nfields);
static void	inrule(char ** fields, int nfiekds);
static int	inzcont(char ** fields, int nfields);
static int	inzone(char ** fields, int nfields);
static int	inzsub(char ** fields, int nfields, int iscont);
static int	itsabbr(const char * abbr, const char * word);
static int	itsdir(char * name);
static int	lowerit(int c);
char *		memcheck(char * tocheck);
static int	mkdirs(char * filename);
static void	newabbr(const char * abbr);
static long	oadd(long t1, long t2);
static void	outzone(const struct zone * zp, int ntzones);
static void	puttzcode(long code, FILE * fp);
static int	rcomp(const void * leftp, const void * rightp);
static time_t	rpytime(const struct rule * rp, int wantedy);
void		rulesub(struct rule * rp,
			char * loyearp, char * hiyearp, char * typep,
			char * monthp, char * dayp, char * timep);
static void	setboundaries(void);
static time_t	tadd(time_t t1, long t2);
static void	usage(void);
static void	writezone(const char * name);
static int	yearistype(int year, const char * type);
static int		charcnt;
static int		errors;
static const char *	filename;
static int		leapcnt;
static int		linenum;
static time_t		max_time;
static int		max_year;
static time_t		min_time;
static int		min_year;
static int		noise;
static const char *	rfilename;
static int		rlinenum;
static const char *	progname;
static int		timecnt;
static int		typecnt;
static int		tt_signed;
struct rule {
	const char *	r_filename;
	int		r_linenum;
	const char *	r_name;
	int		r_loyear;
	int		r_hiyear;
	const char *	r_yrtype;
	int		r_month;
	int		r_dycode;
	int		r_dayofmonth;
	int		r_wday;
	long		r_tod;
	int		r_todisstd;
	long		r_stdoff;
	const char *	r_abbrvar;
	int		r_todo;
	time_t		r_temp;
};
static struct rule *	rules;
static int		nrules;
struct zone {
	const char *	z_filename;
	int		z_linenum;
	const char *	z_name;
	long		z_gmtoff;
	const char *	z_rule;
	const char *	z_format;
	long		z_stdoff;
	struct rule *	z_rules;
	int		z_nrules;
	struct rule	z_untilrule;
	time_t		z_untiltime;
};
static struct zone *	zones;
static int		nzones;
struct link {
	const char *	l_filename;
	int		l_linenum;
	const char *	l_from;
	const char *	l_to;
};
static struct link *	links;
static int		nlinks;
struct lookup {
	const char *	l_word;
	const int	l_value;
};
static struct lookup const *	byword(char * string, struct lookup * lp);
static struct lookup const	mon_names[] = {
	"January",	0,
	"February",	0,
	"March",	0,
	"April",	0,
	"May",		0,
	"June",		0,
	"July",		0,
	"August",	0,
	"September",	0,
	"October",	0,
	"November",	0,
	"December",	0,
	0,		0
};
static struct lookup const	wday_names[] = {
	"Sunday",	0,
	"Monday",	0,
	"Tuesday",	0,
	"Wednesday",	0,
	"Thursday",	0,
	"Friday",	0,
	"Saturday",	0,
	0,		0
};
static struct lookup const	lasts[] = {
	"last-Sunday",		0,
	"last-Monday",		0,
	"last-Tuesday",		0,
	"last-Wednesday",	0,
	"last-Thursday",	0,
	"last-Friday",		0,
	"last-Saturday",	0,
	0,			0
};
static struct lookup const	begin_years[] = {
	"minimum",		0,
	"maximum",		0,
	0,			0
};
static struct lookup const	end_years[] = {
	"minimum",		0,
	"maximum",		0,
	"only",			0,
	0,			0
};
static struct lookup const	leap_types[] = {
	"Rolling",		0,
	"Stationary",		0,
	0,			0
};
static const int	len_months[2][12] = {
	31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
	31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
static const int	len_years[2] = {
	365, 366
};
static time_t		ats[370];
static unsigned char	types[370];
static long		gmtoffs[256];
static char		isdsts[256];
static char		abbrinds[256];
static char		chars[50];
static time_t		trans[50];
static long		corr[50];
static char		roll[50];
char *
memcheck(ptr)
char *	ptr;
{
	return ptr;
}
void
rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep)
struct rule *	rp;
char *		loyearp;
char *		hiyearp;
char *		typep;
char *		monthp;
char *		dayp;
char *		timep;
{
	struct lookup const *	lp;
	char *			cp;
	if ((lp = byword(monthp, 0)) == 0) {
		error("invalid month name");
		return;
	}
	rp->r_month = lp->l_value;
	if (*cp != '\0') {
		cp += strlen(cp) - 1;
		switch (lowerit(*cp)) {
			case 's':
				rp->r_todisstd = 0;
				break;
			case 'w':
				rp->r_todisstd = 0;
				*cp = '\0';
				break;
		}
	}
	rp->r_tod = gethms(timep, "invalid time of day", 0);
	cp = loyearp;
	if ((lp = byword(cp, 0)) != 0) switch ((int) lp->l_value) {
		case 0:
			rp->r_loyear = min_year;
			break;
		case 1:
			rp->r_loyear = max_year;
			break;
		default:
			(void) exit(0);
	} else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1 ||
		rp->r_loyear < min_year || rp->r_loyear > max_year) {
			if (noise)
				error("invalid starting year");
			if (rp->r_loyear > max_year)
				return;
	}
	if ((lp = byword(cp, 0)) != 0) switch ((int) lp->l_value) {
		case 0:
			rp->r_hiyear = min_year;
			break;
		case 1:
			rp->r_hiyear = max_year;
			break;
		case 2:
			rp->r_hiyear = rp->r_loyear;
			break;
	} else {
		if (sscanf(cp, scheck(cp, "%d")) != 1 ||
			rp->r_hiyear < min_year || rp->r_hiyear > max_year) {
			error("invalid ending year");
			if (rp->r_hiyear < min_year)
				return;
		}
	}
	len_months[1][rp->r_month];
}
elsie$ /usr/local/bin/gcc -v try.c
gcc version 1.33
 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 try.c /tmp/cca18840.cpp
GNU CPP version 1.33
 /usr/local/lib/gcc-cc1 /tmp/cca18840.cpp -quiet -dumpbase try.c -version -o /tmp/cca18840.s
GNU C version 1.33 (68k, MIT syntax) compiled by GNU C version 1.33.
try.c:60: warning: parameter `zp' points to incomplete type
try.c:63: warning: parameter `rp' points to incomplete type
try.c:66: warning: parameter `rp' points to incomplete type
try.c: In function rulesub:
try.c:218: argument `rp' doesn't match function prototype
/usr/local/bin/gcc: Program cc1 got fatal signal 11.
elsie$ exit

script done on Sun Feb 19 18:13:10 1989
-- 
	Arthur David Olson    ado@ncifcrf.gov    ADO is a trademark of Ampex.
Technical Details
Message-ID: <8902192314.AA18865@elsie>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!NCIFCRF.GOV!elsie!ado

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!NCIFCRF.GOV!elsie!ado
From: elsie!ado@NCIFCRF.GOV (Arthur David Olson)
Newsgroups: gnu.gcc.bug
Subject: Gnu gcc 1.33 (plus two fixes from rms) can dump core
Message-ID: <8902192314.AA18865@elsie>
Date: 19 Feb 89 23:14:26 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 303