[PATCH] Fortran: fix warnings for symbols with C binding and declared PRIVATE [PR49111]

Jerry D jvdelisle2@gmail.com
Tue Oct 7 20:24:45 GMT 2025


On 10/7/25 1:13 PM, Harald Anlauf wrote:
> Dear All,
> 
> the attached patch addresses a rather old (> 14 years) issue.
> We generated warnings for standard conforming code, where a symbol
> was given a bind(c) attribute and at the same time declared PRIVATE.
> 
> I checked a bunch of compilers, and none gave warnings, except for
> NAG, which did warn, but only if the binding name were the same as
> the default name.
> 
> I considered this to be a good solution, and decided to "hide" the
> warning behind -Wsurprising (contained in -Wall).
> 
> What do others think?
> 
> Attached has been regtested on x86_64-pc-linux-gnu.  OK for mainline?
> 
> Thanks,
> Harald
> 

I think your approach is very reasonable. It gets rid of noise that users do not 
need, very OK by me.

Jerry


More information about the Fortran mailing list