Menu

#1494 ARG1,ARG2,etc become undefined after a nested code-block is executed

closed-fixed
nobody
None
5
2015-03-23
2014-10-07
Anonymous
No

The folloing script looks proper but shows the error: undefined variable: ARG1.
Gnuplot 5.0 rc2 on Debian 7.

print 'ARGC=', ARGC
print 'ARG1=', ARG1
print 'ARG2=', ARG2

# ARG1,ARG2 become undefined after a nested code-block is executed.
if (1) {
    if (1) {}                           # ==> undefined variable: ARG1
#   do for[i=1:1] {}                    # ==> undefined variable: ARG1
#   cond=1; while (cond) { cond=0; }    # ==> undefined variable: ARG1
}

print 'ARGC=', ARGC
print 'ARG1=', ARG1
print 'ARG2=', ARG2

Running this script, argerror.gpi, shows:

$ gnuplot -c argerror.gpi 1 2
ARGC=2
ARG1=1
ARG2=2
ARGC=2
ARG1="argerror.gpi", line 14: undefined variable: ARG1

The following script works.

OPTC=ARGC
OPT1=ARG1
OPT2=ARG2

print 'OPTC=', OPTC
print 'OPT1=', OPT1
print 'OPT2=', OPT2

if (1) {
    if (1) {}
    do for[i=1:1] {}
    cond=1; while (cond) { cond=0; }
}

print 'OPTC=', OPTC
print 'OPT1=', OPT1
print 'OPT2=', OPT2

Sorry if duplicate.
Thanks,

Takuma

Discussion

  • Ethan Merritt

    Ethan Merritt - 2014-10-07

    Thanks for the bug report.
    Now fixed in 5.0 and 5.1

     
  • Ethan Merritt

    Ethan Merritt - 2014-10-07
    • status: open --> pending-fixed
     
  • Ethan Merritt

    Ethan Merritt - 2014-10-12
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB