aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
AgeCommit message (Collapse)AuthorFilesLines
2008-02-24arith.c: Update copyright years.Tobias Schlüter1-1/+1
* arith.c: Update copyright years. * arith.h: Likewise. * array.c: Likewise. * bbt.c: Likewise. * check.c: Likewise. * data.c: Likewise. * data.h: Likewise. * decl.c: Likewise. * dependency.c: Likewise. * dependency.h: Likewise. * dump-parse-tree.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * gfc-internals.texi: Likewise. * gfortran.h: Likewise. * gfortran.texi: Likewise. * gfortranspec.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * intrinsic.h: Likewise. * intrinsic.texi: Likewise. * invoke.texi: Likewise. * io.c: Likewise. * iresolve.c: Likewise. * iso-c-binding.def: Likewise. * iso-fortran-env.def: Likewise. * lang-specs.h: Likewise. * lang.opt: Likewise. * libgfortran.h: Likewise. * match.c: Likewise. * match.h: Likewise. * matchexp.c: Likewise. * misc.c: Likewise. * module.c: Likewise. * openmp.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * parse.h: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * st.c: Likewise. * symbol.c: Likewise. * target-memory.c: Likewise. * target-memory.h: Likewise. * trans-array.h: Likewise. * trans-const.h: Likewise. * trans-stmt.h: Likewise. * trans-types.c: Likewise. * trans-types.h: Likewise. * types.def: Likewise. From-SVN: r132600
2008-01-30re PR fortran/34975 (Bogus error with USEing modules)Paul Thomas1-9/+15
2008-01-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/34975 * symbol.c (gfc_delete_symtree, gfc_undo_symbols): Rename delete_symtree to gfc_delete_symtree. * gfortran.h : Add prototype for gfc_delete_symtree. * module.c (load_generic_interfaces): Transfer symbol to a unique symtree and delete old symtree, instead of renaming. (read_module): The rsym and the found symbol are the same, so the found symtree can be deleted. PR fortran/34429 * decl.c (match_char_spec): Remove the constraint on deferred matching of functions and free the length expression. delete_symtree to gfc_delete_symtree. (gfc_match_type_spec): Whitespace. (gfc_match_function_decl): Defer characteristic association for all types except BT_UNKNOWN. * parse.c (decode_specification_statement): Only derived type function matching is delayed to the end of specification. 2008-01-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/34975 * gfortran.dg/use_only_3.f90: New test. * gfortran.dg/use_only_3.inc: Modules for new test. PR fortran/34429 * gfortran.dg/function_charlen_2.f90: New test. From-SVN: r131956
2008-01-22re PR fortran/34896 (libgomp.fortran/reduction5.f90)Paul Thomas1-0/+3
2008-01-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/34896 * module.c (read_module): Set use_rename attribute. 2008-01-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/34896 * gfortran.dg/use_rename_2.f90: New test. From-SVN: r131712
2008-01-20re PR fortran/34861 (ICE in function with entry (and result?))Paul Thomas1-1/+1
2008-01-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/34861 * resolve.c (resolve_entries): Do not do an array bounds check if the result symbols are the same. PR fortran/34854 * module.c (read_module) : Hide the symtree of the previous version of the symbol if this symbol is renamed. 2008-01-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/34784 * gfortran.dg/mapping_2.f90: Correct ubound expression for h4. PR fortran/34861 * gfortran.dg/entry_array_specs_3.f90: New test. PR fortran/34854 * gfortran.dg/use_rename_1.f90: New test. From-SVN: r131679
2008-01-07re PR fortran/34672 (.mod file misses renamed, USEd symbol)Paul Thomas1-20/+15
2008-01-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/34672 * module.c (write_generic): Rewrite completely. (write_module): Change call to write_generic. 2008-01-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/34672 * gfortran.dg/use_only_2.f90: New test. From-SVN: r131377
2008-01-06re PR fortran/34545 (ICE when compiling Fortran 95 code)Paul Thomas1-0/+6
2008-01-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34545 * module.c (load_needed): If the namespace has no proc_name give it the module symbol. 2008-01-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34545 * gfortran.dg/use_12.f90: New test. From-SVN: r131364
2007-12-21re PR fortran/34438 (gfortran not compliant w.r.t default initialization of ↵Paul Thomas1-0/+1
derived type component and implicit SAVE attribute) 2007-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/34438 * trans-decl.c (gfc_finish_var_decl): Do not mark derived types with default initializers as TREE_STATIC unless they are in the main program scope. (gfc_get_symbol_decl): Pass derived types with a default initializer to gfc_defer_symbol_init. (init_default_dt): Apply default initializer to a derived type. (init_intent_out_dt): Call init_default_dt. (gfc_trans_deferred_vars): Ditto. * module.c (read_module): Check sym->module is there before using it in a string comparison. 2007-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/34438 * gfortran.dg/default_initialization_3.f90: New test. From-SVN: r131124
2007-12-14re PR fortran/34324 (Module files on CRLF systems)Daniel Franke1-1/+1
2007-12-14 Daniel Franke <franke.daniel@gmail.com> PR fortran/34324 * module.c (parse_atom): Fixed parsing of modules files whose lines are terminated by CRLF. From-SVN: r130928
2007-12-06re PR target/34435 (SSE2 intrinsics - emmintrin with optimisations off and ↵Paul Thomas1-1/+2
type conversion error) 2007-12-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34435 * module.c (find_symbol): Do not return symtrees with unique names, which shows that they are private. 2007-12-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34435 * gfortran.dg/used_types_19.f90: New test. From-SVN: r130642
2007-12-04re PR fortran/34318 (Modules: Infinity/NaN parameters read as 0.0)Tobias Burnus1-0/+8
2007-12-04 Tobias Burnus <burnus@net-b.de> PR fortran/34318 * module.c (mio_gmp_real): Properly write NaN and Infinity. 2007-12-04 Tobias Burnus <burnus@net-b.de> PR fortran/34318 * gfortran.dg/module_nan.f90: New. From-SVN: r130600
2007-11-27re PR fortran/33541 (gfortran wrongly imports renamed-use-associated symbol ↵Paul Thomas1-6/+16
unrenamed) 2007-11-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 *interface.c (compare_actual_formal): Exclude assumed size arrays from the possibility of scalar to array mapping. * decl.c (get_proc_name): Fix whitespace problem. PR fortran/34231 * gfortran.h : Add 'use_rename' bit to symbol_attribute. * module.c : Add 'renamed' field to pointer_info.u.rsym. (load_generic_interfaces): Add 'renamed' that is set after the number_use_names is called. This is used to set the attribute use_rename, which, in its turn identifies those symbols that have not been renamed. (load_needed): If pointer_info.u.rsym->renamed is set, then set the use_rename attribute of the symbol. (read_module): Correct an erroneous use of use_flag. Use the renamed flag and the use_rename attribute to determine which symbols are not renamed. 2007-11-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 * gfortran.dg/use_11.f90: New test. PR fortran/34231 * gfortran.dg/generic_15.f90: New test. From-SVN: r130471
2007-11-24re PR fortran/33541 (gfortran wrongly imports renamed-use-associated symbol ↵Paul Thomas1-40/+128
unrenamed) 2007-11-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 * module.c (find_symtree_for_symbol): Move to new location. (find_symbol): New function. (load_generic_interfaces): Rework completely so that symtrees have the local name and symbols have the use name. Renamed generic interfaces exclude the use of the interface without an ONLY clause (11.3.2). (read_module): Implement 11.3.2 in the same way as for generic interfaces. 2007-11-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 * gfortran.dg/nested_modules_1.f90: Change the reference to FOO, forbidden by the standard, to a reference to W. * gfortran.dg/use_only_1.f90: New test. From-SVN: r130395
2007-11-24re PR fortran/34187 (BIND(C): Public generic with private bind(c) specific ↵Tobias Burnus1-0/+1
does not use bind(C) name) 2007-11-23 Tobias Burnus <burnus@net-b.de> PR fortran/34187 * module.c (load_needed): Ensure binding_label is not lost. * decl.c (set_binding_label,gfc_match_bind_c): Replace strncpy by strcpy. 2007-11-23 Tobias Burnus <burnus@net-b.de> PR fortran/34187 * gfortran.dg/bind_c_usage_15.f90: New. From-SVN: r130386
2007-11-17re PR fortran/30285 (gfortran excessive memory usage with COMMON blocks in ↵Francois-Xavier Coudert1-24/+92
modules) PR fortran/30285 * module.c (struct written_common, written_commons): New structure. (compare_written_commons, free_written_common, write_common_0): New functions. (write_common): Call recursive function write_common_0. From-SVN: r130257
2007-10-31[multiple changes]Tobias Burnus1-6/+6
2007-10-31 Tobias Burnus <burnus@net-b.de> PR fortran/33941 * modules.c (intrinsics): Use only alphabetic names for intrinsic operators. 2007-10-31 Dominique d'Humieres <dominiq@lps.ens.fr> Tobias Burnus <burnus@net-b.de> PR fortran/33941 * gfortran.dg/module_read_1.f90: New. From-SVN: r129801
2007-10-28re PR fortran/32147 (Module file change due to order of writting out changes)Tobias Schlüter1-23/+29
fortran/ PR fortran/32147 * module.c (write_symbol): Fix whitespace. (write_symbol0): Walk symtree from left-to-right instead breadth-first. (write_symbol1): Similarly change walk of pointer info tree. (write_module): Insert linebreak. * symbol.c (gfc_traverse_symtree): Change to left-to-right order. (traverse_ns): Likewise. testsuite/ PR fortran/32147 * gfortran.dg/module_md5_1.f90: Update hash-value. From-SVN: r129701
2007-09-28module.c (mio_expr): Avoid -Wcast-qual warning.Kaveh R. Ghazi1-2/+2
* module.c (mio_expr): Avoid -Wcast-qual warning. From-SVN: r128854
2007-09-20re PR fortran/33221 (Cannot declare variables of TYPE without components)Francois-Xavier Coudert1-1/+7
PR fortran/33221 * gfortran.h (symbol_attribute): Add zero_comp field. * symbol.c (gfc_use_derived): Handle case of emtpy derived types. * decl.c (gfc_match_data_decl): Likewise. (gfc_match_derived_decl): Likewise. * module.c (ab_attribute, attr_bits): Add AB_ZERO_COMP member. (mio_symbol_attribute): Write and read AB_ZERO_COMP. * resolve.c (resolve_symbol): Handle case of emtpy derived types. * parse.c (parse_derived): Likewise. * gfortran.dg/used_types_18.f90: Declare variable of empty derived type. From-SVN: r128633
2007-08-26re PR fortran/31298 ([F03] use mod, operator(+) => operator(.userOp.) not ↵Tobias Burnus1-13/+37
supported) 2007-08-26 Tobias Burnus <burnus@net-b.de> PR fortran/31298 * module.c (mio_symbol_ref,mio_interface_rest): Return pointer_info. (load_operator_interfaces): Support multible loading of an operator. 2007-08-26 Tobias Burnus <burnus@net-b.de> PR fortran/31298 * gfortran.dg/use_10.f90: New. From-SVN: r127812
2007-08-19[multiple changes]Tobias Burnus1-1/+3
2007-08-18 Tobias Burnus <burnus@net-b.de> * gfortran.h (gfc_is_intrinsic_typename): Add declaration. * symbol.c (gfc_is_intrinsic_typename): New function. * parse.c (decode_statement): Check for space in ABSTRACT INTERFACE. (parse_interface): Use gfc_is_intrinsic_typename. * decl.c (gfc_match_derived_decl): Ditto. * module.c (gfc_match_use): Use gcc_unreachable() for INTERFACE_ABSTRACT in switch(). 2007-08-19 Tobias Burnus <burnus@net-b.de> * gfortran.dg/interface_abstract_2.f90: New. * gfortran.dg/interface_abstract_1.f90: Fix typo. From-SVN: r127626
2007-08-18[multiple changes]Tobias Burnus1-1/+8
2007-08-18 Paul Thomas <pault@gcc.gnu.org> Janus Weil <jaydub66@gmail.com> * interface.c (gfc_match_interface,gfc_match_abstract_interface, gfc_match_end_interface,gfc_add_interface): Add abstract interface. * dump-parse-tree.c (gfc_show_attr): Ditto. * gfortran.h (interface_type,symbol_attribute): Ditto. * module.c (gfc_match_use,ab_attribute,attr_bits, mio_symbol_attribute): Ditto. * resolve.c (resolve_function): Ditto. * match.h: Ditto. * parse.c (decode_statement): Ditto. (parse_interface): Ditto, check for C1203 (name of abstract interface cannot be the same as an intrinsic type). * decl.c (gfc_match_bind_c): Check for NAME= with abstract interfaces. (access_attr_decl): Handle Abstract interfaces. 2007-08-17 Tobias Burnus <burnus@net-b.de> * gfortran.dg/interface_abstract_1.f90: New. From-SVN: r127612
2007-08-16re PR fortran/33072 ("use mod, only: operator(.sub.)" matches any procedure ↵Tobias Burnus1-16/+23
"sub") 2007-08-16 Tobias Burnus <burnus@net-b.de> PR fortran/33072 * module.c (gfc_match_use): Mark user operators as such. (find_use_name_n): Distinguish between operators and other symbols. (find_use_name,number_use_names,mio_namelist, load_operator_interfaces,load_generic_interfaces,read_module, write_generic): Update find_use_name_n calls. 2007-08-16 Tobias Burnus <burnus@net-b.de> PR fortran/33072 * gfortran.dg/use_9.f90: New. From-SVN: r127564
2007-08-12re PR fortran/31629 (option to make module entities PRIVATE by default)Francois-Xavier Coudert1-1/+4
PR fortran/31629 * lang.opt (-fmodule-private): New option. * gfortran.h (gfc_option_t): Add flag_module_private member. * invoke.texi (-fmodule-private): Document the new option. * module.c (gfc_check_access): Allow the -fmodule-private option to modify the default behaviour. * options.c (gfc_init_options): Initialize flag_module_private. (gfc_handle_option): Handle -fmodule-private. * gfortran.dg/module_private_1.f90: New test. From-SVN: r127381
2007-08-04re PR fortran/31214 (User-defined operator using entry leads to ICE)Paul Thomas1-17/+3
2007-08-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/31214 * symbol.c (get_unique_symtree): Moved from module.c. * module.c (get_unique_symtree): Moved to symbol.c. * decl.c (get_proc_name): Transfer the typespec from the local symbol to the module symbol, in the case that an entry is also a module procedure. Ensure the local symbol is cleaned up by pointing to it with a unique symtree. * dump_parse_tree (gfc_show_code_node): Add EXEC_ASSIGN_CALL. 2007-08-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/31214 * gfortran.dg/entry_13.f90: New test. * gfortran.dg/entry_12.f90: Clean up .mod file. From-SVN: r127213
2007-08-01arith.c: Change copyright header to refer to version 3 of the GNU General ↵Nick Clifton1-4/+3
Public... * arith.c: Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page. * openmp.c, interface.c, intrinsic.c, trans-array.c, trans-expr.c, symbol.c, iso-fortran-env.def, intrinsic.h, decl.c, trans-array.h, matchexp.c, dump-parse-tree.c, trans-common.c, array.c, Make-lang.in, trans-openmp.c, gfortran.h, error.c, iso-c-binding.def, lang.opt, data.c, trans-const.c, trans-stmt.c, expr.c, trans-const.h, trans-stmt.h, module.c, trans.c, scanner.c, trans-types.c, trans.h, gfortranspec.c, trans-types.h, lang-specs.h, io.c, bbt.c, resolve.c, f95-lang.c, st.c, iresolve.c, match.c, trans-decl.c, trans-io.c, target-memory.c, match.h, target-memory.h, parse.c, arith.h, check.c, dependency.c, parse.h, types.def, convert.c, dependency.h, primary.c, trans-intrinsic.c, options.c, misc.c, simplify.c: Likewise. From-SVN: r127129
2007-07-28re PR fortran/31818 (Wrongly accepts namelists with assumed-shape arrays)Daniel Franke1-2/+14
gcc/fortran: 2007-07-28 Daniel Franke <franke.daniel@gmail.com> PR fortran/31818 PR fortran/32876 PR fortran/32905 * gfortran.h (symbol_attribute): Added bits for pointer_comp, private_comp. * parse.c (parse_derived): Set pointer_comp/private_comp bits if the derived type ultimately contains pointer components or private components. * module.c (ab_attribute): New values AB_POINTER_COMP, AB_PRIVATE_COMP. (attr_bits): Added names for new ab_attributes. (mio_symbol_attribute): Save/restore new attribute bits in modules. * match.c (gfc_match_namelist): Removed check for namelist objects of assumed shape. * resolve.c (resolve_fl_namelist): Added check for pointer or private components in nested types. Added check for namelist objects of assumed shape. gcc/testsuite: 2007-07-28 Daniel Franke <franke.daniel@gmail.com> * gfortran.dg/namelist_5.f90: Adjusted error message. * gfortran.dg/assumed_shape_nml.f90: Renamed to ... * gfortran.dg/namelist_31.f90: ... this. Removed dg-warning directive. * gfortran.dg/assumed_size_nml.f90: Renamed to ... * gfortran.dg/namelist_32.f90: ... this. PR fortran/32876 * gfortran.dg/namelist_33.f90: New test. PR fortran/32905 * gfortran.dg/namelist_34.f90: New test. PR fortran/31818 * gfortran.dg/namelist_35.f90: New test. From-SVN: r127014
2007-07-12re PR fortran/32634 (renamed, use associated generic interface rejected)Paul Thomas1-1/+18
2007-07-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/32634 PR fortran/32727 * module.c (write_generic): Restore patch of 2007-07-10 and use symbol name if there are no use names. 2007-07-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/32727 * gfortran.dg/interface_17.f90: New test. From-SVN: r126600
2007-07-12re PR fortran/32634 (renamed, use associated generic interface rejected)Daniel Franke1-17/+1
2007-07-12 Daniel Franke <franke.daniel@gmail.com> PR fortran/32634 PR fortran/32727 * module.c: Reverted Paul's patch from 2007-07-10. From-SVN: r126572
2007-07-10re PR fortran/32157 (intrinsic function name conflicts with subroutine if ↵Paul Thomas1-1/+17
present in the same file) 2007-07-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/32157 * resolve.c (is_external_proc): New function. Adds test that the symbol is not an intrinsic procedure. * (resolve_function, resolve_call): Replace logical statements with call to is_external_proc. PR fortran/32689 * simplify.c (gfc_simplify_transfer): If mold has rank, the result is an array. PR fortran/32634 * module.c (write_generic): Write the local name of the interface. 2007-07-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/32157 * gfortran.dg/overload_2.f90: New test. PR fortran/32689 * gfortran.dg/transfer_simplify_5.f90 PR fortran/32634 * gfortran.dg/interface_15.f90: New test. From-SVN: r126509
2007-07-08re PR fortran/29876 (ICE on bad operator in ONLY clause of USE statement)Daniel Franke1-4/+0
gcc/fortran: 2007-07-08 Daniel Franke <franke.daniel@gmail.com> PR fortran/29876 * module.c (gfc_match_use): Do not set an non-existant intrinsic operator if a user-defined operator is found. gcc/testsuite: 2007-07-08 Daniel Franke <franke.daniel@gmail.com> PR fortran/29876 * gfortran.dg/operator_6.f90: New test. From-SVN: r126472
2007-07-08re PR fortran/17711 (Wrong operator name in error message)Daniel Franke1-6/+18
gcc/fortran: 2007-07-08 Daniel Franke <franke.daniel@gmail.com> Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> PR fortran/17711 * gfortran.h (gfc_intrinsic_op): Added INTRINSIC_EQ_OS, INTRINSIC_NE_OS, INTRINSIC_GT_OS, INTRINSIC_GE_OS, INTRINSIC_LT_OS and INTRINSIC_LE_OS. * arith.c (eval_intrinsic, eval_type_intrinsic0): Likewise. * arith.h (gfc_eq, gfc_ne, gfc_gt, gfc_ge, gfc_lt, gfc_le): Added gfc_intrinsic_op as third argument type. * dump-parse-tree.c (gfc_show_expr): Account for new enum values. * expr.c (simplify_intrinsic_op, check_intrinsic_op): Likewise. * interface.c (check_operator_interface): Likewise. (gfc_check_interfaces): Added cross-checks for FORTRAN 77 and Fortran 90 style operators using new enum values. (gfc_extend_expr): Likewise. (gfc_add_interface): Likewise. * match.c (intrinsic_operators): Distinguish FORTRAN 77 style operators from Fortran 90 style operators using new enum values. * matchexp.c (match_level_4): Account for new enum values. * module.c (mio_expr): Likewise. * resolve.c (resolve_operator): Deal with new enum values, fix inconsistent error messages. * trans-expr.c (gfc_conv_expr_op): Account for new enum values. gcc/testsuite: 2007-07-08 Daniel Franke <franke.daniel@gmail.com> PR fortran/17711 * gfortran.dg/operator_4.f90: New test. * gfortran.dg/operator_5.f90: New test. * gfortran.dg/logical_comp.f90: Adjusted error messages. * gfortran.dg/module_md5_1.f90: Adjusted MD5 sum. Co-Authored-By: Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> From-SVN: r126468
2007-07-07decl.c, [...]: Fix comment typos.Kazu Hirata1-1/+1
* decl.c, gfortran.h, interface.c, module.c, resolve.c, trans-array.c, trans-decl.c: Fix comment typos. Follow spelling conventions. * intrinsic.texi: Fix typos. Follow spelling conventions. From-SVN: r126440
2007-07-06re PR fortran/32633 (bogus error)Daniel Franke1-7/+3
gcc/fortran: 2007-05-06 Daniel Franke <franke.daniel@gmail.com> PR fortran/32633 * symbol.c (save_status): New. * gfortran.h (save_status): Added external declaration. (check_conflict): Check for conflicting explicite SAVE statements only. (gen_special_c_interop_ptr): Use SAVE_EXPLICIT constant. * module.c (ab_attribute, attr_bits): Removed enumerator value AB_SAVE for save attribute. (mio_symbol_attribute): Import/export the full SAVE status, removed usage of AB_SAVE. * dump-parse-tree.c (gfc_show_attr): Dump full SAVE status. * decl.c (add_init_expr_to_sym): Set SAVE_IMPLICIT only if not already explicit. gcc/testsuite: 2007-07-06 Daniel Franke <franke.daniel@gmail.com> * gfortran.dg/save_parameter.f90: New test. * gfortran.dg/module_md5_1.f90: Updated MD5 sum. From-SVN: r126413
2007-07-02[multiple changes]Christopher D. Rickett1-25/+285
2007-07-01 Christopher D. Rickett <crickett@lanl.gov> * interface.c (gfc_compare_derived_types): Special case for comparing derived types across namespaces. (gfc_compare_types): Deal with BT_VOID. (compare_parameter): Use BT_VOID to accept ISO C Binding pointers. * trans-expr.c (gfc_conv_function_call): Remove setting parm_kind to SCALAR (gfc_conv_initializer): Deal with ISO C Binding NULL_PTR and NULL_FUNPTR. (gfc_conv_expr): Convert expressions for ISO C Binding derived types. * symbol.c (gfc_set_default_type): BIND(C) variables should not be implicitly declared. (check_conflict): Add BIND(C) and check for conflicts. (gfc_add_explicit_interface): Whitespace. (gfc_add_is_bind_c): New function. (gfc_copy_attr): Use it. (gfc_new_symbol): Initialize ISO C Binding objects. (get_iso_c_binding_dt): New function. (verify_bind_c_derived_type): Ditto. (gen_special_c_interop_ptr): Ditto. (add_formal_arg): Ditto. (gen_cptr_param): Ditto. (gen_fptr_param): Ditto. (gen_shape_param): Ditto. (add_proc_interface): Ditto. (build_formal_args): Ditto. (generate_isocbinding_symbol): Ditto. (get_iso_c_sym): Ditto. * decl.c (num_idents_on_line, has_name_equals): New variables. (verify_c_interop_param): New function. (build_sym): Finish binding labels and deal with COMMON blocks. (add_init_expr_to_sym): Check if the initialized expression is an iso_c_binding named constants (variable_decl): Set ISO C Binding type_spec components. (gfc_match_kind_spec): Check match for C interoperable kind. (match_char_spec): Fix comment. Chnage gfc_match_small_int to gfc_match_small_int_expr. Check for C interoperable kind. (match_type_spec): Clear the current binding label. (match_attr_spec): Add DECL_IS_BIND_C. If BIND(C) is found, use it to set attributes. (set_binding_label): New function. (set_com_block_bind_c): Ditto. (verify_c_interop): Ditto. (verify_com_block_vars_c_interop): Ditto. (verify_bind_c_sym): Ditto. (set_verify_bind_c_sym): Ditto. (set_verify_bind_c_com_block): Ditto. (get_bind_c_idents): Ditto. (gfc_match_bind_c_stmt): Ditto. (gfc_match_data_decl): Use num_idents_on_line. (match_result): Deal with right paren in BIND(C). (gfc_match_suffix): New function. (gfc_match_function_decl): Use it. Code is re-arranged to deal with ISO C Binding result clauses. (gfc_match_subroutine): Deal with BIND(C). (gfc_match_bind_c): New function. (gfc_get_type_attr_spec): New function. Code is re-arranged in and taken from gfc_match_derived_decl. (gfc_match_derived_decl): Add check for BIND(C). * trans-common.c: Forward declare gfc_get_common. (gfc_sym_mangled_common_id): Change arg from 'const char *name' to 'gfc_common_head *com'. Check for ISO C Binding of the common block. (build_common_decl): 'com->name' to 'com in SET_DECL_ASSEMBLER_NAME. * gfortran.h: Add GFC_MAX_BINDING_LABEL_LEN (bt): Add BT_VOID (sym_flavor): Add FL_VOID. (iso_fortran_env_symbol, iso_c_binding_symbol, intmod_id): New enum (CInteropKind_t): New struct. (c_interop_kinds_table): Use it. Declare an array of structs. (symbol_attribute): Add is_bind_c, is_c_interop, and is_iso_c bitfields. (gfc_typespec): Add is_c_interop; is_iso_c, and f90_type members. (gfc_symbol): Add from_intmod, intmod_sym_id, binding_label, and common_block members. (gfc_common_head): Add binding_label and is_bind_c members. (gfc_gsymbol): Add sym_name, mod_name, and binding_label members. Add prototypes for get_c_kind, gfc_validate_c_kind, gfc_check_any_c_kind, gfc_add_is_bind_c, gfc_add_value, verify_c_interop, verify_c_interop_param, verify_bind_c_sym, verify_bind_c_derived_type, verify_com_block_vars_c_interop, generate_isocbinding_symbol, get_iso_c_sym, gfc_iso_c_sub_interface * iso-c-binding.def: New file. This file contains the definitions of the types provided by the Fortran 2003 ISO_C_BINDING intrinsic module. * trans-const.c (gfc_conv_constant_to_tree): Deal with C_NULL_PTR or C_NULL_FUNPTR expressions. * expr.c (gfc_copy_expr): Add BT_VOID case. For BT_CHARACTER, the ISO C Binding requires a minimum string length of 1 for '\0'. * module.c (intmod_sym): New struct. (pointer_info): Add binding_label member. (write_atom): Set len to 0 for NULL pointers. Check for NULL p and *p. (ab_attribute): Add AB_IS_BIND_C, AB_IS_C_INTEROP and AB_IS_ISO_C. (attr_bits): Add "IS_BIND_C", "IS_C_INTEROP", and "IS_ISO_C". (mio_symbol_attribute): Deal with ISO C Binding attributes. (bt_types): Add "VOID". (mio_typespec): Deal with ISO C Binding components. (mio_namespace_ref): Add intmod variable. (mio_symbol): Check for symbols from an intrinsic module. (load_commons): Check for BIND(C) common block. (read_module): Read binding_label and use it. (write_common): Add label. Write BIND(C) info. (write_blank_common): Blank commons are not BIND(C). Explicitly set is_bind_c=0. (write_symbol): Deal with binding_label. (sort_iso_c_rename_list): New function. (import_iso_c_binding_module): Ditto. (create_int_parameter): Add to args. (use_iso_fortran_env_module): Adjust to deal with iso_c_binding intrinsic module. * trans-types.c (c_interop_kinds_table): new array of structs. (gfc_validate_c_kind): New function. (gfc_check_any_c_kind): Ditto. (get_real_kind_from_node): Ditto. (get_int_kind_from_node): Ditto. (get_int_kind_from_width): Ditto. (get_int_kind_from_minimal_width): Ditto. (init_c_interop_kinds): Ditto. (gfc_init_kinds): call init_c_interop_kinds. (gfc_typenode_for_spec): Adjust for BT_VOID and ISO C Binding pointers. Adjust handling of BT_DERIVED. (gfc_sym_type): Whitespace. (gfc_get_derived_type): Account for iso_c_binding derived types * resolve.c (is_scalar_expr_ptr): New function. (gfc_iso_c_func_interface): Ditto. (resolve_function): Use gfc_iso_c_func_interface. (set_name_and_label): New function. (gfc_iso_c_sub_interface): Ditto. (resolve_specific_s0): Use gfc_iso_c_sub_interface. (resolve_bind_c_comms): New function. (resolve_bind_c_derived_types): Ditto. (gfc_verify_binding_labels): Ditto. (resolve_fl_procedure): Check for ISO C interoperability. (resolve_symbol): Check C interoperability. (resolve_types): Walk the namespace. Check COMMON blocks. * trans-decl.c (gfc_sym_mangled_identifier): Prevent the mangling of identifiers that have an assigned binding label. (gfc_sym_mangled_function_id): Use the binding label rather than the mangled name. (gfc_finish_var_decl): Put variables that are BIND(C) into a common segment of the object file, because this is what C would do. (gfc_create_module_variable): Conver to proper types (set_tree_decl_type_code): New function. (generate_local_decl): Check dummy variables and derived types for ISO C Binding attributes. * match.c (gfc_match_small_int_expr): New function. (gfc_match_name_C): Ditto. (match_common_name): Deal with ISO C Binding in COMMON blocks * trans-io.c (transfer_expr): Deal with C_NULL_PTR or C_NULL_FUNPTR expressions * match.h: Add prototypes for gfc_match_small_int_expr, gfc_match_name_C, match_common_name, set_com_block_bind_c, set_binding_label, set_verify_bind_c_sym, set_verify_bind_c_com_block, get_bind_c_idents, gfc_match_bind_c_stmt, gfc_match_suffix, gfc_match_bind_c, gfc_get_type_attr_spec * parse.c (decode_statement): Use gfc_match_bind_c_stmt (parse_derived): Init *derived_sym = NULL, and gfc_current_block later for valiadation. * primary.c (got_delim): Set ISO C Binding components of ts. (match_logical_constant): Ditto. (match_complex_constant): Ditto. (match_complex_constant): Ditto. (gfc_match_rvalue): Check for existence of at least one arg for C_LOC, C_FUNLOC, and C_ASSOCIATED. * misc.c (gfc_clear_ts): Clear ISO C Bindoing components in ts. (get_c_kind): New function. 2007-07-01 Christopher D. Rickett <crickett@lanl.gov> * Makefile.in: Add support for iso_c_generated_procs.c and iso_c_binding.c. * Makefile.am: Ditto. * intrinsics/iso_c_generated_procs.c: New file containing helper functions. * intrinsics/iso_c_binding.c: Ditto. * intrinsics/iso_c_binding.h: New file * gfortran.map: Include the __iso_c_binding_c_* functions. * libgfortran.h: define GFC_NUM_RANK_BITS. 2007-06-23 Christopher D. Rickett <crickett@lanl.gov> * bind_c_array_params.f03: New files for Fortran 2003 ISO C Binding. * bind_c_coms.f90: Ditto. * bind_c_coms_driver.c: Ditto. * bind_c_dts.f90: Ditto. * bind_c_dts_2.f03: Ditto. * bind_c_dts_2_driver.c: Ditto. * bind_c_dts_3.f03: Ditto. * bind_c_dts_4.f03: Ditto. * bind_c_dts_driver.c: Ditto. * bind_c_implicit_vars.f03: Ditto. * bind_c_procs.f03: Ditto. * bind_c_usage_2.f03: Ditto. * bind_c_usage_3.f03: Ditto. * bind_c_usage_5.f03: Ditto. * bind_c_usage_6.f03: Ditto. * bind_c_usage_7.f03: Ditto. * bind_c_vars.f90: Ditto. * bind_c_vars_driver.c: Ditto. * binding_c_table_15_1.f03: Ditto. * binding_label_tests.f03: Ditto. * binding_label_tests_10.f03: Ditto. * binding_label_tests_10_main.f03: Ditto. * binding_label_tests_11.f03: Ditto. * binding_label_tests_11_main.f03: Ditto. * binding_label_tests_12.f03: Ditto. * binding_label_tests_13.f03: Ditto. * binding_label_tests_13_main.f03: Ditto. * binding_label_tests_14.f03: Ditto. * binding_label_tests_2.f03: Ditto. * binding_label_tests_3.f03: Ditto. * binding_label_tests_4.f03: Ditto. * binding_label_tests_5.f03: Ditto. * binding_label_tests_6.f03: Ditto. * binding_label_tests_7.f03: Ditto. * binding_label_tests_8.f03: Ditto. * binding_label_tests_9.f03: Ditto. * c_assoc.f90: Ditto. * c_assoc_2.f03: Ditto. * c_f_pointer_shape_test.f90: Ditto. * c_f_pointer_tests.f90: Ditto. * c_f_tests_driver.c: Ditto. * c_funloc_tests.f03: Ditto. * c_funloc_tests_2.f03: Ditto. * c_funloc_tests_3.f03: Ditto. * c_funloc_tests_3_funcs.c: Ditto. * c_kind_params.f90: Ditto. * c_kind_tests_2.f03: Ditto. * c_kinds.c: Ditto. * c_loc_driver.c: Ditto. * c_loc_test.f90: Ditto. * c_loc_tests_2.f03: Ditto. * c_loc_tests_2_funcs.c: Ditto. * c_loc_tests_3.f03: Ditto. * c_loc_tests_4.f03: Ditto. * c_loc_tests_5.f03: Ditto. * c_loc_tests_6.f03: Ditto. * c_loc_tests_7.f03: Ditto. * c_loc_tests_8.f03: Ditto. * c_ptr_tests.f03: Ditto. * c_ptr_tests_10.f03: Ditto. * c_ptr_tests_5.f03: Ditto. * c_ptr_tests_7.f03: Ditto. * c_ptr_tests_7_driver.c: Ditto. * c_ptr_tests_8.f03: Ditto. * c_ptr_tests_8_funcs.c: Ditto. * c_ptr_tests_9.f03: Ditto. * c_ptr_tests_driver.c: Ditto. * c_size_t_driver.c: Ditto. * c_size_t_test.f03: Ditto. * com_block_driver.f90: Ditto. * global_vars_c_init.f90: Ditto. * global_vars_c_init_driver.c: Ditto. * global_vars_f90_init.f90: Ditto. * global_vars_f90_init_driver.c: Ditto. * interop_params.f03: Ditto. * iso_c_binding_only.f03: Ditto. * iso_c_binding_rename_1.f03: Ditto. * iso_c_binding_rename_1_driver.c: Ditto. * iso_c_binding_rename_2.f03: Ditto. * iso_c_binding_rename_2_driver.c: Ditto. * kind_tests_2.f03: Ditto. * kind_tests_3.f03: Ditto. * module_md5_1.f90: Ditto. * only_clause_main.c: Ditto. * print_c_kinds.f90: Ditto. * test_bind_c_parens.f03: Ditto. * test_c_assoc.c: Ditto. * test_com_block.f90: Ditto. * test_common_binding_labels.f03: Ditto. * test_common_binding_labels_2.f03: Ditto. * test_common_binding_labels_2_main.f03: Ditto. * test_common_binding_labels_3.f03: Ditto. * test_common_binding_labels_3_main.f03: Ditto. * test_only_clause.f90: Ditto. * use_iso_c_binding.f90: Ditto. * value_5.f90: Ditto. * value_test.f90: Ditto. * value_tests_f03.f90: Ditto. From-SVN: r126185
2007-06-24re PR fortran/32460 (structure constructor not allowed if a USEd type has ↵Tobias Burnus1-0/+1
private components) 2007-06-24 Tobias Burnus <burnus@net-de> PR fortran/32460 * interface.c (gfc_compare_derived_types): Add access check. * symbol.c (gfc_find_component): Ditto. (gfc_set_component_attr,gfc_get_component_attr) Copy access state. * dump-parse-tree.c (gfc_show_components): Dump access state. * gfortran.h (struct gfc_component): Add gfc_access. * module.c (mio_component): Add access state. * (gfc_match_structure_constructor): Check for private access state. 2007-06-24 Tobias Burnus <burnus@net-de> PR fortran/32460 * gfortran.dg/private_type_6.f90: New. From-SVN: r125984
2007-06-07decl.c: Miscellaneous whitespace fixes.Steven G. Kargl1-27/+26
* decl.c: Miscellaneous whitespace fixes. * expr.c: Likewise. * gfortran.h: Likewise. * interface.c : Likewise. * io.c: Likewise. * match.c: Likewise. * match.h: Likewise. * module.c: Likewise. * parse.c: Likewise. * resolve.c: Likewise. * symbol.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. From-SVN: r125533
2007-05-31re PR fortran/32103 (Module with equivalence draws "unsatisfied reference")Paul Thomas1-7/+23
2007-05-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/32103 * module.c (mio_symtree_ref): If an equivalence group member is not used, give it a hidden symbol and set the pointer_info. (load_equiv): Only free the equivalence if none of the members are used. 2007-05-31 Paul Thomas <pault@gcc.gnu.org> PR fortran/32103 * gfortran.dg/module_equivalence_3.f90: New test. From-SVN: r125216
2007-04-25module.c (module_char): Replace fgetc() with getc().Janne Blomqvist1-2/+2
2007-04-25 Janne Blomqvist <jb@gcc.gnu.org> * module.c (module_char): Replace fgetc() with getc(). (write_char): Replace fputc() with putc(). * scanner.c (load_line): Replace fgetc() with getc(). (gfc_read_orig_filename): Likewise. From-SVN: r124154
2007-04-24re PR fortran/31587 (Module files shouldn't be updated if their content ↵Francois-Xavier Coudert1-7/+92
doesn't change) PR fortran/31587 * lib/gcc-dg.exp (scan-module): New function. * gfortran.dg/module_md5_1.f90: New test. * module.c (write_char): Add character to the MD5 buffer. (read_md5_from_module_file): New function. (gfc_dump_module): Compute MD5 for new module file. Call read_md5_from_module_file. Only overwrite old module file if the new MD5 is different. From-SVN: r124126
2007-03-14module.c (mio_typespec): Don't look at ts->cl if not BT_CHARACTER.Jakub Jelinek1-1/+8
* module.c (mio_typespec): Don't look at ts->cl if not BT_CHARACTER. * gfortran.dg/module_implicit_conversion.f90: New test. From-SVN: r122915
2007-03-08[multiple changes]Tobias Burnus1-8/+17
2007-07-08 Tobias Burnus <burnus@net-b.de> * module.c (gfc_match_use): Support renaming of operators in USE statements. * gfortran.texi (Fortran 2003 Status): Document support of renaming of operators. 2007-03-08 Tobias Burnus <burnus@net-b.de> * gfortran.dg/use_5.f90: New test. * gfortran.dg/use_6.f90: Ditto. * gfortran.dg/use_7.f90: Ditto. From-SVN: r122699
2007-03-08re PR fortran/30973 ([4.1, 4.2 only] undetected name conflict: variables may ↵Tobias Burnus1-0/+11
be named like modules) 2007-03-08 Tobias Burnus <burnus@net-b.de> PR fortran/30973 * module.c (read_module): Always import module name as symbol. (gfc_match_use): Disallow module name in the only clause of a use statement. 2007-03-08 Tobias Burnus <burnus@net-b.de> PR fortran/30973 * gfortran.dg/use_4.f90: New test. * gfortran.dg/used_dummy_types_7.f90: Correct ambiguous symbol. From-SVN: r122696
2007-02-12[multiple changes]Paul Thomas1-1/+11
2007-02-13 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * module.c (read_module): Set pointer_info to referenced if the symbol has no namespace. 2007-02-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * gfortran.dg/used_dummy_types_7.f90: New test. From-SVN: r121865
2007-02-11re PR fortran/30554 ([4.1 only] ICE in mio_pointer_ref at module.c:1945)Paul Thomas1-1/+35
2007-02-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * module.c (find_symtree_for_symbol): New function to return a symtree that is not a "unique symtree" given a symbol. (read_module): Do not automatically set pointer_info to referenced because this inhibits the generation of a unique symtree. Recycle the existing symtree if possible by calling find_symtree_for_symbol. PR fortran/30319 * decl.c (add_init_expr_to_sym): Make new charlen for an array constructor initializer. 2007-02-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * gfortran.dg/used_dummy_types_6.f90: Add the "privatized" versions of the modules. PR fortran/30617 * gfortran.dg/intrinsic_actual_2.f90: Make this legal fortran by getting rid of recursive I/O and providing functions with results. PR fortran/30319 * gfortran.dg/char_array_constructor_2.f90 From-SVN: r121824
2007-01-29re PR fortran/30554 ([4.1 only] ICE in mio_pointer_ref at module.c:1945)Paul Thomas1-3/+10
2007-01-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * module.c (read_module): If a symbol is excluded by an ONLY clause, check to see if there is a symtree already loaded. If so, attach the symtree to the pointer_info. 2007-01-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * gfortran.dg/used_dummy_types_6.f90: New test. From-SVN: r121281
2007-01-20openmp.c, [...]: Next installment in the massive whitespace patch.Steven G. Kargl1-254/+225
* openmp.c, matchexp.c, module.c, scanner.c, resolve.c, st.c, parse.c, primary.c, options.c, misc.c, simplify.c: Next installment in the massive whitespace patch. From-SVN: r121012
2007-01-20module.c (mio_array_ref): The dimen_type fields of an array ref are an ↵Roger Sayle1-2/+19
enumerated type and can't be... * module.c (mio_array_ref): The dimen_type fields of an array ref are an enumerated type and can't be read/written directly with a call to mio_integer. Instead loop over and cast each element. From-SVN: r121011
2007-01-17re PR fortran/30476 ([Regression 4.2, 4.3] Via other module imported generic ↵Paul Thomas1-2/+7
interface rejected) 2007-01-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/30476 * module.c (load_generic_interfaces): Make the marking of the symbol as ambiguous conditional on the module names being different. (write_generic): Ensure that the generic interface has a non-NULL module field. 2007-01-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/30476 * gfortran.dg/generic_12.f90: New test. From-SVN: r120860
2006-12-27re PR fortran/20896 (ambiguous interface not detected)Paul Thomas1-0/+10
2006-12-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/20896 * interface.c (check_sym_interfaces): Try to resolve interface reference as a global symbol, if it is not a nodule procedure. (compare_actual_formal): Remove call to gfc_find_symbol; if the expression is already a variable it is locally declared and this has precedence. gfortran.h : Add prototype for resolve_global_procedure. resolve.c (resolve_global_procedure): Remove static attribute from function declaration. (resolve_fl_procedure): Remove symtree declaration and the redundant check for an ambiguous procedure. PR fortran/25135 * module.c (load_generic_interfaces): If the symbol is present and is not generic it is ambiguous. 2006-12-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/20896 * gfortran.dg/interface_10.f90: New test. * gfortran.dg/dummy_procedure_1.f90: Add error for call s1(z), since z is already, locally a variable. PR fortran/25135 * gfortran.dg/generic_11.f90: New test. * gfortran.dg/interface_7.f90: Remove name clash between module name and procedure 'x' referenced in the interface. From-SVN: r120218
2006-12-22re PR fortran/25818 ([4.1 only] Problem with handling optional and entry ↵Paul Thomas1-19/+45
master arguments) 2006-12-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/25818 * trans-array.c (gfc_trans_g77_array): If the variable is optional or not always present, make the statement conditional on presence of the argument. * gfortran.h : Add symbol_attribute not_always_present. * resolve.c (check_argument_lists): New function to check if arguments are not present in all entries. PR fortran/30084 * module.c (mio_component_ref): Move treatment of unique name variables, during output, to fix_mio_expr. (fix_mio_expr): New function that fixes defective expressions before they are written to the module file. (mio_expr): Call the new function. (resolve_entries): Call check_argument_lists. 2006-12-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/25818 * gfortran.dg/entry_array_specs_2.f: New test. PR fortran/30084 * gfortran.dg/nested_modules_6.f90: New test. From-SVN: r120155