• A bug in the ORP.Mod compiler module (Project Oberon)

    From Guy T.@21:1/5 to All on Thu Mar 19 15:54:51 2020
    Hello all,

    I don't know where I can give this information. Please advise.

    I may have found a bug in the ORP.Mod module. In the Declarations procedure the following lines appear:

    IF (x.type.form = ORB.String) & (x.b = 2) THEN ORG.StrToChar(x) END ;
    ORB.NewObj(obj, id, ORB.Const); obj.expo := expo;
    IF x.mode = ORB.Const THEN obj.val := x.a; obj.lev := x.b; obj.type := x.type

    If a one-char string constant is migrated to a CHAR constant (1st line), it will receive a obj.lev := 2 (3rd line). The following modification may resolve the problem:

    IF (x.type.form = ORB.String) & (x.b = 2) THEN ORG.StrToChar(x); x.b := level END ;
    ORB.NewObj(obj, id, ORB.Const); obj.expo := expo;
    IF x.mode = ORB.Const THEN obj.val := x.a; obj.lev := x.b; obj.type := x.type

    At least, it seems to work for me.

    Cheers!

    Guy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Guy T.@21:1/5 to Guy T. on Thu Mar 19 16:28:15 2020
    On Thursday, March 19, 2020 at 6:54:52 PM UTC-4, Guy T. wrote:
    Hello all,

    I don't know where I can give this information. Please advise.

    I may have found a bug in the ORP.Mod module. In the Declarations procedure the following lines appear:

    IF (x.type.form = ORB.String) & (x.b = 2) THEN ORG.StrToChar(x) END ;
    ORB.NewObj(obj, id, ORB.Const); obj.expo := expo;
    IF x.mode = ORB.Const THEN obj.val := x.a; obj.lev := x.b; obj.type := x.type

    If a one-char string constant is migrated to a CHAR constant (1st line), it will receive a obj.lev := 2 (3rd line). The following modification may resolve the problem:

    IF (x.type.form = ORB.String) & (x.b = 2) THEN ORG.StrToChar(x); x.b := level END ;
    ORB.NewObj(obj, id, ORB.Const); obj.expo := expo;
    IF x.mode = ORB.Const THEN obj.val := x.a; obj.lev := x.b; obj.type := x.type

    At least, it seems to work for me.

    Cheers!

    Guy

    Well... I sent this message a bit too fast. The problem is related to the ORG.MakeItem that, in the case of a String constant, put the string length in x.b instead of the level. So I'm asking advise. Is the following a better alternative:

    IF (x.type.form = ORB.String) & (x.b = 2) THEN ORG.StrToChar(x) END ;
    ORB.NewObj(obj, id, ORB.Const); obj.expo := expo;
    IF x.mode = ORB.Const THEN obj.val := x.a; obj.lev := level; obj.type := x.type

    Guy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)