@@ -2,6 +2,7 @@ module compiler_test
2
2
! ! Test compiler conformance with each scenario in which the Fortran 2018
3
3
! ! standard mandates type finalization.
4
4
use veggies, only: result_t, test_item_t, describe, it, assert_equals, assert_that
5
+ use iso_fortran_env, only : compiler_version
5
6
implicit none
6
7
7
8
private
@@ -201,17 +202,34 @@ function check_specification_expression() result(result_)
201
202
type (result_t) result_
202
203
integer exit_status
203
204
logical error_termination_occurred
204
-
205
+
205
206
call execute_command_line( &
206
- command = " fpm run --example specification_expression_finalization > /dev/null 2>&1" , &
207
+ command = " fpm run --example specification_expression_finalization " // fpm_compiler_arguments() // " > /dev/null 2>&1" , &
207
208
wait = .true. , &
208
209
exitstat = exit_status &
209
210
)
210
211
error_termination_occurred = exit_status /= 0
211
212
result_ = assert_that(error_termination_occurred)
212
213
214
+ contains
215
+
216
+ pure function fpm_compiler_arguments () result(args)
217
+ character (len= :), allocatable :: args
218
+
219
+ associate(compiler_identity= >compiler_version())
220
+ if (scan (compiler_identity, " GCC " )==1 ) then
221
+ args = " "
222
+ else if (scan (compiler_identity, " NAG Fortran " )==1 ) then
223
+ args = " --compiler nagfor --flag -fpp"
224
+ else
225
+ error stop " ----> Unrecognized compiler_version() in function fpm_compiler_arguments. <----"
226
+ end if
227
+ end associate
228
+ end function
229
+
213
230
end function
214
231
232
+
215
233
function check_intent_out_finalization () result(result_)
216
234
! ! Test conformance with Fortran 2018 standard clause 7.5.6.3, paragraph 7:
217
235
! ! "nonpointer, nonallocatable, INTENT (OUT) dummy argument"
0 commit comments