- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm getting a "wrong" failure with -check all that doesn't agree with the code I compile:
$ cat a.f90
module Lebedev_quadrature
implicit none
private
public :: ld0014
contains
subroutine ld0014(x,y,z,w)
real, intent(out) :: x(14), y(14), z(14), w(14)
real, parameter :: v1 = 1.0/15.0, v2 = 3.0/40.0
integer :: m
m = 1
call gen_oh(1,m,v1,x(m:),y(m:),z(m:),w(m:))
call gen_oh(2,m,v2,x(m:),y(m:),z(m:),w(m:))
end subroutine ld0014
subroutine gen_oh(code,num,v,x,y,z,w)
integer, intent(in) :: code
integer, intent(inout) :: num
real, intent(in) :: v
real, intent(out) :: x(*), y(*), z(*), w(*)
real :: a
integer :: n
select case (code)
case (1)
a = 1.0
x(1:6) = [ a, -a,0.0,0.0,0.0,0.0]
y(1:6) = [0.0,0.0, a, -a,0.0,0.0]
z(1:6) = [0.0,0.0,0.0,0.0, a, -a]
w(1:6) = v
n = 6
case (2)
a = sqrt(1.0/3.0)
x(1:8) = [ a,-a, a,-a, a,-a, a,-a]
y(1:8) = [ a, a,-a,-a, a, a,-a,-a]
z(1:8) = [ a, a, a, a,-a,-a,-a,-a]
w(1:8) = v
n = 8
end select
num = num+n
end subroutine gen_oh
end module Lebedev_quadrature
program main
use Lebedev_quadrature, only: ld0014
implicit none
integer :: i, j
real :: TempR(14,3), TempW(14)
call ld0014(TempR(:,1),TempR(:,2),TempR(:,3),TempW)
do i=1,14
print *, (TempR(i,j),j=1,3),TempW(i)
end do
end program main
$ ifx -check all a.f90 && ./a.out
forrtl: severe (408): fort: (3): Subscript #1 of the array X has value 0 which is less than the lower bound of 1
Image PC Routine Line Source
a.out 0000000000405FAC Unknown Unknown Unknown
a.out 00000000004058E6 Unknown Unknown Unknown
a.out 0000000000406391 Unknown Unknown Unknown
a.out 000000000040516D Unknown Unknown Unknown
libc.so.6 00007F13823F4D90 Unknown Unknown Unknown
libc.so.6 00007F13823F4E40 __libc_start_main Unknown Unknown
a.out 0000000000405085 Unknown Unknown Unknown
$ ifx --version
ifx (IFX) 2025.0.4 20241205
Copyright (C) 1985-2024 Intel Corporation. All rights reserved
I'm using explicit subscripts (1:6) and (1:8), so there's no way there could be a 0 subscript. I believe this happens because the inline arrays are using a variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tested it in the next version under development and it will be solved.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code works OK using the IFORT compiler, or if you change the array declarations to use assumed shape ,i.e.
real, intent(out) :: x(:), y(:), z(:), w(:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for testing. Unfortunately, both x(:) and x(*) are inappropriate. If I'm using intent(out), I should not rely on the size passed by the caller. The original code had something like:
integer, parameter :: points(2) = [6,8]
real, intent(out) :: x(points(code))
x(:) = [...]
so that the size is dependent on the value of the code argument. It still failed in the same way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So you can use assumed shape.
But note that the passed arrays have origine at index 1 and with size passed in.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, but then the calling program needs to know the size. In my case, only the subroutine being called knows the size. I could of course re-structure the code, move the "points" parameter to a module-wide definition, and so on...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tested it in the next version under development and it will be solved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>but then the calling program needs to know the size
in my example, at the call: size(array(23:45)) would be the size of what will be passed.
Or in your example: size(x(m:))
Jim Dempsey

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