Skip to content

Commit 07e1287

Browse files
committed
fix(compiler_test): scan->index; edit build info
This commit 1. Fixes the compiler_version() substring search by switching from the scan intrinsic function to the index intrinsic function. 2. Fixes the README.md build instructions.
1 parent 35b4c9f commit 07e1287

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
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/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)