Skip to content

unreachable-statement (C191)

This rule is turned on by default.

What it does

Checks for return, exit, cycle, and stop statements that result in unreachable code.

Why is this bad?

Unreachable code can never be executed, and is almost certainly a mistake.

Example

subroutine example(x)
  integer, intent(inout) :: x
  x = x + 1
  return
  print *, x  ! This statement is unreachable
end subroutine example