Skip to content

Document compiler test resutlss & work around IBM association issue #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,32 @@ cd smart-pointer
```
followed by one of the commands below corresponding to your compiler choice.

### Numerical Algorithms Group (`nagfor`)
### Numerical Algorithms Group
```
fpm test --compiler nagfor --flag -fpp
```

### IBM (`xlf2003_r`)
### Intel
```
fpm test --compiler xlf2003_r --flag -DXLF
fpm test --compiler ifort
```

### Intel (`ifort`)
### IBM
```
fpm test --compiler ifort --flag
fpm test --archiver ar --compiler xlf2008_r --flag -DXLF
```

### GCC (`gfortran`)
### GCC
```
fpm test
```

### NVIDIA (`nvfortran`)
### NVIDIA
```
fpm test --compiler nvfortran --flag -Mpreprocess
```

### AMD (`flang`)
### AMD
```
fpm test --compiler flang --flag -cpp
```
Expand Down
297 changes: 134 additions & 163 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,183 +1,154 @@
Compiler Support Status
=======================

This directory contains two categories of unit tests separated into two files:

* `usage_test.f90` exercises the reference-counter library, whereas
* `compiler_test.f90` tests the compiler without using reference-counter,

`compiler_test.f90` verifies that a compiler calls a type's final subroutine
in each of the scenarios in which the Fortran standard requires finalization
to occur. Because one test must run as an external subprogram and because
passing that test involves error termination, that test is in the separate
file [specification_expression_finalization.f90].

* [NAG]
* [GNU]
* [Cray]
* [Intel]
* [NVIDIA]
* [IBM]
* [AMD]
* [LLVM]

NAG
---
- Version: 7.1 (Build 7113)
- Result: 0 test failures. :trophy:
This directory contains two categories of unit tests:

```
nagfor compile_me_only.f90
./a.out
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes a specification expression function result
Pass: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object
```
* [compiler_test_m.f90] tests the compiler without using Smart-Pointers, whereas
* [sp_smart_pointer_test_m.f90] exercises the Smart-Pointers library.

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

Because the first usage test causes a segmentation fault when compiled
with `gfortran`, obtaining the test results requires skipping that test
by running individual tests as follows:
```
fpm test -- -f "<description>"
```
Replace <description> above with one of the enumerated test descriptions,
shown after a colon below, or with a corresponding substring not contained
in the first usage test description.

```
gfortran compile_me_only.f90
./a.out
Fail: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
Fail: finalizes a function reference on the RHS of an intrinsic assignment
Fail: finalizes a specification expression function result
Pass: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object
```
Summary
-------

Cray
----
- Version: 13.0.1
- Result: 3 test failures.
```
ftn compile_me_only.f90
./a.out
Cray Fortran : Version 13.0.1 fails to compile specification_expression_finalization.f90
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Fail: finalizes a specification expression function result
Fail: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object
```
* [AMD](#amd): unsupported (fails to build Smart-Pointers)
* [Cray](#cray): partial support (3 test failures)
* [GCC](#gnu): partial support (6 test failures)
* [IBM](#ibm): partial support (1 test failure)
* [Intel](#intel): partial support (1 test failure)
* [LLVM](#llvm): unsupported (fails to build Smart-Pointers)
* [NAG](#nag): full support :trophy: (0 test failures)
* [NVIDIA](#nvidia): partial support (2 test failures)

Intel
-----
- Version: 2021.1 Beta Build 20200827
- Result: 2 test failures.
```
ifort compile_me_only.f90
./a.out
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
Fail: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes a specification expression function result
Pass: finalizes an intent(out) derived type dummy argument
Fail: finalizes an allocatable component object
Detailed Results
----------------

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

NVIDIA
------
- Version: 22.7-0 64-bit target on x86-64 Linux -tp zen3
- Result: 2 test failures
### Cray
- Version: 13.0.1
- Result: 3 test failures.

### GCC
- Version: 12.2.0
- Result: 4 test failures.
```
nvfortran compile_me_only.f90
./a.out
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes a specification expression function result
Fail: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object
```

IBM
---
% fpm test
Project is up to date

The compiler
Fail: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
Fail: finalizes a function reference on the RHS of an intrinsic assignment
Fail: finalizes a specification expression function result
Pass: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object

A smart_pointer
(skipped copy of declared reference due to a gfortran bug that would cause a segmentation fault)
Pass: creates a resource when constructed
Pass: removes the resource when the object goes out of scope
Fail: copy points to the same resource as the original
Fail: has zero references after a shallow copy goes out of scope
```

### IBM
- Version: IBM Open XL Fortran for AIX 17.1.0
- Result: 1 test failure

In order to for the tests to complete in a way that reports all of the results,
place an exclamation mark (`!`) at the beginning of the following line in the
`compile_me_only.f90` file:
```
,test_result_t("finalizes a specification expression function result", specification_expression()) &
```
which removes the one failing test. Compiling and executing the same file then

```
xlf2003_r compile_me_only.f90
./a.out
$ fpm test --archiver ar --compiler xlf2008_r --flag -DXLF
<WARN> Unknown compiler xlf2008_r requested! Defaults for this compiler might be incorrect
Project is up to date

The compiler
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes a specification expression function result
Pass: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object

A smart_pointer
Pass: creates a resource when constructed
Pass: removes the resource when the object goes out of scope
Pass: copy points to the same resource as the original
Fail: has zero references after a shallow copy goes out of scope

```

### Intel
- Version: 2021.7.0 Build 20220726_000000
- Result: 1 test failure.
```
% fpm test --compiler ifort
Project is up to date

The compiler

Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object
```
**Fail:** Separately compiling `specification_expression_finalization.f90` with
`xlf2003_r` causes a core dump. This is a compiler bug that has been reported
via the Oak Ridge Leadership Computing Facility (OLCF) under ticket OLCFHELP-9069.

AMD
---
- Version tested: 13.0.0 (AOCC_3.2.0-Build#128 2021_11_12)
- Result: Fails to build due to an internal compiler error (ICE)


LLVM
----
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes a specification expression function result
Pass: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object

A smart_pointer
Pass: creates a resource when constructed
Pass: removes the resource when the object goes out of scope
Pass: copy points to the same resource as the original
Fail: has zero references after a shallow copy goes out of scope
```

### LLVM
- Version tested: `git` commit `76911b5f75907eef53a30cc3` (9/20/2022)
- Result: Fails with the error message `not yet implemented: derived type finalization`

[NAG]: #nag
[GNU]: #gnu
[Cray]: #cray
[Intel]: #intel
[NVIDIA]: #nvidia
[IBM]: #ibm
[AMD]: #amd
[LLVM]: #llvm
### NAG
- Version: 7.1 (Build 7113)
- Result: 0 test failures. :trophy:
```
% fpm test --compiler nagfor --flag -fpp
Project is up to date

The compiler
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Pass: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes a specification expression function result
Pass: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object

A smart_pointer
Pass: creates a resource when constructed
Pass: removes the resource when the object goes out of scope
Pass: copy points to the same resource as the original
Pass: has zero references after a shallow copy goes out of scope
```

### NVIDIA
- Version: 22.7-0 64-bit target on x86-64 Linux -tp zen3
- Result: 2 test failures

[specification_expression_finalization.f90]: ../example/test-support/specification_expression_finalization.f90
[compiler_test_m.f90]: ./compiler_test_m.f90
[sp_smart_pointer_test_m.f90]: ./sp_smart_pointer_test_m.F90
20 changes: 11 additions & 9 deletions test/compiler_test_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ function check_specification_expression() result(test_passes)
!! Test conformance with Fortran 2018 standard clause 7.5.6.3, paragraph 6:
!! "specification expression function result"
logical test_passes
integer exit_status
integer exit_status, command_status
logical error_termination_occurred
character(len=132) command_message

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

associate(compiler_identity=>compiler_version())
if (scan(compiler_identity, "GCC")==1) then
if (index(compiler_identity, "GCC")==1) then
args = " "
else if (scan(compiler_identity, "NAG")==1) then
else if (index(compiler_identity, "NAG")==1) then
args = "--compiler nagfor --flag -fpp"
else if (scan(compiler_identity, "Intel")==1) then
args = "--compiler ifort --flag"
else if (scan(compiler_identity, "IBM")==1) then
args = "--compiler xlf2003_r --flag -DXLF"
else if (index(compiler_identity, "Intel")==1) then
args = "--compiler ifort"
else if (index(compiler_identity, "IBM")==1) then
args = "--archiver ar --compiler xlf2008_r --flag -DXLF"
else if (index(compiler_identity, "Cray")==1) then
args = "--compiler ftn"
else
error stop "----> Unrecognized compiler_version() in function fpm_compiler_arguments. <----"
end if
Expand Down
Loading