Chui version bug. Lost longchar data.

Posted by alezhu on 23-May-2019 16:12

Start chui under 11.7 version.

Run code below:

def var a as longchar no-undo.
def var b as longchar no-undo.
def var c as longchar no-undo.

a = "a1".
b = "b2".
c = "c3".

function test longchar(a as longchar):
    def var dd as longchar.
    dd = a.
    return dd.
end.

a = a + c + test(b).

MESSAGE STRING(a).

 

Result is 

c3b2

Expecting result:

a1c3b2

 


Under gui version all works correctly!

Under linux chui may get core dump while compiling.

 

All Replies

Posted by Neil Treeby on 23-May-2019 20:09

I tried this using the 11.7.4 CHUI client ("Character Procedure Editor") on Win 10 64-bit, and got "a1c3b2".  Same with the "GUI Procedure Editor".

Posted by Marco Mendoza on 23-May-2019 20:14

11.6.3 AIX chui:   a1c3b2

Posted by egarcia on 23-May-2019 20:15

Hello,

I just tested with 11.7 (build date Mar 17th) on Linux CentOS, 11.7.4 (build date Oct 10th) on Linux Ubuntu and 11.7 ChUI (build date Mar 27th) on Windows.

I am able to see the expected result in the 3 environments.

Could you test using 11.7.4?

I hope this helps.

Posted by Peter Judge on 23-May-2019 20:16

Please that as a bug with Tech Support, if you don't mind.
 

Posted by Rob Fitzpatrick on 23-May-2019 20:17

Linux 64-bit 11.7.3: c3b2

Win 64-bit 11.7.4: c3b2

Win 32-bit 11.7.4: a1c3b2

Posted by dbeavon on 23-May-2019 21:49

I'm assuming you are deliberately creating a scenario where the parameter "a" is replacing another variable with the same name (that is already scoped to the outer procedure)?

If the parameter to the function ("a") is renamed to "x" then would the problem go away?

It seems like you are asking for trouble if you use overloaded meanings of a variable name, as you do in this example.  

You've probably spent some time at this.  What happens if the datatype of "a", in the function, is switched to an integer.  Is the compiler less confused when there are totally different datatypes involved?  Is the problem specific to longchar or does it happen with character variables?  What about if you have a FORWARD declaration of the function that is declared *before* defining the variable in the outer procedure ("def var a as longchar no-undo.").

Posted by bronco on 24-May-2019 08:25

I don't think it's asking for trouble if you use "a" within the function as well as the outer scope. That should just work.

FWIW: 11.7.4 Win x64 (CHUI): gives me the expected a1c3b2 (tried it with UTF-8 & iso8859-1 cpinternal)

This thread is closed