- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An old practice in Fortran would pass arrays in a call to a Fortran subroutine. Within the subroutine the array size would be defined just as x(1), for an array x. The subroutine array x would assume the size of the array in the subroutine call.
I believe there was an option back in Compaq Visual Fortran v.6.x and in earlier versions of Intel Fortran but I can't locate the compiler option in the latest Intel Visual Fortran. Can anyone help me locate this compiler option?
Thanks,
Peter
I believe there was an option back in Compaq Visual Fortran v.6.x and in earlier versions of Intel Fortran but I can't locate the compiler option in the latest Intel Visual Fortran. Can anyone help me locate this compiler option?
Thanks,
Peter
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Up to 30 years ago, what became x(*) in f77, and was named assumed size in f90, was typically written as x(1), for want of a standard way. Do you mean an option to enable subscript range checking without complaining about the obsolete practice? Early ifort versions required the option /WB to turn some of those from fatal error to warning. That option is still available to allow some strange legacy practices.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The subroutine array x would assume the size of the array in the subroutine call
Not quite. The caller did not pass the size of the argument array to the subroutine at all. The declaration x(1) simply told the compiler that the argument x was an array, and that x(1) was an array element rather than an invocation of a function named x with argument=1. With most compilers, you could put some other number in place of 1, and it would make no difference. Perhaps because of that, the more meaningful notation x(*) was introduced later, as TimP stated.
Unless you ask the compiler (CVF or Intel) to check subscripts, you need no compiler options to process code with such declarations.
Some compilers (I think that the obsolete G77 was one such) would refuse to compile code that contained expressions such as x(2) when x had been declared with the dummy dimension (1). With such a compiler, replacing the "(1) " by "(*)" had to be done throughout the code.
Not quite. The caller did not pass the size of the argument array to the subroutine at all. The declaration x(1) simply told the compiler that the argument x was an array, and that x(1) was an array element rather than an invocation of a function named x with argument=1. With most compilers, you could put some other number in place of 1, and it would make no difference. Perhaps because of that, the more meaningful notation x(*) was introduced later, as TimP stated.
Unless you ask the compiler (CVF or Intel) to check subscripts, you need no compiler options to process code with such declarations.
Some compilers (I think that the obsolete G77 was one such) would refuse to compile code that contained expressions such as x(2) when x had been declared with the dummy dimension (1). With such a compiler, replacing the "(1) " by "(*)" had to be done throughout the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There was no option in CVF to allow (1) to be treated as (*) - it did it automatically. So does Intel Fortran.

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