[gnu.gcc.bug] Compiler aborts for GCC 1.33 on both VAX/VMS and Ultrix

jim@umigw.MIAMI.EDU (jim brown) (02/14/89)

The following routine causes GCC 1.33 compiler to fail with "access violation"
on VAX/VMS and to equivalently fail on Ultrix:

# define	MAGIC_YEAR	1900

static char	*MonthString = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";

long
ConvertOldDate(date)
char		*date;
{
    /*
	Convert a string of the form dd-mmm-yy to
	an integer of the form YYYYMMDD.  The
	string may not have a NULL at the end.

	Avoid STDIO like the plague
    */
    char		months[4];
    int			day, month, year;
    int			indexx(), atoi();

    day = atoi(date);
    while (*date++ != '-')
	;
    months[0] = *date++;
    months[1] = *date++;
    months[2] = *date++;
    months[3] = 0;
    while (*date++ != '-')
	;
    year = atoi(date);
    /*sscanf(date,"%2d-%3s-%2d",&day,months,&year);*/
    month = (indexx(MonthString,months)-1)/3;
    return((MAGIC_YEAR+year)*10000 + (month+1)*100 + day);
}

Compiler termination message is:

$ gcc /inc="dsp0$:[inc]" j.c
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=8018FCEC, PC=00039175, PSL=03C00000
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC

CSE             equiv_constant                             00000055  00039175
CSE             cse_insn                                   000002EE  00039824
CSE             cse_basic_block                            00000082  0003A49C
CSE             cse_main                                   00000160  0003A3E4
TOPLEV          rest_of_compilation                        000001F9  0000ECC9
C-DECL          finish_function                            00000059  0001A5EB
C-PARSE_TAB     yyparse                                    000005DC  000105A6
TOPLEV          compile_file                               0000061D  0000E6D5
TOPLEV          main                                       0000049C  0000F84C
*** Termination code 1000000c
%SYSTEM-F-ABORT, abort

-- 
Jim Brown, University of Miami (home of the Hurricanes)
[send mail to jim@umigw.miami.edu]