Commit c3e799e1 by Fritz Reese Committed by Jakub Jelinek

re PR fortran/87919 (Incorrect fortran handling of -fno-* options)

	PR fortran/87919
	* options.c (SET_FLAG, SET_BITFLAG, SET_BITFLAG2): New macros.
	(set_dec_flags): Set/unset DEC and std flags according to value.
	(post_dec_flags, set_init_local_zero): New functions.
	(gfc_init_options): Use set_init_local_zero and post_dec_flags.
	(gfc_handle_options) <case OPT_fcheck_array_temporaries>: Use
	SET_BITFLAG.
	<case OPT_finit_local_zero>: Use set_init_local_zero.
	<case OPT_fdec>: Pass value to set_dec_flags.
	<case OPT_fdec_structure>: Remove.

Co-Authored-By: Mark Eggleston <mark.eggleston@codethink.co.uk>

From-SVN: r266761
parent e1976443
2018-12-03 Fritz Reese <fritzoreese@gmail.com> 2018-12-03 Fritz Reese <fritzoreese@gmail.com>
Mark Eggleston <mark.eggleston@codethink.co.uk> Mark Eggleston <mark.eggleston@codethink.co.uk>
PR fortran/87919 PR fortran/87919
* options.c (SET_FLAG, SET_BITFLAG, SET_BITFLAG2): New macros. * options.c (SET_FLAG, SET_BITFLAG, SET_BITFLAG2): New macros.
(set_dec_flags): Set/unset DEC and std flags according to value. (set_dec_flags): Set/unset DEC and std flags according to value.
(set_init_local_zero): New helper for -finit-local-zero flag group. (post_dec_flags, set_init_local_zero): New functions.
(gfc_init_options): Fix disabling of init flags, array temporaries (gfc_init_options): Use set_init_local_zero and post_dec_flags.
check, and dec flags when value is zero (from -fno-*). (gfc_handle_options) <case OPT_fcheck_array_temporaries>: Use
SET_BITFLAG.
<case OPT_finit_local_zero>: Use set_init_local_zero.
<case OPT_fdec>: Pass value to set_dec_flags.
<case OPT_fdec_structure>: Remove.
2018-11-30 Thomas Schwinge <thomas@codesourcery.com> 2018-11-30 Thomas Schwinge <thomas@codesourcery.com>
......
...@@ -147,11 +147,7 @@ gfc_init_options (unsigned int decoded_options_count, ...@@ -147,11 +147,7 @@ gfc_init_options (unsigned int decoded_options_count,
gfc_option.flag_preprocessed = 0; gfc_option.flag_preprocessed = 0;
gfc_option.flag_d_lines = -1; gfc_option.flag_d_lines = -1;
gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF; set_init_local_zero (0);
gfc_option.flag_init_integer_value = 0;
gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF;
gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
gfc_option.flag_init_character_value = (char)0;
gfc_option.fpe = 0; gfc_option.fpe = 0;
/* All except GFC_FPE_INEXACT. */ /* All except GFC_FPE_INEXACT. */
...@@ -261,6 +257,9 @@ gfc_post_options (const char **pfilename) ...@@ -261,6 +257,9 @@ gfc_post_options (const char **pfilename)
char *source_path; char *source_path;
int i; int i;
/* Finalize DEC flags. */
post_dec_flags (flag_dec);
/* Excess precision other than "fast" requires front-end /* Excess precision other than "fast" requires front-end
support. */ support. */
if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD) if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD)
...@@ -644,7 +643,7 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, ...@@ -644,7 +643,7 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
break; break;
case OPT_fcheck_array_temporaries: case OPT_fcheck_array_temporaries:
gfc_option.rtcheck |= GFC_RTCHECK_ARRAY_TEMPS; SET_BITFLAG (gfc_option.rtcheck, value, GFC_RTCHECK_ARRAY_TEMPS);
break; break;
case OPT_fd_lines_as_code: case OPT_fd_lines_as_code:
...@@ -694,12 +693,7 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, ...@@ -694,12 +693,7 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
break; break;
case OPT_finit_local_zero: case OPT_finit_local_zero:
gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON; set_init_local_zero (value);
gfc_option.flag_init_integer_value = 0;
flag_init_real = GFC_INIT_REAL_ZERO;
gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
gfc_option.flag_init_character_value = (char)0;
break; break;
case OPT_finit_logical_: case OPT_finit_logical_:
...@@ -798,12 +792,8 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, ...@@ -798,12 +792,8 @@ gfc_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
break; break;
case OPT_fdec: case OPT_fdec:
/* Enable all DEC extensions. */ /* Set (or unset) the DEC extension flags. */
set_dec_flags (1); set_dec_flags (value);
break;
case OPT_fdec_structure:
flag_dec_structure = 1;
break; break;
} }
...@@ -895,3 +885,7 @@ gfc_get_option_string (void) ...@@ -895,3 +885,7 @@ gfc_get_option_string (void)
result[--pos] = '\0'; result[--pos] = '\0';
return result; return result;
} }
#undef SET_BITFLAG
#undef SET_BITFLAG2
#undef SET_FLAG
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment