Page 1 of 2

about SYSTEM.ADR(BasicType)

Posted: Sun Apr 28, 2019 12:29 pm
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

Re: about SYSTEM.ADR(BasicType)

Posted: Sat Jul 18, 2020 1:51 pm
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.

Re: about SYSTEM.ADR(BasicType)

Posted: Tue Jul 21, 2020 9:37 am
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

Re: about SYSTEM.ADR(BasicType)

Posted: Tue Jul 21, 2020 4:29 pm
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;

Re: about SYSTEM.ADR(BasicType)

Posted: Tue Jul 21, 2020 7:28 pm
by Robert
Here is the link to the previous discussion: viewtopic.php?f=49&t=756

Re: about SYSTEM.ADR(BasicType)

Posted: Tue Jul 21, 2020 8:52 pm
by Josef Templ
I think we should create a new issue.
But first please explain what the issue is all about.

- Josef

Re: about SYSTEM.ADR(BasicType)

Posted: Wed Jul 22, 2020 8:14 am
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;

Re: about SYSTEM.ADR(BasicType)

Posted: Wed Jul 22, 2020 9:20 am
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.

Re: about SYSTEM.ADR(BasicType)

Posted: Wed Jul 22, 2020 10:47 am
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

Re: about SYSTEM.ADR(BasicType)

Posted: Tue Jul 28, 2020 9:06 am
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;