Skip to content

linker error when calling ieee_set_halting_mode from a subroutine #1465

@hassaniriad

Description

@hassaniriad

Dear all,
when I compile this minimal example

use, intrinsic :: ieee_exceptions
  call foo ( .false. )
contains
   subroutine foo ( ieee_halting )
      logical, intent(in) :: ieee_halting
      if ( ieee_support_halting(ieee_overflow) ) &
         call ieee_set_halting_mode ( ieee_overflow, halting = ieee_halting )
   end subroutine foo
end

I get this error :

flang truc.f90
Undefined symbols for architecture arm64:
  "_fedisableexcept", referenced from:
      __QFPfoo in truc-917008.o
  "_feenableexcept", referenced from:
      __QFPfoo in truc-917008.o
  "_fegetexcept", referenced from:
      __QFPfoo in truc-917008.o
ld: symbol(s) not found for architecture arm64
flang-21: error: linker command failed with exit code 1 (use -v to see invocation)
flang --version
Homebrew flang version 21.1.8
Target: arm64-apple-darwin24.6.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/flang/21.1.8/libexec
Configuration file: /opt/homebrew/Cellar/flang/21.1.8/libexec/flang.cfg
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin24.cfg

The issue goes away if ieee_set_halting_mode is called directly from the main program :

use, intrinsic :: ieee_exceptions
logical :: ieee_halting = .false.
if ( ieee_support_halting(ieee_overflow) ) &
         call ieee_set_halting_mode ( ieee_overflow, halting = ieee_halting )
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions