- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Everybody,
I am having problems compiling the following simple program that uses "overindexing":
PROGRAM OVERINDEX
IMPLICIT NONE
REAL, DIMENSION(20,20) :: a
INTEGER, PARAMETER :: n = size(a)
INTEGER :: i, j
a(:n,1) = 10.0
END PROGRAM OVERINDEX
Despite using the compiler switch -WB, this is what
I am getting:
program OVERINDEX
a(:n,1) = 10.0
^
Error 172 at (7:overindex.f90) : Not all section elements are within array bounds
I successfully compiled this program using other FORTRAN
90/95 compilers, such as, e.g. Lahey. According to Intel
documentation, the switch -WB should turn off checking
for out-of-bounds indices.
Am I doing something wrong, or is this a bug? Any advice
will be greatly appreciated. Thanks!
Regards,
Bartek Protas
Compiler specs:
Intel Fortran Compiler for 32-bit applications, Version 7.1 Build 20030307Z
Copyright (C) 1985-2003 Intel Corporation. All rights reserved.
F
I am having problems compiling the following simple program that uses "overindexing":
PROGRAM OVERINDEX
IMPLICIT NONE
REAL, DIMENSION(20,20) :: a
INTEGER, PARAMETER :: n = size(a)
INTEGER :: i, j
a(:n,1) = 10.0
END PROGRAM OVERINDEX
Despite using the compiler switch -WB, this is what
I am getting:
program OVERINDEX
a(:n,1) = 10.0
^
Error 172 at (7:overindex.f90) : Not all section elements are within array bounds
I successfully compiled this program using other FORTRAN
90/95 compilers, such as, e.g. Lahey. According to Intel
documentation, the switch -WB should turn off checking
for out-of-bounds indices.
Am I doing something wrong, or is this a bug? Any advice
will be greatly appreciated. Thanks!
Regards,
Bartek Protas
Compiler specs:
Intel Fortran Compiler for 32-bit applications, Version 7.1 Build 20030307Z
Copyright (C) 1985-2003 Intel Corporation. All rights reserved.
F
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
-WB simply converts a bounds violation to a warning instead of an error, Are you also specifying -CB or -C? These turn on bounds checking.
The code is illegal, of course, and results may be unpredictable.
Steve
The code is illegal, of course, and results may be unpredictable.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think the primary reason for the -WB switch is to permit the practice, obsoleted 25 years ago, of using dimension (1) instead of (*) (f77 notation).
I suppose, in your example, it would be better to write
a(:,:) = 10.0
It does look like there is an inconsistency between the documentation and implementation of the -WB switch. Maybe it's intended only to work (loosely speaking) with the f77 subset of Fortran, like some other extensions.
I suppose, in your example, it would be better to write
a(:,:) = 10.0
It does look like there is an inconsistency between the documentation and implementation of the -WB switch. Maybe it's intended only to work (loosely speaking) with the f77 subset of Fortran, like some other extensions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
Thanks for your reply. Nope, I am not using any of the
-C switches. Is seems to me that -WB is not doing what it
should be doing.
I realize that overindexing is illegal, but I have a
huge code that (ab)uses this convention. Any idea as to how
to get around that using 'ifc', or should I rather rewrite
the code? Thanks!
bp++
Thanks for your reply. Nope, I am not using any of the
-C switches. Is seems to me that -WB is not doing what it
should be doing.
I realize that overindexing is illegal, but I have a
huge code that (ab)uses this convention. Any idea as to how
to get around that using 'ifc', or should I rather rewrite
the code? Thanks!
bp++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually, -WB affects run-time bounds checking only. In your case, it's the compiler that is detecting the problem, and I don't see a way to turn that off. I note that the upcoming version 8.0 will let you get away with this.
Looks as if you'll need to rewrite it (and I would recommend doing so in a legal fashion) for use with 7.1.
Steve
Looks as if you'll need to rewrite it (and I would recommend doing so in a legal fashion) for use with 7.1.
Steve

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