summaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-28 14:17:41 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-28 14:17:41 +0000
commitd566c3e0d4beed1e365c732eab16c7b3c7af7df3 (patch)
treee7bff5fef45c93b6d9ac36021ec9edaa569bf861 /gcc/fortran/module.c
parent793e8f94783e037e44e3642624e9f04c6c442a39 (diff)
downloadgcc-d566c3e0d4beed1e365c732eab16c7b3c7af7df3.tar.gz
PR fortran/29383
gcc/fortran/ * gfortran.h (gfc_simplify_ieee_selected_real_kind): New prototype. * libgfortran.h (GFC_FPE_*): Use simple integer values, valid in both C and Fortran. * expr.c (gfc_check_init_expr): Simplify IEEE_SELECTED_REAL_KIND. * simplify.c (gfc_simplify_ieee_selected_real_kind): New function. * module.c (mio_symbol): Keep track of symbols which came from intrinsic modules. (gfc_use_module): Keep track of the IEEE modules. * trans-decl.c (gfc_get_symbol_decl): Adjust code since we have new intrinsic modules. (gfc_build_builtin_function_decls): Build decls for ieee_procedure_entry and ieee_procedure_exit. (is_from_ieee_module, is_ieee_module_used, save_fp_state, restore_fp_state): New functions. (gfc_generate_function_code): Save and restore floating-point state on procedure entry/exit, when IEEE modules are used. * intrinsic.texi: Document the IEEE modules. libgfortran/ * configure.host: Add checks for IEEE support, rework priorities. * configure.ac: Define IEEE_SUPPORT, check for fpsetsticky and fpresetsticky. * configure: Regenerate. * Makefile.am: Build new ieee files, install IEEE_* modules. * Makefile.in: Regenerate. * gfortran.map (GFORTRAN_1.6): Add new symbols. * libgfortran.h (get_fpu_trap_exceptions, set_fpu_trap_exceptions, support_fpu_trap, set_fpu_except_flags, support_fpu_flag, support_fpu_rounding_mode, get_fpu_state, set_fpu_state): New prototypes. * config/fpu-*.h (get_fpu_trap_exceptions, set_fpu_trap_exceptions, support_fpu_trap, set_fpu_except_flags, support_fpu_flag, support_fpu_rounding_mode, get_fpu_state, set_fpu_state): New functions. * ieee/ieee_features.F90: New file. * ieee/ieee_exceptions.F90: New file. * ieee/ieee_arithmetic.F90: New file. * ieee/ieee_helper.c: New file. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fortran_ieee): New function. * gfortran.dg/ieee/ieee.exp: New file. * gfortran.dg/ieee/ieee_1.F90: New file. * gfortran.dg/ieee/ieee_2.f90: New file. * gfortran.dg/ieee/ieee_3.f90: New file. * gfortran.dg/ieee/ieee_4.f90: New file. * gfortran.dg/ieee/ieee_5.f90: New file. * gfortran.dg/ieee/ieee_6.f90: New file. * gfortran.dg/ieee/ieee_7.f90: New file. * gfortran.dg/ieee/ieee_rounding_1.f90: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212102 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index ec67960eae9..bd7da1c37df 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -190,6 +190,9 @@ static gzFile module_fp;
static const char *module_name;
static gfc_use_list *module_list;
+/* If we're reading an intrinsic module, this is its ID. */
+static intmod_id current_intmod;
+
/* Content of module. */
static char* module_content;
@@ -4096,7 +4099,10 @@ mio_symbol (gfc_symbol *sym)
else
{
mio_integer (&intmod);
- sym->from_intmod = (intmod_id) intmod;
+ if (current_intmod)
+ sym->from_intmod = current_intmod;
+ else
+ sym->from_intmod = (intmod_id) intmod;
}
mio_integer (&(sym->intmod_sym_id));
@@ -6733,6 +6739,7 @@ gfc_use_module (gfc_use_list *module)
module_name = module->module_name;
gfc_rename_list = module->rename;
only_flag = module->only_flag;
+ current_intmod = INTMOD_NONE;
filename = XALLOCAVEC (char, strlen (module_name) + strlen (MODULE_EXTENSION)
+ 1);
@@ -6777,6 +6784,26 @@ gfc_use_module (gfc_use_list *module)
if (module_fp == NULL && module->intrinsic)
gfc_fatal_error ("Can't find an intrinsic module named '%s' at %C",
module_name);
+
+ /* Check for the IEEE modules, so we can mark their symbols
+ accordingly when we read them. */
+ if (strcmp (module_name, "ieee_features") == 0
+ && gfc_notify_std (GFC_STD_F2003, "IEEE_FEATURES module at %C"))
+ {
+ current_intmod = INTMOD_IEEE_FEATURES;
+ }
+ else if (strcmp (module_name, "ieee_exceptions") == 0
+ && gfc_notify_std (GFC_STD_F2003,
+ "IEEE_EXCEPTIONS module at %C"))
+ {
+ current_intmod = INTMOD_IEEE_EXCEPTIONS;
+ }
+ else if (strcmp (module_name, "ieee_arithmetic") == 0
+ && gfc_notify_std (GFC_STD_F2003,
+ "IEEE_ARITHMETIC module at %C"))
+ {
+ current_intmod = INTMOD_IEEE_ARITHMETIC;
+ }
}
if (module_fp == NULL)