- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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******************************************************************************
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******************************************************************************
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you use an explicit length in the argument declaration, you are promising that the argument passed in is exactly that length. If this is not the case, the result is unpredictable.
The "padding" does not occur during argument passing - it happens when you do character assignment between objects of different length.
If you are having trouble logging in to Premier Support, send the details to quadsupport@mailbox.intel.com
Steve
The "padding" does not occur during argument passing - it happens when you do character assignment between objects of different length.
If you are having trouble logging in to Premier Support, send the details to quadsupport@mailbox.intel.com
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> 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?
Yes, no problem. I have reported a few issues and found the responses friendly, prompt, and helpful. No axes to grind, that's just my opinion based on my experience.
> serial number managed to get access to the premier
> forum as has been indicated in other threads here?
Yes, no problem. I have reported a few issues and found the responses friendly, prompt, and helpful. No axes to grind, that's just my opinion based on my experience.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page