https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126530
Bug ID: 126530
Summary: Option -Wundefined-vars doesn't catch functions
returning without defining their result
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: mikael at gcc dot gnu.org
Target Milestone: ---
In the example below, the compiler could warn for every function except `i1'
and `i2'. But -Wundefined-vars catches nothing here.
module m
implicit none
contains
function f1()
integer :: f1
end function
function f2() result(r)
integer :: r
end function
function g1()
integer, allocatable :: g1
end function
function g2() result(r)
integer, allocatable :: r
end function
function h1()
integer, allocatable :: h1
allocate(h1)
end function
function h2() result(r)
integer, allocatable :: r
allocate(r)
end function
! No warning expected for this one
function i1()
integer, allocatable :: i1
allocate(i1)
i1 = 2
end function
! No warning expected for this one
function i2() result(r)
integer, allocatable :: r
allocate(r)
r = 2
end function
function j1()
integer, pointer :: j1
end function
function j2() result(r)
integer, pointer :: r
end function
function k1()
integer, pointer :: k1
allocate(k1)
end function
function k2() result(r)
integer, pointer :: r
allocate(r)
end function
end module