Re: [patch, fortran] Iplement warning based on variable definition and use

Thomas Koenig <[email protected]> Thu, 11 Jun 2026 21:14:13 +0200
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Hello Paul,

> I waded through the patch and couldn't see anything objectionable. On
> applying to mainline, I saw:
> /home/pault/Downloads/p11b.diff:1034: trailing whitespace.
> /home/pault/Downloads/p11b.diff:1042: trailing whitespace.
> /home/pault/Downloads/p11b.diff:1084: trailing whitespace
> /home/pault/Downloads/p11b.diff:1104: trailing whitespace.
> /home/pault/Downloads/p11b.diff:1117: trailing whitespace.
> warning: squelched 1 whitespace error

I removed this. "git diff" has the habit of showing trailing whitespace
in bright red.

> git apply --verbose did not enlighten me as to where that last came
> from but the trailing whitespace is definitely there.
> Apart from these signals, the patch applies cleanly. It also passes
> regression testing on a fresh mainline.
> 
> Going through the new tests with -Wall, rather than the specific option:
> warn_undefined_vars_[1-4].f90 produce the new warning plu a plethora
> of unused variable warnings (of course!).
> warn_unused_but_set_1.f90 does not produce the new warning
> warn_unused_intent_out_1.f90 ditto
> warn_unused_read_1.f90 ditto
> Is it worth triggering the last three on -Wall?
> 
> OK for mainline. Do you have any thoughts about backporting?

Thanks for the review!

I have committed this as 
https://gcc.gnu.org/g:9d868e49122b4ce45cffa4d3f47f6ef371e80a24 .

Backporting - this introduces new options, probably not.


> Does this improve gfortran's score on the Polyhedron diagnostic tests?

An interesting question - I haven't looked (yet).  But at least it will
complain when people use IOSTAT and never look at it :-)

Now, let's see if there is any falloout :-)

Best regards

	Thomas