Skip to content

Commit d09cea0

Browse files
committed
Add new NAG bug test case
1 parent a8163aa commit d09cea0

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

nag-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(nag-bug Fortran)
77

8+
add_compiler_test(SOURCES nag-20190906.f90 RUN_ONLY LABELS SR104066)
89
add_compiler_test(SOURCES nag-20190831.f90 RUN_ONLY LABELS SR104066)
910
add_compiler_test(SOURCES nag-20190826a.f90 COMPILE_ONLY LABELS SR104042)
1011
add_compiler_test(SOURCES nag-20190826b.f90 COMPILE_ONLY LABELS SR104042)

nag-bugs/nag-20190906.f90

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
!! SR104042:
2+
!!
3+
!! WRONG RESULT FROM NORM2 WITH REAL64 ARRAY SECTION ARGUMENT
4+
!!
5+
!! This is an alteration of nag-20190831.f90 which still fails after the
6+
!! fix in build 6238 for the latter test case.
7+
!!
8+
!! The following example norm2 should return sqrt(91) but instead returns
9+
!! sqrt(30) for a real64 array, but the correct result for real32.
10+
!!
11+
!! $ nagfor nag-20190906.f90
12+
!! NAG Fortran Compiler Release 6.2(Chiyoda) Build 6238
13+
!! [NAG Fortran Compiler normal termination]
14+
!! $ ./a.out
15+
!! STOP: 1
16+
!!
17+
18+
double precision x(0:3,0:4)
19+
x = 0
20+
x(1:2,1:3) = reshape([1,2,3,4,5,6], shape=[2,3])
21+
if (norm2(x(1:2,1:3)) /= sqrt(91.0d0)) stop 1 ! WRONG NORM2 RESULT
22+
end

0 commit comments

Comments
 (0)