Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!accelerator.eng.ohio-state.edu!kaa.eng.ohio-state.edu!mills
From: mills@kaa.eng.ohio-state.edu (Christopher Mills)
Newsgroups: comp.lang.c
Subject: Re: array[-1] -- permitted?
Message-ID: <629@accelerator.eng.ohio-state.edu>
Date: 23 Sep 88 01:19:39 GMT
References: <1237@imagine.PAWL.RPI.EDU> <816@goofy.megatest.UUCP>
Sender: news@accelerator.eng.ohio-state.edu
Reply-To: mills@kaa.eng.ohio-state.edu (Christopher Mills)
Organization: Ohio State Univ, College of Engineering
Lines: 19


>(yacc output) of a compiler I'm working on:

>{ Mpc_insert_with_searchdir(yypvt[-3],yypvt[-1]);
>                          yyval = tree(N_INSERT_DECL3);} break;

>Is the committee going to
>break this code?  If so, why, fer Pete's sake?

	This should be OK, I believe.  As I understand the internals of
yaccpar, yypvt is a pointer into yyv[], so you're not going outside of
the bounds of the array.  The problem is in the initialization of the
stack where it's pointed to the -1th element which doesn't exist.

-=-
_________________________________________________________________________
| Christopher Mills              | "If you see someone without a smile, |
| mills@baloo.eng.ohio-state.edu |  give them mine - I'm not using it." |
====== My thoughts are not my own--I'm posessed by mailer daemons. ======