Microsoft KB Archive/68077

= FIX: Code Generation with Concatenation & LEN_TRIM =

Article ID: 68077

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q68077



SYMPTOMS
When the code below is compiled with /Od, incorrect code is genererated for the second assignment statement for 'lmessage'.



RESOLUTION
To work around the problem, either


 * 1) Do not use /Od (this will enable optimization. -or-


 * 1) Remove the LEN_TRIM function imbedded in the 'lmessage' statement and replace it with a temporary variable set equal to LEN_TRIM(ltask).



STATUS
Microsoft has confirmed this to be a bug in the products listed above. This problem was corrected in FORTRAN PowerStation, version 1.0.



MORE INFORMATION
The following sample code can be used to demonstrate the problem.

Sample code
implicit none

integer pmsgidsz parameter (pmsgidsz=2) character pmsgk*(pmsgidsz) parameter (pmsgk='k')

character mcosrcmd*1, mcosrctk*1, mcomsgst*300, 1         mcomsgnum*2, mcouppgwstate(10)*1, mcoprcnam*16

common /mco/ mcosrcmd, mcosrctk, mcomsgst, mcomsgnum, 1         mcouppgwstate, mcoprcnam

integer lvar character lcmm*1 character lampid*1, ltask*80, lwindid*1 character lmessage*301, luserid*2, lappmsgid*(pmsgidsz)

mcomsgst = 'abcopy1.flb;1,c,cd,ie' lampid = mcomsgst(2:2) lcmm = 'b'     mcoprcnam = 'ada' mcomsgnum = '01' mcosrcmd = 'c'     mcosrctk = 'c'      mcouppgwstate(1) = '1'

lvar = 3 do while (mcomsgst(lvar:lvar) .ne. ',') lvar = lvar+1 end do

ltask = mcomsgst(3:lvar+1)

lwindid = mcomsgst(lvar+1:lvar+1) luserid = mcomsgst(lvar+3:lvar+4) lappmsgid = mcomsgst(lvar+6:lvar+6+pmsgidsz-1)

lmessage = lcmm//' '//mcoprcnam(1:2)//mcomsgnum// 1          pmsgk//ltask(1:len_trim(ltask))// 2           ','//lwindid//','//luserid//','//lappmsgid// 3          mcosrcmd//mcosrctk//lampid//','//mcouppgwstate(1)

write(*,*) lmessage

lmessage = lcmm//' '//mcoprcnam(1:2)//mcomsgnum// 1          pmsgk//ltask(1:len_trim(ltask))// 2           ','//lwindid//','//luserid//','//lappmsgid// 3          mcosrcmd//mcosrctk//lampid//','//mcouppgwstate(1)

write(*,*) lmessage

end

Additional query words: 5.00 5.10 buglist5.00 buglist5.10 fixlist1.00

Keywords: kbfix KB68077

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.