This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 25 Nov 2018 22:48:58 +0000
- Subject: [Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
- Auto-submitted: auto-generated
- References: <bug-88190-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
With the patch
--- ../_clean/gcc/fortran/options.c 2018-11-21 09:27:43.000000000 +0100
+++ gcc/fortran/options.c 2018-11-25 21:29:39.000000000 +0100
@@ -38,12 +38,14 @@ gfc_option_t gfc_option;
libgfortran/runtime/compile_options.c (init_compile_options). */
static void
-set_default_std_flags (void)
+set_default_std_flags (bool legacy)
{
gfc_option.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003 | GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77
- | GFC_STD_F2008_OBS | GFC_STD_GNU | GFC_STD_LEGACY
+ | GFC_STD_F2008_OBS | GFC_STD_GNU
| GFC_STD_F2018 | GFC_STD_F2018_DEL | GFC_STD_F2018_OBS;
+ if (legacy)
+ gfc_option.allow_std |= GFC_STD_LEGACY;
gfc_option.warn_std = GFC_STD_F2018_DEL | GFC_STD_F95_DEL | GFC_STD_LEGACY;
}
@@ -129,7 +131,7 @@ gfc_init_options (unsigned int decoded_o
set_dec_flags (0);
- set_default_std_flags ();
+ set_default_std_flags (false);
/* Initialize cpp-related options. */
gfc_cpp_init_options (decoded_options_count, decoded_options);
@@ -742,11 +744,11 @@ gfc_handle_option (size_t scode, const c
break;
case OPT_std_gnu:
- set_default_std_flags ();
+ set_default_std_flags (false);
break;
case OPT_std_legacy:
- set_default_std_flags ();
+ set_default_std_flags (true);
gfc_option.warn_std = 0;
break;
I see 683 new failures. Grepping the Fortran code for GFC_STD_LEGACY I get
gcc/fortran/array.c: if (!gfc_notify_std (GFC_STD_LEGACY,
"AC-IMPLIED-DO initial "
gcc/fortran/array.c: if (!gfc_notify_std (GFC_STD_LEGACY,
"AC-IMPLIED-DO final "
gcc/fortran/array.c: if (!gfc_notify_std (GFC_STD_LEGACY,
"AC-IMPLIED-DO step "
gcc/fortran/decl.c: if (!gfc_notify_std (GFC_STD_LEGACY, "PARAMETER
without '()' at %C"))
gcc/fortran/decl.c: if (!gfc_notify_std (GFC_STD_LEGACY, "Blanket SAVE
statement at %C "
gcc/fortran/decl.c: if (!gfc_notify_std (GFC_STD_LEGACY, "SAVE statement
at %C follows "
gcc/fortran/error.c: else if (std & GFC_STD_LEGACY)
gcc/fortran/gfortran.texi:(32), @code{GFC_STD_LEGACY} (64),
@code{GFC_STD_F2008} (128),
gcc/fortran/gfortran.texi:GFC_STD_F2018_OBS | GFC_STD_F2018_DEL | GFC_STD_GNU |
GFC_STD_LEGACY}.
gcc/fortran/gfortran.texi:standard error. Default: @code{GFC_STD_F95_DEL |
GFC_STD_LEGACY}.
gcc/fortran/intrinsic.c: if ((gfc_option.allow_std & GFC_STD_LEGACY) != 0)
gcc/fortran/intrinsic.c: BT_INTEGER,
gfc_integer_kinds[i].kind, GFC_STD_LEGACY);
gcc/fortran/intrinsic.c: BT_REAL, gfc_real_kinds[i].kind,
GFC_STD_LEGACY);
gcc/fortran/intrinsic.c: BT_COMPLEX, gfc_real_kinds[i].kind,
GFC_STD_LEGACY);
gcc/fortran/intrinsic.c: gfc_default_character_kind,
GFC_STD_LEGACY);
gcc/fortran/intrinsic.c: BT_LOGICAL,
gfc_logical_kinds[i].kind, GFC_STD_LEGACY);
gcc/fortran/intrinsic.c: if ((gfc_option.allow_std & GFC_STD_LEGACY) != 0)
gcc/fortran/intrinsic.c: BT_LOGICAL,
gfc_logical_kinds[j].kind, GFC_STD_LEGACY);
gcc/fortran/intrinsic.c: BT_INTEGER,
gfc_integer_kinds[i].kind, GFC_STD_LEGACY);
gcc/fortran/intrinsic.c: case GFC_STD_LEGACY:
gcc/fortran/io.c: /* If rank is nonzero and type is not character, we allow it
under GFC_STD_LEGACY.
gcc/fortran/io.c: if (!gfc_notify_std (GFC_STD_LEGACY, "Non-character in
FORMAT tag "
gcc/fortran/io.c: && !gfc_notify_std (GFC_STD_LEGACY, "Comma before i/o
item list at %L",
gcc/fortran/libgfortran.h:#define GFC_STD_LEGACY (1<<6) /*
Backward compatibility. */
gcc/fortran/match.c: if (!gfc_notify_std (GFC_STD_LEGACY, ".XOR.
operator at %C"))
gcc/fortran/options.c: gfc_option.allow_std |= GFC_STD_LEGACY;
gcc/fortran/options.c: gfc_option.warn_std = GFC_STD_F2018_DEL |
GFC_STD_F95_DEL | GFC_STD_LEGACY;
gcc/fortran/options.c: | GFC_STD_GNU | GFC_STD_LEGACY;
gcc/fortran/options.c: gfc_option.warn_std &= ~(GFC_STD_LEGACY |
GFC_STD_F95_DEL);
gcc/fortran/options.c: if (pedantic && (gfc_option.allow_std & GFC_STD_LEGACY)
!= 0)
gcc/fortran/options.c: gfc_option.warn_std |= GFC_STD_F95_OBS |
GFC_STD_F95_DEL | GFC_STD_LEGACY;
gcc/fortran/primary.c: if (!gfc_notify_std (GFC_STD_LEGACY, "Hollerith
constant at %C"))
gcc/fortran/primary.c: if (!gfc_notify_std (GFC_STD_LEGACY, "%%LOC() as an
rvalue at %C"))
gcc/fortran/resolve.c: || ((gfc_option.warn_std & GFC_STD_LEGACY)
gcc/fortran/resolve.c: if (!gfc_notify_std (GFC_STD_LEGACY, "REAL array
index at %L",
gcc/fortran/resolve.c: gfc_notify_std (GFC_STD_LEGACY, "Label at %L is not in
the same block "
gcc/fortran/symbol.c: if (attr->automatic && !gfc_notify_std (GFC_STD_LEGACY,
gcc/fortran/symbol.c: if (!gfc_notify_std (GFC_STD_LEGACY,
gcc/fortran/symbol.c: if (!gfc_notify_std (GFC_STD_LEGACY,
gcc/fortran/symbol.c: if (!gfc_notify_std (GFC_STD_LEGACY,
gcc/fortran/symbol.c: if (!gfc_notify_std (GFC_STD_LEGACY,
gcc/fortran/symbol.c: if (!gfc_notify_std (GFC_STD_LEGACY,
My next step will be to check that replacing GFC_STD_LEGACY with GFC_STD_GNU
restores the previous behavior.
Meanwhile It will helpful to discuss what we want to keep as GFC_STD_LEGACY,
the failing test being fixed by some { dg-options "-std=legacy -pedantic" }.