Skip to content

Commit 8115759

Browse files
authored
Merge pull request #52 from sourceryinstitute/fix-compiler-test
Document compiler test resutlss & work around IBM association issue
2 parents 35b4c9f + dc3a2c3 commit 8115759

File tree

4 files changed

+162
-182
lines changed

4 files changed

+162
-182
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,32 +92,32 @@ cd smart-pointer
9292
```
9393
followed by one of the commands below corresponding to your compiler choice.
9494

95-
### Numerical Algorithms Group (`nagfor`)
95+
### Numerical Algorithms Group
9696
```
9797
fpm test --compiler nagfor --flag -fpp
9898
```
9999

100-
### IBM (`xlf2003_r`)
100+
### Intel
101101
```
102-
fpm test --compiler xlf2003_r --flag -DXLF
102+
fpm test --compiler ifort
103103
```
104104

105-
### Intel (`ifort`)
105+
### IBM
106106
```
107-
fpm test --compiler ifort --flag
107+
fpm test --archiver ar --compiler xlf2008_r --flag -DXLF
108108
```
109109

110-
### GCC (`gfortran`)
110+
### GCC
111111
```
112112
fpm test
113113
```
114114

115-
### NVIDIA (`nvfortran`)
115+
### NVIDIA
116116
```
117117
fpm test --compiler nvfortran --flag -Mpreprocess
118118
```
119119

120-
### AMD (`flang`)
120+
### AMD
121121
```
122122
fpm test --compiler flang --flag -cpp
123123
```

test/README.md

Lines changed: 134 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,154 @@
11
Compiler Support Status
22
=======================
33

4-
This directory contains two categories of unit tests separated into two files:
5-
6-
* `usage_test.f90` exercises the reference-counter library, whereas
7-
* `compiler_test.f90` tests the compiler without using reference-counter,
8-
9-
`compiler_test.f90` verifies that a compiler calls a type's final subroutine
10-
in each of the scenarios in which the Fortran standard requires finalization
11-
to occur. Because one test must run as an external subprogram and because
12-
passing that test involves error termination, that test is in the separate
13-
file [specification_expression_finalization.f90].
14-
15-
* [NAG]
16-
* [GNU]
17-
* [Cray]
18-
* [Intel]
19-
* [NVIDIA]
20-
* [IBM]
21-
* [AMD]
22-
* [LLVM]
23-
24-
NAG
25-
---
26-
- Version: 7.1 (Build 7113)
27-
- Result: 0 test failures. :trophy:
4+
This directory contains two categories of unit tests:
285

29-
```
30-
nagfor compile_me_only.f90
31-
./a.out
32-
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
33-
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
34-
Pass: finalizes a target when the associated pointer is deallocated
35-
Pass: finalizes an object upon explicit deallocation
36-
Pass: finalizes a non-pointer non-allocatable object at the END statement
37-
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
38-
Pass: finalizes a function reference on the RHS of an intrinsic assignment
39-
Pass: finalizes a specification expression function result
40-
Pass: finalizes an intent(out) derived type dummy argument
41-
Pass: finalizes an allocatable component object
42-
```
6+
* [compiler_test_m.f90] tests the compiler without using Smart-Pointers, whereas
7+
* [sp_smart_pointer_test_m.f90] exercises the Smart-Pointers library.
438

44-
GNU
45-
---
46-
- Version: 12.2.0
47-
- Result: 4 test failures.
9+
[compiler_test_m.f90] verifies that a compiler calls a type's final subroutine
10+
in each of the scenarios in which the Fortran 2018 standard requires finalization
11+
to occur.
4812

49-
Because the first usage test causes a segmentation fault when compiled
50-
with `gfortran`, obtaining the test results requires skipping that test
51-
by running individual tests as follows:
52-
```
53-
fpm test -- -f "<description>"
54-
```
55-
Replace <description> above with one of the enumerated test descriptions,
56-
shown after a colon below, or with a corresponding substring not contained
57-
in the first usage test description.
58-
59-
```
60-
gfortran compile_me_only.f90
61-
./a.out
62-
Fail: finalizes a non-allocatable object on the LHS of an intrinsic assignment
63-
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
64-
Pass: finalizes a target when the associated pointer is deallocated
65-
Pass: finalizes an object upon explicit deallocation
66-
Pass: finalizes a non-pointer non-allocatable object at the END statement
67-
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
68-
Fail: finalizes a function reference on the RHS of an intrinsic assignment
69-
Fail: finalizes a specification expression function result
70-
Pass: finalizes an intent(out) derived type dummy argument
71-
Pass: finalizes an allocatable component object
72-
```
13+
Summary
14+
-------
7315

74-
Cray
75-
----
76-
- Version: 13.0.1
77-
- Result: 3 test failures.
78-
```
79-
ftn compile_me_only.f90
80-
./a.out
81-
Cray Fortran : Version 13.0.1 fails to compile specification_expression_finalization.f90
82-
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
83-
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
84-
Pass: finalizes a target when the associated pointer is deallocated
85-
Pass: finalizes an object upon explicit deallocation
86-
Pass: finalizes a non-pointer non-allocatable object at the END statement
87-
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
88-
Pass: finalizes a function reference on the RHS of an intrinsic assignment
89-
Fail: finalizes a specification expression function result
90-
Fail: finalizes an intent(out) derived type dummy argument
91-
Pass: finalizes an allocatable component object
92-
```
16+
* [AMD](#amd): unsupported (fails to build Smart-Pointers)
17+
* [Cray](#cray): partial support (3 test failures)
18+
* [GCC](#gnu): partial support (6 test failures)
19+
* [IBM](#ibm): partial support (1 test failure)
20+
* [Intel](#intel): partial support (1 test failure)
21+
* [LLVM](#llvm): unsupported (fails to build Smart-Pointers)
22+
* [NAG](#nag): full support :trophy: (0 test failures)
23+
* [NVIDIA](#nvidia): partial support (2 test failures)
9324

94-
Intel
95-
-----
96-
- Version: 2021.1 Beta Build 20200827
97-
- Result: 2 test failures.
98-
```
99-
ifort compile_me_only.f90
100-
./a.out
101-
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
102-
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
103-
Pass: finalizes a target when the associated pointer is deallocated
104-
Pass: finalizes an object upon explicit deallocation
105-
Pass: finalizes a non-pointer non-allocatable object at the END statement
106-
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
107-
Fail: finalizes a function reference on the RHS of an intrinsic assignment
108-
Pass: finalizes a specification expression function result
109-
Pass: finalizes an intent(out) derived type dummy argument
110-
Fail: finalizes an allocatable component object
25+
Detailed Results
26+
----------------
11127

112-
```
28+
### AMD
29+
- Version tested: 13.0.0 (AOCC_3.2.0-Build#128 2021_11_12)
30+
- Result: Fails to build due to an internal compiler error (ICE)
11331

114-
NVIDIA
115-
------
116-
- Version: 22.7-0 64-bit target on x86-64 Linux -tp zen3
117-
- Result: 2 test failures
32+
### Cray
33+
- Version: 13.0.1
34+
- Result: 3 test failures.
11835

36+
### GCC
37+
- Version: 12.2.0
38+
- Result: 4 test failures.
11939
```
120-
nvfortran compile_me_only.f90
121-
./a.out
122-
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
123-
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
124-
Pass: finalizes a target when the associated pointer is deallocated
125-
Pass: finalizes an object upon explicit deallocation
126-
Pass: finalizes a non-pointer non-allocatable object at the END statement
127-
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
128-
Pass: finalizes a function reference on the RHS of an intrinsic assignment
129-
Pass: finalizes a specification expression function result
130-
Fail: finalizes an intent(out) derived type dummy argument
131-
Pass: finalizes an allocatable component object
132-
```
133-
134-
IBM
135-
---
40+
% fpm test
41+
Project is up to date
42+
43+
The compiler
44+
Fail: finalizes a non-allocatable object on the LHS of an intrinsic assignment
45+
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
46+
Pass: finalizes a target when the associated pointer is deallocated
47+
Pass: finalizes an object upon explicit deallocation
48+
Pass: finalizes a non-pointer non-allocatable object at the END statement
49+
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
50+
Fail: finalizes a function reference on the RHS of an intrinsic assignment
51+
Fail: finalizes a specification expression function result
52+
Pass: finalizes an intent(out) derived type dummy argument
53+
Pass: finalizes an allocatable component object
54+
55+
A smart_pointer
56+
(skipped copy of declared reference due to a gfortran bug that would cause a segmentation fault)
57+
Pass: creates a resource when constructed
58+
Pass: removes the resource when the object goes out of scope
59+
Fail: copy points to the same resource as the original
60+
Fail: has zero references after a shallow copy goes out of scope
61+
```
62+
63+
### IBM
13664
- Version: IBM Open XL Fortran for AIX 17.1.0
13765
- Result: 1 test failure
138-
139-
In order to for the tests to complete in a way that reports all of the results,
140-
place an exclamation mark (`!`) at the beginning of the following line in the
141-
`compile_me_only.f90` file:
142-
```
143-
,test_result_t("finalizes a specification expression function result", specification_expression()) &
14466
```
145-
which removes the one failing test. Compiling and executing the same file then
146-
147-
```
148-
xlf2003_r compile_me_only.f90
149-
./a.out
67+
$ fpm test --archiver ar --compiler xlf2008_r --flag -DXLF
68+
<WARN> Unknown compiler xlf2008_r requested! Defaults for this compiler might be incorrect
69+
Project is up to date
70+
71+
The compiler
72+
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
73+
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
74+
Pass: finalizes a target when the associated pointer is deallocated
75+
Pass: finalizes an object upon explicit deallocation
76+
Pass: finalizes a non-pointer non-allocatable object at the END statement
77+
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
78+
Pass: finalizes a function reference on the RHS of an intrinsic assignment
79+
Pass: finalizes a specification expression function result
80+
Pass: finalizes an intent(out) derived type dummy argument
81+
Pass: finalizes an allocatable component object
82+
83+
A smart_pointer
84+
Pass: creates a resource when constructed
85+
Pass: removes the resource when the object goes out of scope
86+
Pass: copy points to the same resource as the original
87+
Fail: has zero references after a shallow copy goes out of scope
88+
89+
```
90+
91+
### Intel
92+
- Version: 2021.7.0 Build 20220726_000000
93+
- Result: 1 test failure.
94+
```
95+
% fpm test --compiler ifort
96+
Project is up to date
97+
98+
The compiler
99+
150100
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
151-
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
152-
Pass: finalizes a target when the associated pointer is deallocated
153-
Pass: finalizes an object upon explicit deallocation
154-
Pass: finalizes a non-pointer non-allocatable object at the END statement
155-
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
156-
Pass: finalizes a function reference on the RHS of an intrinsic assignment
157-
Pass: finalizes an intent(out) derived type dummy argument
158-
Pass: finalizes an allocatable component object
159-
```
160-
**Fail:** Separately compiling `specification_expression_finalization.f90` with
161-
`xlf2003_r` causes a core dump. This is a compiler bug that has been reported
162-
via the Oak Ridge Leadership Computing Facility (OLCF) under ticket OLCFHELP-9069.
163-
164-
AMD
165-
---
166-
- Version tested: 13.0.0 (AOCC_3.2.0-Build#128 2021_11_12)
167-
- Result: Fails to build due to an internal compiler error (ICE)
168-
169-
170-
LLVM
171-
----
101+
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
102+
Pass: finalizes a target when the associated pointer is deallocated
103+
Pass: finalizes an object upon explicit deallocation
104+
Pass: finalizes a non-pointer non-allocatable object at the END statement
105+
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
106+
Pass: finalizes a function reference on the RHS of an intrinsic assignment
107+
Pass: finalizes a specification expression function result
108+
Pass: finalizes an intent(out) derived type dummy argument
109+
Pass: finalizes an allocatable component object
110+
111+
A smart_pointer
112+
Pass: creates a resource when constructed
113+
Pass: removes the resource when the object goes out of scope
114+
Pass: copy points to the same resource as the original
115+
Fail: has zero references after a shallow copy goes out of scope
116+
```
117+
118+
### LLVM
172119
- Version tested: `git` commit `76911b5f75907eef53a30cc3` (9/20/2022)
173120
- Result: Fails with the error message `not yet implemented: derived type finalization`
174121

175-
[NAG]: #nag
176-
[GNU]: #gnu
177-
[Cray]: #cray
178-
[Intel]: #intel
179-
[NVIDIA]: #nvidia
180-
[IBM]: #ibm
181-
[AMD]: #amd
182-
[LLVM]: #llvm
122+
### NAG
123+
- Version: 7.1 (Build 7113)
124+
- Result: 0 test failures. :trophy:
125+
```
126+
% fpm test --compiler nagfor --flag -fpp
127+
Project is up to date
128+
129+
The compiler
130+
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
131+
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
132+
Pass: finalizes a target when the associated pointer is deallocated
133+
Pass: finalizes an object upon explicit deallocation
134+
Pass: finalizes a non-pointer non-allocatable object at the END statement
135+
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
136+
Pass: finalizes a function reference on the RHS of an intrinsic assignment
137+
Pass: finalizes a specification expression function result
138+
Pass: finalizes an intent(out) derived type dummy argument
139+
Pass: finalizes an allocatable component object
140+
141+
A smart_pointer
142+
Pass: creates a resource when constructed
143+
Pass: removes the resource when the object goes out of scope
144+
Pass: copy points to the same resource as the original
145+
Pass: has zero references after a shallow copy goes out of scope
146+
```
147+
148+
### NVIDIA
149+
- Version: 22.7-0 64-bit target on x86-64 Linux -tp zen3
150+
- Result: 2 test failures
151+
183152
[specification_expression_finalization.f90]: ../example/test-support/specification_expression_finalization.f90
153+
[compiler_test_m.f90]: ./compiler_test_m.f90
154+
[sp_smart_pointer_test_m.f90]: ./sp_smart_pointer_test_m.F90

test/compiler_test_m.f90

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ function check_specification_expression() result(test_passes)
210210
!! Test conformance with Fortran 2018 standard clause 7.5.6.3, paragraph 6:
211211
!! "specification expression function result"
212212
logical test_passes
213-
integer exit_status
213+
integer exit_status, command_status
214214
logical error_termination_occurred
215+
character(len=132) command_message
215216

216217
call execute_command_line( &
217218
command = "fpm run --example specification_expression_finalization "// fpm_compiler_arguments() //" > /dev/null 2>&1", &
218-
wait = .true., &
219-
exitstat = exit_status &
219+
wait = .true., exitstat = exit_status, cmdstat = command_status, cmdmsg = command_message &
220220
)
221221
error_termination_occurred = exit_status /=0
222222
test_passes = error_termination_occurred
@@ -227,14 +227,16 @@ function fpm_compiler_arguments() result(args)
227227
character(len=:), allocatable :: args
228228

229229
associate(compiler_identity=>compiler_version())
230-
if (scan(compiler_identity, "GCC")==1) then
230+
if (index(compiler_identity, "GCC")==1) then
231231
args = " "
232-
else if (scan(compiler_identity, "NAG")==1) then
232+
else if (index(compiler_identity, "NAG")==1) then
233233
args = "--compiler nagfor --flag -fpp"
234-
else if (scan(compiler_identity, "Intel")==1) then
235-
args = "--compiler ifort --flag"
236-
else if (scan(compiler_identity, "IBM")==1) then
237-
args = "--compiler xlf2003_r --flag -DXLF"
234+
else if (index(compiler_identity, "Intel")==1) then
235+
args = "--compiler ifort"
236+
else if (index(compiler_identity, "IBM")==1) then
237+
args = "--archiver ar --compiler xlf2008_r --flag -DXLF"
238+
else if (index(compiler_identity, "Cray")==1) then
239+
args = "--compiler ftn"
238240
else
239241
error stop "----> Unrecognized compiler_version() in function fpm_compiler_arguments. <----"
240242
end if

0 commit comments

Comments
 (0)