On 11/7/18, Jakub Jelinek wrote: > On Wed, Nov 07, 2018 at 03:07:04PM +0000, Mark Eggleston wrote: > >> PR fortran/87919 >> * options.c (gfc_handle_option): Removed case OPT_fdec_structure >> as it breaks the handling of -fno-dec-structure. > > No entries for the tests, i.e. > * gfortran.dg/pr87919-dec-structure-1.f: New test. > * gfortran.dg/pr87919-dec-structure-2.f: New test. > * gfortran.dg/pr87919-dec-structure-3.f: New test. > * gfortran.dg/pr87919-dec-structure-4.f: New test. > >> diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c >> index 73f5389361d9..3b7c2d40fe8a 100644 >> --- a/gcc/fortran/options.c >> +++ b/gcc/fortran/options.c >> @@ -761,10 +761,6 @@ gfc_handle_option (size_t scode, const char *arg, >> HOST_WIDE_INT value, >> /* Enable all DEC extensions. */ >> set_dec_flags (1); >> break; >> - >> - case OPT_fdec_structure: >> - flag_dec_structure = 1; >> - break; >> } >> >> Fortran_handle_option_auto (&global_options, &global_options_set, > > LGTM, but I'll defer the final review to Fortran maintainers. Thanks for the patch Mark, I concur with Jakub that it is correct for what it does. However, I have a few comments in addition to the fixes recommended by Jakub regarding the test cases. First, I would prefer to name these test cases as "dec_structure_*.f" to align with the other (23) -fdec-structure test cases. Second, the third case (*dec-structure-3.f) is unnecessary because it is identical in function to dec_structure_1.f90. I concur with the remaining test cases, as well as Jakub's suggestion to cover "-fdec-structure -fno-dec-structure" with an additional test. I would name the final four (= 4 - 1 + 1) tests as "dec_structure_[24-27].f". I have taken the liberty of extending this patch to cover the remainder of PR 87919. That is, to fix -fno-* for -fno-dec, -fno-check-array-temporaries and -fno-init-local-zero. In the extended patch, the 'value' set for the aforementioned options is no longer ignored, so that value=1 truly means set and value=0 truly means "unset". Previously, the aforementioned flags effectively ignored the value=0 condition. Similarly to the tests Mark provided with -fdec-structure, I've provided new tests for the various facets of -fno-dec, -fno-check-array-temporaries, and -fno-init-local-zero. Below is the changelog. Bootstraps and regtests fine for me on x86_64-redhat-linux. If it looks OK I'll commit to trunk (and probably backport to 8-branch and 7-branch since the affected code appears to be the same for those branches). From 2d9e39bbf4a179ae433f33f4e7039b85078ba72f Mon Sep 17 00:00:00 2001 From: Fritz Reese Date: Wed, 7 Nov 2018 15:13:50 -0500 Subject: [PATCH] PR fortran/87919 Fix handling -fno-* prefix for init-local-zero, check-array-temporaries and dec. gcc/fortran/ * options.c (SET_FLAG, SET_BITFLAG): New macros. (set_dec_flags): Unset DEC flags with value==0. (set_init_local_zero): New helper for -finit-local-zero flag group. (gfc_init_options): Fix disabling of init flags, array temporaries check, and dec flags when value is zero (from -fno-*). gcc/testsuiste/ * gfortran.dg/array_temporaries_5.f90: New test. * gfortran.dg/dec_bitwise_ops_3.f90: Ditto. * gfortran.dg/dec_d_lines_3.f: Ditto. * gfortran.dg/dec_exp_4.f90: Ditto. * gfortran.dg/dec_exp_5.f90: Ditto. * gfortran.dg/dec_io_7.f90: Ditto. * gfortran.dg/dec_structure_24.f: Ditto. * gfortran.dg/dec_structure_25.f: Ditto. * gfortran.dg/dec_structure_26.f: Ditto. * gfortran.dg/dec_structure_27.f: Ditto. * gfortran.dg/dec_type_print_3.f90: Ditto. * gfortran.dg/init_flag_20.f90: Ditto. --- gcc/fortran/options.c | 70 +++++++++++++++-------- gcc/testsuite/gfortran.dg/array_temporaries_5.f90 | 20 +++++++ gcc/testsuite/gfortran.dg/dec_bitwise_ops_3.f90 | 19 ++++++ gcc/testsuite/gfortran.dg/dec_d_lines_3.f | 10 ++++ gcc/testsuite/gfortran.dg/dec_exp_4.f90 | 13 +++++ gcc/testsuite/gfortran.dg/dec_exp_5.f90 | 15 +++++ gcc/testsuite/gfortran.dg/dec_io_7.f90 | 22 +++++++ gcc/testsuite/gfortran.dg/dec_structure_24.f | 21 +++++++ gcc/testsuite/gfortran.dg/dec_structure_25.f | 22 +++++++ gcc/testsuite/gfortran.dg/dec_structure_26.f | 22 +++++++ gcc/testsuite/gfortran.dg/dec_structure_27.f | 20 +++++++ gcc/testsuite/gfortran.dg/dec_type_print_3.f90 | 29 ++++++++++ gcc/testsuite/gfortran.dg/init_flag_20.f90 | 62 ++++++++++++++++++++ 13 files changed, 320 insertions(+), 25 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/array_temporaries_5.f90 create mode 100644 gcc/testsuite/gfortran.dg/dec_bitwise_ops_3.f90 create mode 100644 gcc/testsuite/gfortran.dg/dec_d_lines_3.f create mode 100644 gcc/testsuite/gfortran.dg/dec_exp_4.f90 create mode 100644 gcc/testsuite/gfortran.dg/dec_exp_5.f90 create mode 100644 gcc/testsuite/gfortran.dg/dec_io_7.f90 create mode 100644 gcc/testsuite/gfortran.dg/dec_structure_24.f create mode 100644 gcc/testsuite/gfortran.dg/dec_structure_25.f create mode 100644 gcc/testsuite/gfortran.dg/dec_structure_26.f create mode 100644 gcc/testsuite/gfortran.dg/dec_structure_27.f create mode 100644 gcc/testsuite/gfortran.dg/dec_type_print_3.f90 create mode 100644 gcc/testsuite/gfortran.dg/init_flag_20.f90