array[-1] -- permitted?

Christopher Mills mills at kaa.eng.ohio-state.edu
Fri Sep 23 11:19:39 AEST 1988


>(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 at 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. ======



More information about the Comp.lang.c mailing list