Skip to content
Permalink
Browse files

input: fix off-by-one mistake

the following is supposed to work:

    @set A 1.2
    ABC 0 $A $A

but after inspecting the (improved) error, this is currently expanded to:

    ABC 0 1.21.2

which of course gives an "invalid real" error (after the previous commit).
  • Loading branch information...
dev-zero committed Sep 25, 2019
1 parent 5eeec4c commit 0c20774bdf3fa97da027548e7c47f1d5236aa312
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/input/cp_parser_inpp_methods.F
@@ -569,13 +569,13 @@ SUBROUTINE inpp_expand_variables(inpp, input_line, input_file_name, input_line_n
! process line until all variables named with the convention $VAR are expanded
DO WHILE (INDEX(input_line, '$') > 0)
pos1 = INDEX(input_line, '$')
pos1 = pos1+1
pos1 = pos1+1 ! move to the start of the variable name
pos2 = INDEX(input_line(pos1:), ' ')

IF (pos2 == 0) &
pos2 = LEN_TRIM(input_line(pos1:))+1

pos2 = pos1+pos2-1
pos2 = pos1+pos2-2 ! end of the variable name, minus the separating whitespace
varname = input_line(pos1:pos2)
idx = inpp_find_variable(inpp, varname)

0 comments on commit 0c20774

Please sign in to comment.
You can’t perform that action at this time.