On 7/21/26 10:07 AM, Thomas Koenig wrote:
Hello world,
what it says in the ChangeLog. Regression-tested. OK for trunk?
Looks OK Thomas. Thanks for the patch.
Jerry
Best regards
Thomas
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.