https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87459

            Bug ID: 87459
           Summary: -Wunused-variable: False positive for associated
                    variables
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.diehl at mpie dot de
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Warning messages about unused variables (-Wunused-variable) appear wrongly when
associate is used (false positive):

pprogram test

  implicit none
  real :: a = 5
  real :: b

  associate(b => a)
    write(6,*) b
  end associate

end program


gives

Warning: Unused variable ‘b’ declared at (1) [-Wunused-variable]

when complied with -Wunused-variable

Reply via email to