Compile crashes on empty with

Post Reply
X512
Posts: 72
Joined: Sat Feb 07, 2015 2:51 pm

Compile crashes on empty with

Post by X512 »

Following sequence causes trap in compiler code:

Code: Select all

WITH
ELSE
END;
According language report this code seems to be valid. With without else doesn't crash.
Josef Templ
Posts: 262
Joined: Tue Sep 17, 2013 6:50 am

Re: Compile crashes on empty with

Post by Josef Templ »

This should be easy to fix.

The syntax of the WITH statement in Component Pascal has been slightly extended over original Oberon.
The intention obviously was to allow a vertical bar "|" also before the first guarded statement sequence.
However, the syntax changes go further and allow constructs like this one:

WITH ||||||||||||||| END

This is not very meaningful but because it was possible it cannot be changed now.
It is certainly better to fix the bug in the code generator.

- Josef
luowy
Posts: 87
Joined: Thu Dec 17, 2015 1:32 pm

Re: Compile crashes on empty with

Post by luowy »

the fixup , DevCPP.StatSeq

Code: Select all

			END;
				e := sym = else; pos := DevCPM.startpos;
				IF x = NIL THEN err(130);END; (* add this line*)
				IF e THEN DevCPS.Get(sym); StatSeq(s) ELSE s := NIL END ;
				DevCPB.Construct(Nwith, x, s); CheckSym(end);
				IF e THEN x.subcl := 1 END
			ELSIF sym = exit THEN
			.....
		END
	END StatSeq;
luowy
User avatar
Robert
Posts: 177
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Compile crashes on empty with

Post by Robert »

User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Compile crashes on empty with

Post by Ivan Denisov »

Post Reply