Path: utzoo!utgpu!watmath!att!bellcore!rutgers!psuvax1!psuvm!odx From: ODX@PSUVM.BITNET (Tim Larson) Newsgroups: comp.lang.modula2 Subject: Re: FUNNY Eight Co-Queens Message-ID: <89220.090027ODX@PSUVM> Date: 8 Aug 89 13:00:27 GMT References: <819@eutrc3.urc.tue.nl> Organization: Penn State University - Center for Academic Computing Lines: 57 In article <819@eutrc3.urc.tue.nl>, rcpt@eutrc4.urc.tue.nl (Piet Tutelaers) says: > >The Eight Queens Problem solved with COROUTINES crashes Logitech system!!! >The next program will run with the Logitech Modula-2 development system >version 3.0, BUT IF YOU REMOVE lines 3 and 69 of program Queens.mod the >program crashes and FUNNY things happen..... Can somebody explain why? > >uucp: rcpt@eutrc3.UUCP | Piet Tutelaers Room RC 1.90 >bitnet: rcpt@heithe5.BITNET | Eindhoven University of Technology >phone: +31 (0)40 474541 | P.O. Box 513, 5600 MB Eindhoven, NL >----------------------------Queens.mod----------------------------------- >MODULE Queens; > >(* 3 *) FROM InOut IMPORT WriteString, WriteLn, WriteInt; > . . . . > wkspsize = 200; (* informed guess *) > >VAR > colData: > ARRAY Acol OF > RECORD > cr: PROCESS; > wksp: ARRAY [1..wkspsize] OF WORD; > END; > initCol: Acol; . . . . > >PROCEDURE Init; >BEGIN > FOR initCol := 1 TO 8 DO >(* 69*) WriteString('Initiating Placer '); WriteInt(initCol, 0); WriteLn; > WITH colData[initCol] DO > NEWPROCESS(Placer, ADR(wksp), SIZE(wksp), cr); > TRANSFER(main, cr) > END > END >END Init; . . . . I compiled your code using JPI TopSpeed M2 and it worked identically (and correctly) with lines 3 and 69 and without them. I don't have the Logitech compiler anymore, but I used to work with it (I should say *argue* with it :-) and I still have the documentation. It seems to me that two possible things might be going on here, both of which should be easy to test (you may have tested them already, but just in case :-). One is that the compiler is trying to optimize the loop in Init, and is not updating the memory location of colData[initCol] soon enough (page 87 of User's Manual v3.0). You might try turning optimization off before the loop is entered. Otherwise, the work- space you are allocating may be too small (page 383 of User's Manual v3.0). You might try increasing wkspsize to 1024 or so, as it says near the middle of page 383. Sorry I couldn't be of more help, but maybe one of these ideas will work. Good luck, Tim Larson ODX@PSUVM.BITNET