[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 --- Comment #10 from Jerry DeLisle --- Any further thoughts on this?
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 --- Comment #9 from kargl at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #8) > > Comments welcomed! > What problem are you trying to solve? By default, gfortran tries to compile anything that is given to her. Removing GFC_STD_LEGACY from the default setting is simply wrong. The fact that you need to change a number if-conditions from GFC_STD_GNU to (GFC_STD_GNU | GFC_STD_LEGACY) is a clear indication that there is no clear definition of what the two macros mean.
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 --- Comment #8 from Dominique d'Humieres --- Created attachment 45135 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45135&action=edit WIP patch > My next step will be to check that replacing GFC_STD_LEGACY with > GFC_STD_GNU restores the previous behavior. That did not work well. What I have done in the patch is to 'or' GFC_STD_GNU with GFC_STD_LEGACY where appropriate. With the patch I have mostly recovered the behavior without it, except for a few places where 'Legacy' has been replaced with 'GNU'. Comments welcomed!
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 --- Comment #7 from Dominique d'Humieres --- > I have been giving this some thought. After reading our current documentation > for -std= why do we all of a sudden change a policy because the reporter of > 88052 does not like something? Why not just keep the current behavior and use > the allow_std for pr88052 and allow the extension with -std=gnu and default. > Then when user wants more rigorous compliance then use -std=f95, etc. as is > done now. Agreed! However I think it is not a good idea to keep gfc_option.allow_std the same for -std=gnu and std=legacy. This will allow to reject some legacy codes that should be fixed: dangerous extensions, easy to fix ones, ... My list in (weak) priority order is (1) AC-IMPLIED-DO (2) SAVE statement (3) PARAMETER without () (4) REAL array (5) Duplicate .* attribute (6) Label not in the same block (6) Hollerith ...
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 --- Comment #6 from Jerry DeLisle --- (In reply to Dominique d'Humieres from comment #0) > While playing with pr88052 I have found that the value of > compile_options.allow_std passed to libgfortran is the same (4095) when > compiling with -std=gnu or -std=legacy. > I have been giving this some thought. After reading our current documentation for -std= why do we all of a sudden change a policy because the reporter of 88052 does not like something? Why not just keep the current behavior and use the allow_std for pr88052 and allow the extension with -std=gnu and default. Then when user wants more rigorous compliance then use -std=f95, etc. as is done now. This way we dont mess around with all existing behaviors that people are use to. Then for the few cases where we want it we can define a new macro as: #define GFC_LEGACY_ONLY (compile_options.warn_std == 0) and use that in the unique case of pr78351. Just some thoughts to avoid major ripple.
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 --- Comment #5 from kargl at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #3) > With the patch > > --- ../_clean/gcc/fortran/options.c 2018-11-21 09:27:43.0 +0100 > +++ gcc/fortran/options.c 2018-11-25 21:29:39.0 +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 t
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 Jerry DeLisle changed: What|Removed |Added CC||jvdelisle at gcc dot gnu.org --- Comment #4 from Jerry DeLisle --- Also related, how we handle 78351, 87233, 61180, 30929, and 77900. The last one listed I closed because I was not going to fix it. Further evaluation needed.
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 --- Comment #3 from Dominique d'Humieres --- With the patch --- ../_clean/gcc/fortran/options.c 2018-11-21 09:27:43.0 +0100 +++ gcc/fortran/options.c 2018-11-25 21:29:39.0 +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,
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 Dominique d'Humieres changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-11-25 Ever confirmed|0 |1 --- Comment #2 from Dominique d'Humieres --- > Good luck. Thanks! Would something like ... static 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_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; } ... case OPT_std_gnu: set_default_std_flags (false); break; case OPT_std_legacy: set_default_std_flags (true); gfc_option.warn_std = 0; break; make sense?
[Bug fortran/88190] compile_options.allow_std does not allow to distinguish between GFC_STD_GNU and GFC_STD_LEGACY
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88190 kargl at gcc dot gnu.org changed: What|Removed |Added Priority|P3 |P5 CC||kargl at gcc dot gnu.org Severity|normal |enhancement --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #0) > While playing with pr88052 I have found that the value of > compile_options.allow_std passed to libgfortran is the same (4095) when > compiling with -std=gnu or -std=legacy. > > I suspect this is the same at the frontend level. Good luck. ... static void set_default_std_flags (void) { 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_F2018 | GFC_STD_F2018_DEL | GFC_STD_F2018_OBS; gfc_option.warn_std = GFC_STD_F2018_DEL | GFC_STD_F95_DEL | GFC_STD_LEGACY; } ... case OPT_std_gnu: set_default_std_flags (); break; case OPT_std_legacy: set_default_std_flags (); gfc_option.warn_std = 0; break;