function fakultaet(x); begin if (x=0) then begin fakultaet:=1 end else begin fakultaet:=(x*fakultaet((x-1))) end end plic it, ploc it, ramsim it. x fakultaet 0 1 1 1 2 2 3 6 4 0 ! 5 0 ! 10 0 ! 20 0 ! 50 0 ! 80 probably never terminates because lasting overproportionally long.
erik@vulcain:~/fakult/source > cat forbug.pli function func(); begin for x:=1 to 5 do begin a:=4444 end; func:=55555 end erik@vulcain:~/fakult/source > plic forbug.pli forbug.plo first pass started second pass started third pass started creating program... .. [ok] creating program... .. [ok] creating program... .. [ok] Compilation finished at Tue Nov 16 08:40:41 1999 erik@vulcain:~/fakult/source > ploc forbug.plo forbug.ram At line 48: parse error t325 := ; *^* Compilation exited abnormally at Tue Nov 16 08:40:46 1999 erik@vulcain:~/fakult/source >
erik@vulcain:~/fakult > cat bb.pli function prod (start, ende); begin while (start <= ende) do begin start := (start + 1) end; prod := 8 end erik@vulcain:~/fakult > plic bb.pli bb.plo first pass started second pass started third pass started creating program... .. [ok] creating program... .. [ok] creating program... .. [ok] Compilation finished at Sat Nov 6 09:44:27 1999 Speicherzugriffsfehler (core dumped) ^^^^^^ MUST BE FIXED erik@vulcain:~/fakult > ploc bb.plo bb.ram File wird generiert Compilation finished at Sat Nov 6 09:44:31 1999 erik@vulcain:~/fakult > ramsim. run. endless loop.
erik@vulcain:~/fakult > cat add.plo function add(x,y); begin add:=(x+y) end erik@vulcain:~/fakult > ploc add.plo d.ram File wird generiert Compilation finished at Fri Oct 29 16:48:42 1999 erik@vulcain:~/fakult > ploc add.plo dsdfjksdhf.ram File wird generiert Speicherzugriffsfehler (core dumped) erik@vulcain:~/fakult > (es hat nichts damit zu tun dass d.ram schon existiert oder so.) dieser bug scheint nur bei erik aufzutreten. der memleakbug ist schwer zu reproduzieren wenn das system nicht genau so oder aehnlich wie bei erik ist. (zufall) sobald groessere programme compilierbar sind, wird dieser bug sicher noch staerker auftreten und leichter zu fixen sein.
erik@vulcain:~/fakult > cat pistar.pli function factorize(x); begin for i:=1 to x do begin if (((x/i)*i)=x) then factor:=i end; factorize:=afactor end erik@vulcain:~/fakult > plic pistar.pli pistar.plo Speicherzugriffsfehler (core dumped) erik@vulcain:~/fakult >
on erikyyy computer: erik@vulcain:~/fakult/BUGS/adder > cat adder.pli function adder(x); begin for x:=0 to 10000 do begin a:=3 end; adder:=34 end erik@vulcain:~/fakult/BUGS/adder > plic adder.pli adder.plo first pass started second pass started third pass started creating program... .. [ok] creating program... .. [ok] creating program... .. [ok] Compilation finished at Tue Nov 2 15:13:31 1999 Speicherzugriffsfehler (core dumped) erik@vulcain:~/fakult/BUGS/adder > on tagetes compilation would have worked WITHOUT segmentation fault. BUT the resulting program is not a correct .plo program in both cases ! just try to ploc it ! Notice, the original problem is fixed. but now this happens while ploc: > At line 64: Array used as variable before! > t330 := One[CurrentInc]; > *^* > Compilation exited abnormally at Wed Nov 3 20:06:07 1999 so the bug is not closed yet.
erik@vulcain:~/fakult > cat diver.pli function aha(a, b); begin aha := (a / b) end erik@vulcain:~/fakult > plic ... erik@vulcain:~/fakult > ploc ... erik@vulcain:~/fakult > ramsim setze R0 auf 50 setze R1 auf 2 Run R0 = 24 anstelle von den richtigen 25. notice the original problem MIGHT be fixed, but now this happens: > [GEN0005] Index out of range <../common/ctlist.h,73> > Compilation exited abnormally at Wed Nov 3 20:00:24 1999 so the bug stays open.FIX:
create lollipop.pli: --- snip function a(); begin while (b#0) do begin c:=23 end; a:=2 end --- snap plic... ploc... ramsim run R0 will we 3 and not 2.FIX:
Create file achimfakultaet.pli: --- snip function fakultaet(a); begin fakultaet:=(a*fakultaet((a-1))) end --- snap i forgot what the problem was. please achim tell me, so that i can write it here.FIX:
Create file bla1.pli: --- snip function one(a,b,c); begin a:=10; b:=2; one := (a-b) end --- snap plic it, ploc it, ramsim it R0 will be 0 instead of 8 !!!FIX:
it is very difficult to manipulate a ram program because you cannot find line numbers between 1,2,3,4 if line numbers of 10,20,30,40 would be used in ploc, one could easily add lines 15,25 etc. i think this is very important and easy to program.FIX:
Create file erik.pli: --- snip function a(); begin a:=5 end --- snap plic, ploc, ramsim R0 will be 0 instead of 5. might be same problem than bla1-bugFIX:
start theosim open a correct pli file plic it ploc it change the buffer of the pli file to produce a syntax error plic it (will get syntax error, and plo buffer will be gone) change the buffer of the pli file back to original plic it -- now the buffer list in the menubar will be corrupted. the .ram file will be in the middle and will be the same than the .plo file. perhaps the plo buffer wasn't correctly closed ...FIX:
Take the following source.pli function multi(y,z); begin i := 0; while ( i < 20 ) do begin i := (i+1); if (test(i,y,z)=1) then multi := i end end function test(x,y,z); if ((x*y)=z) then test := 1 else test := 0 then do plic source.pli source.plo and get Number of parameters in call to function test does not match declaration!!! which is of course nonsense.
source.pli: function multi(y,z,w); begin i := 0; while ( i < 20 ) do begin i := (i+1); if (test(i,y,z)=1) then multi := i end end function test(x,y,z); if ((x*y)=z) then test := 1 else test := 0 this program works correctly. set R0 <- 3, R1 <- 12 then run the program and you get R0 = 4 now write the following source2.pli which should do exactly the same thing than source.pli: function multi(y,z,w); begin for i := 1 to 20 do if (test(i,y,z)=1) then multi := i end function test(x,y,z); if ((x*y)=z) then test := 1 else test := 0 set R0 <- 3, R1 <- 12 (as above!) and get R0 = 0 which is of course not correct.