#375 upper BIF destroying string data

open
5
2014-08-19
2012-07-22
No

I am having problems with the 'upper' BIF in the following example:
/* 1 2 3 4 5 6 */
/* 123456789012345678901234567890123456789012345678901234567890 */
parms = '"xxxxxxxxxxxxx" -cccccc -b"yyyyyyyyyyyyyyyyyyyyyyy" -o:"f.bat"'
say length(parms)
say parms
q = pos('"',parms)
if q = 0 then parse upper var parms parms
else do
if q > 1 then parms = upper(parms,1,q-1)
up = 1
do i=q+1 to length(parms)
parse value (up&&1) pos('"',parms,i) with up q
if q > 0
then do
if up then parms = upper(parms,i,q-i)
i = q
end
else do
if up then parms = upper(parms,i)
i = length(parms)
end
end
drop i up
end
drop q
say parms
say length(parms)

When called as a subroutine, I get the following output:

[Regina]c
62
"xxxxxxxxxxxxx" -cccccc -b"yyyyyyyyyyyyyyyyyyyyyyy" -o:"f.bat"
"xxxxxxxxxxx♦ 0 62 ☻ ☻ ☻ yyyyyyyyyy" -O:"f.bat"
62
[Regina]c
62
"xxxxxxxxxxxxx" -cccccc -b"yyyyyyyyyyyyyyyyyyyyyyy" -o:"f.bat"
"xxxxxxxxxxxxx" -CCCCCC -B"yyyyyyyyyyyyyyyyyyyyyyy" -O:"f.bat"
62

The second invocation causes a Windows access violation error to occur, although the output is what I am expecting.

When invoked from a command line I get the following:

[C:\REGINA]c
62
"xxxxxxxxxxxxx" -cccccc -b"yyyyyyyyyyyyyyyyyyyyyyy" -o:"f.bat"
"xxxxxxxxxxx♦ 0 62 ☻ ☻ ☻ yyyyyyyyyy" -O:"f.bat"
62

[C:\REGINA]

The second use of 'upper' is causing the problem. The 1st and 3rd won't be invoked with the string data in 'parms'. Just not sure which invocation is starting the problem. Wrote my own 'upper' function and the problem does not occur. Ran the same scenario on ooRexx and everthing runs fine.

Operating environment is Windows XP 32 bit SP3, Regina 3.6 32 bit.

Have included the Dr Watson data for your viewing pleasure.

Discussion

  • Jerry Senowitz

    Jerry Senowitz - 2012-07-22

    Dr Watson Data for Access Violation

     
  • Jerry Senowitz

    Jerry Senowitz - 2012-07-24

    After reviewing the problem report here, I realized that a number of blanks have been removed by the tracker, making the code and console output hard to read, I am attaching 3547354.zip with both the program and the console log. Hope this makes the code easier to read.

     
  • Jerry Senowitz

    Jerry Senowitz - 2012-07-24

    Actual Program and console log

     

Log in to post a comment.