Ping **(5.0/7.0) Mark variables in references for variable definition context as used.
Thomas Koenig <[email protected]> Thu, 18 Jun 2026 18:09:10 +0200
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
Ping? (The false positives are technically regressions. I didn't file a separate PR, though). > what it says in the ChangeLog entry. This fixes a few false positives. > > Regression-tested. OK for trunk? > > Best regards > > Thomas > > Mark variables in references for variable definition context as used. > > Code like "a(i) = 42" would not mark i as used, leading to false > positives for warnings with -Wunused-but-set-variable. This is fixed > in the attached patch. It also removes some default arguments to > make sure that the caller side provides correct information. > > gcc/fortran/ChangeLog: > > PR fortran/30438 > * gfortran.h (gfc_value_set_at): Remove default argument. > (gfc_expr_set_at): Add prototype. > * interface.cc (gfc_compare_actual_formal): Use gfc_expr_set_at. > * intrinsic.cc (mark_args_as_used): Likewise. > * io.cc (resolve_tag): Likewise. > (gfc_resolve_dt): Likewise. > (gfc_resolve_inquire): Likewise. > * resolve.cc (resolve_transfer): Likewise. > (mark_lhs_assignments_set): Likewise. > * symbol.cc (gfc_lvalue_allocated_at): Add comment, fix formatting. > (gfc_expr_set_at): New fuction. > > gcc/testsuite/ChangeLog: > > PR fortran/30438 > * gfortran.dg/warn_unused_but_set_variable_2.f90: New test.