Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Dummy character variable has length greater than actual length

tashker__michael
Beginner
1,382 Views
SubroutineFlareLoad (ANAME,...)
character*8 ANAME
...
end

CallFlareLoad ('signal',...)

forrtl: severe (408): fort: (18) Dummy character variable 'ANAME' has length 8
which is greater than actual variable length 6

Oh, the horror. Can I catch a break here? I can pad the argument 'signal ', or define ANAME as character*(*), but is there some compiler switch that will pad the argument for me? This worked right in 1998. Hmph.
0 Kudos
2 Replies
mecej4
Honored Contributor III
1,382 Views
Section 12.4.1.2 of the Fortran 2003 standard says:

If a scalar dummy argument is of type default character, the length len of the dummy argument shall be less than or equal to the length of the actual argument. The dummy argument becomes associated with the leftmost len characters of the actual argument.

You probably had some run-time checking enabled in order to receive the #408 message for, otherwise, you could have run into an illegal access violation instead.

The following complete version of your program suffers an access violation when compiled and run with CVF 6.6.

[fortran]Subroutine FlareLoad (ANAME)
character*8 ANAME
ANAME(8:8)='$'
return
end

program buggy
Call FlareLoad ('signal')
write(*,'(1x,A90)')'Signal'
end
[/fortran]
0 Kudos
Steven_L_Intel1
Employee
1,382 Views
It never worked "right" - you just never noticed. Use character(*).
0 Kudos
Reply