issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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". :lol:
(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
Attachments
The_Oberon_System_family.pdf
(1.86 MiB) Downloaded 398 times
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post by Ivan Denisov »

I had found the fix for this.
fix.png
Now the VAL will lead the documentation P-S-I. I will prepare demo build soon.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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.
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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.
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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.
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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?
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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.
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#126 Compiler TRAP for SYSTEM.VAL(LONGINT, intreg)

Post 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
blackbox-1.7-rc1.657.7z
(3.74 MiB) Downloaded 398 times
Post Reply