Hi Andre,
Am 03.03.25 um 10:08 schrieb Andre Vehreschild:
Hi Harald,
in +++ b/gcc/fortran/symbol.cc
@@ -4624,12 +4624,28 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym)
there is
+ else if (!pedantic)
+ gfc_warning (0, "Derive ...
To me the "not pedantic" is counter-intuitive. In pedantic mode I would have
expected this to be at least a warning (if not an error). Why is it not flagged
at all? May be I expect something wrong from "pedantic".
it is actually flagged, but one would get the warning *twice*
without the above. The reason is the following in gfc_post_options:
/* If -pedantic, warn about the use of GNU extensions. */
if (pedantic && (gfc_option.allow_std & GFC_STD_GNU) != 0)
gfc_option.warn_std |= GFC_STD_GNU;
/* -std=legacy -pedantic is effectively -std=gnu. */
if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY) != 0)
gfc_option.warn_std |= GFC_STD_F95_OBS | GFC_STD_F95_DEL |
GFC_STD_LEGACY;
Therefore gfc_notify_std always warns for -std=gnu and -std=legacy
when -pedantic is given, unless it generates an error.
I've added a comment and pushed as r15-7798-gf9f16b9f74b767 .
Thanks for the review!
Harald
Besides that: Looks good to me.
Regards,
Andre
On Sun, 2 Mar 2025 22:35:47 +0100
Harald Anlauf <anl...@gmx.de> wrote:
Dear all,
due to an oversight in the Fortran standard before 2018,
empty derived types with bind(C) attribute were explicitly
(deliberately?) accepted by gfortran, giving a warning that
the companion processor might not provide an interoperating
entity.
In the PR, Tobias pointed to a discussion on the J3 ML that
there was a defect in older standards. The attached patch
now generates an error when -std=f20xx is specified, and
continues to generate a warning otherwise.
Regtested on x86_64-pc-linux-gnu. OK for mainline?
Thanks,
Harald
--
Andre Vehreschild * Email: vehre ad gmx dot de