This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

logical (c_bool) function with bind (c)


[try again in plain text]

Dear GFortran Developers,

I came across an compiler error at -O0 for a BIND (C) function
that returns a logical (c_bool). At -O1 the compilation passes.
Is this something known/fixed?

Thank you for great software you are making!

Alexei


$ gfortran -O1 -c p.f90

$ gfortran -O0 -c p.f90
p.f90: In function ‘test’:
p.f90:15:0: error: non-trivial conversion in unary operation
logical(kind=4)
logical(kind=1)
D.1856 = ~D.1855;

p.f90:15: confused by earlier errors, bailing out

$ gfortran --version
GNU Fortran (Debian 4.7.2-5) 4.7.2
...

$ cat p.f90
module bug_O0

interface
function get (ctx, p) result (ok) bind (c)
use iso_c_binding, only: c_ptr, c_int, c_bool
implicit none
type (c_ptr), intent (in), value :: ctx
integer (c_int), intent (out) :: p
logical (c_bool) :: ok
end function get
end interface

contains

subroutine test (ctx)
use iso_c_binding, only: c_ptr, ik => c_int
implicit none
type (c_ptr), intent (in) :: ctx
! *** end of interface ***

integer (ik) :: p

do while (get (ctx, p))
end do
end subroutine test

end module bug_O0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]