Page 6 of 7
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 2:32 pm
by Josef Templ
Ivan Denisov wrote:Josef, if you see all the picture, please explain why there was no RETURN there before?
It is clear that is was done intentionally.
Some historical notes and entertaining stuff
First of all, Ivan, luowy and everybody who is interested in the history of our compiler, I have included a technical report
of the first 2-phase Oberon compiler written at ETH Zurich. The CP compiler was derived from that work.
At that time, the cold war was not really over, we had a generic excuse for everything
someone put into a source code that did not give much sense:
"just to confuse the russians".
(Some actually put this phrase into a comment!)
Now back to the question:
The obvious answer is: just to confuse the russians.
And the interesting thing about this is that we now have the first documented case
where this cold war strategy really worked. And, unintentionally, it also confused the chinese.
Cheers, Josef
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 4:28 pm
by Ivan Denisov
I had found the fix for this.
Now the VAL will lead the documentation P-S-I. I will prepare demo build soon.
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 5:40 pm
by Ivan Denisov
That is the demo version for the fix.
http://blackboxframework.org/unstable/i ... c1.657.zip
In this version operations or procedures call in the second argument are forbidden so this bug can not appear.
This can lead a bit of simplification in future development of new back-ends.
The basic change is trivial.
http://redmine.blackboxframework.org/pr ... 9559758fe0
I fixed all the places in BlackBox where operations and calls were used:
http://redmine.blackboxframework.org/pr ... 8c7cb54141
There were not few places. However more strict and simple rules for VAL will make system more flexible.
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 5:43 pm
by Ivan Denisov
Zinn wrote:It is a question of the compiler architecture. The error ocurrs in the backend and not in the frontend. A backend for an other machines as i86 may have not this kind of problem an can execute the statement which the frontend passed. For flexibility in the future there should be no error detection in the frontend about this topic, because the program statement is corrent an may be execute without any problems with another backend.
I believe that it is not good if for one backend some code is correct but for another it is not correct. Something is wrong in this basic assumptions here.
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 6:19 pm
by luowy
Ivan Denisov wrote: by Ivan Denisov ยป Thu Sep 01, 2016 5:43 pm
Zinn wrote:
It is a question of the compiler architecture. The error ocurrs in the backend and not in the frontend. A backend for an other machines as i86 may have not this kind of problem an can execute the statement which the frontend passed. For flexibility in the future there should be no error detection in the frontend about this topic, because the program statement is corrent an may be execute without any problems with another backend.
I believe that it is not good if for one backend some code is correct but for another it is not correct. Something is wrong in this basic assumptions here.
it's TRUE,I have implemented it. works well.
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 6:52 pm
by luowy
Josef
a trivial example to exam your perfect fixup.
Code: Select all
PROCEDURE Val();
VAR ll:LONGINT;x:INTEGER;r:SHORTREAL;
BEGIN
ll := S.VAL(BYTE,x)+S.VAL(SHORTINT,x)+S.VAL(INTEGER,x*2)+S.VAL(LONGINT,r*2)
+S.VAL(LONGINT,2*x) +S.VAL(INTEGER,ll*2);
END Val;
unfortunately,both two fixup need to be removed if implemented as Helmut mentioned.
the docu is:
VAL(T, x) T, x: any type T x interpreted as of type T
1,if x is a variable,then x memory interpreted as of type T;
2,if x is expression,then x value interpreted as of type T;
no way! Let me say it for you first.
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 7:06 pm
by Zinn
SYSTEM should not be use in normal modules. We should not waste our time at a topic which is used very rarely. Stop this discussion otherwise there will be no release of 1.7
- Helmut
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 7:15 pm
by Ivan Denisov
Zinn wrote:SYSTEM should not be use in normal modules. We should not waste our time at a topic which is used very rarely. Stop this discussion otherwise there will be no release of 1.7
- Helmut
Of cause folds is much more important from your point of view than fix in the compiler!? Are you kidding?
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Thu Sep 01, 2016 8:52 pm
by luowy
Ivan, stop new invest, please.
too long discussion,we cant afford the time.let's release the 1.7.
base the consideration: more simpler more better, especially at the final time.
select Josef's fixup is good enough.
Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)
Posted: Fri Sep 02, 2016 12:05 am
by Ivan Denisov
luowy wrote:Ivan, stop new invest, please.
too long discussion,we cant afford the time.let's release the 1.7.
base the consideration: more simpler more better, especially at the final time.
select Josef's fixup is good enough.
It's all in your hands. Just vote.
I am attaching here new design to keep it for the history