about SYSTEM.ADR(BasicType)

luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

about SYSTEM.ADR(BasicType)

Post by luowy »

a small issue with SYSTEM.ADR(BasicType):

Code: Select all

MODULE ObxAdr;
	IMPORT S := SYSTEM,COM;
	TYPE   T* = INTEGER;	 
			
	PROCEDURE Adr();
		VAR x: INTEGER;
	BEGIN
		x := ADR(T);
	END;
END ObxAdr.

a scratch fixup DevCPB.MOp

Code: Select all

...
       | adr: (*ADR*)
         ....
	         ELSIF z.class = Ntype THEN
					IF z.obj.typ.untagged THEN err(111) 
					ELSE (* +++ *)
						CASE z.obj.typ.form OF
						|Byte..Set, Char16,Int64: err(111) 
						ELSE
						END;
					END;
					z := NewOp(op, z, typ)
				ELSIF (z.class < Nconst)  
...
luowy
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: about SYSTEM.ADR(BasicType)

Post by Ivan Denisov »

The fix of luowy allowing to get descriptor of type.

This is important for such case

Code: Select all

MODULE Test;

IMPORT SYSTEM;

TYPE
	Command* = PROCEDURE;
	
VAR
	adr: INTEGER;
	
BEGIN
	adr := SYSTEM.ADR(Command)
	
END Test.
This is relevant for some lowlevel project.
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: about SYSTEM.ADR(BasicType)

Post by Zinn »

Should we reopen the center issue #199, compiler trap with SYSTEM.ADR(BasicType)
and correct their correction to the new one here?
- Helmut
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: about SYSTEM.ADR(BasicType)

Post by luowy »

Zinn wrote:Should we reopen the center issue #199, compiler trap with SYSTEM.ADR(BasicType)
and correct their correction to the new one here?
- Helmut
yes,I think. ProcType needs to be accepted;
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: about SYSTEM.ADR(BasicType)

Post by Robert »

Here is the link to the previous discussion: viewtopic.php?f=49&t=756
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: about SYSTEM.ADR(BasicType)

Post by Josef Templ »

I think we should create a new issue.
But first please explain what the issue is all about.

- Josef
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: about SYSTEM.ADR(BasicType)

Post by luowy »

Josef Templ wrote:But first please explain what the issue is all about.
I checked the Ivan's demo, the ProcType is rejected, but it shoud be accepted,
Ivan Denisov wrote:This is relevant for some lowlevel project.
He found this bug in some lowlevel projects;
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: about SYSTEM.ADR(BasicType)

Post by Zinn »

Before the the change of #199 the compiler traps during the compilation. After the change of #199 the compiler produced an error marker in the source code, but in some situation it should be compile instead without error.
Someone should work out when it should compile without error and when we need an error marker.
This is beyond my knowledge.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: about SYSTEM.ADR(BasicType)

Post by Josef Templ »

The same but shorter in particular with respect to the generated code:

Code: Select all

				ELSIF z.class = Ntype THEN
					IF z.obj.typ.untagged OR (f IN {Byte..Set, Char16, Int64}) THEN err(111) END;
					z := NewOp(op, typ, z)
We would also have to update the "Platform-Specific Issues" which currently states:
ADR(T) T: a record type INTEGER address of Descriptor of T

- Josef
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: about SYSTEM.ADR(BasicType)

Post by luowy »

Josef Templ wrote:CODE: SELECT ALL
            ELSIF z.class = Ntype THEN
               IF z.obj.typ.untagged OR (f IN {Byte..Set, Char16, Int64}) THEN err(111) END;
               z := NewOp(op, typ, z)
This fix can be passed;
Post Reply