File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ include(testing)
55
66project (nag-bug Fortran)
77
8+ add_compiler_test(SOURCES nag-20200110.f90 RUN_ONLY COMPILE_FLAGS "-O" )
89add_compiler_test(SOURCES nag-20190906.f90 RUN_ONLY LABELS SR104066)
910add_compiler_test(SOURCES nag-20190831.f90 RUN_ONLY LABELS SR104066)
1011add_compiler_test(SOURCES nag-20190826a.f90 COMPILE_ONLY LABELS SR104042)
Original file line number Diff line number Diff line change 1+ ! ! WRONG CODE UNDER OPTIMIZATION
2+ ! !
3+ ! ! The 6.2 compiler generates wrong code for the following example
4+ ! ! when compiled with -O. The array ARR2 should ultimately have the
5+ ! ! same size as ARR1, but instead has size 0.
6+ ! !
7+ ! ! Credit to David Neill-Asanza (dhna@lanl.gov) for this reproducer.
8+ ! !
9+ ! ! $ nagfor -O nag-20200110.f90
10+ ! ! NAG Fortran Compiler Release 6.2(Chiyoda) Build 6243
11+ ! !
12+ ! ! $ ./a.out
13+ ! ! STOP: 1
14+
15+ integer :: i, arr1(32 )
16+ integer , allocatable :: arr2(:)
17+ arr1 = [(i, i= 1 ,size (arr1))]
18+ arr2 = arr1
19+ arr2 = arr2 * 2
20+ if (size (arr2) /= size (arr1)) stop 1
21+ if (any (arr2 /= 2 * arr1)) stop 2
22+ end
23+
You can’t perform that action at this time.
0 commit comments