Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The functions do not work with gfortran-13 -Ofast -flto #29

Open
zaikunzhang opened this issue Oct 2, 2023 · 2 comments
Open

The functions do not work with gfortran-13 -Ofast -flto #29

zaikunzhang opened this issue Oct 2, 2023 · 2 comments

Comments

@zaikunzhang
Copy link
Collaborator

gtest fails if gfortran-13 is invoked with -Ofast -flto, which runs the standard link-time optimizer.

@zaikunzhang
Copy link
Collaborator Author

gfortran-10, gfortran-11, and gfortran-12 do not have the same problem.

@zaikunzhang
Copy link
Collaborator Author

Note that the problem remains even if we define posinf and neginf as follows (in a separated file) and use them instead of huge_value to define is_nan. See d9504b0.

module inf_values_mod                                                                                                                   
                                                                                                                                        
use, intrinsic :: ieee_arithmetic, only : ieee_value, ieee_negative_inf, ieee_positive_inf                                              
implicit none                                                                                                                           
private                                                                                                                                 
public :: posinf, neginf                                                                                                                                                                                   
interface posinf                                                                                                                        
    module procedure posinf_sp, posinf_dp                                                                                               
end interface posinf                                                                                                                    
                                                                                                                                        
interface neginf                                                                                                                        
    module procedure neginf_sp, neginf_dp                                                                                               
end interface neginf                                                                                                                    
                                                                                                                                        
contains                                                                                                                                
                                                                                                                                        
pure function posinf_sp(x) result(y)                                                                                                    
use, non_intrinsic :: consts_mod, only : SP                                                                                             
implicit none                                                                                                                           
real(SP), intent(in) :: x                                                                                                               
real(SP) :: y                                                                                                                           
y = ieee_value(x, ieee_positive_inf)                                                                                                    
end function posinf_sp                                                                                                                  
                                                                                                                                        
pure function posinf_dp(x) result(y)                                                                                                    
use, non_intrinsic :: consts_mod, only : DP                                                                                             
implicit none                                                                                                                           
real(DP), intent(in) :: x                                                                                                               
real(DP) :: y                                                                                                                           
y = ieee_value(x, ieee_positive_inf)                                                                                                    
end function posinf_dp                                                                                                                  
                                                                                                                                        
                                                                                                                                        
pure function neginf_sp(x) result(y)                                                                                                    
use, non_intrinsic :: consts_mod, only : SP                                                                                             
implicit none                                                                                                                           
real(SP), intent(in) :: x                                                                                                               
real(SP) :: y                                                                                                                           
y = ieee_value(x, ieee_negative_inf)                                                                                                    
end function neginf_sp                                                                                                                  
                                                                                                                                        
pure function neginf_dp(x) result(y)                                                                                                    
use, non_intrinsic :: consts_mod, only : DP                                                                                             
implicit none                                                                                                                           
real(DP), intent(in) :: x                                                                                                               
real(DP) :: y                                                                                                                           
y = ieee_value(x, ieee_negative_inf)                                                                                                    
end function neginf_dp                                                                                                                  
                                                                                                                                        
                                                                                                                                        
end module inf_values_mod  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant