Skip to content

Commit db8c41e

Browse files
committed
Add new NAG 6.2, 7.0 bug test case
1 parent c9f1ed5 commit db8c41e

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

nag-bugs/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ include(testing)
55

66
project(nag-bug Fortran)
77

8-
add_compiler_test(SOURCES nag-20200110.f90 RUN_ONLY COMPILE_FLAGS "-O")
8+
add_compiler_test(SOURCES nag-20200124.f90 COMPILE_ONLY LABELS SR104818)
9+
add_compiler_test(SOURCES nag-20200110.f90 RUN_ONLY COMPILE_FLAGS "-O" LABELS SR104737)
910
add_compiler_test(SOURCES nag-20190906.f90 RUN_ONLY LABELS SR104066)
1011
add_compiler_test(SOURCES nag-20190831.f90 RUN_ONLY LABELS SR104066)
1112
add_compiler_test(SOURCES nag-20190826a.f90 COMPILE_ONLY LABELS SR104042)

nag-bugs/nag-20200124.f90

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
!! SR104818
2+
!!
3+
!! GENERIC FUNCTION LOSES CONTIGUOUS ATTRIBUTE
4+
!!
5+
!! The following example shows that the CONTIGUOUS attribute of an
6+
!! array pointer valued function is not being propagated to the
7+
!! generic function for which it is a specific procedure in some
8+
!! contexts. The error occurs for both 6.2 and 7.0, but not 6.1
9+
!!
10+
!! $ nagfor -w nag-20200124.f90
11+
!! NAG Fortran Compiler Release 6.2(Chiyoda) Build 6253
12+
!! Error: nag-20200124.f90, line 34: Argument DP (no. 1) of FOO is a CONTIGUOUS
13+
!! pointer, but the actual argument is not simply contiguous
14+
!! [NAG Fortran Compiler error termination, 1 error, 1 warning]
15+
!!
16+
17+
module contig_generic_ptr_func
18+
19+
interface dataptr
20+
procedure dataptr1
21+
end interface
22+
23+
contains
24+
25+
function dataptr1() result(dp)
26+
real, pointer, contiguous :: dp(:)
27+
allocate(dp(10))
28+
end function
29+
30+
end module
31+
32+
use contig_generic_ptr_func
33+
real, pointer, contiguous :: x(:)
34+
x => dataptr() ! NO ERROR HERE
35+
call foo(dataptr1()) ! NO ERROR HERE
36+
call foo(dataptr()) ! BUT ERROR HERE
37+
contains
38+
subroutine foo(dp)
39+
real, pointer, contiguous :: dp(:)
40+
end subroutine
41+
end

0 commit comments

Comments
 (0)