Skip to content

Commit

Permalink
Implement workaround for ifx compiler with optimization (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi authored Feb 25, 2024
1 parent 09d8036 commit 02aa61c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
8 changes: 0 additions & 8 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,10 @@ project(
sources = []
subdir('src')

# Intel compiler (as of 2024.0.2) crashes when building the library with optimization turned on.
if meson.get_compiler('fortran').get_id() == 'intel-llvm'
fortran_args = ['-O0']
else
fortran_args = []
endif

fortuno_lib = library(
meson.project_name(),
sources: sources,
version: meson.project_version(),
fortran_args: fortran_args
)

fortuno_dep = declare_dependency(
Expand Down
5 changes: 0 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ target_include_directories(
$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/${FORTUNO_INSTALL_MODULEDIR}>
)

# ifx (as of version 2024.0.2) crashes when optimization is turned on
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM")
target_compile_options(Fortuno PRIVATE "-O0")
endif ()

if (FORTUNO_INSTALL)
install(
TARGETS Fortuno
Expand Down
16 changes: 15 additions & 1 deletion src/fortuno/testcontext.f90
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,23 @@ subroutine test_context_register_check(this, checkfailed, msg, file, line)
allocate(failureinfo)
call this%create_failure_location(failureinfo%location, file, line)
if (present(msg)) failureinfo%message = msg
if (allocated(this%failureinfo_)) call move_alloc(this%failureinfo_, failureinfo%previous)
! Workaround:ifx:2024.0
! ifx crashes during compilation with optimization on the move_alloc statement.
! if (allocated(this%failureinfo_)) call move_alloc(this%failureinfo_, failureinfo%previous)
if (allocated(this%failureinfo_)) call my_move_alloc(this%failureinfo_, failureinfo%previous)
call move_alloc(failureinfo, this%failureinfo_)

contains

! Workaround move_alloc function.
subroutine my_move_alloc(src, trg)
type(failure_info), allocatable, intent(inout) :: src
type(failure_info), allocatable, intent(out) :: trg

call move_alloc(src, trg)

end subroutine my_move_alloc

end subroutine test_context_register_check


Expand Down

0 comments on commit 02aa61c

Please sign in to comment.