[Nickle]Invalid input generates segfault

Barton C Massey bart@cs.pdx.edu
Thu, 26 Jul 2001 19:58:24 -0700


Note that
  int[] a = [5];
works, as intended. int[] is not a syntax error, but a valid
type---namely, the type of all integer arrays of any
dimensionality.  (e.g., int[*] and int[*,*] are subtypes of
int[].)

If Keith doesn't get a chance to fix the bug today, I'll
meditate on it and see what I can do.

The syntax error thing is hard to fix.

		Bart

In message <15200.54106.813493.711265@scream.east.isi.edu> you wrote:
> I've found that the following input cause a segmentation fault in
> nickle, (1.99.1, 1.99.2, and CVS as of today):
> 
> 	> int[] a;
> 	Program received signal SIGSEGV, Segmentation fault.
> 	0x804c71e in CompileCompositeImplicitInit (type=0x814f1c0) at
> 	compile.c:1031
> 	1031            if (type->array.dimensions->tree.left)
> 
> where, of course, dimensions is NULL.
> 
> I assume this should be a syntax error? Maybe it's time to start
> feeding random input to nickle to try to crash it? :)
> 
> -Carl
> 
> PS. I've found that it is quite easy with interactive nickle to get
> the parser confused after a syntax error, (but not quite so easy to
> unwedge it). For instance:
> 
> 	> int foo()
> 	syntax error before "("
> 	+ )
> 	+ 
> 	+ }
> 	+ ;
> 	+ 
> 	+ 
> 	+ ;
> 	>
> 	> # Phew! 
> 
> I'm not sure how easy that would be to fix...
> 
> _______________________________________________
> Nickle mailing list
> Nickle@keithp.com
> http://keithp.com/mailman/listinfo/nickle