Honored Contributor Honored Contributor
Re: Itanium migration issue with function

Hmmm,

Seems to work for me using  I64 BASIC V1.7-000

I changed the provide program (why a sill DOC file??? why not good old TXT !!!) to read:

1 !Call to Function      

   REC$ = "aaaaa.bbbbb;ccccc          "        

   option_piece$ = FNREAD$ ( REC$ )        

    PRINT option_piece$

:

Compile, link, run ... "bbbbb"

 

As pointed out, the function seems to freely use data scoped in 'main' and in the 'function'.

Specifically I don't like seeing REC$ used when R1$ is passed with the the value of REC$.. in the example.

Are you sure each call to FNREAD$ passes REC$. Maybe REC$ was empty on entry?? Check with debugger!

I am also not a fan of modifying my function argument.

I suppose that's legal, but why not grab a fresh intermediate variable?

 

The debugger also happily looked at the variables for me:

break at X$MAIN\X$MAIN\FNREAD$\%LINE 40X$MAIN\X$MAIN\FNREAD$\R1$:      "bbbbb"X$MAIN\X$MAIN\REC$:     "aaaaa.bbbbb;ccccc          "

 

So I suspect it is an interaction with variable declarations as main level.

As suggested, compil/list and specifically look for "Allocation information for DEF FNREAD$ "

And any and all variable used in that function.

 

Good luck!

Hein