Skip to content

Commit 2cb5317

Browse files
committed
Add test case for horrible Intel 18 and 19 bug
1 parent 8da0180 commit 2cb5317

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

intel-bugs/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include(testing)
55

66
project(intel-bugs Fortran)
77

8+
add_compiler_test(SOURCES intel-20191229.f90 RUN_ONLY)
89
add_compiler_test(SOURCES intel-20191228.f90)
910
add_compiler_test(SOURCES intel-20190909.f90 COMPILE_ONLY)
1011
add_compiler_test(SOURCES intel-20190903b.f90 COMPILE_ONLY)

intel-bugs/intel-20191229.f90

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
!! ALLOCATES LHS ARRAY WITH WRONG BOUNDS
2+
!!
3+
!! This is totally f*cked up. LHS allocatable array Z is not allocated
4+
!! with the bounds of Y, but with the bounds of the actual argument X.
5+
!! Affects 18.0.5 and 19.0.5
6+
!!
7+
!! $ ifort --version
8+
!! ifort (IFORT) 19.0.5.281 20190815
9+
!! $ ifort intel-20191229.f90
10+
!! $ ./a.out
11+
!! 2
12+
!!
13+
14+
real, allocatable :: x(:)
15+
allocate(x(-2:0))
16+
call foo(x)
17+
contains
18+
subroutine foo(y)
19+
real, intent(in) :: y(:)
20+
real, allocatable :: z(:)
21+
if (lbound(y,1) /= 1) stop 1
22+
z = y ! <== Z IS NOT ALLOCATED WITH THE CORRECT BOUNDS!
23+
if (lbound(z,1) /= lbound(y,1)) stop 2 ! <== EXITS HERE
24+
end subroutine
25+
end

0 commit comments

Comments
 (0)