re PR libfortran/25425 ([4.1 only] F95 and F2003 differ on list-directed output for 0.0)

	PR libfortran/25425

	* trans-decl.c (gfc_generate_function_code): Add new argument,
	pedantic, to set_std call.

	* libgfortran.h: Add pedantic field to compile_options struct.
	* io/write.c (calculate_G_format): Depending on the standard,
	choose E or F format for list-directed output of 0.0.
	* runtime/error.c (notify_std): Make warning and error dependent
	on pedanticity.
	* runtime/compile_options.c (set_std): Use new pedantic argument.

From-SVN: r110769
parent 2cf94e58
2006-02-08 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/25425
* trans-decl.c (gfc_generate_function_code): Add new argument,
pedantic, to set_std call.
2005-02-06 Thomas Koenig <Thomas.Koenig@online.de> 2005-02-06 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/23815 PR libfortran/23815
......
...@@ -2226,7 +2226,8 @@ gfc_build_builtin_function_decls (void) ...@@ -2226,7 +2226,8 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_set_std = gfor_fndecl_set_std =
gfc_build_library_function_decl (get_identifier (PREFIX("set_std")), gfc_build_library_function_decl (get_identifier (PREFIX("set_std")),
void_type_node, void_type_node,
2, 3,
gfc_int4_type_node,
gfc_int4_type_node, gfc_int4_type_node,
gfc_int4_type_node); gfc_int4_type_node);
...@@ -2817,10 +2818,10 @@ gfc_generate_function_code (gfc_namespace * ns) ...@@ -2817,10 +2818,10 @@ gfc_generate_function_code (gfc_namespace * ns)
/* Now generate the code for the body of this function. */ /* Now generate the code for the body of this function. */
gfc_init_block (&body); gfc_init_block (&body);
/* If this is the main program and we compile with -pedantic, add a call /* If this is the main program, add a call to set_std to set up the
to set_std to set up the runtime library Fortran language standard runtime library Fortran language standard parameters. */
parameters. */
if (sym->attr.is_main_program && pedantic) if (sym->attr.is_main_program)
{ {
tree arglist, gfc_int4_type_node; tree arglist, gfc_int4_type_node;
...@@ -2831,6 +2832,9 @@ gfc_generate_function_code (gfc_namespace * ns) ...@@ -2831,6 +2832,9 @@ gfc_generate_function_code (gfc_namespace * ns)
arglist = gfc_chainon_list (arglist, arglist = gfc_chainon_list (arglist,
build_int_cst (gfc_int4_type_node, build_int_cst (gfc_int4_type_node,
gfc_option.allow_std)); gfc_option.allow_std));
arglist = gfc_chainon_list (arglist,
build_int_cst (gfc_int4_type_node,
pedantic));
tmp = build_function_call_expr (gfor_fndecl_set_std, arglist); tmp = build_function_call_expr (gfor_fndecl_set_std, arglist);
gfc_add_expr_to_block (&body, tmp); gfc_add_expr_to_block (&body, tmp);
} }
......
2006-02-08 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/25425
* libgfortran.h: Add pedantic field to compile_options struct.
* io/write.c (calculate_G_format): Depending on the standard,
choose E or F format for list-directed output of 0.0.
* runtime/error.c (notify_std): Make warning and error dependent
on pedanticity.
* runtime/compile_options.c (set_std): Use new pedantic argument.
2006-02-07 Dale Ranta <dir@lanl.gov> 2006-02-07 Dale Ranta <dir@lanl.gov>
PR fortran/25577 PR fortran/25577
...@@ -6,8 +16,8 @@ ...@@ -6,8 +16,8 @@
2006-02-07 Rainer Emrich <r.emrich@de.tecosim.com> 2006-02-07 Rainer Emrich <r.emrich@de.tecosim.com>
* intrinsics/c99_functions.c: Work around incompatible * intrinsics/c99_functions.c: Work around incompatible
declarations of cabs{,f,l} on pre-C99 IRIX systems. declarations of cabs{,f,l} on pre-C99 IRIX systems.
2005-02-06 Thomas Koenig <Thomas.Koenig@online.de> 2005-02-06 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/23815 PR libfortran/23815
......
...@@ -302,7 +302,8 @@ calculate_G_format (st_parameter_dt *dtp, const fnode *f, ...@@ -302,7 +302,8 @@ calculate_G_format (st_parameter_dt *dtp, const fnode *f,
/* In case of the two data magnitude ranges, /* In case of the two data magnitude ranges,
generate E editing, Ew.d[Ee]. */ generate E editing, Ew.d[Ee]. */
exp_d = calculate_exp (d); exp_d = calculate_exp (d);
if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 )) if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 ) ||
((m == 0.0) && !(compile_options.allow_std & GFC_STD_F2003)))
{ {
newf->format = FMT_E; newf->format = FMT_E;
newf->u.real.w = w; newf->u.real.w = w;
......
...@@ -336,6 +336,7 @@ typedef struct ...@@ -336,6 +336,7 @@ typedef struct
{ {
int warn_std; int warn_std;
int allow_std; int allow_std;
int pedantic;
int convert; int convert;
} }
compile_options_t; compile_options_t;
......
...@@ -37,13 +37,15 @@ compile_options_t compile_options; ...@@ -37,13 +37,15 @@ compile_options_t compile_options;
/* Prototypes */ /* Prototypes */
extern void set_std (GFC_INTEGER_4, GFC_INTEGER_4); extern void set_std (GFC_INTEGER_4, GFC_INTEGER_4, GFC_INTEGER_4);
export_proto(set_std); export_proto(set_std);
void void
set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std) set_std (GFC_INTEGER_4 warn_std, GFC_INTEGER_4 allow_std,
GFC_INTEGER_4 pedantic)
{ {
compile_options.pedantic = pedantic;
compile_options.warn_std = warn_std; compile_options.warn_std = warn_std;
compile_options.allow_std = allow_std; compile_options.allow_std = allow_std;
} }
...@@ -58,6 +60,7 @@ init_compile_options (void) ...@@ -58,6 +60,7 @@ init_compile_options (void)
| GFC_STD_F2003 | GFC_STD_LEGACY; | GFC_STD_F2003 | GFC_STD_LEGACY;
compile_options.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL compile_options.allow_std = GFC_STD_F95_OBS | GFC_STD_F95_DEL
| GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY; | GFC_STD_F2003 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY;
compile_options.pedantic = 0;
} }
/* Function called by the front-end to tell us the /* Function called by the front-end to tell us the
......
/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
Contributed by Andy Vaught Contributed by Andy Vaught
This file is part of the GNU Fortran 95 runtime library (libgfortran). This file is part of the GNU Fortran 95 runtime library (libgfortran).
...@@ -508,6 +508,9 @@ notify_std (int std, const char * message) ...@@ -508,6 +508,9 @@ notify_std (int std, const char * message)
{ {
int warning; int warning;
if (!compile_options.pedantic)
return SUCCESS;
warning = compile_options.warn_std & std; warning = compile_options.warn_std & std;
if ((compile_options.allow_std & std) != 0 && !warning) if ((compile_options.allow_std & std) != 0 && !warning)
return SUCCESS; return SUCCESS;
......
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