From 40474135d8d7cc3275852d7ed5200e1993c362ad Mon Sep 17 00:00:00 2001 From: burnus Date: Thu, 9 Jul 2009 09:42:34 +0000 Subject: 2009-07-09 Tobias Burnus PR fortran/40604 * intrinsic.c (gfc_convert_type_warn): Set sym->result. * trans-expr.c (gfc_conv_procedure_call): Fix -fcheck=pointer for optional arguments. 2009-07-09 Tobias Burnus PR fortran/40604 * gfortran.dg/pointer_check_6.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149405 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 7bb10ec245b..9402234b034 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -3994,6 +3994,7 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag) new_expr->shape = gfc_copy_shape (shape, rank); gfc_get_ha_sym_tree (sym->name, &new_expr->symtree); + new_expr->symtree->n.sym->result = new_expr->symtree->n.sym; new_expr->symtree->n.sym->ts = *ts; new_expr->symtree->n.sym->attr.flavor = FL_PROCEDURE; new_expr->symtree->n.sym->attr.function = 1; -- cgit v1.2.1 From 4ca842c83eaf39fd6d1a3764471e8ce510ecbb1d Mon Sep 17 00:00:00 2001 From: burnus Date: Sat, 11 Jul 2009 00:03:07 +0000 Subject: 2009-07-09 Tobias Burnus PR fortran/33197 * check.c (gfc_check_fn_rc2008): New function. * intrinsic.h (gfc_check_fn_rc2008): New prototype. * intrinsic.c (add_functions): Add complex tan, cosh, sinh, and tanh. 2009-07-09 Tobias Burnus PR fortran/33197 * gfortran.dg/complex_intrinsic_3.f90: New test. * gfortran.dg/complex_intrinsic_4.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149503 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 9402234b034..a918ddf7d23 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1440,7 +1440,7 @@ add_functions (void) make_generic ("cos", GFC_ISYM_COS, GFC_STD_F77); add_sym_1 ("cosh", GFC_ISYM_COSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77, - gfc_check_fn_r, gfc_simplify_cosh, gfc_resolve_cosh, + gfc_check_fn_rc2008, gfc_simplify_cosh, gfc_resolve_cosh, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dcosh", GFC_ISYM_COSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77, @@ -2405,7 +2405,7 @@ add_functions (void) make_generic ("sin", GFC_ISYM_SIN, GFC_STD_F77); add_sym_1 ("sinh", GFC_ISYM_SINH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77, - gfc_check_fn_r, gfc_simplify_sinh, gfc_resolve_sinh, + gfc_check_fn_rc2008, gfc_simplify_sinh, gfc_resolve_sinh, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dsinh", GFC_ISYM_SINH,CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77, @@ -2488,7 +2488,7 @@ add_functions (void) make_generic ("system", GFC_ISYM_SYSTEM, GFC_STD_GNU); add_sym_1 ("tan", GFC_ISYM_TAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77, - gfc_check_fn_r, gfc_simplify_tan, gfc_resolve_tan, + gfc_check_fn_rc2008, gfc_simplify_tan, gfc_resolve_tan, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dtan", GFC_ISYM_TAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77, @@ -2498,7 +2498,7 @@ add_functions (void) make_generic ("tan", GFC_ISYM_TAN, GFC_STD_F77); add_sym_1 ("tanh", GFC_ISYM_TANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77, - gfc_check_fn_r, gfc_simplify_tanh, gfc_resolve_tanh, + gfc_check_fn_rc2008, gfc_simplify_tanh, gfc_resolve_tanh, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dtanh", GFC_ISYM_TANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77, -- cgit v1.2.1 From 6f4274f96edf36ee6fc7721f3d048aeead46cc5c Mon Sep 17 00:00:00 2001 From: burnus Date: Sat, 25 Jul 2009 19:39:07 +0000 Subject: 2009-07-25 Tobias Burnus Francois-Xavier Coudert PR fortran/33197 * intrinsic.c (add_functions): Support complex arguments for acos,acosh,asin,asinh,atan,atanh. * invoke.texi (ACOS,ACOSH,ASIN,ASINH,ATAN,ATANH): Support complex arguments. * simplify.c (gfc_simplify_acos,gfc_simplify_acosh, gfc_simplify_asin,gfc_simplify_asinh,gfc_simplify_atan, gfc_simplify_atanh,gfc_simplify_atan,gfc_simplify_asinh, gfc_simplify_acosh,gfc_simplify_atanh): Support complex arguments. 2009-07-25 Tobias Burnus PR fortran/33197 * intrinsics/c99_functions.c (cacosf,cacos,cacosl,casinf, casin,casind,catanf,catan,catanl,cacoshf,cacosh,cacoshl, casinhf,casinh,casinhf,catanhf,catanh,catanhl): New functions. * c99_protos.h: Add prototypes for those. 2009-07-25 Tobias Burnus PR fortran/33197 * gfortran.dg/complex_intrinsic_5.f90: New test. * gfortran.dg/complex_intrinsic_7.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150087 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index a918ddf7d23..0b2d1b8c8db 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1134,7 +1134,7 @@ add_functions (void) make_generic ("achar", GFC_ISYM_ACHAR, GFC_STD_F95); add_sym_1 ("acos", GFC_ISYM_ACOS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77, - gfc_check_fn_r, gfc_simplify_acos, gfc_resolve_acos, + gfc_check_fn_rc2008, gfc_simplify_acos, gfc_resolve_acos, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dacos", GFC_ISYM_ACOS, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77, @@ -1144,7 +1144,7 @@ add_functions (void) make_generic ("acos", GFC_ISYM_ACOS, GFC_STD_F77); add_sym_1 ("acosh", GFC_ISYM_ACOSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, - GFC_STD_F2008, gfc_check_fn_r, gfc_simplify_acosh, + GFC_STD_F2008, gfc_check_fn_rc2008, gfc_simplify_acosh, gfc_resolve_acosh, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dacosh", GFC_ISYM_ACOSH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU, @@ -1217,7 +1217,7 @@ add_functions (void) make_generic ("any", GFC_ISYM_ANY, GFC_STD_F95); add_sym_1 ("asin", GFC_ISYM_ASIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77, - gfc_check_fn_r, gfc_simplify_asin, gfc_resolve_asin, + gfc_check_fn_rc2008, gfc_simplify_asin, gfc_resolve_asin, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dasin", GFC_ISYM_ASIN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77, @@ -1227,7 +1227,7 @@ add_functions (void) make_generic ("asin", GFC_ISYM_ASIN, GFC_STD_F77); add_sym_1 ("asinh", GFC_ISYM_ASINH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, - GFC_STD_F2008, gfc_check_fn_r, gfc_simplify_asinh, + GFC_STD_F2008, gfc_check_fn_rc2008, gfc_simplify_asinh, gfc_resolve_asinh, x, BT_REAL, dr, REQUIRED); add_sym_1 ("dasinh", GFC_ISYM_ASINH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU, @@ -1243,7 +1243,7 @@ add_functions (void) make_generic ("associated", GFC_ISYM_ASSOCIATED, GFC_STD_F95); add_sym_1 ("atan", GFC_ISYM_ATAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F77, - gfc_check_fn_r, gfc_simplify_atan, gfc_resolve_atan, + gfc_check_fn_rc2008, gfc_simplify_atan, gfc_resolve_atan, x, BT_REAL, dr, REQUIRED); add_sym_1 ("datan", GFC_ISYM_ATAN, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_F77, @@ -1253,7 +1253,7 @@ add_functions (void) make_generic ("atan", GFC_ISYM_ATAN, GFC_STD_F77); add_sym_1 ("atanh", GFC_ISYM_ATANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, - GFC_STD_F2008, gfc_check_fn_r, gfc_simplify_atanh, + GFC_STD_F2008, gfc_check_fn_rc2008, gfc_simplify_atanh, gfc_resolve_atanh, x, BT_REAL, dr, REQUIRED); add_sym_1 ("datanh", GFC_ISYM_ATANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dd, GFC_STD_GNU, -- cgit v1.2.1 From 1b25477b41ad226112d46626a26d189b837d3d83 Mon Sep 17 00:00:00 2001 From: burnus Date: Sun, 26 Jul 2009 17:25:56 +0000 Subject: 2009-07-26 Tobias Burnus PR fortran/33197 * intrinsic.c (make_generic): Remove assert as "atan" can be both ISYM_ATAN and ISYM_ATAN2. (add_functions): Add two-argument variant of ATAN. * intrinsic.h (gfc_check_atan_2): Add check for it. * intrinsic.texi (ATAN2): Correct and enhance description. (ATAN): Describe two-argument variant of ATAN. 2009-07-26 Tobias Burnus PR fortran/33197 * gfortran.dg/atan2_1.f90: New test * gfortran.dg/atan2_2.f90: New test git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 0b2d1b8c8db..d2cdb591888 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1008,8 +1008,6 @@ make_generic (const char *name, gfc_isym_id id, int standard ATTRIBUTE_UNUSED) while (g->name != NULL) { - gcc_assert (g->id == id); - g->next = g + 1; g->specific = 1; g++; @@ -1250,6 +1248,11 @@ add_functions (void) gfc_check_fn_d, gfc_simplify_atan, gfc_resolve_atan, x, BT_REAL, dd, REQUIRED); + /* Two-argument version of atan, equivalent to atan2. */ + add_sym_2 ("atan", GFC_ISYM_ATAN2, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, GFC_STD_F2008, + gfc_check_atan_2, gfc_simplify_atan2, gfc_resolve_atan2, + y, BT_REAL, dr, REQUIRED, x, BT_REAL, dr, REQUIRED); + make_generic ("atan", GFC_ISYM_ATAN, GFC_STD_F77); add_sym_1 ("atanh", GFC_ISYM_ATANH, CLASS_ELEMENTAL, ACTUAL_YES, BT_REAL, dr, -- cgit v1.2.1 From 1de1b1a9e40b5aa064d5e3d032dd43ce14f6d2ad Mon Sep 17 00:00:00 2001 From: burnus Date: Wed, 30 Sep 2009 19:55:45 +0000 Subject: fortran/ 2009-09-30 Janus Weil * check.c (gfc_check_same_type_as): New function for checking SAME_TYPE_AS and EXTENDS_TYPE_OF. * decl.c (encapsulate_class_symbol): Set ABSTRACT attribute for class container, if the contained type has it. Add an initializer for the class container. (add_init_expr_to_sym): Handle BT_CLASS. (vindex_counter): New counter for setting vindices. (gfc_match_derived_decl): Set vindex for all derived types, not only those which are being extended. * expr.c (gfc_check_assign_symbol): Handle NULL initialization of class pointers. * gfortran.h (gfc_isym_id): New values GFC_ISYM_SAME_TYPE_AS and GFC_ISYM_EXTENDS_TYPE_OF. (gfc_type_is_extensible): New prototype. * intrinsic.h (gfc_check_same_type_as): New prototype. * intrinsic.c (add_functions): Add SAME_TYPE_AS and EXTENDS_TYPE_OF. * primary.c (gfc_expr_attr): Handle CLASS-valued functions. * resolve.c (resolve_structure_cons): Handle BT_CLASS. (type_is_extensible): Make non-static and rename to 'gfc_type_is_extensible. (resolve_select_type): Renamed type_is_extensible. (resolve_class_assign): Handle NULL pointers. (resolve_fl_variable_derived): Renamed type_is_extensible. (resolve_fl_derived): Ditto. * trans-expr.c (gfc_trans_subcomponent_assign): Handle NULL initialization of class pointer components. (gfc_conv_structure): Handle BT_CLASS. * trans-intrinsic.c (gfc_conv_same_type_as,gfc_conv_extends_type_of): New functions. (gfc_conv_intrinsic_function): Handle SAME_TYPE_AS and EXTENDS_TYPE_OF. 2009-09-30 Janus Weil * gfortran.h (type_selector, select_type_tmp): New global variables. * match.c (type_selector, select_type_tmp): New global variables, used for SELECT TYPE statements. (gfc_match_select_type): Better error handling. Remember selector. (gfc_match_type_is): Create temporary variable. * module.c (ab_attribute): New value 'AB_IS_CLASS'. (attr_bits): New string. (mio_symbol_attribute): Handle 'is_class'. * resolve.c (resolve_select_type): Insert pointer assignment statement, to assign temporary to selector. * symbol.c (gfc_get_ha_sym_tree): Replace selector by a temporary in SELECT TYPE statements. 2009-09-30 Janus Weil * dump-parse-tree.c (show_code_node): Renamed 'alloc_list'. * gfortran.h (gfc_code): Rename 'alloc_list'. Add member 'ts'. (gfc_expr_to_initialize): New prototype. * match.c (alloc_opt_list): Correctly check type compatibility. Renamed 'alloc_list'. (dealloc_opt_list): Renamed 'alloc_list'. * resolve.c (expr_to_initialize): Rename to 'gfc_expr_to_initialize' and make it non-static. (resolve_allocate_expr): Set vindex for CLASS variables correctly. Move initialization code to gfc_trans_allocate. Renamed 'alloc_list'. (resolve_allocate_deallocate): Renamed 'alloc_list'. (check_class_pointer_assign): Rename to 'resolve_class_assign'. Change argument type. Adjust to work with ordinary assignments. (resolve_code): Call 'resolve_class_assign' for ordinary assignments. Renamed 'check_class_pointer_assign'. * st.c (gfc_free_statement): Renamed 'alloc_list'. * trans-stmt.c (gfc_trans_allocate): Renamed 'alloc_list'. Handle size determination and initialization of CLASS variables. Bugfix for ALLOCATE statements with default initialization and SOURCE block. (gfc_trans_deallocate): Renamed 'alloc_list'. 2009-09-30 Paul Thomas * trans-expr.c (gfc_conv_procedure_call): Convert a derived type actual to a class object if the formal argument is a class. 2009-09-30 Janus Weil PR fortran/40996 * decl.c (build_struct): Handle allocatable scalar components. * expr.c (gfc_add_component_ref): Correctly set typespec of expression, after inserting component reference. * match.c (gfc_match_type_is,gfc_match_class_is): Make sure that no variables are being used uninitialized. * primary.c (gfc_match_varspec): Handle CLASS array components. * resolve.c (resolve_select_type): Transform EXEC_SELECT_TYPE to EXEC_SELECT. * trans-array.c (structure_alloc_comps,gfc_trans_deferred_array): Handle allocatable scalar components. * trans-expr.c (gfc_conv_component_ref): Ditto. * trans-types.c (gfc_get_derived_type): Ditto. 2009-09-30 Janus Weil * decl.c (encapsulate_class_symbol): Modify names of class container components by prefixing with '$'. (gfc_match_end): Handle COMP_SELECT_TYPE. * expr.c (gfc_add_component_ref): Modify names of class container components by prefixing with '$'. * gfortran.h (gfc_statement): Add ST_SELECT_TYPE, ST_TYPE_IS and ST_CLASS_IS. (gfc_case): New field 'ts'. (gfc_exec_op): Add EXEC_SELECT_TYPE. (gfc_type_is_extension_of): New prototype. * match.h (gfc_match_select_type,gfc_match_type_is,gfc_match_class_is): New prototypes. * match.c (match_derived_type_spec): New function. (match_type_spec): Use 'match_derived_type_spec'. (match_case_eos): Modify error message. (gfc_match_select_type): New function. (gfc_match_case): Modify error message. (gfc_match_type_is): New function. (gfc_match_class_is): Ditto. * parse.h (gfc_compile_state): Add COMP_SELECT_TYPE. * parse.c (decode_statement): Handle SELECT TYPE, TYPE IS and CLASS IS statements. (next_statement): Handle ST_SELECT_TYPE. (gfc_ascii_statement): Handle ST_SELECT_TYPE, ST_TYPE_IS, ST_CLASS_IS. (parse_select_type_block): New function. (parse_executable): Handle ST_SELECT_TYPE. * resolve.c (resolve_deallocate_expr): Handle BT_CLASS. Modify names of class container components by prefixing with '$'. (resolve_allocate_expr): Ditto. (resolve_select_type): New function. (gfc_resolve_blocks): Handle EXEC_SELECT_TYPE. (check_class_pointer_assign): Modify names of class container components by prefixing with '$'. (resolve_code): Ditto. * st.c (gfc_free_statement): Ditto. * symbol.c (gfc_type_is_extension_of): New function. (gfc_type_compatible): Use 'gfc_type_is_extension_of', plus a bugfix. * trans.c (gfc_trans_code): Handel EXEC_SELECT_TYPE. 2009-09-30 Janus Weil Paul Thomas * check.c (gfc_check_move_alloc): Arguments don't have to be arrays. The second argument needs to be type-compatible with the first (not the other way around, which makes a difference for CLASS entities). * decl.c (encapsulate_class_symbol): New function. (build_sym,build_struct): Handle BT_CLASS, call 'encapsulate_class_symbol'. (gfc_match_decl_type_spec): Remove warning, use BT_CLASS. (gfc_match_derived_decl): Set vindex; * expr.c (gfc_add_component_ref): New function. (gfc_copy_expr,gfc_check_pointer_assign,gfc_check_assign_symbol): Handle BT_CLASS. * dump-parse-tree.c (show_symbol): Print vindex. * gfortran.h (bt): New basic type BT_CLASS. (symbol_attribute): New field 'is_class'. (gfc_typespec): Remove field 'is_class'. (gfc_symbol): New field 'vindex'. (gfc_get_ultimate_derived_super_type): New prototype. (gfc_add_component_ref): Ditto. * interface.c (gfc_compare_derived_types): Pointer equality check moved here from gfc_compare_types. (gfc_compare_types): Handle BT_CLASS and use gfc_type_compatible. * match.c (gfc_match_allocate,gfc_match_deallocate,gfc_match_call): Handle BT_CLASS. * misc.c (gfc_clear_ts): Removed is_class. (gfc_basic_typename,gfc_typename): Handle BT_CLASS. * module.c (bt_types,mio_typespec): Handle BT_CLASS. (mio_symbol): Handle vindex. * primary.c (gfc_match_varspec,gfc_variable_attr): Handle BT_CLASS. * resolve.c (find_array_spec,check_typebound_baseobject): Handle BT_CLASS. (resolve_ppc_call,resolve_expr_ppc): Don't call 'gfc_is_proc_ptr_comp' inside 'gcc_assert'. (resolve_deallocate_expr,resolve_allocate_expr): Handle BT_CLASS. (check_class_pointer_assign): New function. (resolve_code): Handle BT_CLASS, call check_class_pointer_assign. (resolve_fl_var_and_proc,type_is_extensible,resolve_fl_variable_derived, resolve_fl_variable): Handle BT_CLASS. (check_generic_tbp_ambiguity): Add special case. (resolve_typebound_procedure,resolve_fl_derived): Handle BT_CLASS. * symbol.c (gfc_get_ultimate_derived_super_type): New function. (gfc_type_compatible): Handle BT_CLASS. * trans-expr.c (conv_parent_component_references): Handle CLASS containers. (gfc_conv_initializer): Handle BT_CLASS. * trans-types.c (gfc_typenode_for_spec,gfc_get_derived_type): Handle BT_CLASS. testsuite/ 2009-09-30 Janus Weil * gfortran.dg/same_type_as_1.f03: New test. * gfortran.dg/same_type_as_2.f03: Ditto. 2009-09-30 Janus Weil * gfortran.dg/select_type_1.f03: Extended. * gfortran.dg/select_type_3.f03: New test. 2009-09-30 Janus Weil * gfortran.dg/class_allocate_1.f03: New test. 2009-09-30 Janus Weil PR fortran/40996 * gfortran.dg/allocatable_scalar_3.f90: New test. * gfortran.dg/select_type_2.f03: Ditto. * gfortran.dg/typebound_proc_5.f03: Changed error messages. 2009-09-30 Janus Weil * gfortran.dg/block_name_2.f90: Modified error message. * gfortran.dg/select_6.f90: Ditto. * gfortran.dg/select_type_1.f03: New test. 2009-09-30 Janus Weil * gfortran.dg/allocate_derived_1.f90: Remove -w option. * gfortran.dg/class_1.f03: Ditto. * gfortran.dg/class_2.f03: Ditto. * gfortran.dg/proc_ptr_comp_pass_1.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_2.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_3.f90: Ditto. * gfortran.dg/typebound_call_10.f03: Ditto. * gfortran.dg/typebound_call_2.f03: Ditto. * gfortran.dg/typebound_call_3.f03: Ditto. * gfortran.dg/typebound_call_4.f03: Ditto. * gfortran.dg/typebound_call_9.f03: Ditto. * gfortran.dg/typebound_generic_3.f03: Ditto. * gfortran.dg/typebound_generic_4.f03: Ditto. * gfortran.dg/typebound_operator_1.f03: Ditto. * gfortran.dg/typebound_operator_2.f03: Ditto. * gfortran.dg/typebound_operator_3.f03: Ditto. * gfortran.dg/typebound_operator_4.f03: Ditto. * gfortran.dg/typebound_proc_1.f08: Ditto. * gfortran.dg/typebound_proc_5.f03: Ditto. * gfortran.dg/typebound_proc_6.f03: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152345 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index d2cdb591888..3e8e3f2e5a4 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1599,6 +1599,12 @@ add_functions (void) make_generic ("exponent", GFC_ISYM_EXPONENT, GFC_STD_F95); + add_sym_2 ("extends_type_of", GFC_ISYM_EXTENDS_TYPE_OF, CLASS_INQUIRY, + ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F2003, + gfc_check_same_type_as, NULL, NULL, + a, BT_UNKNOWN, 0, REQUIRED, + mo, BT_UNKNOWN, 0, REQUIRED); + add_sym_0 ("fdate", GFC_ISYM_FDATE, NO_CLASS, ACTUAL_NO, BT_CHARACTER, dc, GFC_STD_GNU, NULL, NULL, gfc_resolve_fdate); @@ -2307,6 +2313,12 @@ add_functions (void) make_generic ("rrspacing", GFC_ISYM_RRSPACING, GFC_STD_F95); + add_sym_2 ("same_type_as", GFC_ISYM_SAME_TYPE_AS, CLASS_INQUIRY, ACTUAL_NO, + BT_LOGICAL, dl, GFC_STD_F2003, + gfc_check_same_type_as, NULL, NULL, + a, BT_UNKNOWN, 0, REQUIRED, + b, BT_UNKNOWN, 0, REQUIRED); + add_sym_2 ("scale", GFC_ISYM_SCALE, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95, gfc_check_scale, gfc_simplify_scale, gfc_resolve_scale, x, BT_REAL, dr, REQUIRED, i, BT_INTEGER, di, REQUIRED); -- cgit v1.2.1 From 66a56860076243903465dadec8482f55d32144dc Mon Sep 17 00:00:00 2001 From: jakub Date: Sat, 28 Nov 2009 12:13:21 +0000 Subject: * trans-common.c (create_common): Remove unused offset variable. * io.c (gfc_match_wait): Remove unused loc variable. * trans-openmp.c (gfc_trans_omp_clauses): Remove unused old_clauses variable. (gfc_trans_omp_do): Remove unused outermost variable. * iresolve.c (gfc_resolve_alarm_sub, gfc_resolve_fseek_sub): Remove unused status variable. * module.c (number_use_names): Remove unused c variable. (load_derived_extensions): Remove unused nuse variable. * trans-expr.c (gfc_conv_substring): Remove unused var variable. * trans-types.c (gfc_get_array_descr_info): Remove unused offset_off variable. * matchexp.c (match_primary): Remove unused where variable. * trans-intrinsic.c (gfc_conv_intrinsic_bound): Remove unused cond2 variable. (gfc_conv_intrinsic_sizeof): Remove unused source variable. (gfc_conv_intrinsic_transfer): Remove unused stride variable. (gfc_conv_intrinsic_function): Remove unused isym variable. * arith.c (gfc_hollerith2real, gfc_hollerith2complex, gfc_hollerith2logical): Remove unused len variable. * parse.c (parse_derived): Remove unused derived_sym variable. * decl.c (variable_decl): Remove unused old_locus variable. * resolve.c (check_class_members): Remove unused tbp_sym variable. (resolve_ordinary_assign): Remove unused assign_proc variable. (resolve_equivalence): Remove unused value_name variable. * data.c (get_array_index): Remove unused re variable. * trans-array.c (gfc_conv_array_transpose): Remove unused src_info variable. (gfc_conv_resolve_dependencies): Remove unused aref and temp_dim variables. (gfc_conv_loop_setup): Remove unused dim and len variables. (gfc_walk_variable_expr): Remove unused head variable. * match.c (match_typebound_call): Remove unused var variable. * intrinsic.c (gfc_convert_chartype): Remove unused from_ts variable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 3e8e3f2e5a4..a62dd92375b 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4054,14 +4054,12 @@ gfc_try gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts) { gfc_intrinsic_sym *sym; - gfc_typespec from_ts; locus old_where; gfc_expr *new_expr; int rank; mpz_t *shape; gcc_assert (expr->ts.type == BT_CHARACTER && ts->type == BT_CHARACTER); - from_ts = expr->ts; /* expr->ts gets clobbered */ sym = find_char_conv (&expr->ts, ts); gcc_assert (sym); -- cgit v1.2.1 From bdfbc762ef80b1196e214ed9c90e9f57a11e264b Mon Sep 17 00:00:00 2001 From: janus Date: Mon, 30 Nov 2009 20:43:06 +0000 Subject: merge from fortran-dev branch: gcc/fortran/ 2009-11-30 Janus Weil PR fortran/42053 * resolve.c (resolve_select_type): Check for duplicate CLASS IS blocks. 2009-11-30 Janus Weil PR fortran/41631 * decl.c (gfc_match_derived_decl): Set extension level. * gfortran.h (symbol_attribute): Expand 'extension' bit field to 8 bit. * iresolve.c (gfc_resolve_extends_type_of): Return value of 'is_extension_of' has kind=4. * match.c (select_type_set_tmp,gfc_match_class_is): Create temporary for CLASS IS blocks. * module.c (MOD_VERSION): Bump module version. (ab_attribute,attr_bits): Remove AB_EXTENSION. (mio_symbol_attribute): Handle expanded 'extension' field. * resolve.c (resolve_select_type): Implement CLASS IS blocks. (resolve_fl_variable_derived): Show correct type name. * symbol.c (gfc_build_class_symbol): Set extension level. 2009-11-30 Janus Weil * intrinsic.h (gfc_resolve_extends_type_of): Add prototype. * intrinsic.c (add_functions): Use 'gfc_resolve_extends_type_of'. * iresolve.c (gfc_resolve_extends_type_of): New function, which replaces the call to EXTENDS_TYPE_OF by the library function 'is_extension_of' and modifies the arguments. * trans-intrinsic.c (gfc_conv_extends_type_of): Removed. (gfc_conv_intrinsic_function): FOR EXTENDS_TYPE_OF, don't call gfc_conv_extends_type_of but gfc_conv_intrinsic_funcall. 2009-11-30 Paul Thomas Janus Weil * decl.c (encapsulate_class_symbol): Replaced by 'gfc_build_class_symbol'. (build_sym,build_struct): Call 'gfc_build_class_symbol'. (gfc_match_derived_decl): Replace vindex by hash_value. * dump-parse-tree.c (show_symbol): Replace vindex by hash_value. * gfortran.h (symbol_attribute): Add field 'vtab'. (gfc_symbol): Replace vindex by hash_value. (gfc_class_esym_list): Ditto. (gfc_get_derived_type,gfc_build_class_symbol,gfc_find_derived_vtab): New prototypes. * module.c (mio_symbol): Replace vindex by hash_value. * resolve.c (vindex_expr): Rename to 'hash_value_expr'. (resolve_class_compcall,resolve_class_typebound_call): Renamed 'vindex_expr'. (resolve_select_type): Replace $vindex by $vptr->$hash. * symbol.c (gfc_add_save): Handle vtab symbols. (gfc_type_compatible): Rewrite. (gfc_build_class_symbol): New function which replaces 'encapsulate_class_symbol'. (gfc_find_derived_vtab): New function to set up a vtab symbol for a derived type. * trans-decl.c (gfc_create_module_variable): Handle vtab symbols. * trans-expr.c (select_class_proc): Replace vindex by hash_value. (gfc_conv_derived_to_class): New function to construct a temporary CLASS variable from a derived type expression. (gfc_conv_procedure_call): Call 'gfc_conv_derived_to_class'. (gfc_conv_structure): Initialize the $extends and $size fields of vtab symbols. (gfc_trans_class_assign): Replace $vindex by $vptr. Remove the $size assignment. * trans-intrinsic.c (gfc_conv_same_type_as): Replace $vindex by $vptr->$hash, and replace vindex by hash_value. * trans-stmt.c (gfc_trans_allocate): Insert $vptr references, replace $vindex by $vptr. Remove the $size assignment. * trans-types.c (gfc_get_derived_type): Make it non-static. gcc/testsuite/ 2009-11-30 Janus Weil PR fortran/42053 * gfortran.dg/select_type_9.f03: New. 2009-11-30 Janus Weil PR fortran/41631 * gfortran.dg/extends_type_of_1.f03: Fix invalid test case. * gfortran.dg/module_md5_1.f90: Adjusted MD5 sum. * gfortran.dg/select_type_1.f03: Remove FIXMEs. * gfortran.dg/select_type_2.f03: Ditto. * gfortran.dg/select_type_8.f03: New test. 2009-11-30 Janus Weil * gfortran.dg/extends_type_of_1.f03: New test. * gfortran.dg/same_type_as_1.f03: Extended. 2009-11-30 Paul Thomas * gfortran.dg/class_4c.f03: Add dg-additional-sources. * gfortran.dg/class_4d.f03: Rename module. Cleanup modules. libgfortran/ 2009-11-30 Janus Weil * gfortran.map: Add _gfortran_is_extension_of. * Makefile.am: Add intrinsics/extends_type_of.c. * Makefile.in: Regenerated. * intrinsics/extends_type_of.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154840 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index a62dd92375b..859fd4b7abf 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1601,7 +1601,7 @@ add_functions (void) add_sym_2 ("extends_type_of", GFC_ISYM_EXTENDS_TYPE_OF, CLASS_INQUIRY, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F2003, - gfc_check_same_type_as, NULL, NULL, + gfc_check_same_type_as, NULL, gfc_resolve_extends_type_of, a, BT_UNKNOWN, 0, REQUIRED, mo, BT_UNKNOWN, 0, REQUIRED); -- cgit v1.2.1 From cd584ef87c4d4e8308e135adbe6bcea2dcaec489 Mon Sep 17 00:00:00 2001 From: burnus Date: Tue, 16 Feb 2010 08:35:05 +0000 Subject: 2010-02-16 Tobias Burnus PR fortran/43040 * gfortran.h (gfc_isym_id): Rename GFS_ISYM_GAMMA to * GFS_ISYM_TGAMMA. * intrinsic.c (add_functions): Ditto. * iresolve.c (gfc_resolve_gamma): Call tgamma instead of gamma. * mathbuiltins.def: Use TGAMMA instead of GAMMA with "tgamma". git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156796 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 859fd4b7abf..7062312707c 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1665,15 +1665,15 @@ add_functions (void) make_generic ("fput", GFC_ISYM_FPUT, GFC_STD_GNU); - add_sym_1 ("gamma", GFC_ISYM_GAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, + add_sym_1 ("gamma", GFC_ISYM_TGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F2008, gfc_check_fn_r, gfc_simplify_gamma, gfc_resolve_gamma, x, BT_REAL, dr, REQUIRED); - add_sym_1 ("dgamma", GFC_ISYM_GAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU, + add_sym_1 ("dgamma", GFC_ISYM_TGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU, gfc_check_fn_d, gfc_simplify_gamma, gfc_resolve_gamma, x, BT_REAL, dr, REQUIRED); - make_generic ("gamma", GFC_ISYM_GAMMA, GFC_STD_F2008); + make_generic ("gamma", GFC_ISYM_TGAMMA, GFC_STD_F2008); /* Unix IDs (g77 compatibility) */ add_sym_1 ("getcwd", GFC_ISYM_GETCWD, NO_CLASS, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU, -- cgit v1.2.1 From 1384ae99ee84aa34f559ffb29468099e22d88dd2 Mon Sep 17 00:00:00 2001 From: pault Date: Thu, 1 Apr 2010 18:06:05 +0000 Subject: 2010-04-01 Paul Thomas * ioparm.def : Update copyright. * lang.opt : ditto * trans-array.c : ditto * trans-array.h : ditto * expr.c: ditto * trans-types.c: ditto * dependency.c : ditto * gfortran.h : ditto * options.c : ditto * trans-io.c : ditto * trans-intrinsic.c : ditto * libgfortran.h : ditto * invoke.texi : ditto * intrinsic.texi : ditto * trans.c : ditto * trans.h : ditto * intrinsic.c : ditto * interface.c : ditto * iresolve.c : ditto * trans-stmt.c : ditto * trans-stmt.h : ditto * parse,c : ditto * match.h : ditto * error.c : ditto git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157923 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 7062312707c..684b2cf1742 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1,6 +1,7 @@ /* Build up a list of intrinsic subroutines and functions for the name-resolution stage. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. Contributed by Andy Vaught & Katherine Holcomb -- cgit v1.2.1 From c6cd3066bcb72a59fecce6bfa99cb4e169a4a751 Mon Sep 17 00:00:00 2001 From: burnus Date: Tue, 6 Apr 2010 16:26:02 +0000 Subject: 2010-04-06 Tobias Burnus PR fortran/39997 * intrinsic.c (add_functions): Add num_images. * decl.c (gfc_match_end): Handle END CRITICAL. * intrinsic.h (gfc_simplify_num_images): Add prototype. * dump-parse-tree.c (show_code_node): Dump CRITICAL, ERROR STOP, and SYNC. * gfortran.h (gfc_statement): Add enum items for those. (gfc_exec_op) Ditto. (gfc_isym_id): Add num_images. * trans-stmt.c (gfc_trans_stop): Handle ERROR STOP. (gfc_trans_sync,gfc_trans_critical): New functions. * trans-stmt.h (gfc_trans_stop,gfc_trans_sync, gfc_trans_critical): Add/update prototypes. * trans.c (gfc_trans_code): Handle CRITICAL, ERROR STOP, and SYNC statements. * trans.h (gfor_fndecl_error_stop_string) Add variable. * resolve.c (resolve_sync): Add function. (gfc_resolve_blocks): Handle CRITICAL. (resolve_code): Handle CRITICAL, ERROR STOP, (resolve_branch): Add CRITICAL constraint check. and SYNC statements. * st.c (gfc_free_statement): Add new statements. * trans-decl.c (gfor_fndecl_error_stop_string): Global variable. (gfc_build_builtin_function_decls): Initialize it. * match.c (gfc_match_if): Handle ERROR STOP and SYNC. (gfc_match_critical, gfc_match_error_stop, sync_statement, gfc_match_sync_all, gfc_match_sync_images, gfc_match_sync_memory): New functions. (match_exit_cycle): Handle CRITICAL constraint. (gfc_match_stopcode): Handle ERROR STOP. * match.h (gfc_match_critical, gfc_match_error_stop, gfc_match_sync_all, gfc_match_sync_images, gfc_match_sync_memory): Add prototype. * parse.c (decode_statement, gfc_ascii_statement, parse_executable): Handle new statements. (parse_critical_block): New function. * parse.h (gfc_compile_state): Add COMP_CRITICAL. * intrinsic.texi (num_images): Document new function. * simplify.c (gfc_simplify_num_images): Add function. 2010-04-06 Tobias Burnus PR fortran/39997 * gfortran.dg/coarray_1.f90: New test. * gfortran.dg/coarray_2.f90: New test. * gfortran.dg/coarray_3.f90: New test. 2010-04-06 Tobias Burnus PR fortran/39997 * runtime/stop.c (error_stop_string): New function. * gfortran.map (_gfortran_error_stop_string): Add. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158008 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 684b2cf1742..fbfc47af12c 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -2221,6 +2221,9 @@ add_functions (void) make_generic ("null", GFC_ISYM_NULL, GFC_STD_F95); + add_sym_0 ("num_images", GFC_ISYM_NUMIMAGES, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, + NULL, gfc_simplify_num_images, NULL); + add_sym_3 ("pack", GFC_ISYM_PACK, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95, gfc_check_pack, gfc_simplify_pack, gfc_resolve_pack, ar, BT_REAL, dr, REQUIRED, msk, BT_LOGICAL, dl, REQUIRED, -- cgit v1.2.1 From a250d5604c330534faa5c2c410c33db5d8253768 Mon Sep 17 00:00:00 2001 From: burnus Date: Wed, 14 Apr 2010 05:43:30 +0000 Subject: 2010-04-14 Tobias Burnus PR fortran/18918 * array.c (gfc_find_array_ref): Handle codimensions. (gfc_match_array_spec,gfc_match_array_ref): Use gfc_fatal_error. * check.c (is_coarray, dim_corank_check, gfc_check_lcobound, gfc_check_image_index, gfc_check_this_image, gfc_check_ucobound): New functions. * gfortran.h (gfc_isym_id): Add GFC_ISYM_IMAGE_INDEX, GFC_ISYM_LCOBOUND, GFC_ISYM_THIS_IMAGE, GFC_ISYM_UCOBOUND. * intrinsic.h (add_functions): Add this_image, image_index, lcobound and ucobound intrinsics. * intrinsic.c (gfc_check_lcobound,gfc_check_ucobound, gfc_check_image_index, gfc_check_this_image, gfc_simplify_image_index, gfc_simplify_lcobound, gfc_simplify_this_image, gfc_simplify_ucobound): New function prototypes. * intrinsic.texi (IMAGE_INDEX, LCOBOUND, THIS_IMAGE IMAGE_INDEX): Document new intrinsic functions. * match.c (gfc_match_critical, sync_statement): Make * -fcoarray=none error fatal. * simplify.c (simplify_bound_dim): Handle coarrays. (simplify_bound): Update simplify_bound_dim call. (gfc_simplify_num_images): Add -fcoarray=none check. (simplify_cobound, gfc_simplify_lcobound, gfc_simplify_ucobound, gfc_simplify_ucobound, gfc_simplify_ucobound): New functions. 2010-04-14 Tobias Burnus PR fortran/18918 * gfortran.dg/coarray_9.f90: Update dg-errors. * gfortran.dg/coarray_10.f90: New test. * gfortran.dg/coarray_11.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158292 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index fbfc47af12c..470839af104 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1081,7 +1081,8 @@ add_functions (void) *y = "y", *sz = "size", *sta = "string_a", *stb = "string_b", *z = "z", *ln = "len", *ut = "unit", *han = "handler", *num = "number", *tm = "time", *nm = "name", *md = "mode", - *vl = "values", *p1 = "path1", *p2 = "path2", *com = "command"; + *vl = "values", *p1 = "path1", *p2 = "path2", *com = "command", + *ca = "coarray", *sub = "sub"; int di, dr, dd, dl, dc, dz, ii; @@ -1784,6 +1785,10 @@ add_functions (void) make_generic ("ierrno", GFC_ISYM_IERRNO, GFC_STD_GNU); + add_sym_2 ("image_index", GFC_ISYM_IMAGE_INDEX, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, + gfc_check_image_index, gfc_simplify_image_index, NULL, + ca, BT_REAL, dr, REQUIRED, sub, BT_INTEGER, ii, REQUIRED); + /* The resolution function for INDEX is called gfc_resolve_index_func because the name gfc_resolve_index is already used in resolve.c. */ add_sym_4 ("index", GFC_ISYM_INDEX, CLASS_ELEMENTAL, ACTUAL_YES, @@ -1919,6 +1924,14 @@ add_functions (void) make_generic ("lbound", GFC_ISYM_LBOUND, GFC_STD_F95); + add_sym_3 ("lcobound", GFC_ISYM_LCOBOUND, CLASS_INQUIRY, ACTUAL_NO, + BT_INTEGER, di, GFC_STD_F95, + gfc_check_lcobound, gfc_simplify_lcobound, NULL, + ca, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL, + kind, BT_INTEGER, di, OPTIONAL); + + make_generic ("lcobound", GFC_ISYM_LCOBOUND, GFC_STD_F95); + add_sym_1 ("leadz", GFC_ISYM_LEADZ, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, gfc_check_i, gfc_simplify_leadz, NULL, @@ -2526,6 +2539,10 @@ add_functions (void) make_generic ("tanh", GFC_ISYM_TANH, GFC_STD_F77); + add_sym_2 ("this_image", GFC_ISYM_THIS_IMAGE, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, + gfc_check_this_image, gfc_simplify_this_image, NULL, + ca, BT_REAL, dr, OPTIONAL, dm, BT_INTEGER, ii, OPTIONAL); + add_sym_0 ("time", GFC_ISYM_TIME, NO_CLASS, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU, NULL, NULL, gfc_resolve_time); @@ -2582,6 +2599,14 @@ add_functions (void) make_generic ("ubound", GFC_ISYM_UBOUND, GFC_STD_F95); + add_sym_3 ("ucobound", GFC_ISYM_UCOBOUND, CLASS_INQUIRY, ACTUAL_NO, + BT_INTEGER, di, GFC_STD_F95, + gfc_check_ucobound, gfc_simplify_ucobound, NULL, + ca, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL, + kind, BT_INTEGER, di, OPTIONAL); + + make_generic ("ucobound", GFC_ISYM_UCOBOUND, GFC_STD_F95); + /* g77 compatibility for UMASK. */ add_sym_1 ("umask", GFC_ISYM_UMASK, NO_CLASS, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU, gfc_check_umask, NULL, gfc_resolve_umask, -- cgit v1.2.1 From 6ff06d363f15102bf83a04bd7228a7fc13230995 Mon Sep 17 00:00:00 2001 From: kargl Date: Tue, 20 Apr 2010 21:24:36 +0000 Subject: 2010-04-20 Harald Anlauf * intrinsic.c (sort_actual): Remove 'is' in error message. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158577 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 470839af104..494b8165584 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -3292,7 +3292,7 @@ keywords: if (f->actual != NULL) { - gfc_error ("Argument '%s' is appears twice in call to '%s' at %L", + gfc_error ("Argument '%s' appears twice in call to '%s' at %L", f->name, name, where); return FAILURE; } -- cgit v1.2.1 From 746a1b37cd308d2c795256089e106e3197854465 Mon Sep 17 00:00:00 2001 From: burnus Date: Sun, 2 May 2010 15:13:03 +0000 Subject: 2010-05-02 Tobias Burnus PR fortran/18918 * intrinsic.c (add_functions): Fix GFC_STD and add gfc_resolve_* calls for lcobound, ucobound, image_index and this_image. * intrinsic.h (gfc_resolve_lcobound, gfc_resolve_this_image, gfc_resolve_image_index, gfc_resolve_ucobound): New prototypes. * iresolve.c (gfc_resolve_lcobound, gfc_resolve_this_image, gfc_resolve_image_index, gfc_resolve_ucobound, resolve_bound): New functions. (gfc_resolve_lbound, gfc_resolve_ubound): Use resolve_bound. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158974 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 494b8165584..34afabc3d22 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1786,7 +1786,7 @@ add_functions (void) make_generic ("ierrno", GFC_ISYM_IERRNO, GFC_STD_GNU); add_sym_2 ("image_index", GFC_ISYM_IMAGE_INDEX, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, - gfc_check_image_index, gfc_simplify_image_index, NULL, + gfc_check_image_index, gfc_simplify_image_index, gfc_resolve_image_index, ca, BT_REAL, dr, REQUIRED, sub, BT_INTEGER, ii, REQUIRED); /* The resolution function for INDEX is called gfc_resolve_index_func @@ -1925,12 +1925,12 @@ add_functions (void) make_generic ("lbound", GFC_ISYM_LBOUND, GFC_STD_F95); add_sym_3 ("lcobound", GFC_ISYM_LCOBOUND, CLASS_INQUIRY, ACTUAL_NO, - BT_INTEGER, di, GFC_STD_F95, - gfc_check_lcobound, gfc_simplify_lcobound, NULL, + BT_INTEGER, di, GFC_STD_F2008, + gfc_check_lcobound, gfc_simplify_lcobound, gfc_resolve_lcobound, ca, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL); - make_generic ("lcobound", GFC_ISYM_LCOBOUND, GFC_STD_F95); + make_generic ("lcobound", GFC_ISYM_LCOBOUND, GFC_STD_F2008); add_sym_1 ("leadz", GFC_ISYM_LEADZ, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, @@ -2540,7 +2540,7 @@ add_functions (void) make_generic ("tanh", GFC_ISYM_TANH, GFC_STD_F77); add_sym_2 ("this_image", GFC_ISYM_THIS_IMAGE, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F2008, - gfc_check_this_image, gfc_simplify_this_image, NULL, + gfc_check_this_image, gfc_simplify_this_image, gfc_resolve_this_image, ca, BT_REAL, dr, OPTIONAL, dm, BT_INTEGER, ii, OPTIONAL); add_sym_0 ("time", GFC_ISYM_TIME, NO_CLASS, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU, @@ -2600,12 +2600,12 @@ add_functions (void) make_generic ("ubound", GFC_ISYM_UBOUND, GFC_STD_F95); add_sym_3 ("ucobound", GFC_ISYM_UCOBOUND, CLASS_INQUIRY, ACTUAL_NO, - BT_INTEGER, di, GFC_STD_F95, - gfc_check_ucobound, gfc_simplify_ucobound, NULL, + BT_INTEGER, di, GFC_STD_F2008, + gfc_check_ucobound, gfc_simplify_ucobound, gfc_resolve_ucobound, ca, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL, kind, BT_INTEGER, di, OPTIONAL); - make_generic ("ucobound", GFC_ISYM_UCOBOUND, GFC_STD_F95); + make_generic ("ucobound", GFC_ISYM_UCOBOUND, GFC_STD_F2008); /* g77 compatibility for UMASK. */ add_sym_1 ("umask", GFC_ISYM_UMASK, NO_CLASS, ACTUAL_NO, BT_INTEGER, di, -- cgit v1.2.1 From 99bb75090187e4da6840f5b1c273d8047244c440 Mon Sep 17 00:00:00 2001 From: dfranke Date: Fri, 7 May 2010 15:36:45 +0000 Subject: gcc/fortran/: 2010-05-07 Daniel Franke PR fortran/40728 * intrinc.c (gfc_is_intrinsic): Do not prematurely mark symbol as external gcc/testsuite/: 2010-05-07 Daniel Franke PR fortran/40728 * gfortran.dg/coarray_1.f90: Fixed error message. * gfortran.dg/selected_char_kind_3.f90: Fixed error message. * gfortran.dg/intrinsic_std_1.f90: Fixed bogus message. * gfortran.dg/intrinsic_std_5.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159155 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 34afabc3d22..e8041eb9b9a 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -956,17 +956,14 @@ gfc_is_intrinsic (gfc_symbol* sym, int subroutine_flag, locus loc) /* See if this intrinsic is allowed in the current standard. */ if (gfc_check_intrinsic_standard (isym, &symstd, false, loc) == FAILURE) { - if (sym->attr.proc == PROC_UNKNOWN) - { - if (gfc_option.warn_intrinsics_std) - gfc_warning_now ("The intrinsic '%s' at %L is not included in the" - " selected standard but %s and '%s' will be" - " treated as if declared EXTERNAL. Use an" - " appropriate -std=* option or define" - " -fall-intrinsics to allow this intrinsic.", - sym->name, &loc, symstd, sym->name); - gfc_add_external (&sym->attr, &loc); - } + if (sym->attr.proc == PROC_UNKNOWN + && gfc_option.warn_intrinsics_std) + gfc_warning_now ("The intrinsic '%s' at %L is not included in the" + " selected standard but %s and '%s' will be" + " treated as if declared EXTERNAL. Use an" + " appropriate -std=* option or define" + " -fall-intrinsics to allow this intrinsic.", + sym->name, &loc, symstd, sym->name); return false; } -- cgit v1.2.1 From d7dbc78793abdbdb03100fda50c3881e13cae023 Mon Sep 17 00:00:00 2001 From: dfranke Date: Mon, 10 May 2010 17:10:53 +0000 Subject: gcc/fortran/: 2010-05-10 Daniel Franke PR fortran/27866 PR fortran/35003 PR fortran/42809 * intrinsic.c (gfc_convert_type_warn): Be more discriminative about conversion warnings. gcc/testsuite/: 2010-05-08 Daniel Franke PR fortran/27866 PR fortran/35003 PR fortran/42809 * gfortran.dg/array_constructor_type_17.f03: Updated match string. * gfortran.dg/warn_conversion.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159238 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index e8041eb9b9a..07867541be0 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4016,8 +4016,40 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag) gfc_warning_now ("Extension: Conversion from %s to %s at %L", gfc_typename (&from_ts), gfc_typename (ts), &expr->where); else if (wflag && gfc_option.warn_conversion) - gfc_warning_now ("Conversion from %s to %s at %L", - gfc_typename (&from_ts), gfc_typename (ts), &expr->where); + { + /* If the types are the same (but not LOGICAL), and if from-kind + is larger than to-kind, this may indicate a loss of precision. + The same holds for conversions from REAL to COMPLEX. */ + if (((from_ts.type == ts->type && from_ts.type != BT_LOGICAL) + && from_ts.kind > ts->kind) + || ((from_ts.type == BT_REAL && ts->type == BT_COMPLEX) + && from_ts.kind > ts->kind)) + gfc_warning_now ("Possible loss of precision in conversion " + "from %s to %s at %L", gfc_typename (&from_ts), + gfc_typename (ts), &expr->where); + + /* If INTEGER is converted to REAL/COMPLEX, this is generally ok if + the kind of the INTEGER value is less or equal to the kind of the + REAL/COMPLEX one. Otherwise the value may not fit. + Assignment of an overly large integer constant also generates + an overflow error with range checking. */ + else if (from_ts.type == BT_INTEGER + && (ts->type == BT_REAL || ts->type == BT_COMPLEX) + && from_ts.kind > ts->kind) + gfc_warning_now ("Possible loss of digits in conversion " + "from %s to %s at %L", gfc_typename (&from_ts), + gfc_typename (ts), &expr->where); + + /* If REAL/COMPLEX is converted to INTEGER, or COMPLEX is converted + to REAL we almost certainly have a loss of digits, regardless of + the respective kinds. */ + else if (((from_ts.type == BT_REAL || from_ts.type == BT_COMPLEX) + && ts->type == BT_INTEGER) + || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL)) + gfc_warning_now ("Likely loss of digits in conversion from" + "%s to %s at %L", gfc_typename (&from_ts), + gfc_typename (ts), &expr->where); + } /* Insert a pre-resolved function call to the right function. */ old_where = expr->where; -- cgit v1.2.1 From 148aaa7fa6884e257d205df009ea315b6b521c9c Mon Sep 17 00:00:00 2001 From: dfranke Date: Thu, 13 May 2010 14:08:05 +0000 Subject: gcc/fortran/: 2010-05-13 Daniel Franke PR fortran/35779 * intrinsic.c (gfc_init_expr): Renamed to gfc_init_expr_flag. Updated all usages. * expr.c (init_flag): Removed; use gfc_init_expr_flag everywhere. * array.c (match_array_list): Pass on gfc_init_expr_flag when matching iterators. gcc/testsuite/: 2010-05-13 Daniel Franke PR fortran/35779 * gfortran.dg/initialization_25.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159366 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 07867541be0..ff0049be88e 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see /* Namespace to hold the resolved symbols for intrinsic subroutines. */ static gfc_namespace *gfc_intrinsic_namespace; -int gfc_init_expr = 0; +bool gfc_init_expr_flag = false; /* Pointers to an intrinsic function and its argument names that are being checked. */ @@ -3803,7 +3803,7 @@ gfc_intrinsic_func_interface (gfc_expr *expr, int error_flag) if ((isym->id == GFC_ISYM_REAL || isym->id == GFC_ISYM_DBLE || isym->id == GFC_ISYM_CMPLX) - && gfc_init_expr + && gfc_init_expr_flag && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Function '%s' " "as initialization expression at %L", name, &expr->where) == FAILURE) @@ -3879,7 +3879,7 @@ got_specific: (4) A reference to an elemental standard intrinsic function, where each argument is an initialization expression */ - if (gfc_init_expr && isym->elemental && flag + if (gfc_init_expr_flag && isym->elemental && flag && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Elemental function " "as initialization expression with non-integer/non-" "character arguments at %L", &expr->where) == FAILURE) -- cgit v1.2.1 From b53b53b4d02d73419519acd48cfbd1123950f062 Mon Sep 17 00:00:00 2001 From: dfranke Date: Wed, 19 May 2010 11:43:53 +0000 Subject: gcc/fortran/: 2010-05-19 Daniel Franke PR fortran/34505 * intrinsic.h (gfc_check_float): New prototype. (gfc_check_sngl): New prototype. * check.c (gfc_check_float): New. (gfc_check_sngl): New. * intrinsic.c (add_functions): Moved DFLOAT from aliasing DBLE to be a specific for REAL. Added check routines for FLOAT, DFLOAT and SNGL. * intrinsic.texi: Removed individual nodes of FLOAT, DFLOAT and SNGL, added them to the list of specifics of REAL instead. gcc/testsuite/: 2010-05-19 Daniel Franke PR fortran/34505 * gfortran.dg/dfloat_1.f90: Add warnings for non-default kind arguments; add check for return value kind. * gfortran.dg/float_1.f90: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159558 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index ff0049be88e..02dea3039fd 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1476,8 +1476,6 @@ add_functions (void) gfc_check_dble, gfc_simplify_dble, gfc_resolve_dble, a, BT_REAL, dr, REQUIRED); - make_alias ("dfloat", GFC_STD_GNU); - make_generic ("dble", GFC_ISYM_DBLE, GFC_STD_F77); add_sym_1 ("digits", GFC_ISYM_DIGITS, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95, @@ -2293,11 +2291,15 @@ add_functions (void) a, BT_UNKNOWN, dr, REQUIRED); add_sym_1 ("float", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77, - gfc_check_i, gfc_simplify_float, NULL, + gfc_check_float, gfc_simplify_float, NULL, a, BT_INTEGER, di, REQUIRED); + add_sym_1 ("dfloat", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dd, GFC_STD_GNU, + gfc_check_float, gfc_simplify_dble, gfc_resolve_dble, + a, BT_REAL, dr, REQUIRED); + add_sym_1 ("sngl", GFC_ISYM_REAL, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F77, - NULL, gfc_simplify_sngl, NULL, + gfc_check_sngl, gfc_simplify_sngl, NULL, a, BT_REAL, dd, REQUIRED); make_generic ("real", GFC_ISYM_REAL, GFC_STD_F77); -- cgit v1.2.1 From 721f64bf120bb5e0466594a695fd7b475ceefeb7 Mon Sep 17 00:00:00 2001 From: dfranke Date: Wed, 19 May 2010 16:35:34 +0000 Subject: gcc/fortran/: 2010-05-19 Daniel Franke PR fortran/44055 * lang.opt (Wconversion-extra): New option. * gfortran.h (gfc_option_t): Add warn_conversion_extra. * options.c (gfc_init_options): Disable -Wconversion-extra by default. (set_Wall): Enable -Wconversion. (gfc_handle_option): Set warn_conversion_extra. * intrinsic.c (gfc_convert_type_warn): Ignore kind conditions introduced for -Wconversion if -Wconversion-extra is present. * invoke.texi: Add -Wconversion to -Wall; document new behaviour of -Wconversion; document -Wconversion-extra. gcc/testsuite/: 2010-05-19 Daniel Franke PR fortran/44055 * gfortran.dg/c_sizeof_2.f90: Add -Wno-conversion to dg-options; Fixed scope of C_SIZEOF. * gfortran.dg/warn_conversion_2.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159586 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 02dea3039fd..a92b5b54519 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4015,18 +4015,38 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag) /* At this point, a conversion is necessary. A warning may be needed. */ if ((gfc_option.warn_std & sym->standard) != 0) - gfc_warning_now ("Extension: Conversion from %s to %s at %L", - gfc_typename (&from_ts), gfc_typename (ts), &expr->where); - else if (wflag && gfc_option.warn_conversion) { + gfc_warning_now ("Extension: Conversion from %s to %s at %L", + gfc_typename (&from_ts), gfc_typename (ts), + &expr->where); + } + else if (wflag) + { + /* Two modes of warning: + - gfc_option.warn_conversion tries to be more intelligent + about the warnings raised and omits those where smaller + kinds are promoted to larger ones without change in the + value + - gfc_option.warn_conversion_extra does not take the kinds + into account and also warns for coversions like + REAL(4) -> REAL(8) + + NOTE: Possible enhancement for warn_conversion + If converting from a smaller to a larger kind, check if the + value is constant and if yes, whether the value still fits + in the smaller kind. If yes, omit the warning. + */ + /* If the types are the same (but not LOGICAL), and if from-kind is larger than to-kind, this may indicate a loss of precision. The same holds for conversions from REAL to COMPLEX. */ if (((from_ts.type == ts->type && from_ts.type != BT_LOGICAL) - && from_ts.kind > ts->kind) + && ((gfc_option.warn_conversion && from_ts.kind > ts->kind) + || gfc_option.warn_conversion_extra)) || ((from_ts.type == BT_REAL && ts->type == BT_COMPLEX) - && from_ts.kind > ts->kind)) - gfc_warning_now ("Possible loss of precision in conversion " + && ((gfc_option.warn_conversion && from_ts.kind > ts->kind) + || gfc_option.warn_conversion_extra))) + gfc_warning_now ("Possible change of value in conversion " "from %s to %s at %L", gfc_typename (&from_ts), gfc_typename (ts), &expr->where); @@ -4037,18 +4057,21 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag) an overflow error with range checking. */ else if (from_ts.type == BT_INTEGER && (ts->type == BT_REAL || ts->type == BT_COMPLEX) - && from_ts.kind > ts->kind) - gfc_warning_now ("Possible loss of digits in conversion " + && ((gfc_option.warn_conversion && from_ts.kind > ts->kind) + || gfc_option.warn_conversion_extra)) + gfc_warning_now ("Possible change of value in conversion " "from %s to %s at %L", gfc_typename (&from_ts), gfc_typename (ts), &expr->where); /* If REAL/COMPLEX is converted to INTEGER, or COMPLEX is converted to REAL we almost certainly have a loss of digits, regardless of the respective kinds. */ - else if (((from_ts.type == BT_REAL || from_ts.type == BT_COMPLEX) - && ts->type == BT_INTEGER) - || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL)) - gfc_warning_now ("Likely loss of digits in conversion from" + else if ((((from_ts.type == BT_REAL || from_ts.type == BT_COMPLEX) + && ts->type == BT_INTEGER) + || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL)) + && (gfc_option.warn_conversion + || gfc_option.warn_conversion_extra)) + gfc_warning_now ("Possible change of value in conversion from " "%s to %s at %L", gfc_typename (&from_ts), gfc_typename (ts), &expr->where); } -- cgit v1.2.1 From f1d241cc353f610b130907dbc3a58ab209a326c2 Mon Sep 17 00:00:00 2001 From: kargl Date: Wed, 9 Jun 2010 16:24:59 +0000 Subject: 2010-06-09 Steven G. Kargl * testsuite/gfortran.dg/mvbits_9.f90: New test. * testsuite/gfortran.dg/ibset_1.f90: Ditto. * testsuite/gfortran.dg/ibits_1.f90: Ditto. * testsuite/gfortran.dg/btest_1.f90: Ditto. * testsuite/gfortran.dg/ibclr_1.f90: Ditto. 2010-06-09 Steven G. Kargl * fortran/intrinsic.c (add_functions): Change gfc_check_btest, gfc_check_ibclr, and gfc_check_ibset to gfc_check_bitfcn. * fortran/intrinsic.h: Remove prototypes for gfc_check_btest, gfc_check_ibclr, and gfc_check_ibset. Add prototype for gfc_check_bitfcn. * fortran/check.c (nonnegative_check, less_than_bitsize1, less_than_bitsize2): New functions. (gfc_check_btest): Renamed to gfc_check_bitfcn. Use nonnegative_check and less_than_bitsize1. (gfc_check_ibclr, gfc_check_ibset): Removed. (gfc_check_ibits,gfc_check_mvbits): Use nonnegative_check and less_than_bitsize1. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160492 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index a92b5b54519..2d82f20f957 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1354,7 +1354,7 @@ add_functions (void) make_generic ("bit_size", GFC_ISYM_BIT_SIZE, GFC_STD_F95); add_sym_2 ("btest", GFC_ISYM_BTEST, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F95, - gfc_check_btest, gfc_simplify_btest, gfc_resolve_btest, + gfc_check_bitfcn, gfc_simplify_btest, gfc_resolve_btest, i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED); make_generic ("btest", GFC_ISYM_BTEST, GFC_STD_F95); @@ -1738,7 +1738,7 @@ add_functions (void) make_generic ("iargc", GFC_ISYM_IARGC, GFC_STD_GNU); add_sym_2 ("ibclr", GFC_ISYM_IBCLR, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95, - gfc_check_ibclr, gfc_simplify_ibclr, gfc_resolve_ibclr, + gfc_check_bitfcn, gfc_simplify_ibclr, gfc_resolve_ibclr, i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED); make_generic ("ibclr", GFC_ISYM_IBCLR, GFC_STD_F95); @@ -1751,7 +1751,7 @@ add_functions (void) make_generic ("ibits", GFC_ISYM_IBITS, GFC_STD_F95); add_sym_2 ("ibset", GFC_ISYM_IBSET, CLASS_ELEMENTAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95, - gfc_check_ibset, gfc_simplify_ibset, gfc_resolve_ibset, + gfc_check_bitfcn, gfc_simplify_ibset, gfc_resolve_ibset, i, BT_INTEGER, di, REQUIRED, pos, BT_INTEGER, di, REQUIRED); make_generic ("ibset", GFC_ISYM_IBSET, GFC_STD_F95); -- cgit v1.2.1 From a1a2dd690b8b894db8e4363a8efd49043bf2e35f Mon Sep 17 00:00:00 2001 From: dfranke Date: Wed, 9 Jun 2010 19:40:58 +0000 Subject: gcc/fortran/: 2010-06-09 Daniel Franke PR fortran/44359 * intrinsic.c (gfc_convert_type_warn): Further improve -Wconversion. gcc/testsuite/: 2010-06-09 Daniel Franke PR fortran/44359 * gfortran.dg/warn_conversion.f90: Removed check for redundant warning. * gfortran.dg/warn_conversion_2.f90: Use non-constant expression to check for warning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160505 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 113 ++++++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 52 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 2d82f20f957..e5463a1a74f 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4022,58 +4022,67 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag) } else if (wflag) { - /* Two modes of warning: - - gfc_option.warn_conversion tries to be more intelligent - about the warnings raised and omits those where smaller - kinds are promoted to larger ones without change in the - value - - gfc_option.warn_conversion_extra does not take the kinds - into account and also warns for coversions like - REAL(4) -> REAL(8) - - NOTE: Possible enhancement for warn_conversion - If converting from a smaller to a larger kind, check if the - value is constant and if yes, whether the value still fits - in the smaller kind. If yes, omit the warning. - */ - - /* If the types are the same (but not LOGICAL), and if from-kind - is larger than to-kind, this may indicate a loss of precision. - The same holds for conversions from REAL to COMPLEX. */ - if (((from_ts.type == ts->type && from_ts.type != BT_LOGICAL) - && ((gfc_option.warn_conversion && from_ts.kind > ts->kind) - || gfc_option.warn_conversion_extra)) - || ((from_ts.type == BT_REAL && ts->type == BT_COMPLEX) - && ((gfc_option.warn_conversion && from_ts.kind > ts->kind) - || gfc_option.warn_conversion_extra))) - gfc_warning_now ("Possible change of value in conversion " - "from %s to %s at %L", gfc_typename (&from_ts), - gfc_typename (ts), &expr->where); - - /* If INTEGER is converted to REAL/COMPLEX, this is generally ok if - the kind of the INTEGER value is less or equal to the kind of the - REAL/COMPLEX one. Otherwise the value may not fit. - Assignment of an overly large integer constant also generates - an overflow error with range checking. */ - else if (from_ts.type == BT_INTEGER - && (ts->type == BT_REAL || ts->type == BT_COMPLEX) - && ((gfc_option.warn_conversion && from_ts.kind > ts->kind) - || gfc_option.warn_conversion_extra)) - gfc_warning_now ("Possible change of value in conversion " - "from %s to %s at %L", gfc_typename (&from_ts), - gfc_typename (ts), &expr->where); - - /* If REAL/COMPLEX is converted to INTEGER, or COMPLEX is converted - to REAL we almost certainly have a loss of digits, regardless of - the respective kinds. */ - else if ((((from_ts.type == BT_REAL || from_ts.type == BT_COMPLEX) - && ts->type == BT_INTEGER) - || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL)) - && (gfc_option.warn_conversion - || gfc_option.warn_conversion_extra)) - gfc_warning_now ("Possible change of value in conversion from " - "%s to %s at %L", gfc_typename (&from_ts), - gfc_typename (ts), &expr->where); + if (gfc_option.flag_range_check + && expr->expr_type == EXPR_CONSTANT + && from_ts.type == ts->type) + { + /* Do nothing. Constants of the same type are range-checked + elsewhere. If a value too large for the target type is + assigned, an error is generated. Not checking here avoids + duplications of warnings/errors. + If range checking was disabled, but -Wconversion enabled, + a non range checked warning is generated below. */ + } + else if (from_ts.type == BT_LOGICAL || ts->type == BT_LOGICAL) + { + /* Do nothing. This block exists only to simplify the other + else-if expressions. + LOGICAL <> LOGICAL no warning, independent of kind values + LOGICAL <> INTEGER extension, warned elsewhere + LOGICAL <> REAL invalid, error generated elsewhere + LOGICAL <> COMPLEX invalid, error generated elsewhere */ + } + else if (from_ts.type == ts->type + || (from_ts.type == BT_INTEGER && ts->type == BT_REAL) + || (from_ts.type == BT_INTEGER && ts->type == BT_COMPLEX) + || (from_ts.type == BT_REAL && ts->type == BT_COMPLEX)) + { + /* Larger kinds can hold values of smaller kinds without problems. + Hence, only warn if target kind is smaller than the source + kind - or if -Wconversion-extra is specified. */ + if (gfc_option.warn_conversion_extra) + gfc_warning_now ("Conversion from %s to %s at %L", + gfc_typename (&from_ts), gfc_typename (ts), + &expr->where); + else if (gfc_option.warn_conversion + && from_ts.kind > ts->kind) + gfc_warning_now ("Possible change of value in conversion " + "from %s to %s at %L", gfc_typename (&from_ts), + gfc_typename (ts), &expr->where); + } + else if ((from_ts.type == BT_REAL && ts->type == BT_INTEGER) + || (from_ts.type == BT_COMPLEX && ts->type == BT_INTEGER) + || (from_ts.type == BT_COMPLEX && ts->type == BT_REAL)) + { + /* Conversion from REAL/COMPLEX to INTEGER or COMPLEX to REAL + usually comes with a loss of information, regardless of kinds. */ + if (gfc_option.warn_conversion_extra + || gfc_option.warn_conversion) + gfc_warning_now ("Possible change of value in conversion " + "from %s to %s at %L", gfc_typename (&from_ts), + gfc_typename (ts), &expr->where); + } + else if (from_ts.type == BT_HOLLERITH || ts->type == BT_HOLLERITH) + { + /* If HOLLERITH is involved, all bets are off. */ + if (gfc_option.warn_conversion_extra + || gfc_option.warn_conversion) + gfc_warning_now ("Conversion from %s to %s at %L", + gfc_typename (&from_ts), gfc_typename (ts), + &expr->where); + } + else + gcc_unreachable (); } /* Insert a pre-resolved function call to the right function. */ -- cgit v1.2.1 From 1011a9ca98952b1fff364a3350b9372a7ef340b0 Mon Sep 17 00:00:00 2001 From: burnus Date: Fri, 25 Jun 2010 19:40:37 +0000 Subject: 2010-06-25 Tobias Burnus * intrinsic.h (gfc_check_selected_real_kind, gfc_simplify_selected_real_kind): Update prototypes. * intrinsic.c (add_functions): Add radix support to selected_real_kind. * check.c (gfc_check_selected_real_kind): Ditto. * simplify.c (gfc_simplify_selected_real_kind): Ditto. * trans-decl.c (gfc_build_intrinsic_function_decls): Change call from selected_real_kind to selected_real_kind2008. * intrinsic.texi (SELECTED_REAL_KIND): Update for radix. (PRECISION, RANGE, RADIX): Add cross @refs. 2010-06-25 Tobias Burnus * intrinsics/selected_real_kind.f90 (_gfortran_selected_real_kind2008): Add function. (_gfortran_selected_real_kind): Stub which calls _gfortran_selected_real_kind2008. * gfortran.map (GFORTRAN_1.4): Add _gfortran_selected_real_kind2008. * mk-srk-inc.sh: Save also RADIX. 2010-06-25 Tobias Burnus * selected_real_kind_2.f90: New. * selected_real_kind_3.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161411 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index e5463a1a74f..833fd30beb1 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -2375,10 +2375,11 @@ add_functions (void) make_generic ("selected_int_kind", GFC_ISYM_SI_KIND, GFC_STD_F95); - add_sym_2 ("selected_real_kind", GFC_ISYM_SR_KIND, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di, + add_sym_3 ("selected_real_kind", GFC_ISYM_SR_KIND, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_INTEGER, di, GFC_STD_F95, gfc_check_selected_real_kind, gfc_simplify_selected_real_kind, NULL, - p, BT_INTEGER, di, OPTIONAL, r, BT_INTEGER, di, OPTIONAL); + p, BT_INTEGER, di, OPTIONAL, r, BT_INTEGER, di, OPTIONAL, + "radix", BT_INTEGER, di, OPTIONAL); make_generic ("selected_real_kind", GFC_ISYM_SR_KIND, GFC_STD_F95); -- cgit v1.2.1 From 95bf00d57a5dddd773b91d637479d17a4ca5fd76 Mon Sep 17 00:00:00 2001 From: janus Date: Thu, 8 Jul 2010 21:29:56 +0000 Subject: 2010-07-08 Janus Weil PR fortran/44649 * gfortran.h (gfc_isym_id): Add GFC_ISYM_C_SIZEOF,GFC_ISYM_STORAGE_SIZE. * intrinsic.h (gfc_check_c_sizeof,gfc_check_storage_size, gfc_resolve_storage_size): New prototypes. * check.c (gfc_check_c_sizeof,gfc_check_storage_size): New functions. * intrinsic.c (add_functions): Add STORAGE_SIZE. * iresolve.c (gfc_resolve_storage_size): New function. * trans-intrinsic.c (gfc_conv_intrinsic_sizeof): Handle polymorphic arguments. (gfc_conv_intrinsic_storage_size): New function. (gfc_conv_intrinsic_function): Handle STORAGE_SIZE. 2010-07-08 Janus Weil PR fortran/44649 * gfortran.dg/c_sizeof_1.f90: Modified. * gfortran.dg/storage_size_1.f08: New. * gfortran.dg/storage_size_2.f08: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161977 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/intrinsic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/intrinsic.c') diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 833fd30beb1..87d9c800df0 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -2459,7 +2459,10 @@ add_functions (void) x, BT_UNKNOWN, 0, REQUIRED); make_generic ("sizeof", GFC_ISYM_SIZEOF, GFC_STD_GNU); - make_alias ("c_sizeof", GFC_STD_F2008); + + add_sym_1 ("c_sizeof", GFC_ISYM_C_SIZEOF, CLASS_INQUIRY, ACTUAL_NO, + BT_INTEGER, ii, GFC_STD_F2008, gfc_check_c_sizeof, NULL, NULL, + x, BT_UNKNOWN, 0, REQUIRED); add_sym_1 ("spacing", GFC_ISYM_SPACING, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95, gfc_check_x, gfc_simplify_spacing, gfc_resolve_spacing, @@ -2500,6 +2503,12 @@ add_functions (void) make_generic ("stat", GFC_ISYM_STAT, GFC_STD_GNU); + add_sym_2 ("storage_size", GFC_ISYM_STORAGE_SIZE, CLASS_INQUIRY, ACTUAL_NO, + BT_INTEGER, di, GFC_STD_F2008, + gfc_check_storage_size, NULL, gfc_resolve_storage_size, + a, BT_UNKNOWN, 0, REQUIRED, + kind, BT_INTEGER, di, OPTIONAL); + add_sym_3red ("sum", GFC_ISYM_SUM, CLASS_TRANSFORMATIONAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_F95, gfc_check_product_sum, gfc_simplify_sum, gfc_resolve_sum, ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL, -- cgit v1.2.1