I'm emitting a false warning "used without definition" warning for variable cited in an inquiry intrinsic (e.g. LBOUND), and failing to emit an "unused local" warning for allocatables that only appear in ALLOCATE statements. This patch makes the analysis more context-aware by rewriting it in terms of typed expression traversal, and moves the analysis part into Evaluate/check-expression.cpp from Semantics/expression.cpp.
7 lines
199 B
Fortran
7 lines
199 B
Fortran
!RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic -Werror
|
|
!WARNING: Value of local variable 'x' is never used [-Wunused-variable]
|
|
real, allocatable:: x(:)
|
|
allocate(x(1))
|
|
print *, lbound(x)
|
|
end
|