Skip to content
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,14 @@ fpm test --compiler ifx --profile release --flag "-coarray -DASSERT_MULTI_IMAGE"
```

### Building and testing with the LLVM `flang-new` compiler
#### LLVM 19 Version
```
fpm test --compiler flang-new --flag "-mmlir -allow-assumed-rank -O3"
```
#### LLVM 20 or later
```
fpm test --compiler flang-new --flag "-O3"
```

### Building and testing with the Numerical Algorithms Group (NAG) compiler
```
Expand Down
12 changes: 6 additions & 6 deletions include/assert_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@

! Deal with stringification issues:
! https://gcc.gnu.org/legacy-ml/fortran/2009-06/msg00131.html
#ifndef STRINGIFY
#ifndef CPP_STRINGIFY_SOURCE
# if defined(__GFORTRAN__) || defined(_CRAYFTN) || defined(NAGFOR)
# define STRINGIFY(x) "x"
# define CPP_STRINGIFY_SOURCE(x) "x"
# else
# define STRINGIFY(x) #x
# define CPP_STRINGIFY_SOURCE(x) #x
# endif
#endif

#if ASSERTIONS
# define call_assert(assertion) call assert_always(assertion, "call_assert(" // STRINGIFY(assertion) // ") in file " // __FILE__ // ", line " // string(__LINE__))
# define call_assert_describe(assertion, description) call assert_always(assertion, description // " in file " // __FILE__ // ", line " // string(__LINE__))
# define call_assert_diagnose(assertion, description, diagnostic_data) call assert_always(assertion, description // " in file " // __FILE__ // ", line " // string(__LINE__), diagnostic_data)
# define call_assert(assertion) call assert_always(assertion, "call_assert(" // CPP_STRINGIFY_SOURCE(assertion) // ") in file " // __FILE__ // ", line " // fortran_stringify_integer(__LINE__))
# define call_assert_describe(assertion, description) call assert_always(assertion, description // " in file " // __FILE__ // ", line " // fortran_stringify_integer(__LINE__))
# define call_assert_diagnose(assertion, description, diagnostic_data) call assert_always(assertion, description // " in file " // __FILE__ // ", line " // fortran_stringify_integer(__LINE__), diagnostic_data)
#else
# define call_assert(assertion)
# define call_assert_describe(assertion, description)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module string_m
module fortran_stringify_integer_m
implicit none

contains

pure function string(number) result(number_as_string)
pure function fortran_stringify_integer(number) result(number_as_string)
integer, intent(in) :: number
integer, parameter :: max_len=128
character(len=max_len) :: untrimmed_string
character(len=:), allocatable :: number_as_string

write(untrimmed_string, *) number
write(untrimmed_string, '(i0)') number
number_as_string = trim(adjustl(untrimmed_string))
end function

end module string_m
end module
18 changes: 13 additions & 5 deletions src/assert_m.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
module assert_m
use intrinsic_array_m
use assert_subroutine_m
use characterizable_m
use string_m, only : string
!! Public interface
use intrinsic_array_m, only : intrinsic_array_t
use assert_subroutine_m, only : assert, assert_always
use characterizable_m, only : characterizable_t

! The function below is public only to support automated
! invocation via `assert_macros.h`. For a more broadly useful
! function to convert numeric data to string format, please
! consider using the functions that can be accessed via the
! `string_t` generic interface in the Julienne framework at
! https://go.lbl.gov/julienne.
use fortran_stringify_integer_m, only : fortran_stringify_integer
implicit none
end module assert_m
end module