There seems to be a bug with passing characters to a subroutine which stores them in fixed length variables.
Storing them in len=* variables works fine, but in len=x where x is any number leads to other arguments getting into the variables. The same behaviour is seen from v6 and v7 of the compiler. It seems the padding normally seen when you do "character(len=20) foo" "foo='test'" isn't happening when passing into the subroutine.
Also, has anyone with a unsupported, non commerical serial number managed to get access to the premier forum as has been indicated in other threads here? I've registered, given it my serial number, but on logging in I'm redirected to premier.intel.com, which gives me a "403 permission denied".
The program below shows up the character passing bug, and here is the output:
25c is "---------1---------2-----"
va is "firstarg"
vb is "secondarg"
va is "firstarg2"
vb is "secondarg2"
fa is "firstargsecondargfirst"
fb is "secondargfirstarg2s"
fa is "firstarg2secondarg2f"
fb is "secondarg2firstargsecon"
far is "firstargsecondargfirst"
fbr is "secondargfirstarg2s"
far is "firstarg2secondarg2 "
fbr is "secondarg2 "
25c is "---------1---------2-----"
program charbug
implicit none
write(6,*) '25c is "---------1---------2-----"'
call subvar('firstarg','secondarg')
call subvar('firstarg2','secondarg2')
call subfix('firstarg','secondarg')
call subfix('firstarg2','secondarg2')
call subfixr('firstarg','secondarg')
call subfixr('firstarg2','secondarg2')
write(6,*) '25c is "---------1---------2-----"'
stop
end
c**************************************************************
subroutine subvar(va,vb)
implicit none
character(len=*) va
character(len=*) vb
write(6,*) 'va is "',va,'"'
write(6,*) 'vb is "',vb,'"'
return
end
subroutine subfix(fa,fb)
implicit none
character(len=25) fa
character(len=25) fb
write(6,*) 'fa is "',fa,'"'
write(6,*) 'fb is "',fb,'"'
return
end
subroutine subfixr(far,fbr)
implicit none
character(len=25) far
character(len=25) fbr
write(6,*) 'far is "',far,'"'
write(6,*) 'fbr is "',fbr,'"'
far = ''
fbr = ''
return
end
c******************************************************************************
Bug with passing characters to subroutines
Пожалуйста, обратитесь к странице Уведомление об оптимизации для более подробной информации относительно производительности и оптимизации в программных продуктах компании Intel.


