Skip to content

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

Closed
@cyrilgandon

Description

@cyrilgandon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions