about SYSTEM.ADR(BasicType)

about SYSTEM.ADR(BasicType)

Postby luowy » Sun Apr 28, 2019 12:29 pm

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

Re: about SYSTEM.ADR(BasicType)

Postby Ivan Denisov » Sat Jul 18, 2020 1:51 pm

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

Re: about SYSTEM.ADR(BasicType)

Postby Zinn » Tue Jul 21, 2020 9:37 am

Should we reopen the center issue #199, compiler trap with SYSTEM.ADR(BasicType)
and correct their correction to the new one here?
- Helmut
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: about SYSTEM.ADR(BasicType)

Postby luowy » Tue Jul 21, 2020 4:29 pm

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

Re: about SYSTEM.ADR(BasicType)

Postby Robert » Tue Jul 21, 2020 7:28 pm

Here is the link to the previous discussion: viewtopic.php?f=49&t=756
User avatar
Robert
 
Posts: 1022
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: about SYSTEM.ADR(BasicType)

Postby Josef Templ » Tue Jul 21, 2020 8:52 pm

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

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

Re: about SYSTEM.ADR(BasicType)

Postby luowy » Wed Jul 22, 2020 8:14 am

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

Re: about SYSTEM.ADR(BasicType)

Postby Zinn » Wed Jul 22, 2020 9:20 am

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

Re: about SYSTEM.ADR(BasicType)

Postby Josef Templ » Wed Jul 22, 2020 10:47 am

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
User avatar
Josef Templ
 
Posts: 2032
Joined: Tue Sep 17, 2013 6:50 am

Re: about SYSTEM.ADR(BasicType)

Postby luowy » Tue Jul 28, 2020 9:06 am

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

Next

Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron