- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program m
implicit none
call sub1('X)
end program
subroutine sub1(s)
implicit none
character*8 s
write (6,*) 'sub1 s = ', s
end subroutine
We use the following compiler flags :
-check bounds
-traceback
-f77rtl
-save
-vms
-align norecords
-align dcommons
-align nosequence
-fpic
-extend-source
-warn declarations
-warn usage
-warn truncated_source
-warn noalign
-sox
-real-size 64
-double-size 64
-integer-size 32
When executed, this code crashes at the write statement in sub1 with error "forrtl: severe (408): fort: (18): Dummy character variable 'S' has length 8 which is greater then actual variable length 1". It should print "sub1 s = X". Disabling -check bounds it not an option. Are there other flags needed to get compatibility with HP VMS Fortran, before we take on changing the 1,193 locations in our code that will generate this crash?
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not knowledgeable about the treatment of character parameters on VMS but the error is new with the introduction of the string bounds checking provided in our 11.1 release. The program runs as you expect with Intel Fortran 10.1 and earlier compilers without -vms and with bounds checking enabled because the string bounds checks are not done.
Based on an earlier related thread (here), the advice of using CHARACTER(*) is a possible solution with the 11.1 release and bounds checking enabled. I don't see any other compiler options that may help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I ask for an enhancement to -vms, what are my chances of getting it?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"If a scalar dummy argument is of type character, its length must not be greater than the length of its associated actual argument."
Another quote, this one from Sec. 6.1.1 of the Compaq Fortran 77 Language Reference Manual (1999):
"The length of a dummy argument with a data type of character must not be greater than the length of its associated actual argument."
The VAX Fortran behavior that you describe may have existed in an old version, but is in disagreement both with the Fortran 77 standard and the just listed references for VMS Fortran.
If Intel were to implement your request, we should hope that it will be under a separate option: not the -vms option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd like to have Steve Lionel have a look at this issue, since he is an expert on VMS Fortran behavior. He's been out on vacation this week but will be back next week.
And to summarize: I believe you want the combination of -vms -check bounds to IGNORE string bounds checking altogether, because older VMS compilers did not check string bounds?
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[If, in the real code, there are many references to S in the procedure, there are tricks you might apply to minimize the textual changes. For example, you might move the body of the procedure into an internal procedure, with a new host body that simply calls the internal procedure, passing through the arguments, except that instead of passing through S, you pass through S(:MIN(8,LEN(S))). The S inside the internal procedure now has the properties you were expecting of S in your original code.]
Good luck!
-Kurt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Chris, if you don't mind, please state why it is necessary for you to request bound-checks at all? Do you want bounds checked for only non-CHARACTER types? Or do you want some checking done for CHARACTER types, too, but want the specific standard-violating behavior not flagged?
There is a way out that does not call for the dubious tactic of altering the compiler merely to allow one user's non-standard-conforming code to work.
This would consist of giving the user a means to allow the Fortran runtime error handler to ignore a specific error, a certain count of errors of all types, or to demote a numbered error to a warning, the selection being made using environment variables or extra command line options to be passed to the Fortran runtime. All errors would be caught and, by default, reported, but the user would have the option to suppress/ignore a chosen subset of errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The appropriate fix here is to use CHARACTER(*) rather than an explicit length for a character dummy argument. We will not change the compiler to remove this error check as part of bounds checking.

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