Ping **(5.0/7.0) Mark variables in references for variable definition context as used.
Jerry D
jvdelisle2@gmail.com
Thu Jun 18 16:32:31 GMT 2026
On 6/18/26 9:09 AM, Thomas Koenig wrote:
> 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?
Yes, looks good Thomas. Thanks
Jerry
>>
>> 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.
>
More information about the Fortran
mailing list