https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126333
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Thomas Koenig <[email protected]>: https://gcc.gnu.org/g:ea991f752fc2a65a887c64190d8cad415edac8c9 commit r17-2596-gea991f752fc2a65a887c64190d8cad415edac8c9 Author: Thomas Koenig <[email protected]> Date: Tue Jul 21 19:04:48 2026 +0200 Fix a few false positive warnings with unused/undefined warnings. Trying out the new warnings on actual code found a new false positives. The charlen of an ALLOCATE was not marked as used, the expression in SELECT CASE was not marked as used and host-associated variables were not exempt from testing. All fixed with the attached patch. gcc/fortran/ChangeLog: PR fortran/126333 * resolve.cc (resolve_allocate_deallocate): Resolve charlen of ts and set as used if present. (resolve_select): Mark code->expr1 as used. (find_unused_vs_set): Do not complain about host-associated variables which are not marked private. gcc/testsuite/ChangeLog: PR fortran/126333 * gfortran.dg/warn_undefined_vars_8.f90: New test. * gfortran.dg/warn_undefined_vars_9.f90: New test. * gfortran.dg/warn_unused_but_set_variable_5.f90: New test.
