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

Compilation failed when using gfortran flag default-real-8 and stdlib #875

Open
cyrilgandon opened this issue Sep 23, 2024 · 0 comments · May be fixed by #876
Open

Compilation failed when using gfortran flag default-real-8 and stdlib #875

cyrilgandon opened this issue Sep 23, 2024 · 0 comments · May be fixed by #876
Labels
bug Something isn't working

Comments

@cyrilgandon
Copy link

cyrilgandon commented Sep 23, 2024

Description

I am trying to compile my program in 64 bits. I use gfortran and the option default-real-8 to compile :

-fdefault-real-8 Set the default real type to an 8 byte wide type.

but got an error:

build\dependencies\stdlib\src\stdlib_specialfunctions_gamma.f90:1175:18:

 1175 |             res = l_gamma(n + 1, 1.0D0)
      |                  1
Error: There is no specific function for the generic 'l_gamma' at (1)

If I believe the error, the function containing this call is

impure elemental function l_factorial_iint64(n) result(res)
    integer(int64), intent(in) :: n

    [...]
    
    res = l_gamma(n + 1, 1.0D0)
end function

So n being int(8) and 1.0D0 being real(8), I think it should find this overload:

impure elemental function l_gamma_iint64dp(z, x) result(res)
    integer(int64), intent(in) :: z
    real(dp), intent(in) :: x

    [...]

end function

But apparently not. Pretty new to Fortran and the kind stuff, I guess I am missing something!

Edit: I extract the code, and the error is more clear:

Type mismatch in argument 'x' at (1); passed REAL(16) to REAL(8)

So I guess default-real-8 is promoting 1.0D0 from REAL(8) to REAL(16)

Expected Behaviour

The stdlib should compile with a default real of size 8.

Version of stdlib

ccdba91

Platform and Architecture

Windows

Additional Information

Also post a question on SO: https://stackoverflow.com/questions/79013476/compilation-failed-when-using-gfortran-flag-default-real-8-and-stdlib

@cyrilgandon cyrilgandon added the bug Something isn't working label Sep 23, 2024
cyrilgandon pushed a commit to cyrilgandon/stdlib that referenced this issue Sep 23, 2024
cyrilgandon pushed a commit to cyrilgandon/stdlib that referenced this issue Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant